f40e8eba7e3fd8036680e788a36a2e3a3a0efa16
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-05-29  Chris Dumez  <cdumez@apple.com>
2
3         [iOS] The WebContent process needs proper entitlement to do secure drawing
4         https://bugs.webkit.org/show_bug.cgi?id=198343
5         <rdar://problem/50671257>
6
7         Reviewed by Tim Horton.
8
9         The WebContent process needs proper entitlement to do secure drawing on iOS.
10
11         * Configurations/WebContent-iOS.entitlements:
12
13 2019-05-29  Youenn Fablet  <youenn@apple.com>
14
15         UserMediaCaptureManager should remove a source from its map once the source is ended
16         https://bugs.webkit.org/show_bug.cgi?id=198337
17
18         Reviewed by Eric Carlson.
19
20         When the source is stopped, for instance using MediaStreamTrack.stop,
21         remove the source from UserMediaCaptureManager sources map.
22         This makes sure the map will not grow over time.
23         Add an if check to ensure that the source is still there before processing an incoming IPC call.
24
25         When UIProcess tells us the capture is finished (typically capture failed), remove the entry on WebProcess side as well.
26
27         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
28         (WebKit::UserMediaCaptureManager::createCaptureSource):
29         (WebKit::UserMediaCaptureManager::sourceStopped):
30         (WebKit::UserMediaCaptureManager::captureFailed):
31         (WebKit::UserMediaCaptureManager::sourceMutedChanged):
32         (WebKit::UserMediaCaptureManager::sourceSettingsChanged):
33         (WebKit::UserMediaCaptureManager::storageChanged):
34         (WebKit::UserMediaCaptureManager::ringBufferFrameBoundsChanged):
35         (WebKit::UserMediaCaptureManager::audioSamplesAvailable):
36         (WebKit::UserMediaCaptureManager::remoteVideoSampleAvailable):
37         (WebKit::UserMediaCaptureManager::sourceEnded):
38         (WebKit::UserMediaCaptureManager::applyConstraintsSucceeded):
39         (WebKit::UserMediaCaptureManager::applyConstraintsFailed):
40
41 2019-05-29  Youenn Fablet  <youenn@apple.com>
42
43         UserMediaCaptureManagerProxy::SourceProxy should directly have access to its IPC connection
44         https://bugs.webkit.org/show_bug.cgi?id=198335
45
46         Reviewed by Eric Carlson.
47
48         Previously, SourceProxy was getting its IPC connection by going through its manager, then its process proxy.
49         As some calls can be done from a background thread, it is safer to directly make SourceProxy own a Ref of its IPC connection.
50
51         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
52         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::SourceProxy):
53         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
54
55 2019-05-28  Geoffrey Garen  <ggaren@apple.com>
56
57         WeakPtr breaks vtables when upcasting to base classes
58         https://bugs.webkit.org/show_bug.cgi?id=188799
59
60         Reviewed by Youenn Fablet.
61
62         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
63         (WebKit::WebResourceLoadStatisticsStore::networkSession):
64         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
65         * Shared/WebBackForwardListItem.cpp:
66         (WebKit::WebBackForwardListItem::suspendedPage const):
67         * Shared/WebBackForwardListItem.h:
68         (WebKit::WebBackForwardListItem::suspendedPage const): Deleted. Moved
69         functions out of line to avoid #include explosion for .get().
70
71         * UIProcess/Authentication/cocoa/SecKeyProxyStore.h:
72         (WebKit::SecKeyProxyStore::get const):
73         (WebKit::SecKeyProxyStore::weakPtrFactory const): Deleted. Adopted
74         CanMakeWeakPtr.
75
76         * UIProcess/WebAuthentication/AuthenticatorManager.h:
77         * UIProcess/WebProcessProxy.cpp: It takes an extra using declaration
78         to disambiguate multiple CanMakeWeakPtr base classes now.
79
80         (WebKit::WebProcessProxy::processPool const):
81         * UIProcess/WebProcessProxy.h:
82         (WebKit::WebProcessProxy::processPool const): Deleted. Moved
83         functions out of line to avoid #include explosion for .get().
84
85 2019-05-29  Youenn Fablet  <youenn@apple.com>
86
87         Modernize getting proxies of UserMediaCaptureManagerProxy
88         https://bugs.webkit.org/show_bug.cgi?id=198336
89
90         Reviewed by Eric Carlson.
91
92         No change of behavior, use HashMap::get instead of find.
93
94         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
95         (WebKit::UserMediaCaptureManagerProxy::startProducingData):
96         (WebKit::UserMediaCaptureManagerProxy::stopProducingData):
97         (WebKit::UserMediaCaptureManagerProxy::capabilities):
98         (WebKit::UserMediaCaptureManagerProxy::setMuted):
99         (WebKit::UserMediaCaptureManagerProxy::applyConstraints):
100
101 2019-05-29  Andy Estes  <aestes@apple.com>
102
103         [watchOS] Remove an unneeded #import
104         https://bugs.webkit.org/show_bug.cgi?id=198339
105         <rdar://problem/51195415>
106
107         Reviewed by Wenson Hsieh.
108
109         * UIProcess/ios/forms/WKTimePickerViewController.mm:
110
111 2019-05-29  Brent Fulgham  <bfulgham@apple.com>
112
113         Correct flaky WebAuthN test cases
114         https://bugs.webkit.org/show_bug.cgi?id=198308
115         <rdar://problem/48677219>
116
117         Reviewed by David Kilzer.
118
119         Correct offset math in the MockHidConnection implementation. The write position of
120         the payload buffer was computed using the value of 'size()', which is set to the full
121         capacity of the vector after a 'grow()' operation.
122
123         Tests: http/wpt/webauthn
124
125         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
126         (WebKit::MockHidConnection::feedReports): 
127
128 2019-05-28  Fujii Hironori  <Hironori.Fujii@sony.com>
129
130         [WinCairo] REGRESSION(r245186) Crash in NetworkCache::IOChannel::read in http/tests/IndexedDB some tests
131         https://bugs.webkit.org/show_bug.cgi?id=197941
132
133         Reviewed by Don Olmstead.
134
135         http/tests/IndexedDB some tests were crashing in
136         NetworkCache::IOChannel::read in order to allocate a buffer with
137         std::numeric_limits<size_t>::max() as the size.
138
139         IOChannel::read should check the file size, and calculate the read
140         size.
141
142         * NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp:
143         (WebKit::NetworkCache::IOChannel::read): Limit the read buffer
144         size by calling FileSystem::getFileSize.
145
146 2019-05-28  Brent Fulgham  <bfulgham@apple.com>
147
148         Fix sandbox violation when using QuickLook on iOS
149         https://bugs.webkit.org/show_bug.cgi?id=198312
150         <rdar://problem/51134351>
151
152         Reviewed by Alexey Proskuryakov.
153
154         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
155
156 2019-05-28  Tim Horton  <timothy_horton@apple.com>
157
158         Horizontal scrollbar flashes after scrolling vertically with keyboard
159         https://bugs.webkit.org/show_bug.cgi?id=197942
160         <rdar://problem/46169578>
161
162         Reviewed by Dean Jackson.
163
164         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
165         (axesForDelta):
166         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
167         Only flash relevant axes.
168
169         * Platform/spi/ios/UIKitSPI.h:
170
171 2019-05-28  Alex Christensen  <achristensen@webkit.org>
172
173         Build Fix.
174
175         * UIProcess/WKImagePreviewViewController.mm:
176         (-[WKImagePreviewViewController IGNORE_WARNINGS_END]):
177         (-[WKImagePreviewViewController previewActionItems]): Deleted.
178
179 2019-05-28  Tim Horton  <timothy_horton@apple.com>
180
181         REGRESSION(r245795): causing internal testers to exit early after 50 crashes.
182         https://bugs.webkit.org/show_bug.cgi?id=198310
183         <rdar://problem/51192535>
184
185         Reviewed by Simon Fraser.
186
187         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
188         (WebKit::touchActionsForPoint):
189         Initialize hitView to nil.
190
191 2019-05-28  Brent Fulgham  <bfulgham@apple.com>
192
193         Remove dead code from sandboxes
194         https://bugs.webkit.org/show_bug.cgi?id=198300
195
196         Reviewed by Alexey Proskuryakov.
197
198         SSIA.
199
200         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
201         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
202         * WebProcess/com.apple.WebProcess.sb.in:
203
204 2019-05-28  Brent Fulgham  <bfulgham@apple.com>
205
206         Update sandbox rules for more News use cases
207         https://bugs.webkit.org/show_bug.cgi?id=198236
208         <rdar://problem/50054027>
209
210         Reviewed by Alexey Proskuryakov.
211
212         Update the WebContent and Network process sandboxes so that News has the same set of allowed
213         service access as regular WebKit views.
214
215         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
216         * WebProcess/com.apple.WebProcess.sb.in:
217
218 2019-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
219
220         [GTK] Use WPEBackend-fdo for accelerating compositing in Wayland instead of the nested compositor
221         https://bugs.webkit.org/show_bug.cgi?id=197944
222
223         Reviewed by Michael Catanzaro.
224
225         The WPEBackend-fdo implementation is quite similar to our Wayland nested compositor, but more efficient (using
226         linux dmabuf, resource caching, etc.). This allows us to share even more code with WPE port too.
227
228         * PlatformGTK.cmake:
229         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
230         (WebKit::ThreadedCompositor::forceRepaint): WPE doesn't support force repaint yet.
231         * Shared/WebPageCreationParameters.cpp:
232         (WebKit::WebPageCreationParameters::encode const): Use USE(WPE_RENDERER) instead of PLATFORM(WPE).
233         (WebKit::WebPageCreationParameters::decode): Ditto.
234         * Shared/WebPageCreationParameters.h:
235         * Shared/WebProcessCreationParameters.cpp:
236         (WebKit::WebProcessCreationParameters::encode const): Ditto.
237         (WebKit::WebProcessCreationParameters::decode): Ditto.
238         * Shared/WebProcessCreationParameters.h:
239         * SourcesGTK.txt:
240         * UIProcess/API/gtk/PageClientImpl.cpp:
241         (WebKit::PageClientImpl::hostFileDescriptor): Implement it when using WPE just calling webkitWebViewBaseRenderHostFileDescriptor().
242         * UIProcess/API/gtk/PageClientImpl.h:
243         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
244         (webkitWebViewBaseCreateWebPage): Initialize the web page after the accelerated backing store is created, since
245         it's used now during intialization.
246         (webkitWebViewBaseRenderHostFileDescriptor): Return AcceleratedBackingStore::renderHostFileDescriptor()
247         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
248         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
249         * UIProcess/PageClient.h:
250         * UIProcess/WebPageProxy.cpp:
251         (WebKit::WebPageProxy::creationParameters): Use USE(WPE_RENDERER) instead of PLATFORM(WPE).
252         * UIProcess/WebProcessPool.cpp:
253         (WebKit::WebProcessPool::initializeNewWebProcess): Remove wayland display name initialization.
254         * UIProcess/glib/WebProcessPoolGLib.cpp:
255         (WebKit::WebProcessPool::platformInitializeWebProcess): Initialize wayland display name when not using WPE here
256         now. In case of using WPE, initialize hostClientFileDescriptor and implementationLibraryName.
257         * UIProcess/glib/WebProcessProxyGLib.cpp:
258         (WebKit::WebProcessProxy::platformGetLaunchOptions): Remove unused wayland socket command line process parameter.
259         * UIProcess/gtk/AcceleratedBackingStore.h:
260         (WebKit::AcceleratedBackingStore::renderHostFileDescriptor): Return -1 by default.
261         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
262         (WebKit::AcceleratedBackingStoreWayland::create): When using WPE call wpe_fdo_initialize_for_egl_display() and
263         check we have the required extensions.
264         (WebKit::AcceleratedBackingStoreWayland::AcceleratedBackingStoreWayland): When using WPE initialize the view backend.
265         (WebKit::AcceleratedBackingStoreWayland::~AcceleratedBackingStoreWayland): When using WPE release the EGL images
266         still in use and the view texture.
267         (WebKit::AcceleratedBackingStoreWayland::renderHostFileDescriptor): Call wpe_view_backend_get_renderer_host_fd().
268         (WebKit::AcceleratedBackingStoreWayland::displayBuffer): Create the view texture if needed, save the pending
269         image and schedule a redraw.
270         (WebKit::AcceleratedBackingStoreWayland::paint): When using WPE commit the pending image and use it as target of
271         the view texture.
272         * UIProcess/gtk/AcceleratedBackingStoreWayland.h:
273         * UIProcess/gtk/HardwareAccelerationManager.cpp:
274         (WebKit::HardwareAccelerationManager::HardwareAccelerationManager): When using WPE disable hardware acceleration
275         if wpe_fdo_initialize_for_egl_display() fails.
276         * UIProcess/gtk/WaylandCompositor.cpp:
277         * UIProcess/gtk/WaylandCompositor.h:
278         * WebProcess/WebPage/AcceleratedSurface.cpp:
279         (WebKit::AcceleratedSurface::create): Create an AcceleratedSurfaceLibWPE for GTK port when using WPE and shared
280         display is Wayland.
281         * WebProcess/WebPage/WebPage.cpp:
282         * WebProcess/WebPage/WebPage.h:
283         * WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp:
284         (WebKit::AcceleratedSurfaceLibWPE::initialize): Use the shared display for compositing instead of shared display.
285         * WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.h:
286         * WebProcess/WebProcess.h:
287         * WebProcess/glib/WebProcessGLib.cpp:
288         (WebKit::WebProcess::platformInitializeWebProcess): Initialize the wpe display when using WPE.
289
290 2019-05-27  Wenson Hsieh  <wenson_hsieh@apple.com>
291
292         [iOS] Dropping in an editable element should result in a ranged selection
293         https://bugs.webkit.org/show_bug.cgi?id=198267
294         <rdar://problem/51145977>
295
296         Reviewed by Tim Horton.
297
298         When drag and drop was first implemented for iOS in iOS 11, selection behavior when dropping into editable
299         elements matched that of macOS, by leaving the inserted content selected after performing the drop. However, in
300         other parts of the platform (e.g. Notes), both the keyboard and selection views are not shown after a drop.
301
302         Instead of matching macOS behavior, WebKit on iOS should match the rest of the platform. This is a little
303         tricky, since we use the selection range after a drop to create a TextIndicator snapshot when creating a drag
304         preview. To resolve this, we refactor some of the logic introduced in r245778 to remember the DOM range to
305         snapshot before collapsing the range to the end of the inserted content.
306
307         Tested by adjusting some existing API tests.
308
309         * UIProcess/ios/WKContentViewInteraction.mm:
310         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
311
312         Remove some logic that currently presents the keyboard while the user is performing a drop that focuses an
313         editable element.
314
315         * WebProcess/WebPage/WebPage.h:
316
317         Add a member variable to keep track of which range should be snapshotted when generating a drop preview.
318
319         * WebProcess/WebPage/ios/WebPageIOS.mm:
320         (WebKit::WebPage::didConcludeDrop):
321         (WebKit::WebPage::didConcludeEditDrag):
322
323         Collapse the selection range to the end after an edit drag (i.e., a drop in an editable area that inserted
324         content).
325
326         (WebKit::WebPage::computeAndSendEditDragSnapshot):
327
328 2019-05-27  Chris Dumez  <cdumez@apple.com>
329
330         Unreviewed Win Cairo build fix after r245796.
331
332         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
333         (WebKit::WebsiteDataStore::getAllStorageAccessEntries):
334
335 2019-05-27  Chris Dumez  <cdumez@apple.com>
336
337         Unreviewed Win Cairo build fix after r245796.
338
339         * Shared/WebPageCreationParameters.cpp:
340         (WebKit::WebPageCreationParameters::decode):
341
342 2019-05-27  Chris Dumez  <cdumez@apple.com>
343
344         Use a strongly-typed identifier for pages
345         https://bugs.webkit.org/show_bug.cgi?id=198206
346
347         Reviewed by Youenn Fablet.
348
349         * WebKit/*:
350
351 2019-05-27  Antoine Quint  <graouts@apple.com>
352
353         [Pointer Events] Test at pointerevents/ios/touch-action-none-in-overflow-scrolling-touch.html times out
354         https://bugs.webkit.org/show_bug.cgi?id=198275
355         <rdar://problem/50618496>
356
357         Reviewed by Antti Koivisto.
358
359         Only WKCompositingView instances may have associated touch-action data, so we should filter out any hit-testing view
360         that isn't a WKCompositingView when finding the view that should hit-test when looking for touch-action information.
361
362         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
363         (WebKit::touchActionsForPoint):
364
365 2019-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
366
367         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.25.1 release
368
369         * gtk/NEWS: Add release notes for 2.25.1.
370
371 2019-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
372
373         Unreviewed. Fix GTK distcheck
374
375         Remove symbols that are not longer present in the library.
376
377         * webkitglib-symbols.map:
378
379 2019-05-26  Simon Fraser  <simon.fraser@apple.com>
380
381         Move VelocityData to WebCore
382         https://bugs.webkit.org/show_bug.cgi?id=198261
383
384         Reviewed by Antti Koivisto.
385
386         Move VelocityData and HistoricalVelocityData to WebCore for future use in overflow scroll.
387
388         VisibleContentRectUpdateInfo can now store a VelocityData (its timestamp is used as
389         the timetamp for the entire update).
390
391         * Shared/VisibleContentRectUpdateInfo.cpp:
392         (WebKit::VisibleContentRectUpdateInfo::encode const):
393         (WebKit::VisibleContentRectUpdateInfo::decode):
394         (WebKit::operator<<):
395         * Shared/VisibleContentRectUpdateInfo.h:
396         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
397         (WebKit::VisibleContentRectUpdateInfo::scrollVelocity const):
398         (WebKit::VisibleContentRectUpdateInfo::enclosedInScrollableAncestorView const):
399         (WebKit::VisibleContentRectUpdateInfo::timestamp const):
400         (WebKit::operator==):
401         (WebKit::VisibleContentRectUpdateInfo::horizontalVelocity const): Deleted.
402         (WebKit::VisibleContentRectUpdateInfo::verticalVelocity const): Deleted.
403         (WebKit::VisibleContentRectUpdateInfo::scaleChangeRate const): Deleted.
404         * Shared/WebCoreArgumentCoders.cpp:
405         (IPC::ArgumentCoder<VelocityData>::encode):
406         (IPC::ArgumentCoder<VelocityData>::decode):
407         * Shared/WebCoreArgumentCoders.h:
408         * UIProcess/ios/WKContentView.mm:
409         (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
410         (WebKit::HistoricalVelocityData::VelocityData::VelocityData): Deleted.
411         (WebKit::HistoricalVelocityData::HistoricalVelocityData): Deleted.
412         (WebKit::HistoricalVelocityData::velocityForNewData): Deleted.
413         (WebKit::HistoricalVelocityData::clear): Deleted.
414         (WebKit::HistoricalVelocityData::append): Deleted.
415         * WebProcess/WebPage/ios/WebPageIOS.mm:
416         (WebKit::WebPage::dynamicViewportSizeUpdate):
417         (WebKit::WebPage::viewportConfigurationChanged):
418         (WebKit::adjustVelocityDataForBoundedScale):
419         (WebKit::WebPage::updateVisibleContentRects):
420
421 2019-05-26  John Wilander  <wilander@apple.com>
422
423         Resource Load Statistics: Downgrade document.referrer to the referrer's eTLD+1 if the page was navigated to with a prevalent resource referrer containing link decoration
424         https://bugs.webkit.org/show_bug.cgi?id=198227
425         <rdar://problem/51117258>
426
427         Reviewed by Alex Christensen.
428
429         This patch adds a call back to the UI process if the network process finds the navigational
430         data transfer was done by a prevalent resource and we need to adjust something for the page.
431         Currently, that adjustment is to downgrade document.referrer.
432
433         The patch also removes an unused completion handler.
434
435         * NetworkProcess/NetworkProcess.cpp:
436         (WebKit::NetworkProcess::didCommitCrossSiteLoadWithDataTransfer):
437         (WebKit::NetworkProcess::committedCrossSiteLoadWithLinkDecoration): Deleted.
438             New name since we no longer only look for link decoration but also other means of navigational data transfer.
439         * NetworkProcess/NetworkProcess.h:
440         * NetworkProcess/NetworkProcess.messages.in:
441         * UIProcess/Network/NetworkProcessProxy.cpp:
442         (WebKit::NetworkProcessProxy::didCommitCrossSiteLoadWithDataTransfer):
443         (WebKit::NetworkProcessProxy::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource):
444         (WebKit::NetworkProcessProxy::committedCrossSiteLoadWithLinkDecoration): Deleted.
445             New name since we no longer only look for link decoration but also other means of navigational data transfer.
446         * UIProcess/Network/NetworkProcessProxy.h:
447         * UIProcess/Network/NetworkProcessProxy.messages.in:
448         * UIProcess/WebPageProxy.cpp:
449         (WebKit::checkIfNavigationContainsDataTransfer):
450         (WebKit::WebPageProxy::didCommitLoadForFrame):
451         (WebKit::WebPageProxy::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource):
452         (WebKit::isNonUniqueNavigationWithLinkDecoration): Deleted.
453             New name since we no longer only look for link decoration but also other means of navigational data transfer.
454         * UIProcess/WebPageProxy.h:
455         * UIProcess/WebProcessPool.cpp:
456         (WebKit::WebProcessPool::didCommitCrossSiteLoadWithDataTransfer):
457         (WebKit::WebProcessPool::committedCrossSiteLoadWithLinkDecoration): Deleted.
458             New name since we no longer only look for link decoration but also other means of navigational data transfer.
459         * UIProcess/WebProcessPool.h:
460         * WebProcess/WebPage/WebPage.cpp:
461         (WebKit::WebPage::wasLoadedWithDataTransferFromPrevalentResource):
462         * WebProcess/WebPage/WebPage.h:
463         * WebProcess/WebPage/WebPage.messages.in:
464
465 2019-05-26  Wenson Hsieh  <wenson_hsieh@apple.com>
466
467         [iOS] Dropped text, attachments, and images should animate into place
468         https://bugs.webkit.org/show_bug.cgi?id=198243
469         <rdar://problem/35205373>
470
471         Reviewed by Tim Horton.
472
473         Adds support for targeted drop animations on iOS in modern WebKit by adopting UIKit SPI introduced in
474         <rdar://problem/31075005> to allow updating the drop preview mid-flight. To get the animation right, we refactor
475         and augment existing logic for taking snapshots after performing a drop in an editable content.
476
477         Currently, upon dropping in editable content, we first snapshot the web view and temporarily cover the real web
478         view with this snapshot. When the TextIndicator data arrives that contains (1) a snapshot of the visible part of
479         the web view ignoring the selection, and (2) a snapshot of just the selected contents after drop, we crossfade
480         from the web view snapshot to the snapshot in (1) using a hard-coded time delay (~500ms), and target the drop
481         preview to the drag caret rect. During this process, snapshot (2) is completely ignored.
482
483         This was effectively a halfway implemention of the desired effect of animating the dropped content into place
484         and crossfading to the final content; before UIKit implemented updateable drag previews, the full implementation
485         was not possible in modern WebKit (without using synchronous IPC).
486
487         Now that we're able to update the drag preview in the middle of the drop animation, we can now utilize snapshot
488         (2) above and clean up some parts of the drop animation in editable content. See below for more details.
489
490         * UIProcess/API/Cocoa/WKWebView.mm:
491         (-[WKWebView _doAfterReceivingEditDragSnapshotForTesting:]):
492
493         Add a testing hook to perform the given block after any pending edit drag snapshot has been received. See
494         TestWebKitAPI changes for more detail.
495
496         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
497         * UIProcess/PageClient.h:
498         * UIProcess/WebPageProxy.h:
499         * UIProcess/WebPageProxy.messages.in:
500
501         Split up the existing DidConcludeEditDrag IPC message into two messages: WillReceiveEditDragSnapshot and
502         DidReceiveEditDragSnapshot. This allows us to defer cleaning up the drag session state during an edit drop,
503         until after the final edit drag snapshot has been received.
504
505         * UIProcess/ios/DragDropInteractionState.h:
506
507         Add some new methods to help manage the lifecycle of drop preview provider blocks.
508
509         * UIProcess/ios/DragDropInteractionState.mm:
510         (WebKit::createTargetedDragPreview):
511
512         Drive-by fix: make this return a RetainPtr.
513
514         (WebKit::DragDropInteractionState::prepareForDelayedDropPreview):
515
516         Stores a drop preview provider, given to us by UIKit.
517
518         (WebKit::DragDropInteractionState::deliverDelayedDropPreview):
519
520         Invokes the stored drop preview providers with given text indicator data. This is invoked after snapshots are
521         taken following an edit drag (this is additionally after all images in the inserted fragment have finished
522         loading).
523
524         (WebKit::DragDropInteractionState::clearAllDelayedItemPreviewProviders):
525
526         Invokes all stored drop preview providers with a nil preview. This is invoked in any case where drag session
527         cleanup occurs earlier than normal (e.g., if the web process crashes during drop), and ensures that the handlers
528         are always invoked when cleaning up the drag session.
529
530         (WebKit::DragDropInteractionState::previewForDragItem const):
531         (WebKit::DragDropInteractionState::dragAndDropSessionsDidEnd):
532
533         Call clearAllDelayedItemPreviewProviders.
534
535         * UIProcess/ios/PageClientImplIOS.h:
536         * UIProcess/ios/PageClientImplIOS.mm:
537         (WebKit::PageClientImpl::willReceiveEditDragSnapshot):
538         (WebKit::PageClientImpl::didReceiveEditDragSnapshot):
539         (WebKit::PageClientImpl::didConcludeEditDrag): Deleted.
540
541         More plumbing (see changes to DidConcludeEditDrag above).
542
543         * UIProcess/ios/WKContentViewInteraction.h:
544         * UIProcess/ios/WKContentViewInteraction.mm:
545         (-[WKContentView cleanupInteraction]):
546         (-[WKContentView cleanUpDragSourceSessionState]):
547         (-[WKContentView _willReceiveEditDragSnapshot]):
548         (-[WKContentView _didReceiveEditDragSnapshot:]):
549
550         Set _waitingForEditDragSnapshot to YES in the gap between when -_willReceiveEditDragSnapshot is invoked, and
551         when -_didReceiveEditDragSnapshot is invoked. If _waitingForEditDragSnapshot is YES, we bail out of
552         -cleanUpDragSourceSessionState, and instead clean up drag session state after the edit drag snapshot is
553         received.
554
555         (-[WKContentView _deliverDelayedDropPreviewIfPossible:]):
556         (-[WKContentView _didPerformDragOperation:]):
557         (-[WKContentView textEffectsWindow]):
558
559         Drive-by fix to remove a workaround for a deprecation warning.
560
561         (-[WKContentView dropInteraction:item:willAnimateDropWithAnimator:]):
562         (-[WKContentView dropInteraction:concludeDrop:]):
563
564         Implement this hook to ensure that the unselected content snapshot view and visible content snapshot view are
565         guaranteed to be removed from the view after a drop in editable content, even if the drag edit snapshot arrives
566         after the drop is concluded.
567
568         (-[WKContentView dropInteraction:previewForDroppingItem:withDefault:]):
569         (-[WKContentView _dropInteraction:delayedPreviewProviderForDroppingItem:previewProvider:]):
570
571         Implement the new UIKit SPI here. UIKit hands us a preview provider here, which we can invoke at a later time
572         to update the drop preview. We do this in _didReceiveEditDragSnapshot.
573
574         (-[WKContentView _doAfterReceivingEditDragSnapshotForTesting:]):
575         (-[WKContentView _didConcludeEditDrag:]): Deleted.
576         * UIProcess/ios/WebPageProxyIOS.mm:
577         (WebKit::WebPageProxy::willReceiveEditDragSnapshot):
578         (WebKit::WebPageProxy::didReceiveEditDragSnapshot):
579         (WebKit::WebPageProxy::didConcludeDrop):
580         (WebKit::WebPageProxy::didConcludeEditDrag): Deleted.
581         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
582         (WebKit::WebChromeClient::didFinishLoadingImageForElement):
583         * WebProcess/WebCoreSupport/WebChromeClient.h:
584         * WebProcess/WebPage/WebPage.cpp:
585         (WebKit::WebPage::didFinishLoadingImageForElement):
586         * WebProcess/WebPage/WebPage.h:
587         * WebProcess/WebPage/WebPage.messages.in:
588         * WebProcess/WebPage/ios/WebPageIOS.mm:
589         (WebKit::WebPage::didConcludeDrop):
590
591         If an edit drag has been concluded, there's no need to hang on to pending dropped image elements anymore; clear
592         out the set here.
593
594         (WebKit::WebPage::didConcludeEditDrag):
595
596         After concluding an edit drag, we try to deliver two web content snapshots to the UI process, so that the UI
597         process can assemble a targeted drop preview for UIKit. One snapshot is of the visible content area, not
598         including any selected content. The other snapshot is of the selected content only. However, when dropping
599         images (or a text selection containing images), these images may not yet have been loaded. If that is the case,
600         these images will appear to be missing from these snapshots.
601
602         To ensure that we don't take this snapshot too early, defer it until all image elements in the dropped content
603         range have finished loading. We can tell that all dropped images have finished loading by using a new client
604         hook that is invoked when an image has finished loading.
605
606         (WebKit::WebPage::didFinishLoadingImageForElement):
607         (WebKit::WebPage::computeAndSendEditDragSnapshot):
608
609         Snapshot the selected content and send it to the UI process.
610
611 2019-05-24  Youenn Fablet  <youenn@apple.com>
612
613         REGRESSION (r245715?) [WK2] Layout Test http/wpt/cache-storage/cache-storage-networkprocess-crash.html is a flaky failure
614         https://bugs.webkit.org/show_bug.cgi?id=198222
615         <rdar://problem/51114899>
616
617         Reviewed by Alex Christensen.
618
619         In case a connection gets closed, handle all of its async reply completion handlers.
620         This ensures they handlers are called in case the connection does not get destroyed until a much later stage.
621
622         * Platform/IPC/Connection.cpp:
623         (IPC::Connection::~Connection):
624         (IPC::Connection::connectionDidClose):
625         (IPC::addAsyncReplyHandler):
626         (IPC::clearAsyncReplyHandlers):
627         (IPC::CompletionHandler<void):
628
629 2019-05-24  Per Arne Vollan  <pvollan@apple.com>
630
631         Remove unused member in WebsiteDataRecord
632         https://bugs.webkit.org/show_bug.cgi?id=198231
633
634         Reviewed by Brent Fulgham.
635
636         The data member 'originsWithCredentials' in WebsiteDataRecord is no longer needed since origins
637         with credentials are now stored in the 'origins' member.
638
639         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
640         (WebKit::WebsiteDataRecord::addOriginWithCredential): Deleted.
641         * UIProcess/WebsiteData/WebsiteDataRecord.h:
642         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
643         (WebKit::WebsiteDataStore::fetchDataAndApply):
644
645 2019-05-24  David Quesada  <david_quesada@apple.com>
646
647         Crash under WebCore::TimerBase::~TimerBase after a download is canceled
648         https://bugs.webkit.org/show_bug.cgi?id=197927
649         rdar://problem/50822728
650
651         Reviewed by Ryosuke Niwa.
652
653         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
654         (WebKit::Download::platformCancelNetworkLoad):
655             CFNetwork makes no guarantees about what thread is used to call the completion block
656             passed to -[NSURLSessionDownloadTask cancelByProducingResumeData], and in some cases,
657             it can be called on a background queue. This eventually causes the Download to be
658             deallocated on the background queue, which triggers a release assertion failure in
659             ~TimerBase. When CFNetwork finishes canceling the download, we should move to the
660             main thread before calling didCancel().
661
662 2019-05-24  Youenn Fablet  <youenn@apple.com>
663
664         Update messages_unittest.py after r245715
665         https://bugs.webkit.org/show_bug.cgi?id=198214
666
667         Reviewed by Alexey Proskuryakov.
668
669         Update expected results for messages.py output.i
670         Small refactoring to messages.py: instead of calling the completionHandler in case of decoding error with AsyncReply errors,
671         call cancelReply directly as it does the same thing.
672
673         * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
674         (Messages::WebPage::TestAsyncMessage::callReply):
675         (Messages::WebPage::TestAsyncMessage::cancelReply):
676         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::callReply):
677         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::cancelReply):
678         * Scripts/webkit/messages.py:
679
680 2019-05-23  Ross Kirsling  <ross.kirsling@sony.com>
681
682         Socket-based RWI should be able to inspect a JSContext
683         https://bugs.webkit.org/show_bug.cgi?id=198197
684
685         Reviewed by Don Olmstead.
686
687         * UIProcess/socket/RemoteInspectorClient.cpp:
688         (WebKit::RemoteInspectorClient::inspect):
689         * UIProcess/socket/RemoteInspectorClient.h:
690         * UIProcess/socket/RemoteInspectorProtocolHandler.cpp:
691         (WebKit::RemoteInspectorProtocolHandler::inspect):
692         (WebKit::RemoteInspectorProtocolHandler::targetListChanged):
693         (WebKit::RemoteInspectorProtocolHandler::platformStartTask):
694         * UIProcess/socket/RemoteInspectorProtocolHandler.h:
695         Have the RWI client actually pass the debuggableType to WebInspectorUI.
696
697 2019-05-22  Stephanie Lewis  <slewis@apple.com>
698
699         release builds of webkit cannot be used to generate a dyld shared cache
700         https://bugs.webkit.org/show_bug.cgi?id=198150
701         <rdar://problem/50675982>
702
703         Reviewed by Dan Bernstein.
704
705         Restrict the -not_for_dyld_shared_cache linker flag to macosx
706
707         * Configurations/WebKit.xcconfig:
708
709
710 2019-05-23  Zalan Bujtas  <zalan@apple.com>
711
712         [Hittest] Move hittesting from RenderView to Document
713         https://bugs.webkit.org/show_bug.cgi?id=198192
714         <rdar://problem/51077762>
715
716         Reviewed by Antti Koivisto.
717
718         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
719         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
720         * WebProcess/WebPage/WebPage.cpp:
721         (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
722         * WebProcess/WebPage/ios/WebPageIOS.mm:
723         (WebKit::WebPage::dynamicViewportSizeUpdate):
724
725 2019-05-23  Youenn Fablet  <youenn@apple.com>
726
727         CacheStorageConnection callbacks should be completed on network connection close
728         https://bugs.webkit.org/show_bug.cgi?id=195757
729
730         Reviewed by Alex Christensen.
731
732         Update according new WebCore CacheStorageConnection interface.
733         Use Async IPC replies so that the completion handlers are called on network crash.
734
735         Allow to have specific error handling in case of cancelled reply or badly decoded message.
736         This allows to reject the corresponding JS promise.
737
738         * CMakeLists.txt:
739         * DerivedSources-output.xcfilelist:
740         * DerivedSources.make:
741         * NetworkProcess/cache/CacheStorageEngine.cpp:
742         (WebKit::CacheStorage::Engine::clearMemoryRepresentation):
743         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
744         (WebKit::CacheStorage::Caches::requestSpace):
745         (WebKit::CacheStorage::Caches::writeRecord):
746         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
747         (WebKit::CacheStorageEngineConnection::open):
748         (WebKit::CacheStorageEngineConnection::remove):
749         (WebKit::CacheStorageEngineConnection::caches):
750         (WebKit::CacheStorageEngineConnection::retrieveRecords):
751         (WebKit::CacheStorageEngineConnection::deleteMatchingRecords):
752         (WebKit::CacheStorageEngineConnection::putRecords):
753         * NetworkProcess/cache/CacheStorageEngineConnection.h:
754         (IPC::AsyncReplyError<WebCore::DOMCacheEngine::CacheIdentifierOrError>::create):
755         (IPC::AsyncReplyError<WebCore::DOMCacheEngine::RecordIdentifiersOrError>::create):
756         (IPC::AsyncReplyError<WebCore::DOMCacheEngine::CacheInfosOrError>::create):
757         (IPC::AsyncReplyError<WebCore::DOMCacheEngine::RecordsOrError>::create):
758         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
759         * Platform/IPC/ArgumentCoders.h:
760         * Platform/IPC/Connection.h:
761         (IPC::AsyncReplyError::create):
762         * Scripts/webkit/messages.py:
763         * WebKit.xcodeproj/project.pbxproj:
764         * WebProcess/Cache/WebCacheStorageConnection.cpp:
765         (WebKit::WebCacheStorageConnection::open):
766         (WebKit::WebCacheStorageConnection::remove):
767         (WebKit::WebCacheStorageConnection::retrieveCaches):
768         (WebKit::WebCacheStorageConnection::retrieveRecords):
769         (WebKit::WebCacheStorageConnection::batchDeleteOperation):
770         (WebKit::WebCacheStorageConnection::batchPutOperation):
771         (WebKit::WebCacheStorageConnection::engineRepresentation):
772         * WebProcess/Cache/WebCacheStorageConnection.h:
773         * WebProcess/Cache/WebCacheStorageConnection.messages.in: Removed.
774         * WebProcess/Network/NetworkProcessConnection.cpp:
775         (WebKit::NetworkProcessConnection::didReceiveMessage):
776
777 2019-05-23  Sihui Liu  <sihui_liu@apple.com>
778
779         Handling for non-persistent data should be consistent in computeNetworkProcessAccessTypeForDataFetch
780         https://bugs.webkit.org/show_bug.cgi?id=198050
781
782         Reviewed by Youenn Fablet.
783
784         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
785         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
786
787 2019-05-23  Youenn Fablet  <youenn@apple.com>
788
789         Set default WebsiteDataStore storage quota based on StorageQuotaManager
790         https://bugs.webkit.org/show_bug.cgi?id=198133
791         <rdar://problem/51031436>
792
793         Reviewed by Geoffrey Garen.
794
795         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
796
797 2019-05-23  Alex Christensen  <achristensen@webkit.org>
798
799         Deprecate more preview API
800         https://bugs.webkit.org/show_bug.cgi?id=198152
801
802         Reviewed by Dean Jackson.
803
804         This is working towards <rdar://problem/51003503>
805
806         * UIProcess/API/Cocoa/WKPreviewActionItem.h:
807         * UIProcess/API/Cocoa/WKPreviewActionItem.mm:
808         * UIProcess/API/Cocoa/WKPreviewActionItemIdentifiers.h:
809         * UIProcess/API/Cocoa/WKPreviewActionItemInternal.h:
810         * UIProcess/API/Cocoa/WKPreviewElementInfo.h:
811         * UIProcess/API/Cocoa/WKPreviewElementInfo.mm:
812         * UIProcess/API/Cocoa/WKUIDelegate.h:
813         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
814         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::activeTouchActions const):
815         * UIProcess/ios/WKContentViewInteraction.mm:
816         (previewIdentifierForElementAction):
817         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
818         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
819         (-[WKContentView _previewItemController:commitPreview:]):
820
821 2019-05-23  Antoine Quint  <graouts@apple.com>
822
823         [tvOS] Build broken by r245639
824         https://bugs.webkit.org/show_bug.cgi?id=198172
825         <rdar://problem/51048991>
826
827         Unreviewed build fix.
828
829         * UIProcess/WebPageProxy.cpp:
830         (WebKit::WebPageProxy::touchWithIdentifierWasRemoved):
831         * UIProcess/WebPageProxy.h:
832         * UIProcess/ios/WebPageProxyIOS.mm:
833         (WebKit::WebPageProxy::touchWithIdentifierWasRemoved): Deleted.
834         * WebProcess/WebPage/WebPage.cpp:
835         (WebKit::WebPage::touchWithIdentifierWasRemoved):
836         * WebProcess/WebPage/WebPage.h:
837         * WebProcess/WebPage/ios/WebPageIOS.mm:
838         (WebKit::WebPage::touchWithIdentifierWasRemoved): Deleted.
839
840 2019-05-23  Antoine Quint  <graouts@apple.com>
841
842         [tvOS] Build broken by r245639
843         https://bugs.webkit.org/show_bug.cgi?id=198172
844         <rdar://problem/51048991>
845
846         Unreviewed build fix.
847
848         * WebProcess/WebPage/WebPage.messages.in:
849
850 2019-05-23  Adrian Perez de Castro  <aperez@igalia.com>
851
852         [WPE] Build fails with ENABLE_VIDEO=OFF and ENABLE_WEB_AUDIO=OFF
853         https://bugs.webkit.org/show_bug.cgi?id=198125
854
855         Reviewed by Philippe Normand.
856
857         * UIProcess/glib/WebProcessPoolGLib.cpp: Guard the inclusion of GStreamerCommon.h with USE(GSTREAMER).
858         * WebProcess/glib/WebProcessGLib.cpp: Ditto.
859
860 2019-05-22  Antoine Quint  <graouts@apple.com>
861
862         [tvOS] Build broken by r245639
863         https://bugs.webkit.org/show_bug.cgi?id=198172
864         <rdar://problem/51048991>
865
866         Unreviewed build fix.
867
868         * UIProcess/ios/WKSyntheticTapGestureRecognizer.m:
869         (-[WKSyntheticTapGestureRecognizer reset]):
870         (-[WKSyntheticTapGestureRecognizer touchesEnded:withEvent:]):
871
872 2019-05-22  Youenn Fablet  <youenn@apple.com>
873
874         Use modern async IPC for EngineRepresentationCompleted and ClearMemoryRepresentationCompleted
875         https://bugs.webkit.org/show_bug.cgi?id=198134
876
877         Reviewed by Alex Christensen.
878
879         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
880         (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation):
881         (WebKit::CacheStorageEngineConnection::engineRepresentation):
882         * NetworkProcess/cache/CacheStorageEngineConnection.h:
883         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
884         * WebProcess/Cache/WebCacheStorageConnection.cpp:
885         (WebKit::WebCacheStorageConnection::clearMemoryRepresentation):
886         (WebKit::WebCacheStorageConnection::engineRepresentation):
887         (WebKit::WebCacheStorageConnection::clearMemoryRepresentationCompleted): Deleted.
888         (WebKit::WebCacheStorageConnection::engineRepresentationCompleted): Deleted.
889         * WebProcess/Cache/WebCacheStorageConnection.h:
890         * WebProcess/Cache/WebCacheStorageConnection.messages.in:
891
892 2019-05-22  Ryosuke Niwa  <rniwa@webkit.org>
893
894         REGRESSION(r245148): Removing inputmode="none" does not bring up software keyboard
895         https://bugs.webkit.org/show_bug.cgi?id=198141
896
897         Reviewed by Geoffrey Garen.
898
899         r245148 changed _requiresKeyboardWhenFirstResponder to return NO when shouldShowAutomaticKeyboardUI
900         returns NO with regards to software keyboard. This introduced a regression that removing inputmode="none"
901         no longer brings up the software keyboard. Fixed the bug by making it return YES when inputmode="none"
902         is present on an editable element in shouldShowAutomaticKeyboardUI, partially restoring the old behavior.
903
904         * UIProcess/ios/WKContentViewInteraction.mm:
905         (-[WKContentView shouldShowAutomaticKeyboardUI]):
906         (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]):
907         (-[WKContentView _requiresKeyboardWhenFirstResponder]):
908
909 2019-05-22  Tim Horton  <timothy_horton@apple.com>
910
911         REGRESSION (r240552): PDF contents are not exposed to Accessibility (VO, etc.)
912         https://bugs.webkit.org/show_bug.cgi?id=198146
913         <rdar://problem/50698533>
914
915         Reviewed by Simon Fraser.
916
917         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
918         (WebKit::WebPage::updateMockAccessibilityElementAfterCommittingLoad):
919         * WebProcess/WebPage/WebPage.cpp:
920         (WebKit::WebPage::didCommitLoad):
921         (WebKit::WebPage::updateMockAccessibilityElementAfterCommittingLoad):
922         * WebProcess/WebPage/WebPage.h:
923         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h:
924         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
925         (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
926         (-[WKAccessibilityWebPageObjectBase setWebPage:]):
927         (-[WKAccessibilityWebPageObjectBase setHasMainFramePlugin:]):
928         In r240552, we changed to only defer to the main frame PluginView's
929         accessibility tree if the cached "has a plugin" bit is true. That bit
930         was only updated in WebPage::platformInitialize, which is long before
931         we've actually loaded anything or have any clue if we're going to have
932         a plugin.
933
934         Instead, push updates every time we commit a load, which coincides
935         with when we make other decisions based on having a plugin or not.
936         Also, just use the existence of a PluginDocument to make the decision,
937         instead of actually digging in to see if there's a PluginView, since
938         PluginView comes in asynchronously.
939
940 2019-05-22  Ryosuke Niwa  <rniwa@webkit.org>
941
942         Crash in WebFrame::jsContext() when m_coreFrame is null
943         https://bugs.webkit.org/show_bug.cgi?id=198067
944
945         Reviewed by Alex Christensen.
946
947         Added missing null checks. Unfortunately no new tests since we don't have a reproducible test case.
948
949         * WebProcess/WebPage/WebFrame.cpp:
950         (WebKit::WebFrame::jsContext):
951         (WebKit::WebFrame::jsContextForWorld):
952
953 2019-05-22  Sihui Liu  <sihui_liu@apple.com>
954
955         API Test landed in r245540 [Mac WK2] TestWebKitAPI.WKWebView.LocalStorageProcessCrashes is a flaky failure
956         https://bugs.webkit.org/show_bug.cgi?id=198090
957         <rdar://problem/51003644>
958
959         Reviewed by Youenn Fablet.
960
961         We used to dispatch StorageManager message to StorageManager's work queue, which required message handler to be
962         added to queue before receiving first StorageManager message, otherwise network process would not know how to
963         decode the message.
964
965         After r245540, when netork process crashes and dom storage is accessed from web process after that, web process 
966         re-establishes its connection to network process, asks network process to add message handler, and then sends 
967         StorageManager message immediately. Because work queue message receiver is added on a background thread in 
968         network process, it is possible the StorageManager message is received before that.
969
970         A safe and easy resolution is to not dispatch StorageManager message to work queue, so that we don't need to 
971         wait for the message receiver to be added. Handling message on the main thread also allows us to untying the 
972         knot that binds StorageManager and connection, which may be a preferred design in the future.
973
974         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
975         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
976         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage):
977         * NetworkProcess/NetworkProcess.cpp:
978         (WebKit::NetworkProcess::webPageWasAdded):
979         * NetworkProcess/WebStorage/StorageManager.cpp:
980         (WebKit::StorageManager::processDidCloseConnection):
981         (WebKit::StorageManager::createLocalStorageMap):
982         (WebKit::StorageManager::createTransientLocalStorageMap):
983         (WebKit::StorageManager::createSessionStorageMap):
984         (WebKit::StorageManager::destroyStorageMap):
985         (WebKit::didGetValues):
986         (WebKit::StorageManager::getValues):
987         (WebKit::StorageManager::setItem):
988         (WebKit::StorageManager::setItems):
989         (WebKit::StorageManager::removeItem):
990         (WebKit::StorageManager::clear):
991         (WebKit::StorageManager::processWillOpenConnection): Deleted.
992         (WebKit::StorageManager::dispatchMessageToQueue): Deleted.
993         (WebKit::StorageManager::dispatchSyncMessageToQueue): Deleted.
994         * NetworkProcess/WebStorage/StorageManager.h:
995
996 2019-05-22  Antoine Quint  <graouts@apple.com>
997
998         [iOS] Compatibility mouse events aren't prevented by calling preventDefault() on pointerdown
999         https://bugs.webkit.org/show_bug.cgi?id=198124
1000         <rdar://problem/50410863>
1001
1002         Reviewed by Tim Horton.
1003
1004         In order to correctly prevent "compatibility" mouse events from being dispatched when the initial "pointerdown" event had preventDefault()
1005         called while handled, we need to pass the PointerID for the touch that triggered a tap gesture in the UI process down in the Web process
1006         and into the resulting PlatformMouseEvent.
1007
1008         This means we need to identify the touch identifier, which is the same as the PointerID used for Pointer Events, in the single tap gesture
1009         recognizer, an instance of WKSyntheticTapGestureRecognizer. To do this, we subclass the -[UIResponder touchesEnded:withEvent:] method and
1010         track the touch identifier as the lastActiveTouchIdentifier, a new public property of WKSyntheticTapGestureRecognizer. To allow for this,
1011         we need the support of the content view's UIWebTouchEventsGestureRecognizer which is exposed to the WKSyntheticTapGestureRecognizer as its
1012         supportingWebTouchEventsGestureRecognizer property. This lastActiveTouchIdentifier property is cleared as the gesture recognizer is reset.
1013
1014         This allows the content view to pass the PointerID down to the Web process starting from -[WKContentView _singleTapRecognized:], going
1015         through WebPageProxy::commitPotentialTap() and eventually WebPage::completeSyntheticClick().
1016
1017         While we used to tell the PointerCaptureController that a PointerID was no longer active when a given touch ended or was canceled (in
1018         WebKitAdditions code), we can no longer do this as the dispatch of a synthetic tap is performed asynchronously and will happen past the
1019         dispatch of "pointerup" and "pointercancel" Pointer Events. To clear inactive PointerIDs from the PointerCaptureController, we add a new
1020         touchWithIdentifierWasRemoved() method on the WebPage and its proxy. When the WKSyntheticTapGestureRecognizer resets and -[WKContentView _singleTapDidReset:]
1021         is called, we call that method which allows for only active PointerIDs to be tracked by the PointerCaptureController.
1022
1023         * UIProcess/WebPageProxy.h:
1024         * UIProcess/ios/WKContentViewInteraction.mm:
1025         (-[WKContentView setupInteraction]):
1026         (-[WKContentView cleanupInteraction]):
1027         (-[WKContentView _singleTapDidReset:]):
1028         (-[WKContentView _singleTapRecognized:]):
1029         * UIProcess/ios/WKSyntheticTapGestureRecognizer.h:
1030         * UIProcess/ios/WKSyntheticTapGestureRecognizer.m:
1031         (-[WKSyntheticTapGestureRecognizer reset]):
1032         (-[WKSyntheticTapGestureRecognizer touchesEnded:withEvent:]):
1033         * UIProcess/ios/WebPageProxyIOS.mm:
1034         (WebKit::WebPageProxy::touchWithIdentifierWasRemoved):
1035         (WebKit::WebPageProxy::commitPotentialTap):
1036         * WebProcess/WebPage/WebPage.h:
1037         * WebProcess/WebPage/WebPage.messages.in:
1038         * WebProcess/WebPage/ios/WebPageIOS.mm:
1039         (WebKit::dispatchSyntheticMouseMove):
1040         (WebKit::WebPage::handleSyntheticClick):
1041         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
1042         (WebKit::WebPage::completeSyntheticClick):
1043         (WebKit::WebPage::commitPotentialTap):
1044         (WebKit::WebPage::touchWithIdentifierWasRemoved):
1045
1046 2019-05-22  Jiewen Tan  <jiewen_tan@apple.com>
1047
1048         [WebAuthN] Support Attestation Conveyance Preference
1049         https://bugs.webkit.org/show_bug.cgi?id=192722
1050         <rdar://problem/49939647>
1051
1052         Reviewed by Brent Fulgham.
1053
1054         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
1055         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
1056         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp:
1057         (WebKit::CtapHidAuthenticator::continueMakeCredentialAfterResponseReceived const):
1058         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp:
1059         (WebKit::U2fHidAuthenticator::continueRegisterCommandAfterResponseReceived):
1060
1061 2019-05-22  Zalan Bujtas  <zalan@apple.com>
1062
1063         [Paste] Add support for preferred presentation size when pasting an image
1064         https://bugs.webkit.org/show_bug.cgi?id=198132
1065         <rdar://problem/50886917>
1066
1067         Reviewed by Wenson Hsieh.
1068
1069         * UIProcess/API/Cocoa/_WKElementAction.mm:
1070         (addToReadingList):
1071         * UIProcess/ios/WKActionSheetAssistant.mm:
1072         (-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
1073         (-[WKActionSheetAssistant defaultActionsForImageSheet:]):
1074
1075 2019-05-22  Youenn Fablet  <youenn@apple.com>
1076
1077         Implement Feature policy self/none/* parsing
1078         https://bugs.webkit.org/show_bug.cgi?id=198078
1079
1080         Reviewed by Eric Carlson.
1081
1082         Fix a case where completion handler might not always be called.
1083
1084         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1085         (WebKit::UserMediaPermissionRequestManager::userMediaAccessWasGranted):
1086
1087 2019-05-22  Ross Kirsling  <ross.kirsling@sony.com>
1088
1089         Unreviewed fix for non-unified build after r245320.
1090
1091         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1092         (WebKit::convertRectFromFrameClientToRootView):
1093         (WebKit::convertPointFromFrameClientToRootView):
1094         (WebKit::WebAutomationSessionProxy::computeElementLayout):
1095
1096 2019-05-22  Carlos Garcia Campos  <cgarcia@igalia.com>
1097
1098         Unreviewed. Fix GTK unit tests after r245565
1099
1100         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1101         (webkitWebViewBaseDispose): Null check accessible before calling webkitWebViewAccessibleSetWebView().
1102
1103 2019-05-21  Ross Kirsling  <ross.kirsling@sony.com>
1104
1105         [PlayStation] Don't call fcntl.
1106         https://bugs.webkit.org/show_bug.cgi?id=197961
1107
1108         Reviewed by Fujii Hironori.
1109
1110         * Platform/IPC/unix/ConnectionUnix.cpp:
1111         (IPC::Connection::open):
1112         Use WTF::setNonBlock.
1113
1114 2019-05-21  Chris Dumez  <cdumez@apple.com>
1115
1116         [PSON] Assertion hit when navigating back after a process swap forced by the client
1117         https://bugs.webkit.org/show_bug.cgi?id=198006
1118
1119         Reviewed by Alex Christensen.
1120
1121         After r245198, we construct a SuspendedPageProxy when a process-swap is forced by the client
1122         and we delay to closing of the WebPage in the old WebProcess until it is safe to do so without
1123         flashing (by calling SuspendedPageProxy::closeWithoutFlashing()). The issue is that our logic
1124         deciding if we should reuse a SuspendedPageProxy's WebPage relied on the SuspendedPageProxy's
1125         m_suspensionState not being set to FailedToSuspend. In the case of a process-swap forced by the
1126         client with delayed page closing, the suspended state may be suspended but is still not usable
1127         because it is about to get closed. We would wrongly believe there is a WebPage to be reused so
1128         the ProvisionalPageProxy would construct a proxy for the main frame in its constructor, we would
1129         then hit the ASSERT(!m_mainFrame) assertion in ProvisionalPageProxy::didCreateMainFrame() when
1130         the WebContent process would unexpectedly create a main frame.
1131
1132         To address the issue, stop relying on the suspended state to determine if we can reuse a WebPage
1133         or not and introduce a new pageIsClosedOrClosing() getter on the SuspendedPageProxy instead
1134         which indicates if the WebPage in the WebContent process has been closed or is about to be.
1135
1136         * UIProcess/ProvisionalPageProxy.cpp:
1137         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
1138         * UIProcess/SuspendedPageProxy.cpp:
1139         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
1140         (WebKit::SuspendedPageProxy::pageIsClosedOrClosing const):
1141         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
1142         * UIProcess/SuspendedPageProxy.h:
1143         * UIProcess/WebPageProxy.cpp:
1144         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1145
1146 2019-05-21  Per Arne Vollan  <pvollan@apple.com>
1147
1148         Sandbox violation is making the WebContent process crash
1149         https://bugs.webkit.org/show_bug.cgi?id=198089
1150         <rdar://problem/50999499>
1151
1152         Reviewed by Brent Fulgham.
1153
1154         A new syscall rule needs to be added to the sandbox on iOS and macOS.
1155
1156         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1157         * WebProcess/com.apple.WebProcess.sb.in:
1158
1159 2019-05-21  Alex Christensen  <achristensen@webkit.org>
1160
1161         Mark WKUIDelegate webView:shouldPreviewElement: and webView:previewingViewControllerForElement:defaultActions: as deprecated
1162         https://bugs.webkit.org/show_bug.cgi?id=198083
1163         <rdar://problem/50735687>
1164
1165         Reviewed by Geoffrey Garen.
1166
1167         * UIProcess/API/Cocoa/WKUIDelegate.h:
1168
1169 2019-05-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1170
1171         The cost of WebViewImpl::hasMarkedTextWithCompletionHandler should not increase with document size
1172         https://bugs.webkit.org/show_bug.cgi?id=198075
1173         <rdar://problem/37560103>
1174
1175         Reviewed by Tim Horton.
1176
1177         * UIProcess/Cocoa/WebViewImpl.mm:
1178         (WebKit::WebViewImpl::hasMarkedTextWithCompletionHandler):
1179
1180         Refactor hasMarkedTextWithCompletionHandler to use Editor::hasComposition, instead of computing the actual
1181         marked text range. The latter is more expensive and unnecessary, since it uses TextIterator from the document
1182         root to find editing offsets. This makes the cost of determining whether there is marked text proportional to
1183         the document size.
1184
1185         This matches behavior in legacy WebKit, as well as iOS.
1186
1187         * UIProcess/WebPageProxy.cpp:
1188         (WebKit::WebPageProxy::hasMarkedText):
1189         * UIProcess/WebPageProxy.h:
1190         * WebProcess/WebPage/WebPage.cpp:
1191         (WebKit::WebPage::hasMarkedText):
1192         * WebProcess/WebPage/WebPage.h:
1193         * WebProcess/WebPage/WebPage.messages.in:
1194
1195 2019-05-21  Jiewen Tan  <jiewen_tan@apple.com>
1196
1197         [WebAuthN] Make WebAuthN default on only on macOS
1198         https://bugs.webkit.org/show_bug.cgi?id=198068
1199         <rdar://problem/50971874>
1200
1201         Reviewed by Brent Fulgham.
1202
1203         * Shared/WebPreferences.yaml:
1204         * Shared/WebPreferencesDefaultValues.h:
1205
1206 2019-05-21  Pablo Saavedra  <psaavedra@igalia.com>
1207
1208         Undefined reference platformCloseFrontendPageAndWindow() linking against libWPEWebKit-1.0.so after r245536
1209         https://bugs.webkit.org/show_bug.cgi?id=198069
1210
1211         Reviewed by Ross Kirsling.
1212
1213         * UIProcess/RemoteWebInspectorProxy.cpp:
1214
1215 2019-05-21  Sihui Liu  <sihui_liu@apple.com>
1216
1217         REGRESSION(r245540): ASSERTION FAILED: identifier.isNull() || RunLoop::isMain()
1218         https://bugs.webkit.org/show_bug.cgi?id=198074
1219
1220         Reviewed by Youenn Fablet.
1221
1222         * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
1223         (WebKit::LocalStorageDatabaseTracker::databasePath const):
1224
1225 2019-05-21  Antti Koivisto  <antti@apple.com>
1226
1227         RTL/overflow scroll tests fail with async overflow enabled
1228         https://bugs.webkit.org/show_bug.cgi?id=196013
1229         <rdar://problem/49066649>
1230
1231         Reviewed by Simon Fraser.
1232
1233         Add missing scroll offset <-> scroll position conversions.
1234
1235         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
1236         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1237         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers):
1238         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll):
1239
1240 2019-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1241
1242         [WPE] Add initial accessibility support using ATK
1243         https://bugs.webkit.org/show_bug.cgi?id=197413
1244
1245         Reviewed by Michael Catanzaro.
1246
1247         Rename WebKitWebViewBaseAccessible as WebKitWebViewAccessible and move it to glib removing its dependency on
1248         GTK. WPEView now implements get_accessible to return its associated WebKitWebViewAccessible.
1249
1250         * PlatformWPE.cmake:
1251         * SourcesGTK.txt:
1252         * SourcesWPE.txt:
1253         * UIProcess/API/glib/WebKitWebViewAccessible.cpp: Added.
1254         (webkitWebViewAccessibleInitialize):
1255         (webkitWebViewAccessibleRefStateSet):
1256         (webkitWebViewAccessibleGetIndexInParent):
1257         (webkit_web_view_accessible_class_init):
1258         (webkitWebViewAccessibleNew):
1259         (webkitWebViewAccessibleSetWebView):
1260         * UIProcess/API/glib/WebKitWebViewAccessible.h: Added.
1261         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1262         (webkitWebViewBaseDispose):
1263         (webkitWebViewBaseGetAccessible):
1264         * UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp: Removed.
1265         * UIProcess/API/gtk/WebKitWebViewBaseAccessible.h: Removed.
1266         * UIProcess/API/wpe/PageClientImpl.cpp:
1267         (WebKit::PageClientImpl::accessible):
1268         * UIProcess/API/wpe/PageClientImpl.h:
1269         * UIProcess/API/wpe/WPEView.cpp:
1270         (WKWPE::m_backend):
1271         (WKWPE::View::~View):
1272         (WKWPE::View::accessible):
1273         * UIProcess/API/wpe/WPEView.h:
1274         * UIProcess/WebPageProxy.h:
1275         * UIProcess/WebPageProxy.messages.in:
1276         * UIProcess/wpe/WebPageProxyWPE.cpp:
1277         (WebKit::WebPageProxy::bindAccessibilityTree): Call atk_socket_embed() with the given plug ID.
1278         * WebProcess/WebPage/WebPage.h:
1279         * WebProcess/WebPage/wpe/WebPageWPE.cpp:
1280         (WebKit::WebPage::platformInitialize): Create the WebKitWebPageAccessibilityObject and send
1281         BindAccessibilityTree message to the UI process.
1282         * WebProcess/wpe/WebProcessMainWPE.cpp:
1283         (WebKit::initializeAccessibility): Implement AtkUtil interface and initialize the atk bridge.
1284
1285 2019-05-20  Alex Christensen  <achristensen@webkit.org>
1286
1287         Revert r245501
1288         https://bugs.webkit.org/show_bug.cgi?id=198007
1289
1290         That change did not fix <rdar://problem/49808949> but it caused <rdar://problem/50967271> so out it goes.
1291
1292         * Shared/API/Cocoa/WKMain.h: Added.
1293         * Shared/API/Cocoa/WKMain.mm: Added.
1294         (WKXPCServiceMain):
1295         * Shared/EntryPointUtilities/Cocoa/AuxiliaryProcessMain.cpp: Added.
1296         (main):
1297         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
1298         (main): Deleted.
1299         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1300         (WebKit::ProcessLauncher::launchProcess):
1301         * WebKit.xcodeproj/project.pbxproj:
1302
1303 2019-05-20  Wenson Hsieh  <wenson_hsieh@apple.com>
1304
1305         [iOS] Layout viewport size on google.com increases after rotating to landscape and back
1306         https://bugs.webkit.org/show_bug.cgi?id=198062
1307         <rdar://problem/50547895>
1308
1309         Reviewed by Maciej Stachowiak.
1310
1311         During an animated resize (e.g. when rotating the device on iOS), we currently immediately trigger the new
1312         shrink-to-fit content size heuristic in the middle of dynamicViewportSizeUpdate, after the new view layout size
1313         has been applied to the viewport configuration but before we've issued a resize event to the page.
1314
1315         Thus, on pages that use listen to the resize event and adjust their content accordingly to fit within the new
1316         layout width, we prematurely declare that the page has horizontally overflowed, and try to lay out at a larger
1317         width and scale down. This causes the page to unnecessarily shrink after rotating to landscale orientation and
1318         back.
1319
1320         To fix this, we simply move the call to shrink-to-fit-content to the end of the dynamic viewport size update,
1321         such that the page has had a chance to adjust to the new layout size.
1322
1323         Test: fast/events/ios/rotation/do-not-shrink-to-fit-content-after-rotation.html
1324
1325         * WebProcess/WebPage/ios/WebPageIOS.mm:
1326         (WebKit::WebPage::dynamicViewportSizeUpdate):
1327
1328 2019-05-20  Ross Kirsling  <ross.kirsling@sony.com>
1329
1330         Make lossy LayoutUnit constructors explicit
1331         https://bugs.webkit.org/show_bug.cgi?id=191811
1332
1333         Reviewed by Antti Koivisto.
1334
1335         * WebProcess/WebPage/WebPage.cpp:
1336         * WebProcess/WebPage/ios/WebPageIOS.mm:
1337         Make usage of LayoutUnit(float) explicit.
1338
1339 2019-05-20  Per Arne Vollan  <pvollan@apple.com>
1340
1341         [iOS] WebKit crash loop
1342         https://bugs.webkit.org/show_bug.cgi?id=198061
1343         <rdar://problem/50967271>
1344
1345         Reviewed by Brent Fulgham.
1346
1347         A new syscall rule needs to be added to the sandbox on iOS.
1348
1349         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1350
1351 2019-05-20  Sihui Liu  <sihui_liu@apple.com>
1352
1353         Move Web Storage to Network Process
1354         https://bugs.webkit.org/show_bug.cgi?id=197636
1355
1356         Reviewed by Youenn Fablet.
1357
1358         * CMakeLists.txt:
1359         * DerivedSources.make:
1360         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1361         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1362         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage):
1363         (WebKit::NetworkConnectionToWebProcess::didClose):
1364         (WebKit::NetworkConnectionToWebProcess::webPageWasAdded):
1365         (WebKit::NetworkConnectionToWebProcess::webPageWasRemoved):
1366         (WebKit::NetworkConnectionToWebProcess::webProcessSessionChanged):
1367         * NetworkProcess/NetworkConnectionToWebProcess.h:
1368         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1369         * NetworkProcess/NetworkProcess.cpp:
1370         (WebKit::NetworkProcess::networkSessionByConnection const):
1371         (WebKit::NetworkProcess::hasLocalStorage):
1372         (WebKit::NetworkProcess::fetchWebsiteData):
1373         (WebKit::NetworkProcess::deleteWebsiteData):
1374         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1375         (WebKit::filterForRegistrableDomains):
1376         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
1377         (WebKit::NetworkProcess::webPageWasAdded):
1378         (WebKit::NetworkProcess::webPageWasRemoved):
1379         (WebKit::NetworkProcess::webProcessWasDisconnected):
1380         (WebKit::NetworkProcess::webProcessSessionChanged):
1381         (WebKit::NetworkProcess::getLocalStorageOriginDetails):
1382         * NetworkProcess/NetworkProcess.h:
1383         * NetworkProcess/NetworkProcess.messages.in:
1384         * NetworkProcess/NetworkSession.cpp:
1385         (WebKit::NetworkSession::NetworkSession):
1386         (WebKit::NetworkSession::~NetworkSession):
1387         * NetworkProcess/NetworkSession.h:
1388         (WebKit::NetworkSession::storageManager):
1389         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1390         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
1391         (WebKit::NetworkSessionCreationParameters::encode const):
1392         (WebKit::NetworkSessionCreationParameters::decode):
1393         * NetworkProcess/NetworkSessionCreationParameters.h:
1394         * NetworkProcess/WebStorage/LocalStorageDatabase.cpp: Renamed from Source/WebKit/UIProcess/WebStorage/LocalStorageDatabase.cpp.
1395         (WebKit::LocalStorageDatabase::create):
1396         (WebKit::LocalStorageDatabase::LocalStorageDatabase):
1397         (WebKit::LocalStorageDatabase::~LocalStorageDatabase):
1398         (WebKit::LocalStorageDatabase::openDatabase):
1399         (WebKit::LocalStorageDatabase::tryToOpenDatabase):
1400         (WebKit::LocalStorageDatabase::migrateItemTableIfNeeded):
1401         (WebKit::LocalStorageDatabase::importItems):
1402         (WebKit::LocalStorageDatabase::setItem):
1403         (WebKit::LocalStorageDatabase::removeItem):
1404         (WebKit::LocalStorageDatabase::clear):
1405         (WebKit::LocalStorageDatabase::close):
1406         (WebKit::LocalStorageDatabase::itemDidChange):
1407         (WebKit::LocalStorageDatabase::scheduleDatabaseUpdate):
1408         (WebKit::LocalStorageDatabase::updateDatabase):
1409         (WebKit::LocalStorageDatabase::updateDatabaseWithChangedItems):
1410         (WebKit::LocalStorageDatabase::databaseIsEmpty):
1411         * NetworkProcess/WebStorage/LocalStorageDatabase.h: Renamed from Source/WebKit/UIProcess/WebStorage/LocalStorageDatabase.h.
1412         * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp: Renamed from Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp.
1413         (WebKit::LocalStorageDatabaseTracker::create):
1414         (WebKit::LocalStorageDatabaseTracker::LocalStorageDatabaseTracker):
1415         (WebKit::LocalStorageDatabaseTracker::~LocalStorageDatabaseTracker):
1416         (WebKit::LocalStorageDatabaseTracker::databasePath const):
1417         (WebKit::LocalStorageDatabaseTracker::didOpenDatabaseWithOrigin):
1418         (WebKit::LocalStorageDatabaseTracker::deleteDatabaseWithOrigin):
1419         (WebKit::LocalStorageDatabaseTracker::deleteAllDatabases):
1420         (WebKit::LocalStorageDatabaseTracker::databasesModifiedSince):
1421         (WebKit::LocalStorageDatabaseTracker::origins const):
1422         (WebKit::LocalStorageDatabaseTracker::originDetails):
1423         * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.h: Renamed from Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.h.
1424         * NetworkProcess/WebStorage/StorageManager.cpp: Renamed from Source/WebKit/UIProcess/WebStorage/StorageManager.cpp.
1425         (WebKit::StorageManager::StorageArea::securityOrigin const):
1426         (WebKit::StorageManager::StorageArea::isSessionStorage const):
1427         (WebKit::StorageManager::LocalStorageNamespace::storageManager const):
1428         (WebKit::StorageManager::TransientLocalStorageNamespace::create):
1429         (WebKit::StorageManager::TransientLocalStorageNamespace::~TransientLocalStorageNamespace):
1430         (WebKit::StorageManager::TransientLocalStorageNamespace::getOrCreateStorageArea):
1431         (WebKit::StorageManager::TransientLocalStorageNamespace::origins const):
1432         (WebKit::StorageManager::TransientLocalStorageNamespace::clearStorageAreasMatchingOrigin):
1433         (WebKit::StorageManager::TransientLocalStorageNamespace::clearAllStorageAreas):
1434         (WebKit::StorageManager::TransientLocalStorageNamespace::TransientLocalStorageNamespace):
1435         (WebKit::StorageManager::StorageArea::create):
1436         (WebKit::StorageManager::StorageArea::StorageArea):
1437         (WebKit::StorageManager::StorageArea::~StorageArea):
1438         (WebKit::StorageManager::StorageArea::addListener):
1439         (WebKit::StorageManager::StorageArea::removeListener):
1440         (WebKit::StorageManager::StorageArea::hasListener const):
1441         (WebKit::StorageManager::StorageArea::clone const):
1442         (WebKit::StorageManager::StorageArea::setItem):
1443         (WebKit::StorageManager::StorageArea::removeItem):
1444         (WebKit::StorageManager::StorageArea::clear):
1445         (WebKit::StorageManager::StorageArea::items const):
1446         (WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded const):
1447         (WebKit::StorageManager::StorageArea::dispatchEvents const):
1448         (WebKit::StorageManager::LocalStorageNamespace::create):
1449         (WebKit::StorageManager::LocalStorageNamespace::LocalStorageNamespace):
1450         (WebKit::StorageManager::LocalStorageNamespace::~LocalStorageNamespace):
1451         (WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea):
1452         (WebKit::StorageManager::LocalStorageNamespace::didDestroyStorageArea):
1453         (WebKit::StorageManager::LocalStorageNamespace::clearStorageAreasMatchingOrigin):
1454         (WebKit::StorageManager::LocalStorageNamespace::clearAllStorageAreas):
1455         (WebKit::StorageManager::SessionStorageNamespace::isEmpty const):
1456         (WebKit::StorageManager::SessionStorageNamespace::allowedConnections const):
1457         (WebKit::StorageManager::SessionStorageNamespace::origins const):
1458         (WebKit::StorageManager::SessionStorageNamespace::clearStorageAreasMatchingOrigin):
1459         (WebKit::StorageManager::SessionStorageNamespace::clearAllStorageAreas):
1460         (WebKit::StorageManager::SessionStorageNamespace::create):
1461         (WebKit::StorageManager::SessionStorageNamespace::SessionStorageNamespace):
1462         (WebKit::StorageManager::SessionStorageNamespace::~SessionStorageNamespace):
1463         (WebKit::StorageManager::SessionStorageNamespace::addAllowedConnection):
1464         (WebKit::StorageManager::SessionStorageNamespace::removeAllowedConnection):
1465         (WebKit::StorageManager::SessionStorageNamespace::getOrCreateStorageArea):
1466         (WebKit::StorageManager::SessionStorageNamespace::cloneTo):
1467         (WebKit::StorageManager::create):
1468         (WebKit::StorageManager::StorageManager):
1469         (WebKit::StorageManager::~StorageManager):
1470         (WebKit::StorageManager::createSessionStorageNamespace):
1471         (WebKit::StorageManager::destroySessionStorageNamespace):
1472         (WebKit::StorageManager::addAllowedSessionStorageNamespaceConnection):
1473         (WebKit::StorageManager::removeAllowedSessionStorageNamespaceConnection):
1474         (WebKit::StorageManager::cloneSessionStorageNamespace):
1475         (WebKit::StorageManager::processWillOpenConnection):
1476         (WebKit::StorageManager::processDidCloseConnection):
1477         (WebKit::StorageManager::getSessionStorageOrigins):
1478         (WebKit::StorageManager::deleteSessionStorageOrigins):
1479         (WebKit::StorageManager::deleteSessionStorageEntriesForOrigins):
1480         (WebKit::StorageManager::getLocalStorageOrigins):
1481         (WebKit::StorageManager::getLocalStorageOriginDetails):
1482         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
1483         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
1484         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
1485         (WebKit::StorageManager::createLocalStorageMap):
1486         (WebKit::StorageManager::createTransientLocalStorageMap):
1487         (WebKit::StorageManager::createSessionStorageMap):
1488         (WebKit::StorageManager::destroyStorageMap):
1489         (WebKit::StorageManager::getValues):
1490         (WebKit::StorageManager::setItem):
1491         (WebKit::StorageManager::removeItem):
1492         (WebKit::StorageManager::clear):
1493         (WebKit::StorageManager::applicationWillTerminate):
1494         (WebKit::StorageManager::findStorageArea const):
1495         (WebKit::StorageManager::getOrCreateLocalStorageNamespace):
1496         (WebKit::StorageManager::getOrCreateTransientLocalStorageNamespace):
1497         * NetworkProcess/WebStorage/StorageManager.h: Renamed from Source/WebKit/UIProcess/WebStorage/StorageManager.h.
1498         * NetworkProcess/WebStorage/StorageManager.messages.in: Renamed from Source/WebKit/UIProcess/WebStorage/StorageManager.messages.in.
1499         * NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm: Copied from Source/WebKit/UIProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm.
1500         (WebKit::LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup const):
1501         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1502         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1503         * NetworkProcess/curl/NetworkSessionCurl.cpp:
1504         (WebKit::NetworkSessionCurl::NetworkSessionCurl):
1505         * NetworkProcess/soup/NetworkSessionSoup.cpp:
1506         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
1507         * PlatformMac.cmake:
1508         * PlatformWin.cmake:
1509         * Shared/WebPageCreationParameters.cpp:
1510         (WebKit::WebPageCreationParameters::encode const):
1511         (WebKit::WebPageCreationParameters::decode):
1512         * Shared/WebPageCreationParameters.h:
1513         * Shared/WebsiteData/WebsiteData.cpp:
1514         (WebKit::WebsiteData::ownerProcess):
1515         * Sources.txt:
1516         * SourcesCocoa.txt:
1517         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
1518         (WKKeyValueStorageManagerGetKeyValueStorageOrigins):
1519         (WKKeyValueStorageManagerGetStorageDetailsByOrigin):
1520         (WKKeyValueStorageManagerDeleteEntriesForOrigin):
1521         (WKKeyValueStorageManagerDeleteAllEntries):
1522         * UIProcess/Network/NetworkProcessProxy.cpp:
1523         (WebKit::NetworkProcessProxy::hasLocalStorage):
1524         (WebKit::NetworkProcessProxy::getLocalStorageDetails):
1525         * UIProcess/Network/NetworkProcessProxy.h:
1526         * UIProcess/WebPageProxy.cpp:
1527         (WebKit::WebPageProxy::createNewPage):
1528         * UIProcess/WebProcessPool.cpp:
1529         (WebKit::WebProcessPool::ensureNetworkProcess):
1530         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1531         (WebKit::WebsiteDataStore::parameters):
1532         (WebKit::WebsiteDataStore::platformInitialize):
1533         (WebKit::WebsiteDataStore::platformDestroy):
1534         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1535         (WebKit::WebsiteDataStore::WebsiteDataStore):
1536         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
1537         (WebKit::WebsiteDataStore::fetchDataAndApply):
1538         (WebKit::WebsiteDataStore::removeData):
1539         (WebKit::WebsiteDataStore::hasLocalStorageForTesting const):
1540         (WebKit::WebsiteDataStore::parameters):
1541         (WebKit::WebsiteDataStore::getLocalStorageDetails):
1542         (WebKit::m_client): Deleted.
1543         (WebKit::WebsiteDataStore::cloneSessionData): Deleted.
1544         (WebKit::WebsiteDataStore::webPageWasAdded): Deleted.
1545         (WebKit::WebsiteDataStore::webPageWasInvalidated): Deleted.
1546         (WebKit::WebsiteDataStore::webProcessWillOpenConnection): Deleted.
1547         (WebKit::WebsiteDataStore::webPageWillOpenConnection): Deleted.
1548         (WebKit::WebsiteDataStore::webPageDidCloseConnection): Deleted.
1549         (WebKit::WebsiteDataStore::webProcessDidCloseConnection): Deleted.
1550         * UIProcess/WebsiteData/WebsiteDataStore.h:
1551         (WebKit::WebsiteDataStore::resolvedLocalStorageDirectory const):
1552         (WebKit::WebsiteDataStore::storageManager): Deleted.
1553         * WebKit.xcodeproj/project.pbxproj:
1554         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1555         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
1556         * WebProcess/Network/NetworkProcessConnection.cpp:
1557         (WebKit::NetworkProcessConnection::didReceiveMessage):
1558         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1559         (WebKit::WebChromeClient::createWindow):
1560         * WebProcess/WebPage/WebPage.cpp:
1561         (WebKit::WebPage::close):
1562         * WebProcess/WebProcess.cpp:
1563         (WebKit::WebProcess::createWebPage):
1564         (WebKit::WebProcess::removeWebPage):
1565         (WebKit::WebProcess::ensureNetworkProcessConnection):
1566         (WebKit::WebProcess::networkProcessConnectionClosed):
1567         (WebKit::WebProcess::registerStorageAreaMap):
1568         (WebKit::WebProcess::unregisterStorageAreaMap):
1569         (WebKit::WebProcess::storageAreaMap const):
1570         (WebKit::WebProcess::enablePrivateBrowsingForTesting):
1571         * WebProcess/WebProcess.h:
1572         * WebProcess/WebStorage/StorageAreaMap.cpp:
1573         (WebKit::StorageAreaMap::StorageAreaMap):
1574         (WebKit::StorageAreaMap::~StorageAreaMap):
1575         (WebKit::StorageAreaMap::setItem):
1576         (WebKit::StorageAreaMap::removeItem):
1577         (WebKit::StorageAreaMap::clear):
1578         (WebKit::StorageAreaMap::loadValuesIfNeeded):
1579         (WebKit::StorageAreaMap::connect):
1580         (WebKit::StorageAreaMap::disconnect):
1581         * WebProcess/WebStorage/StorageAreaMap.h:
1582         (WebKit::StorageAreaMap::identifier const):
1583
1584 2019-05-20  Ross Kirsling  <ross.kirsling@sony.com>
1585
1586         [WinCairo] Implement Remote Web Inspector Client.
1587         https://bugs.webkit.org/show_bug.cgi?id=197434
1588
1589         Reviewed by Don Olmstead.
1590
1591         * PlatformWin.cmake:
1592         * UIProcess/RemoteWebInspectorProxy.cpp:
1593         * UIProcess/RemoteWebInspectorProxy.h:
1594         * UIProcess/socket/RemoteInspectorClient.cpp: Added.
1595         * UIProcess/socket/RemoteInspectorClient.h: Added.
1596         * UIProcess/socket/RemoteInspectorProtocolHandler.cpp: Added.
1597         * UIProcess/socket/RemoteInspectorProtocolHandler.h: Added.
1598         * UIProcess/win/RemoteWebInspectorProxyWin.cpp: Added.
1599         * UIProcess/win/WebView.cpp:
1600         (WebKit::WebView::WebView):
1601
1602 2019-05-20  Per Arne Vollan  <pvollan@apple.com>
1603
1604         [macOS] STP can't launch any WebContent processes
1605         https://bugs.webkit.org/show_bug.cgi?id=198045
1606         <rdar://problem/50931110>
1607
1608         Reviewed by Brent Fulgham.
1609
1610         This is caused by a syscall sandbox violation.
1611
1612         * WebProcess/com.apple.WebProcess.sb.in:
1613
1614 2019-05-20  Zhifei Fang  <zhifei_fang@apple.com>
1615
1616         Allow WebContent mach-lookup AGXCompilerService
1617         https://bugs.webkit.org/show_bug.cgi?id=198031
1618         <rdar://problem/50552974>
1619
1620         Reviewed by Per Arne Vollan.
1621
1622         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1623
1624 2019-05-20  Sihui Liu  <sihui_liu@apple.com>
1625
1626         [ Mac WK2 iOS Sim] Layout Test http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html is a flaky failure
1627         https://bugs.webkit.org/show_bug.cgi?id=196307
1628         <rdar://problem/49345360>
1629
1630         Reviewed by Alex Christensen.
1631
1632         Delay dumping statistics if there is data being removed.
1633
1634         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
1635         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
1636         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
1637         (WebKit::ResourceLoadStatisticsStore::dataRecordsBeingRemoved const):
1638         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1639         (WebKit::WebResourceLoadStatisticsStore::dumpResourceLoadStatistics):
1640         (WebKit::WebResourceLoadStatisticsStore::tryDumpResourceLoadStatistics):
1641         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1642
1643 2019-05-20  Ludovico de Nittis  <ludovico.denittis@collabora.com>
1644
1645         [WPE][Qt] Use C++17 instead of C++14
1646         https://bugs.webkit.org/show_bug.cgi?id=197415
1647
1648         Reviewed by Philippe Normand.
1649
1650         There was a regression introduced with the commit https://bugs.webkit.org/show_bug.cgi?id=197131
1651         The WPE Qt port was not updated to C++17 and this leaded to a compilation error.
1652
1653         * PlatformWPE.cmake:
1654
1655 2019-05-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1656
1657         [GTK] Use a repeating timer to populate emoji chooser
1658         https://bugs.webkit.org/show_bug.cgi?id=197984
1659
1660         Reviewed by Michael Catanzaro.
1661
1662         It ensures the emoji chooser popover is shown as soon as it's requested.
1663
1664         * UIProcess/API/gtk/WebKitEmojiChooser.cpp:
1665         (webkitEmojiChooserSetupSectionBox):
1666         (webkitEmojiChooserSetupRecent):
1667         (webkitEmojiChooserSetupEmojiSections):
1668         (webkitEmojiChooserConstructed):
1669
1670 2019-05-19  Antoine Quint  <graouts@apple.com>
1671
1672         [Pointer Events] Listening to a "pointerover", "pointerenter", "pointerout" or "pointerleave" event alone does not fire the event on iOS
1673         https://bugs.webkit.org/show_bug.cgi?id=197882
1674         <rdar://problem/50769116>
1675
1676         Reviewed by Dean Jackson.
1677
1678         * UIProcess/WebPageProxy.cpp:
1679         (WebKit::WebPageProxy::updateTouchEventTracking):
1680
1681 2019-05-19  Alex Christensen  <achristensen@webkit.org>
1682
1683         Revert r240956
1684         https://bugs.webkit.org/show_bug.cgi?id=198007
1685         <rdar://problem/49808949>
1686
1687         Reviewed by Alexey Proskuryakov.
1688
1689         r240956 made SafariForWebKitDevelopment crash when using WebKit nightly builds.
1690         Since it's not needed and the binary reduction wasn't too big, just revert that revision.
1691
1692         * Shared/API/Cocoa/WKMain.h: Removed.
1693         * Shared/API/Cocoa/WKMain.mm: Removed.
1694         * Shared/EntryPointUtilities/Cocoa/AuxiliaryProcessMain.cpp: Removed.
1695         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
1696         (main):
1697         * SourcesCocoa.txt:
1698         * WebKit.xcodeproj/project.pbxproj:
1699
1700 2019-05-18  Jiewen Tan  <jiewen_tan@apple.com>
1701
1702         [WebAuthN] Allow authenticators that support both CTAP and U2F to try U2F if CTAP fails in authenticatorGetAssertion
1703         https://bugs.webkit.org/show_bug.cgi?id=197974
1704         <rdar://problem/50879746>
1705
1706         Reviewed by Brent Fulgham.
1707
1708         Authenticators that support both CTAP and U2F protocols can be used in a U2F enabled browser to create a credential in
1709         U2F format. When such authenticator is used to login in WebKit, it will be treated as a CTAP authenticator. Since the
1710         previous credential is in U2F format, the authenticator will not consider that as a valid credential when CTAP requests
1711         come along for that U2F credential. Therefore the previous created U2F credential will not be asked at all, and users
1712         will not be able to login. This situation is not well documented in the CTAP/WebAuthN spec yet.
1713
1714         To workaround the above issue, an authenticator that supports both protocols will be downgraded to a U2F authenticator
1715         to ask a potential U2F credential once a valid error is returned regarding to the first CTAP request.
1716
1717         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1718         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
1719         * UIProcess/WebAuthentication/Authenticator.h:
1720         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1721         (WebKit::AuthenticatorManager::downgrade):
1722         * UIProcess/WebAuthentication/AuthenticatorManager.h:
1723         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
1724         (WebKit::MockHidConnection::parseRequest):
1725         (WebKit::MockHidConnection::feedReports):
1726         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
1727         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp:
1728         (WebKit::CtapHidAuthenticator::makeCredential):
1729         (WebKit::CtapHidAuthenticator::getAssertion):
1730         (WebKit::CtapHidAuthenticator::continueGetAssertionAfterResponseReceived):
1731         (WebKit::CtapHidAuthenticator::tryDowngrade):
1732         (WebKit::CtapHidAuthenticator::continueGetAssertionAfterResponseReceived const): Deleted.
1733         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h:
1734
1735 2019-05-17  Don Olmstead  <don.olmstead@sony.com>
1736
1737         [CMake] Use builtin FindICU
1738         https://bugs.webkit.org/show_bug.cgi?id=197934
1739
1740         Reviewed by Michael Catanzaro.
1741
1742         Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.
1743
1744         * CMakeLists.txt:
1745
1746 2019-05-17  Alex Christensen  <achristensen@webkit.org>
1747
1748         Enable legacy EME for iOS WKWebView
1749         https://bugs.webkit.org/show_bug.cgi?id=197964
1750         <rdar://problem/50625666>
1751
1752         Reviewed by Wenson Hsieh.
1753
1754         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1755         (-[WKWebViewConfiguration init]):
1756
1757 2019-05-17  Antoine Quint  <graouts@apple.com>
1758
1759         Add a website policy to disable the legacy -webkit-overflow-scrolling:touch behavior
1760         https://bugs.webkit.org/show_bug.cgi?id=197943
1761         <rdar://problem/49078202>
1762
1763         Reviewed by Brent Fulgham.
1764
1765         * Shared/WebsiteLegacyOverflowScrollingTouchPolicy.h: Added.
1766         * Shared/WebsitePoliciesData.cpp:
1767         (WebKit::WebsitePoliciesData::encode const):
1768         (WebKit::WebsitePoliciesData::decode):
1769         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
1770         * Shared/WebsitePoliciesData.h:
1771         * UIProcess/API/APIWebsitePolicies.cpp:
1772         (API::WebsitePolicies::copy const):
1773         (API::WebsitePolicies::data):
1774         * UIProcess/API/APIWebsitePolicies.h:
1775         * WebKit.xcodeproj/project.pbxproj:
1776
1777 2019-05-17  Alex Christensen  <achristensen@webkit.org>
1778
1779         Add SPI to set a list of hosts to which to send custom header fields cross-origin
1780         https://bugs.webkit.org/show_bug.cgi?id=197397
1781
1782         Reviewed by Geoff Garen.
1783
1784         * Shared/API/APIObject.h:
1785         * Shared/Cocoa/APIObject.mm:
1786         (API::Object::newObject):
1787         * Shared/WebsitePoliciesData.cpp:
1788         (WebKit::WebsitePoliciesData::decode):
1789         * Shared/WebsitePoliciesData.h:
1790         * SourcesCocoa.txt:
1791         * UIProcess/API/APICustomHeaderFields.h: Added.
1792         * UIProcess/API/APIWebsitePolicies.cpp:
1793         (API::WebsitePolicies::WebsitePolicies):
1794         (API::WebsitePolicies::copy const):
1795         (API::WebsitePolicies::data):
1796         * UIProcess/API/APIWebsitePolicies.h:
1797         * UIProcess/API/C/WKWebsitePolicies.cpp:
1798         (WKWebsitePoliciesCopyCustomHeaderFields):
1799         (WKWebsitePoliciesSetCustomHeaderFields):
1800         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
1801         (-[WKWebpagePreferences _customHeaderFields]):
1802         (-[WKWebpagePreferences _setCustomHeaderFields:]):
1803         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
1804         * UIProcess/API/Cocoa/_WKCustomHeaderFields.h: Added.
1805         * UIProcess/API/Cocoa/_WKCustomHeaderFields.mm: Added.
1806         (-[_WKCustomHeaderFields init]):
1807         (-[_WKCustomHeaderFields dealloc]):
1808         (-[_WKCustomHeaderFields fields]):
1809         (-[_WKCustomHeaderFields setFields:]):
1810         (-[_WKCustomHeaderFields thirdPartyDomains]):
1811         (-[_WKCustomHeaderFields setThirdPartyDomains:]):
1812         (-[_WKCustomHeaderFields _apiObject]):
1813         * UIProcess/API/Cocoa/_WKCustomHeaderFieldsInternal.h: Added.
1814         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
1815         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
1816         (-[_WKWebsitePolicies customHeaderFields]): Deleted.
1817         (-[_WKWebsitePolicies setCustomHeaderFields:]): Deleted.
1818         * UIProcess/Cocoa/WebViewImpl.h:
1819         * UIProcess/Cocoa/WebViewImpl.mm:
1820         (WebKit::WebViewImpl::takeFocus):
1821         (WebKit::WebViewImpl::accessibilityAttributeValue):
1822         * WebKit.xcodeproj/project.pbxproj:
1823
1824 2019-05-17  Brady Eidson  <beidson@apple.com>
1825
1826         Avoid races in taking networking assertions for downloads by having both Networking and UIProcess do it.
1827         <rdar://problem/50564630> and https://bugs.webkit.org/show_bug.cgi?id=197995
1828
1829         Reviewed by Chris Dumez.
1830
1831         There's a fairly indeterminant time gap between when the UIProcess decides a load becomes a download
1832         and when the NetworkProcess Download object is created, and therefore the download assertion to be taken.
1833
1834         The time gap can be long enough for the Networking process to suspend before the download actually starts.
1835
1836         There's the reverse race when the UIProcess tells a download to stop, as well.
1837
1838         By having both the UIProcess and NetworkProcess take an assertion on behalf of the NetworkProcess we
1839         avoid the race.
1840
1841         * NetworkProcess/Downloads/DownloadMap.cpp:
1842         (WebKit::DownloadMap::add):
1843         (WebKit::DownloadMap::remove):
1844
1845         * NetworkProcess/NetworkResourceLoader.cpp:
1846         (WebKit::NetworkResourceLoader::convertToDownload):
1847
1848         * UIProcess/Downloads/DownloadProxyMap.cpp:
1849         (WebKit::DownloadProxyMap::createDownloadProxy):
1850         (WebKit::DownloadProxyMap::downloadFinished):
1851         (WebKit::DownloadProxyMap::invalidate):
1852         * UIProcess/Downloads/DownloadProxyMap.h:
1853
1854 2019-05-17  Keith Rollin  <krollin@apple.com>
1855
1856         Re-enable generate-xcfilelists
1857         https://bugs.webkit.org/show_bug.cgi?id=197933
1858         <rdar://problem/50831677>
1859
1860         Reviewed by Jonathan Bedard.
1861
1862         The following two tasks have been completed, and we can re-enable
1863         generate-xcfilelists:
1864
1865         Bug 197619 <rdar://problem/50507392> Temporarily disable generate-xcfilelists (197619)
1866         Bug 197622 <rdar://problem/50508222> Rewrite generate-xcfilelists in Python (197622)
1867
1868         * Scripts/check-xcfilelists.sh:
1869
1870 2019-05-17  Commit Queue  <commit-queue@webkit.org>
1871
1872         Unreviewed, rolling out r245401.
1873         https://bugs.webkit.org/show_bug.cgi?id=197990
1874
1875         Causing internal build failures (Requested by ShawnRoberts on
1876         #webkit).
1877
1878         Reverted changeset:
1879
1880         "Add SPI to set a list of hosts to which to send custom header
1881         fields cross-origin"
1882         https://bugs.webkit.org/show_bug.cgi?id=197397
1883         https://trac.webkit.org/changeset/245401
1884
1885 2019-05-17  Commit Queue  <commit-queue@webkit.org>
1886
1887         Unreviewed, rolling out r245418.
1888         https://bugs.webkit.org/show_bug.cgi?id=197989
1889
1890         New API test causing crashes on Mojave testers (Requested by
1891         ShawnRoberts on #webkit).
1892
1893         Reverted changeset:
1894
1895         "Add a unit test for client certificate authentication"
1896         https://bugs.webkit.org/show_bug.cgi?id=197800
1897         https://trac.webkit.org/changeset/245418
1898
1899 2019-05-17  Antti Koivisto  <antti@apple.com>
1900
1901         [iOS] Respect scrolling="no" on composited frames
1902         https://bugs.webkit.org/show_bug.cgi?id=197972
1903         <rdar://problem/50252398>
1904
1905         Reviewed by Simon Fraser.
1906
1907         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
1908         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1909         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
1910
1911         Disallow scrolling based on canHaveScrollbars, similar to main frame.
1912
1913         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers):
1914         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollView const):
1915
1916         Factor into a function.
1917
1918 2019-05-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1919
1920         Unreviewed. Fix variations shown in GTK emoji chooser after r245460.
1921
1922         We are tno showing the variations in the sub-popover because of a missing parameter in
1923         webkitEmojiChooserAddEmoji() call.
1924
1925         * UIProcess/API/gtk/WebKitEmojiChooser.cpp:
1926         (webkitEmojiChooserShowVariations): Pass prepend parameter to webkitEmojiChooserAddEmoji().
1927
1928 2019-05-16  Carlos Garcia Campos  <cgarcia@igalia.com>
1929
1930         [GTK] Need WebKitContextMenuItemType to open emoji picker
1931         https://bugs.webkit.org/show_bug.cgi?id=176760
1932
1933         Reviewed by Michael Catanzaro.
1934
1935         Add a default implementation to show the emoji chooser when requested by the application, either using the
1936         context menu or keyboard shortcuts. GtkEmojiChooser is private in GTK, so we include our own copy, adapted to
1937         the WebKit coding style. The emoji chooser is always shown by default when using GTK >= 3.24 for any editable
1938         content. I'm going to add public API in a follow up patch to be able to use your own chooser, or even prevent
1939         the default chooser from being shown, similar to what we do for other UI elements like file chooser, color
1940         chooser, print dialog, etc.
1941
1942         * Shared/API/glib/WebKitContextMenuActions.cpp:
1943         (webkitContextMenuActionGetActionTag): Handle insert emoji action.
1944         (webkitContextMenuActionGetForContextMenuItem): Ditto.
1945         (webkitContextMenuActionGetLabel): Ditto.
1946         * SourcesGTK.txt:
1947         * UIProcess/API/gtk/WebKitContextMenuActions.h:
1948         * UIProcess/API/gtk/WebKitEmojiChooser.cpp: Added.
1949         (webkitEmojiChooserAddEmoji):
1950         (webkitEmojiChooserAddRecentItem):
1951         (emojiActivated):
1952         (emojiDataHasVariations):
1953         (webkitEmojiChooserShowVariations):
1954         (emojiLongPressed):
1955         (emojiPressed):
1956         (emojiPopupMenu):
1957         (verticalAdjustmentChanged):
1958         (webkitEmojiChooserSetupSectionBox):
1959         (scrollToSection):
1960         (webkitEmojiChooserSetupSectionButton):
1961         (webkitEmojiChooserSetupRecent):
1962         (webkitEmojiChooserEnsureEmptyResult):
1963         (webkitEmojiChooserSearchChanged):
1964         (webkitEmojiChooserSetupFilters):
1965         (webkitEmojiChooserInitializeEmojiMaxWidth):
1966         (webkitEmojiChooserConstructed):
1967         (webkitEmojiChooserShow):
1968         (webkit_emoji_chooser_class_init):
1969         (webkitEmojiChooserNew):
1970         * UIProcess/API/gtk/WebKitEmojiChooser.h: Added.
1971         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1972         (_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate): Add a timer to release the emoji chooser if not used
1973         after 2 minutes.
1974         (_WebKitWebViewBasePrivate::releaseEmojiChooserTimerFired): Destroy the emoji chooser.
1975         (emojiChooserEmojiPicked): Complete the operation using the given emoji text.
1976         (emojiChooserClosed): Complete the operation if needed using an empty string.
1977         (webkitWebViewBaseShowEmojiChooser): Create the emoji chooser if needed and show it.
1978         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
1979         * UIProcess/WebPageProxy.h: Add showEmojiPicker().
1980         * UIProcess/WebPageProxy.messages.in: Add ShowEmojiPicker message.
1981         * UIProcess/gtk/KeyBindingTranslator.cpp:
1982         (WebKit::insertEmojiCallback): Add GtkInsertEmoji command.
1983         (WebKit::KeyBindingTranslator::KeyBindingTranslator): Connect to insert-emoji signal.
1984         * UIProcess/gtk/WebPageProxyGtk.cpp:
1985         (WebKit::WebPageProxy::showEmojiPicker): Call webkitWebViewBaseShowEmojiChooser().
1986         * WebProcess/WebCoreSupport/WebContextMenuClient.h: Override insertEmoji() for GTK port.
1987         * WebProcess/WebCoreSupport/WebEditorClient.h: Add insertEmoji() for GTK port.
1988         * WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp:
1989         (WebKit::WebContextMenuClient::insertEmoji): Call WebPage::showEmojiPicker().
1990         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
1991         (WebKit::WebEditorClient::handleGtkEditorCommand): Call WebPage::showEmojiPicker() if command is GtkInsertEmoji.
1992         (WebKit::WebEditorClient::executePendingEditorCommands): Handle Gtk specific commands.
1993         (WebKit::WebEditorClient::handleKeyboardEvent): Use a reference instead of a pointer for Frame.
1994         * WebProcess/WebPage/WebPage.h:
1995         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1996         (WebKit::WebPage::showEmojiPicker): Send ShowEmojiPicker message to the UI process.
1997
1998 2019-05-16  John Wilander  <wilander@apple.com>
1999
2000         Storage Access API: Call completion handlers in NetworkConnectionToWebProcess::hasStorageAccess() and NetworkConnectionToWebProcess::requestStorageAccess() when feature is off
2001         https://bugs.webkit.org/show_bug.cgi?id=197967
2002         <rdar://problem/50753129>
2003
2004         Reviewed by Brent Fulgham.
2005
2006         NetworkConnectionToWebProcess::hasStorageAccess() and NetworkConnectionToWebProcess::requestStorageAccess()
2007         should call their completion handlers when there is no Resource Load Statistics object, i.e. when Resource
2008         Load Statistics is off. This happens for ephemeral sessions which made code for federated login providers
2009         hang, waiting for the result to document.hasStorageAccess().
2010
2011         The existing layout test case was augmented to use an ephemeral session.
2012
2013         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2014         (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
2015         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
2016
2017 2019-05-16  Alex Christensen  <achristensen@webkit.org>
2018
2019         Add a unit test for client certificate authentication
2020         https://bugs.webkit.org/show_bug.cgi?id=197800
2021
2022         Reviewed by Youenn Fablet.
2023
2024         * Shared/cf/ArgumentCodersCF.cpp:
2025         Move SPI declarations to SecuritySPI.h.
2026
2027 2019-05-16  Alex Christensen  <achristensen@webkit.org>
2028
2029         Add SPI to set a list of hosts to which to send custom header fields cross-origin
2030         https://bugs.webkit.org/show_bug.cgi?id=197397
2031
2032         Reviewed by Geoff Garen.
2033
2034         * Shared/API/APIObject.h:
2035         * Shared/Cocoa/APIObject.mm:
2036         (API::Object::newObject):
2037         * Shared/WebsitePoliciesData.cpp:
2038         (WebKit::WebsitePoliciesData::decode):
2039         * Shared/WebsitePoliciesData.h:
2040         * SourcesCocoa.txt:
2041         * UIProcess/API/APICustomHeaderFields.h: Added.
2042         * UIProcess/API/APIWebsitePolicies.cpp:
2043         (API::WebsitePolicies::WebsitePolicies):
2044         (API::WebsitePolicies::copy const):
2045         (API::WebsitePolicies::data):
2046         * UIProcess/API/APIWebsitePolicies.h:
2047         * UIProcess/API/C/WKWebsitePolicies.cpp:
2048         (WKWebsitePoliciesCopyCustomHeaderFields):
2049         (WKWebsitePoliciesSetCustomHeaderFields):
2050         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
2051         (-[WKWebpagePreferences _customHeaderFields]):
2052         (-[WKWebpagePreferences _setCustomHeaderFields:]):
2053         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
2054         * UIProcess/API/Cocoa/_WKCustomHeaderFields.h: Added.
2055         * UIProcess/API/Cocoa/_WKCustomHeaderFields.mm: Added.
2056         (-[_WKCustomHeaderFields init]):
2057         (-[_WKCustomHeaderFields dealloc]):
2058         (-[_WKCustomHeaderFields fields]):
2059         (-[_WKCustomHeaderFields setFields:]):
2060         (-[_WKCustomHeaderFields thirdPartyDomains]):
2061         (-[_WKCustomHeaderFields setThirdPartyDomains:]):
2062         (-[_WKCustomHeaderFields _apiObject]):
2063         * UIProcess/API/Cocoa/_WKCustomHeaderFieldsInternal.h: Added.
2064         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2065         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2066         (-[_WKWebsitePolicies customHeaderFields]): Deleted.
2067         (-[_WKWebsitePolicies setCustomHeaderFields:]): Deleted.
2068         * UIProcess/Cocoa/WebViewImpl.h:
2069         * UIProcess/Cocoa/WebViewImpl.mm:
2070         (WebKit::WebViewImpl::takeFocus):
2071         (WebKit::WebViewImpl::accessibilityAttributeValue):
2072         * WebKit.xcodeproj/project.pbxproj:
2073
2074 2019-05-16  Ryan Walklin  <ryan@testtoast.com>
2075
2076         [WPE] Rendering on a HiDPI display looks scaled up instead of rendered at 2x
2077         https://bugs.webkit.org/show_bug.cgi?id=185764
2078
2079         Reviewed by Carlos Garcia Campos.
2080
2081         Add a function to the wpe_view_backend_client struct which accepts a device scale factor
2082         configured through wpe_view_backend_dispatch_set_device_scale_factor() and calls
2083         setIntrinsicDeviceScaleFactor for the the current View.Page object. The
2084         function definition has been added in libwpe 1.3.
2085
2086         * UIProcess/API/wpe/WPEView.cpp:
2087         (WKWPE::m_backend): Add set_device_scale_factor implementation declared by libwpe.
2088
2089 2019-05-15  Devin Rousso  <drousso@apple.com>
2090
2091         Web Inspector: user gesture toggle should also force user interaction flag
2092         https://bugs.webkit.org/show_bug.cgi?id=197269
2093
2094         Reviewed by Joseph Pecoraro.
2095
2096         * WebProcess/WebCoreSupport/WebChromeClient.h:
2097         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2098         (WebKit::WebChromeClient::userIsInteracting const): Added.
2099         (WebKit::WebChromeClient::setUserIsInteracting): Added.
2100
2101         * WebProcess/WebPage/WebPage.h:
2102         (WebKit::WebPage::userIsInteracting const): Added.
2103         (WebKit::WebPage::setUserIsInteracting): Added.
2104
2105 2019-05-15  Brent Fulgham  <bfulgham@apple.com>
2106
2107         Revise sandbox to allow IOKit properties needed by Metal and LaunchServices
2108         https://bugs.webkit.org/show_bug.cgi?id=197924
2109         <rdar://problem/50823976>
2110
2111         Reviewed by Per Arne Vollan.
2112
2113         Update sandbox to allow access to some IOKit properties to avoid sandbox violations that could
2114         lower performance or increase launch times:
2115
2116         * WebProcess/com.apple.WebProcess.sb.in:
2117
2118 2019-05-15  Chris Dumez  <cdumez@apple.com>
2119
2120         Unreviewed, fix assertion introduced in r245339.
2121
2122         * UIProcess/WebProcessCache.cpp:
2123         (WebKit::WebProcessCache::CachedProcess::CachedProcess):
2124
2125 2019-05-15  Sihui Liu  <sihui_liu@apple.com>
2126
2127         Add assertions to help diagnose crash at WebProcessProxy::processPool()
2128         https://bugs.webkit.org/show_bug.cgi?id=197856
2129         <rdar://problem/49341366>
2130
2131         Reviewed by Chris Dumez.
2132
2133         * UIProcess/WebProcessCache.cpp:
2134         (WebKit::WebProcessCache::CachedProcess::CachedProcess):
2135         * UIProcess/WebProcessLifetimeObserver.cpp:
2136         (WebKit::WebProcessLifetimeObserver::addWebPage):
2137         (WebKit::WebProcessLifetimeObserver::removeWebPage):
2138         * UIProcess/WebProcessLifetimeObserver.h:
2139         (WebKit::WebProcessLifetimeObserver::hasProcess const):
2140
2141 2019-05-15  Wenson Hsieh  <wenson_hsieh@apple.com>
2142
2143         inputmode="numeric" should show a number pad with digits 0-9, instead of the numeric keyplane
2144         https://bugs.webkit.org/show_bug.cgi?id=197916
2145         <rdar://problem/50815427>
2146
2147         Reviewed by Timothy Hatcher.
2148
2149         Use UIKeyboardTypeNumberPad instead of UIKeyboardTypeNumbersAndPunctuation when presenting a keyboard for a
2150         field with inputmode="numeric". While the WhatWG specification merely requires the UA to display a keyboard
2151         "capable of numeric input", it suggests that the keyboard should be "useful for PIN entry", which loosely
2152         implies a number pad.
2153
2154         This is also generally in line with feedback from web developers.
2155
2156         * UIProcess/ios/WKContentViewInteraction.mm:
2157         (-[WKContentView textInputTraits]):
2158
2159 2019-05-15  Don Olmstead  <don.olmstead@sony.com>
2160
2161         Add USE(LIBWPE) for AcceleratedSurface
2162         https://bugs.webkit.org/show_bug.cgi?id=197918
2163
2164         Reviewed by Michael Catanzaro.
2165
2166         Renamed AcceleratedSurfaceWPE to AcceleratedSurfaceLibWPE since it just uses the
2167         libwpe APIs.
2168
2169         * PlatformWPE.cmake:
2170         * SourcesWPE.txt:
2171         * WebProcess/WebPage/AcceleratedSurface.cpp:
2172         (WebKit::AcceleratedSurface::create):
2173         * WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp: Renamed from Source/WebKit/WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp.
2174         (WebKit::AcceleratedSurfaceLibWPE::create):
2175         (WebKit::AcceleratedSurfaceLibWPE::AcceleratedSurfaceLibWPE):
2176         (WebKit::AcceleratedSurfaceLibWPE::~AcceleratedSurfaceLibWPE):
2177         (WebKit::AcceleratedSurfaceLibWPE::initialize):
2178         (WebKit::AcceleratedSurfaceLibWPE::finalize):
2179         (WebKit::AcceleratedSurfaceLibWPE::window const):
2180         (WebKit::AcceleratedSurfaceLibWPE::surfaceID const):
2181         (WebKit::AcceleratedSurfaceLibWPE::clientResize):
2182         (WebKit::AcceleratedSurfaceLibWPE::willRenderFrame):
2183         (WebKit::AcceleratedSurfaceLibWPE::didRenderFrame):
2184         * WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.h: Renamed from Source/WebKit/WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.h.
2185
2186 2019-05-15  Youenn Fablet  <youenn@apple.com>
2187
2188         getUserMedia sandbox extensions should not be revoked when a getUserMedia allowed request is being processed
2189         https://bugs.webkit.org/show_bug.cgi?id=197851
2190
2191         Reviewed by Alex Christensen.
2192
2193         Before the patch, stopping capture in a document and quickly triggering a new capture
2194         might fail as the UIProcess would grant access and revoke sandbox access based on the fact
2195         the page is no longer capturing.
2196         To fix that issue, keep a state in the UIProcess to not revoke sandbox extensions in case of
2197         capture being started.
2198         Add an IPC message back to tell UIProcess when an allowed capture is finished.
2199         Just after doing that, make sure the document is updating the media state to UIProcess, which will trigger proper sandbox extension handling.
2200
2201         This should also trigger the case of an allowed getUserMedia call that fails to start for some reason.
2202         In that case, the patch will automatically trigger a document media state refresh which will trigger a sandbox revokation.
2203
2204         Covered by added test that exercise a newly added debug assertion.
2205         This assertion ensures that we revoke extensions while a document is not capturing.
2206
2207         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2208         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
2209         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess):
2210         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
2211         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2212         * UIProcess/UserMediaProcessManager.cpp:
2213         (WebKit::UserMediaProcessManager::willCreateMediaStream):
2214         (WebKit::UserMediaProcessManager::revokeSandboxExtensionsIfNeeded):
2215         * UIProcess/UserMediaProcessManager.h:
2216         * UIProcess/WebPageProxy.h:
2217         (WebKit::WebPageProxy::isCapturingAudio const):
2218         (WebKit::WebPageProxy::isCapturingVideo const):
2219         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2220         (WebKit::UserMediaPermissionRequestManager::userMediaAccessWasGranted):
2221         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
2222         * WebProcess/WebPage/WebPage.cpp:
2223         (WebKit::WebPage::userMediaAccessWasGranted):
2224         * WebProcess/WebPage/WebPage.h:
2225         * WebProcess/WebPage/WebPage.messages.in:
2226         * WebProcess/WebProcess.cpp:
2227         (WebKit::checkDocumentsCaptureStateConsistency):
2228         (WebKit::WebProcess::revokeUserMediaDeviceSandboxExtensions):
2229
2230 2019-05-15  Chris Dumez  <cdumez@apple.com>
2231
2232         [WK2][iOS] UIProcess may get killed because it is taking too long to release its background task after expiration
2233         https://bugs.webkit.org/show_bug.cgi?id=197893
2234         <rdar://problem/50234105>
2235
2236         Reviewed by Alex Christensen.
2237
2238         The UIProcess may get killed because it is taking too long to release its background task after its expiration handler
2239         was called. The reason is that the background task's expiration handler was sequentially sending a ProcessWillSuspendImminently
2240         synchronous IPC to each of its child processes and only then ends the background task. By the time we receive the response from
2241         all child processes, it may be too late and we get killed.
2242
2243         To address the issue, we now:
2244         1. Send the ProcessWillSuspendImminently asynchronously so that all processes can do their processing in parallel
2245         2. After 2 seconds, the UIProcess releases the background task (We get killed after ~5 seconds)
2246
2247         Also, to make sure that the UIProcess supends promptly, we now make sure we never start a new background task *after*
2248         the app has been backgrounded. The intention of our background task is too finish critical work (like releasing locked
2249         files) after the app gets backgrounded, not to start new work and delay process suspension.
2250
2251         * NetworkProcess/NetworkProcess.cpp:
2252         (WebKit::NetworkProcess::processWillSuspendImminently):
2253         * NetworkProcess/NetworkProcess.h:
2254         * NetworkProcess/NetworkProcess.messages.in:
2255         * UIProcess/Network/NetworkProcessProxy.cpp:
2256         (WebKit::NetworkProcessProxy::sendProcessWillSuspendImminently):
2257         * UIProcess/WebProcessProxy.cpp:
2258         (WebKit::WebProcessProxy::sendProcessWillSuspendImminently):
2259         * UIProcess/ios/ProcessAssertionIOS.mm:
2260         (-[WKProcessAssertionBackgroundTaskManager init]):
2261         (-[WKProcessAssertionBackgroundTaskManager _scheduleReleaseTask]):
2262         (-[WKProcessAssertionBackgroundTaskManager _cancelPendingReleaseTask]):
2263         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
2264         * WebProcess/WebProcess.cpp:
2265         (WebKit::WebProcess::didReceiveSyncMessage):
2266         (WebKit::WebProcess::processWillSuspendImminently):
2267         * WebProcess/WebProcess.h:
2268         * WebProcess/WebProcess.messages.in:
2269
2270 2019-05-15  Jiewen Tan  <jiewen_tan@apple.com>
2271
2272         [WebAuthN] Make WebAuthN default on
2273         https://bugs.webkit.org/show_bug.cgi?id=197805
2274         <rdar://problem/50683699>
2275
2276         Reviewed by Darin Adler.
2277
2278         * Shared/WebPreferences.yaml:
2279
2280 2019-05-15  Youenn Fablet  <youenn@apple.com>
2281
2282         Reuse existing WebPageProxy quota handler for NetworkProcessProxy quota requests
2283         https://bugs.webkit.org/show_bug.cgi?id=197463
2284         <rdar://problem/47403621>
2285
2286         Reviewed by Alex Christensen.
2287
2288         Add a getter to know whether websitedatastore client implements the quota delegate.
2289         If not, find the most visible page that is the same origin as the quota request
2290         and reuse the existing exceededDatabasQuota delegate.
2291         This approach allows to call the delegate even if the quota request comes from a service worker.
2292         If no such page is found, the quota will not be increased.
2293
2294         Refactoring to make sure we are calling the delegate once a previous call to that delegate is completed.
2295         Covered by API test.
2296
2297         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2298         * UIProcess/Network/NetworkProcessProxy.cpp:
2299         (WebKit::NetworkProcessProxy::requestStorageSpace):
2300         * UIProcess/WebPageProxy.cpp:
2301         (WebKit::StorageRequests::add):
2302         (WebKit::StorageRequests::processNext):
2303         (WebKit::StorageRequests::areBeingProcessed const):
2304         (WebKit::StorageRequests::setAreBeingProcessed):
2305         (WebKit::StorageRequests::StorageRequests):
2306         (WebKit::StorageRequests::~StorageRequests):
2307         (WebKit::StorageRequests::singleton):
2308         (WebKit::WebPageProxy::forMostVisibleWebPageIfAny):
2309         (WebKit::WebPageProxy::didChangeMainDocument):
2310         (WebKit::WebPageProxy::exceededDatabaseQuota):
2311         (WebKit::WebPageProxy::requestStorageSpace):
2312         (WebKit::WebPageProxy::makeStorageSpaceRequest):
2313         * UIProcess/WebPageProxy.h:
2314         * UIProcess/WebProcessProxy.cpp:
2315         (WebKit::WebProcessProxy::forWebPages):
2316         * UIProcess/WebProcessProxy.h:
2317         * UIProcess/WebsiteData/WebsiteDataStoreClient.h:
2318         (WebKit::WebsiteDataStoreClient::implementsRequestStorageSpaceHandler const):
2319
2320 2019-05-15  Youenn Fablet  <youenn@apple.com>
2321
2322         Constant crashes under WebPage::isThrottleable() after r245299
2323         https://bugs.webkit.org/show_bug.cgi?id=197902
2324         <rdar://problem/50793796>
2325
2326         Reviewed by Alex Christensen.
2327
2328         Update throttle state after a run loop iteration when page state changes to make sure the pageMap does not have null pages.
2329         Add appNapEnabled preference that is used by added API test.
2330
2331         * WebProcess/WebPage/WebPage.cpp:
2332         (WebKit::WebPage::updateThrottleState):
2333         * UIProcess/API/Cocoa/WKPreferences.mm:
2334         (-[WKPreferences _setAppNapEnabled:]):
2335         (-[WKPreferences _appNapEnabled]):
2336         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2337
2338 2019-05-15  Alex Christensen  <achristensen@webkit.org>
2339
2340         Allow NSFileCoordinator to be called from WebContent process
2341         https://bugs.webkit.org/show_bug.cgi?id=197895
2342         <rdar://problem/50107679>
2343
2344         Reviewed by Brent Fulgham.
2345
2346         * WebProcess/com.apple.WebProcess.sb.in:
2347         Expand sandbox to allow use of com.apple.FileCoordination mach service like we do on iOS.
2348
2349 2019-05-15  Devin Rousso  <drousso@apple.com>
2350
2351         Web Automation: elements larger than the viewport have incorrect in-view center point
2352         https://bugs.webkit.org/show_bug.cgi?id=195696
2353         <rdar://problem/48737122>
2354
2355         Reviewed by Simon Fraser.
2356
2357         Original patch by Brian Burg <bburg@apple.com>.
2358
2359         This seems to be an omission in the specification. While it does mention that the in-view
2360         center point (IVCP) must be within the viewport, the algorithm never intersects the element
2361         bounding box with the viewport rect.
2362
2363         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2364         (WebKit::WebAutomationSessionProxy::computeElementLayout):
2365         This code is incorrect. For `CoordinateSystem::LayoutViewport`, coordinates should be in
2366         root view coordinates so that it can be later converted to screen and synthesized as a HID
2367         event in screen coordinates. Intersect the element rect and the viewport rect before finding
2368         the center point of the part of the element that's visible in the viewport.
2369
2370         (WebKit::convertRectFromFrameClientToRootView): Added.
2371         (WebKit::convertPointFromFrameClientToRootView): Added.
2372         Added helpers to properly account for scroll contents position on iOS.
2373
2374         * UIProcess/Automation/WebAutomationSession.cpp:
2375         (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
2376         Now that we determine whether the element is inside the viewport much earlier, if the
2377         element has no `inViewCenterPoint`, we can return a `TargetOutOfBounds` instead of a more
2378         "generic" `ElementNotInteractable`.
2379
2380         (WebKit::WebAutomationSession::simulateMouseInteraction):
2381         Rename `locationInView` -> `locationInViewport`.
2382
2383         (WebKit::WebAutomationSession::simulateTouchInteraction):
2384         This code is incorrect. The `unobscuredContentRect` is in screen coordinates, but
2385         we are trying to see if (x, y) is outside the size of the viewport assumed to be at (0, 0).
2386         Grab the visual viewport rect and see if the location exceeds the viewport size.
2387
2388         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
2389         (WebKit::operator<<):
2390         Add logging helper for `TouchInteraction` enum.
2391
2392         (WebKit::WebAutomationSession::platformSimulateTouchInteraction):
2393         Move local variable.
2394
2395         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
2396         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
2397         Fix a typo in logging.
2398
2399         * UIProcess/Automation/Automation.json:
2400         Simplify enum name.
2401
2402         * Platform/Logging.h:
2403         Add logging channel to dump fully resolved interaction details.
2404
2405 2019-05-14  Ross Kirsling  <ross.kirsling@sony.com>
2406
2407         Unreviewed restoration of non-unified build.
2408
2409         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2410         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2411         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
2412         * UIProcess/WebProcessProxy.cpp:
2413
2414 2019-05-14  Youenn Fablet  <youenn@apple.com>
2415
2416         A service worker process should app nap when all its clients app nap
2417         https://bugs.webkit.org/show_bug.cgi?id=185626
2418         <rdar://problem/46785908>
2419
2420         Reviewed by Alex Christensen.
2421
2422         Compute whether a given web process can be throttled on every page throttling change.
2423         Send that information to network process which stores that information in WebSWServerConnection.
2424         Every WebSWServerToContextConnection throttle state is then computed based on all WebSWServerConnection
2425         that have a client that matches the registrable domain of the context connection.
2426
2427         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
2428         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
2429         (WebKit::WebSWServerConnection::unregisterServiceWorkerClient):
2430         (WebKit::WebSWServerConnection::hasMatchingClient const):
2431         (WebKit::WebSWServerConnection::computeThrottleState const):
2432         (WebKit::WebSWServerConnection::setThrottleState):
2433         (WebKit::WebSWServerConnection::updateThrottleState):
2434         (WebKit::WebSWServerConnection::serverToContextConnectionCreated):
2435         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
2436         (WebKit::WebSWServerConnection::isThrottleable const):
2437         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
2438         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2439         (WebKit::WebSWServerToContextConnection::setThrottleState):
2440         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
2441         (WebKit::WebSWServerToContextConnection::isThrottleable const):
2442         * UIProcess/ServiceWorkerProcessProxy.cpp:
2443         * UIProcess/ServiceWorkerProcessProxy.h:
2444         * WebProcess/Storage/WebSWClientConnection.cpp:
2445         (WebKit::WebSWClientConnection::WebSWClientConnection):
2446         (WebKit::WebSWClientConnection::updateThrottleState):
2447         * WebProcess/Storage/WebSWClientConnection.h:
2448         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2449         (WebKit::WebSWContextManagerConnection::setThrottleState):
2450         (WebKit::WebSWContextManagerConnection::isThrottleable const):
2451         * WebProcess/Storage/WebSWContextManagerConnection.h:
2452         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2453         * WebProcess/WebPage/WebPage.cpp:
2454         (WebKit::WebPage::updateUserActivity):
2455         (WebKit::WebPage::isThrottleable const):
2456         * WebProcess/WebPage/WebPage.h:
2457         * WebProcess/WebProcess.cpp:
2458         (WebKit::WebProcess::arePagesThrottleable const):
2459         * WebProcess/WebProcess.h:
2460
2461 2019-05-14  Chris Dumez  <cdumez@apple.com>
2462
2463         Crash under WebKit::WebProcessProxy::didBecomeUnresponsive()
2464         https://bugs.webkit.org/show_bug.cgi?id=197883
2465         <rdar://problem/50665984>
2466
2467         Reviewed by Alex Christensen.
2468
2469         Protect |this| in didBecomeUnresponsive() and didExceedCPULimit() since we call client
2470         delegates and those may cause |this| to get destroyed.
2471
2472         * UIProcess/WebProcessProxy.cpp:
2473         (WebKit::WebProcessProxy::didBecomeUnresponsive):
2474         (WebKit::WebProcessProxy::didExceedCPULimit):
2475
2476 2019-05-14  Chris Dumez  <cdumez@apple.com>
2477
2478         The network process tries to take a process assertion when NetworkProcess::processWillSuspendImminently() is called
2479         https://bugs.webkit.org/show_bug.cgi?id=197888
2480
2481         Reviewed by Geoffrey Garen.
2482
2483         When actualPrepareToSuspend() in the Network process is called set the 'IsSuspended' flag on the SQLite database tracker and unset
2484         the flag when the process resume. This is consistent with what we already do in the WebProcess and makes sure that
2485         the network process does not try and take on a new assertion due to locked files when getting notified it is about to get
2486         suspended.
2487
2488         * NetworkProcess/NetworkProcess.cpp:
2489         (WebKit::NetworkProcess::actualPrepareToSuspend):
2490         (WebKit::NetworkProcess::processWillSuspendImminently):
2491         (WebKit::NetworkProcess::resume):
2492
2493 2019-05-14  Chris Dumez  <cdumez@apple.com>
2494
2495         Update TBA macros for API / SPI that has already shipped
2496         https://bugs.webkit.org/show_bug.cgi?id=197841
2497         <rdar://problem/50698499>
2498
2499         Reviewed by Geoffrey Garen.
2500
2501         * Configurations/WebKit.xcconfig:
2502         Disable header postprocessing when building for macOS Mojave
2503
2504         * Shared/API/Cocoa/_WKRenderingProgressEvents.h:
2505         * UIProcess/API/C/WKPage.h:
2506         * UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h:
2507         * UIProcess/API/Cocoa/WKBrowsingContextController.h:
2508         * UIProcess/API/Cocoa/WKBrowsingContextGroup.h:
2509         * UIProcess/API/Cocoa/WKBrowsingContextHistoryDelegate.h:
2510         * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegate.h:
2511         * UIProcess/API/Cocoa/WKBrowsingContextPolicyDelegate.h:
2512         * UIProcess/API/Cocoa/WKConnection.h:
2513         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
2514         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2515         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2516         * UIProcess/API/Cocoa/WKProcessGroup.h:
2517         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2518         * UIProcess/API/Cocoa/WKTypeRefWrapper.h:
2519         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2520         * UIProcess/API/Cocoa/WKView.h:
2521         (WK_CLASS_DEPRECATED_WITH_REPLACEMENT):
2522         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2523         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2524         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2525         * UIProcess/API/Cocoa/_WKAttachment.h:
2526         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h:
2527         * UIProcess/API/Cocoa/_WKDownload.h:
2528         * UIProcess/API/Cocoa/_WKFormInputSession.h:
2529         * UIProcess/API/Cocoa/_WKInspector.h:
2530         * UIProcess/API/Cocoa/_WKInternalDebugFeature.h:
2531         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2532         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2533         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2534         * WebProcess/API/Cocoa/WKWebProcess.h:
2535         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
2536         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
2537
2538 2019-05-14  Commit Queue  <commit-queue@webkit.org>
2539
2540         Unreviewed, rolling out r245281.
2541         https://bugs.webkit.org/show_bug.cgi?id=197887
2542
2543         Broke API Test TestWebKitAPI.Challenge.ClientCertificate
2544         (Requested by aakashjain on #webkit).
2545
2546         Reverted changeset:
2547
2548         "Add a unit test for client certificate authentication"
2549         https://bugs.webkit.org/show_bug.cgi?id=197800
2550         https://trac.webkit.org/changeset/245281
2551
2552 2019-05-14  Daniel Bates  <dabates@apple.com>
2553
2554         [iOS] Cannot scroll to beginning of document after scrolling to end of document and vice versa via key commands
2555         https://bugs.webkit.org/show_bug.cgi?id=197848
2556         <rdar://problem/49523065>
2557
2558         Reviewed by Brent Fulgham.
2559
2560         Following the fix for <rdar://problem/49523065>, UIKit no longer emits a keyup event for a Command-
2561         modified key. This breaks WebKit's own implementation of key command handling for scrolling to the
2562         beginning or end of the document (triggered using Command + Arrow Up and Command + Arrow Down,
2563         respectively) because it watches for keyup events to reset state after initiating a scroll. If state
2564         is not reset then the scroll key command logic becomes confused and may not perform a subsequent scroll.
2565         It seems like we can actually get away with supporting these key commands and future Command modified
2566         commands by preemptively reseting state on keydown if the Command modifier is held down. If this does
2567         not work out then we can do something more complicated.
2568
2569         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
2570         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
2571
2572 2019-05-14  Brent Fulgham  <bfulgham@apple.com>
2573
2574         Protect current WebFrame during form submission
2575         https://bugs.webkit.org/show_bug.cgi?id=197459
2576         <rdar://problem/50368618>
2577
2578         Reviewed by Alex Christensen.
2579
2580         The 'continueWillSubmitForm' method calls a completion handler that
2581         might affect the state of the current frame. Ensure the frame is valid
2582         for the scope of the function.
2583
2584         * WebProcess/WebPage/WebFrame.cpp:
2585         (WebKit::WebFrame::continueWillSubmitForm):
2586
2587 2019-05-14  Daniel Bates  <dabates@apple.com>
2588
2589         [iOS] Cannot tab or shift + tab out of address bar on google.com
2590         https://bugs.webkit.org/show_bug.cgi?id=197859
2591         <rdar://problem/46651565>
2592
2593         Reviewed by Darin Adler.
2594
2595         Non-editable elements can participate in tab cycling via the HTML tabindex attribute.
2596         We should allow setting the initial focus to such an element when transitioning from
2597         the chrome (e.g. address bar) to the web page.
2598
2599         * UIProcess/ios/WKContentViewInteraction.mm:
2600         (-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]):
2601
2602 2019-05-14  Alex Christensen  <achristensen@webkit.org>
2603
2604         Add a unit test for client certificate authentication
2605         https://bugs.webkit.org/show_bug.cgi?id=197800
2606
2607         Reviewed by Youenn Fablet.
2608
2609         * Shared/cf/ArgumentCodersCF.cpp:
2610         Move SPI declarations to SecuritySPI.h.
2611
2612 2019-05-13  Wenson Hsieh  <wenson_hsieh@apple.com>
2613
2614         Followup to r245267: fix some more deprecated uses of -[UIApplication interfaceOrientation]
2615         https://bugs.webkit.org/show_bug.cgi?id=197867
2616         <rdar://problem/50743963>
2617
2618         Reviewed by Simon Fraser.
2619
2620         Add a helper method on WKContentView that asks the view's window's scene for an interface orientation; then,
2621         use this helper from various places in WebKit instead of invoking -[UIApplication interfaceOrientation]
2622         directly. No change in behavior.
2623
2624         * UIProcess/ios/WKContentView.h:
2625         * UIProcess/ios/WKContentView.mm:
2626         (-[WKContentView interfaceOrientation]):
2627         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
2628         (-[WKDataListSuggestionsPicker initWithInformation:inView:]):
2629         * UIProcess/ios/forms/WKFormColorPicker.mm:
2630         (-[WKColorPicker initWithView:]):
2631         * UIProcess/ios/forms/WKFormInputControl.mm:
2632         (-[WKDateTimePicker initWithView:datePickerMode:]):
2633         * UIProcess/ios/forms/WKFormSelectPicker.mm:
2634         (-[WKMultipleSelectPicker initWithView:]):
2635         * UIProcess/ios/forms/WKFormSelectPopover.mm:
2636         (-[WKSelectPopover initWithView:hasGroups:]):
2637
2638 2019-05-13  Wenson Hsieh  <wenson_hsieh@apple.com>
2639
2640         [iOS] When running layout tests that tap in the same location, subsequent tests fail to fire click handlers
2641         https://bugs.webkit.org/show_bug.cgi?id=197821
2642         <rdar://problem/50700512>
2643
2644         Reviewed by Tim Horton.
2645
2646         After r244775, when running back-to-back layout tests on iOS that simulate taps in the same location, the double
2647         tap gesture recognizer for recognizing double clicks ends up recognizing instead of the single tap gesture
2648         recognizer in the subsequent test. This means that click handlers in the subsequent test will fail to recognize,
2649         unless the element with the click handler is also accompanied by a dblclick handler.
2650
2651         To avoid this, we reset the double click gesture recognizer when navigating; this has the additional effect of
2652         making it such that the second page doesn't end up observing a dblclick when the first click was only sent to
2653         the first page.
2654
2655         * UIProcess/ios/PageClientImplIOS.mm:
2656         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame):
2657         * UIProcess/ios/WKContentViewInteraction.h:
2658         * UIProcess/ios/WKContentViewInteraction.mm:
2659         (-[WKContentView setupInteraction]):
2660         (-[WKContentView _didStartProvisionalLoadForMainFrame]):
2661
2662 2019-05-13  Wenson Hsieh  <wenson_hsieh@apple.com>
2663
2664         Unreviewed, fix some deprecation warnings when using a recent SDK
2665
2666         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
2667         (-[WKDataListSuggestionsPicker initWithInformation:inView:]):
2668
2669 2019-05-13  Jiewen Tan  <jiewen_tan@apple.com>
2670
2671         [WebAuthN] InvalidStateError should be reported to sites
2672         https://bugs.webkit.org/show_bug.cgi?id=193269
2673         <rdar://problem/48298264>
2674
2675         Reviewed by Brent Fulgham.
2676
2677         This patch implements step 20 about InvalidStateError of the spec:
2678         https://www.w3.org/TR/webauthn/#createCredential.
2679
2680         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2681         (WebKit::AuthenticatorManager::respondReceived):
2682         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp:
2683         (WebKit::CtapHidAuthenticator::continueMakeCredentialAfterResponseReceived const):
2684
2685 2019-05-13  Jer Noble  <jer.noble@apple.com>
2686
2687         Take out MediaPlayback UI assertion when any WebProcess is playing audible media
2688         https://bugs.webkit.org/show_bug.cgi?id=197798
2689
2690         Reviewed by Chris Dumez.
2691
2692         To keep the system from suspending the UIProcess (and all the other constellation of processes that
2693         are necessary to play media), take a UIProcess assertion with the MediaPlayback reason whenever there
2694         is a WebContent process that is playing audible media.
2695
2696         * Platform/spi/ios/AssertionServicesSPI.h:
2697         * UIProcess/ProcessAssertion.h:
2698         * UIProcess/WebPageProxy.cpp:
2699         (WebKit::WebPageProxy::updatePlayingMediaDidChange):
2700         * UIProcess/WebProcessPool.cpp:
2701         (WebKit::WebProcessPool::setWebProcessIsPlayingAudibleMedia):
2702         (WebKit::WebProcessPool::clearWebProcessIsPlayingAudibleMedia):
2703         * UIProcess/WebProcessPool.h:
2704         * UIProcess/WebProcessProxy.cpp:
2705         (WebKit::WebProcessProxy::webPageMediaStateDidChange):
2706         * UIProcess/WebProcessProxy.h:
2707         * UIProcess/ios/ProcessAssertionIOS.mm:
2708         (WebKit::toBKSProcessAssertionReason):
2709         (WebKit::ProcessAssertion::ProcessAssertion):
2710         * WebProcess/WebProcess.h:
2711
2712 2019-05-13  Per Arne Vollan  <pvollan@apple.com>
2713
2714         [iOS] Crash when trying to QuickLook
2715         https://bugs.webkit.org/show_bug.cgi?id=197853
2716         <rdar://problem/49795964>
2717
2718         Reviewed by Brent Fulgham.
2719
2720         This is caused by a syscall sandbox violation.
2721
2722         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2723
2724 2019-05-13  Brent Fulgham  <bfulgham@apple.com>
2725
2726         Correct the sandbox to allow loading libraries from /Library/Apple 
2727         https://bugs.webkit.org/show_bug.cgi?id=197844
2728
2729         Reviewed by Per Arne Vollan.
2730
2731         Grant access to '/Library/Apple' as an appropriate place to load
2732         system frameworks.
2733
2734         * WebProcess/com.apple.WebProcess.sb.in:
2735
2736 2019-05-13  Chris Dumez  <cdumez@apple.com>
2737
2738         Unreviewed, rolling out r245240.
2739
2740         Broke the build
2741
2742         Reverted changeset:
2743
2744         "Update TBA macros for API / SPI that has already shipped"
2745         https://bugs.webkit.org/show_bug.cgi?id=197841
2746         https://trac.webkit.org/changeset/245240
2747
2748 2019-05-13  Youenn Fablet  <youenn@apple.com>
2749
2750         Use kDNSServiceFlagsKnownUnique for DNSServiceRegisterRecord only on platforms supporting it
2751         https://bugs.webkit.org/show_bug.cgi?id=197802
2752
2753         Reviewed by Eric Carlson.
2754
2755         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
2756         (WebKit::NetworkMDNSRegister::registerMDNSName):
2757
2758 2019-05-13  Don Olmstead  <don.olmstead@sony.com>
2759
2760         decidePolicyForInstallMissingMediaPluginsPermissionRequest requires GStreamer
2761         https://bugs.webkit.org/show_bug.cgi?id=197843
2762
2763         Reviewed by Alex Christensen.
2764
2765         * UIProcess/API/wpe/PageClientImpl.cpp:
2766         ENABLE(VIDEO) && USE(GSTREAMER)
2767         * UIProcess/WebPageProxy.h:
2768         Cleanup the declaration.
2769
2770 2019-05-13  Don Olmstead  <don.olmstead@sony.com>
2771
2772         Move StorageManager.cpp into WebKit/Sources.txt
2773         https://bugs.webkit.org/show_bug.cgi?id=197842
2774
2775         Reviewed by Michael Catanzaro.
2776
2777         StorageManager.cpp is used by all ports so it should just go into Sources.txt.
2778
2779         * PlatformMac.cmake:
2780         * PlatformWin.cmake:
2781         * Sources.txt:
2782         * SourcesCocoa.txt:
2783         * SourcesGTK.txt:
2784         * SourcesWPE.txt:
2785
2786 2019-05-13  Chris Dumez  <cdumez@apple.com>
2787
2788         Update TBA macros for API / SPI that has already shipped
2789         https://bugs.webkit.org/show_bug.cgi?id=197841
2790         <rdar://problem/50698499>
2791
2792         Reviewed by Alex Christensen.
2793
2794         * Shared/API/Cocoa/_WKRenderingProgressEvents.h:
2795         * UIProcess/API/C/WKPage.h:
2796         * UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h:
2797         * UIProcess/API/Cocoa/WKBrowsingContextController.h:
2798         * UIProcess/API/Cocoa/WKBrowsingContextGroup.h:
2799         * UIProcess/API/Cocoa/WKBrowsingContextHistoryDelegate.h:
2800         * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegate.h:
2801         * UIProcess/API/Cocoa/WKBrowsingContextPolicyDelegate.h:
2802         * UIProcess/API/Cocoa/WKConnection.h:
2803         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
2804         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2805         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2806         * UIProcess/API/Cocoa/WKProcessGroup.h:
2807         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2808         * UIProcess/API/Cocoa/WKTypeRefWrapper.h:
2809         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2810         * UIProcess/API/Cocoa/WKView.h:
2811         (WK_CLASS_DEPRECATED_WITH_REPLACEMENT):
2812         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2813         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2814         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2815         * UIProcess/API/Cocoa/_WKAttachment.h:
2816         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h:
2817         * UIProcess/API/Cocoa/_WKDownload.h:
2818         * UIProcess/API/Cocoa/_WKFormInputSession.h:
2819         * UIProcess/API/Cocoa/_WKInspector.h:
2820         * UIProcess/API/Cocoa/_WKInternalDebugFeature.h:
2821         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2822         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2823         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2824         * WebProcess/API/Cocoa/WKWebProcess.h:
2825         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
2826         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
2827
2828 2019-05-13  Chris Fleizach  <cfleizach@apple.com>
2829
2830         AX: Need an entitlement for WebContent to send accessibility notifications
2831         https://bugs.webkit.org/show_bug.cgi?id=197832
2832
2833         Reviewed by Brent Fulgham.
2834
2835         In order to send accessibility notifications on iOS, we need to be able to look up this port.
2836
2837         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2838
2839 2019-05-13  Michael Catanzaro  <mcatanzaro@igalia.com>
2840
2841         Unreviewed, fix unused variable warnings in release builds
2842
2843         * UIProcess/WebProcessPool.cpp:
2844         (WebKit::WebProcessPool::clearWebProcessHasUploads):
2845
2846 2019-05-12  Takashi Komori  <Takashi.Komori@sony.com>
2847
2848         [Curl] Suppress extra didReceiveAuthenticationChallenge call when accessing a server which checks basic auth.
2849         https://bugs.webkit.org/show_bug.cgi?id=197650
2850
2851         Reviewed by Fujii Hironori.
2852
2853         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2854         (WebKit::NetworkDataTaskCurl::restartWithCredential):
2855
2856 2019-05-10  Chris Dumez  <cdumez@apple.com>
2857
2858         [PSON] Prevent flashing when the process-swap is forced by the client
2859         https://bugs.webkit.org/show_bug.cgi?id=197799
2860
2861         Reviewed by Geoffrey Garen.
2862
2863         When the process-swap is forced by the client, we would not construct a SuspendedPageProxy for
2864         the previous page, which would cause a white/black flash upon navigation on macOS. The reason
2865         we did not construct a SuspendedPageProxy is that it would be unsafe to keep the page around
2866         in this case because other windows might have an opener link to the page when the swap is forced
2867         and we need those opener / openee links to get severed.
2868
2869         The new approach to maintain the Web facing behavior without flashing is to create a suspended
2870         page proxy for the previous page when the process swap is forced by the client. We then close
2871         the page as soon as we can do so without flashing (when pageEnteredAcceleratedCompositingMode()
2872         has been called).
2873
2874         * UIProcess/SuspendedPageProxy.cpp:
2875         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
2876         (WebKit::SuspendedPageProxy::close):
2877         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
2878         (WebKit::SuspendedPageProxy::closeWithoutFlashing):
2879         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
2880         * UIProcess/SuspendedPageProxy.h:
2881         * UIProcess/WebPageProxy.cpp:
2882         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
2883         (WebKit::WebPageProxy::commitProvisionalPage):
2884         * UIProcess/WebPageProxy.h:
2885
2886 2019-05-10  Brent Fulgham  <bfulgham@apple.com>
2887
2888         Streamline test-and-clear operation for ContextMenu
2889         https://bugs.webkit.org/show_bug.cgi?id=197795
2890         <rdar://problem/50473746>
2891
2892         Reviewed by Wenson Hsieh.
2893
2894         Rather than performing a check when entering the function, doing work,
2895         then clearing the member variable, perform the check and clear in
2896         a single operation. Only perform the selection if the menu exists.
2897
2898         * WebProcess/WebPage/WebPage.cpp:
2899         (WebKit::WebPage::didSelectItemFromActiveContextMenu):
2900
2901 2019-05-10  Megan Gardner  <megan_gardner@apple.com>
2902
2903         Returning incorrect marked text rects
2904         https://bugs.webkit.org/show_bug.cgi?id=197758
2905         <rdar://problem/46548586>
2906
2907         Reviewed by Tim Horton.
2908
2909         We are not returning marked text rects in the correct view coordinate space.
2910         This is the same translation we are applying to the caret rects. 
2911
2912         * WebProcess/WebPage/ios/WebPageIOS.mm:
2913         (WebKit::WebPage::platformEditorState const):
2914
2915 2019-05-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2916
2917         Let WebKit clients supply an application name for user agent in modern compatibility mode
2918         https://bugs.webkit.org/show_bug.cgi?id=197782
2919         <rdar://problem/50646747>
2920
2921         Reviewed by Beth Dakin.
2922
2923         Add plumbing for a new private property on WKWebpagePreferences.
2924
2925         * UIProcess/API/APIWebsitePolicies.cpp:
2926         (API::WebsitePolicies::copy const):
2927         * UIProcess/API/APIWebsitePolicies.h:
2928         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
2929         (-[WKWebpagePreferences _applicationNameForUserAgentWithModernCompatibility]):
2930         (-[WKWebpagePreferences _setApplicationNameForUserAgentWithModernCompatibility:]):
2931         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
2932
2933 2019-05-10  Chris Dumez  <cdumez@apple.com>
2934
2935         The active tab sometimes app naps even though it should not
2936         https://bugs.webkit.org/show_bug.cgi?id=197791
2937         <rdar://problem/48460054>
2938
2939         Reviewed by Geoffrey Garen.
2940
2941         The WebPage constructor was initializing m_activityState but not calling updateThrottleState().
2942         As a result, we would not take a UserActivity even when warranted by the initial activity state.
2943
2944         * WebProcess/WebPage/WebPage.cpp:
2945
2946 2019-05-10  Fujii Hironori  <Hironori.Fujii@sony.com>
2947
2948         [WinCairo] storage/indexeddb tests are timing out
2949         https://bugs.webkit.org/show_bug.cgi?id=196289
2950
2951         Reviewed by Alex Christensen.
2952
2953         storage/indexeddb tests were timing out for WinCairo port because
2954         WebKit::NetworkCache classes were not implemented yet for Windows.
2955
2956         Implement WebKit::NetworkCache classes by using WTF::FileSystem
2957         functions.
2958
2959         * NetworkProcess/cache/CacheStorageEngine.cpp:
2960         (WebKit::CacheStorage::Engine::readFile): Use
2961         IOChannel::isOpened() to check the channel is opened instead of
2962         checking the file descriptor.
2963         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
2964         (WebKit::NetworkCache::BlobStorage::add):
2965         (WebKit::NetworkCache::BlobStorage::remove):
2966         * NetworkProcess/cache/NetworkCacheData.cpp:
2967         (WebKit::NetworkCache::Data::mapToFile const):
2968         (WebKit::NetworkCache::mapFile):
2969         (WebKit::NetworkCache::adoptAndMapFile):
2970         (WebKit::NetworkCache::makeSalt):
2971         (WebKit::NetworkCache::readOrMakeSalt):
2972         * NetworkProcess/cache/NetworkCacheData.h:
2973         (WebKit::NetworkCache::Data::isEmpty const):
2974         (WebKit::NetworkCache::Data::size const):
2975         * NetworkProcess/cache/NetworkCacheDataCurl.cpp:
2976         (WebKit::NetworkCache::Data::Data):
2977         (WebKit::NetworkCache::Data::empty):
2978         (WebKit::NetworkCache::Data::data const):
2979         (WebKit::NetworkCache::Data::isNull const):
2980         (WebKit::NetworkCache::Data::apply const):
2981         (WebKit::NetworkCache::Data::subrange const):
2982         (WebKit::NetworkCache::concatenate):
2983         (WebKit::NetworkCache::Data::adoptMap): Deleted.
2984         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
2985         (WebKit::NetworkCache::traverseDirectory):
2986         (WebKit::NetworkCache::fileTimes):
2987         (WebKit::NetworkCache::updateFileModificationTimeIfNeeded):
2988         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
2989         * NetworkProcess/cache/NetworkCacheIOChannel.h:
2990         (WebKit::NetworkCache::IOChannel::isOpened const):
2991         (WebKit::NetworkCache::IOChannel::fileDescriptor const): Deleted.
2992         * NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp:
2993         (WebKit::NetworkCache::IOChannel::IOChannel):
2994         (WebKit::NetworkCache::IOChannel::~IOChannel):
2995         (WebKit::NetworkCache::runTaskInQueue):
2996         (WebKit::NetworkCache::IOChannel::read):
2997         (WebKit::NetworkCache::IOChannel::write):
2998
2999 2019-05-10  Chris Dumez  <cdumez@apple.com>
3000
3001         Do not wait until requestPermission() is called to fire deviceorientation events if permission was already granted
3002         https://bugs.webkit.org/show_bug.cgi?id=197750
3003
3004         Reviewed by Geoffrey Garen.
3005
3006         The UIProcess remembers previous device orientation permission decisions per origin for the duration of the browsing
3007         session. However, the WebContent process was not aware of previous decisions and would therefore not fire any
3008         deviceorientation / devicemotion events until the JS has called requestPermission(). This patches addresses this
3009         problem by having the UIProcess communicate any previous permission decision for the origin via WebSitePolicies.
3010
3011         * UIProcess/WebPageProxy.cpp:
3012         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3013         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.cpp:
3014         (WebKit::WebDeviceOrientationAndMotionAccessController::shouldAllowAccess):
3015         (WebKit::WebDeviceOrientationAndMotionAccessController::cachedDeviceOrientationPermission const):
3016         (WebKit::WebDeviceOrientationAndMotionAccessController::deviceOrientationPermission const): Deleted.
3017         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.h:
3018
3019 2019-05-10  Chris Dumez  <cdumez@apple.com>
3020
3021         Add WKWebViewConfiguration._canShowWhileLocked SPI
3022         https://bugs.webkit.org/show_bug.cgi?id=197777
3023         <rdar://problem/50065100>
3024
3025         Reviewed by Tim Horton.
3026
3027         * Platform/mac/LayerHostingContext.h:
3028         * Platform/mac/LayerHostingContext.mm:
3029         (WebKit::LayerHostingContext::createForExternalHostingProcess):
3030         * Shared/WebPageCreationParameters.cpp:
3031         (WebKit::WebPageCreationParameters::encode const):
3032         (WebKit::WebPageCreationParameters::decode):
3033         * Shared/WebPageCreationParameters.h:
3034         * UIProcess/API/APIPageConfiguration.cpp:
3035         (API::PageConfiguration::copy const):
3036         * UIProcess/API/APIPageConfiguration.h:
3037         (API::PageConfiguration::canShowWhileLocked const):
3038         (API::PageConfiguration::setCanShowWhileLocked):
3039         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3040         (-[WKWebViewConfiguration _setCanShowWhileLocked:]):
3041         (-[WKWebViewConfiguration _canShowWhileLocked]):
3042         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
3043         * UIProcess/WebPageProxy.cpp:
3044         (WebKit::WebPageProxy::creationParameters):
3045         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
3046         (WebKit::PlatformCALayerRemoteCustom::PlatformCALayerRemoteCustom):
3047         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
3048         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
3049         (WebKit::RemoteLayerTreeContext::canShowWhileLocked const):
3050         * WebProcess/WebPage/WebPage.cpp:
3051         (WebKit::m_canShowWhileLocked):
3052         (WebKit::m_shrinkToFitContentTimer): Deleted.
3053         * WebProcess/WebPage/WebPage.h:
3054         (WebKit::WebPage::canShowWhileLocked const):
3055
3056 2019-05-10  Michael Catanzaro  <mcatanzaro@igalia.com>
3057
3058         Fix a bunch of compiler warnings
3059         https://bugs.webkit.org/show_bug.cgi?id=197785
3060
3061         Reviewed by Don Olmstead.
3062
3063         Guard Cocoa-specific format modifier to avoid -Wformat warning.
3064
3065         * NetworkProcess/AdClickAttributionManager.cpp:
3066         (WebKit::AdClickAttributionManager::fireConversionRequest):
3067
3068 2019-05-10  Chris Fleizach  <cfleizach@apple.com>
3069
3070         AX: Crash at WebKit: WebKit::WebSpeechSynthesisClient::speak
3071         https://bugs.webkit.org/show_bug.cgi?id=197761
3072         <rdar://problem/50237614>
3073
3074         Reviewed by Per Arne Vollan.
3075
3076         It's valid for the incoming voice to be nil, so we need to protect against that.
3077
3078         Tests: fast/speechsynthesis/speech-synthesis-real-client-version.html
3079
3080         * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp:
3081         (WebKit::WebSpeechSynthesisClient::speak):
3082
3083 2019-05-10  Michael Catanzaro  <mcatanzaro@igalia.com>
3084
3085         [WPE][GTK] Add webkit_frame_get_id() API
3086         https://bugs.webkit.org/show_bug.cgi?id=197270
3087
3088         Reviewed by Carlos Garcia Campos.
3089
3090         It's as simple as can be: just an API to return the ID of a frame.
3091
3092         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
3093         * WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp:
3094         (webkit_frame_get_id):
3095         * WebProcess/InjectedBundle/API/gtk/WebKitFrame.h:
3096         * WebProcess/InjectedBundle/API/wpe/WebKitFrame.h:
3097         * WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-1.0-sections.txt:
3098
3099 2019-05-10  Michael Catanzaro  <mcatanzaro@igalia.com>
3100
3101         [WPE][GTK] Add WebKitWebPage::did-associate-form-controls-for-frame and deprecate original did-associate-form-controls
3102         https://bugs.webkit.org/show_bug.cgi?id=197271
3103
3104         Reviewed by Youenn Fablet.
3105
3106         * WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h:
3107         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
3108         (webkit_web_page_class_init):
3109         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3110         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]):
3111         * WebProcess/InjectedBundle/APIInjectedBundleFormClient.h:
3112         (API::InjectedBundle::FormClient::didAssociateFormControls):
3113         * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
3114         (WebKit::InjectedBundlePageFormClient::didAssociateFormControls):
3115         * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:
3116         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3117         (WebKit::WebChromeClient::didAssociateFormControls):
3118         * WebProcess/WebCoreSupport/WebChromeClient.h:
3119
3120 2019-05-09  Rob Buis  <rbuis@igalia.com>
3121
3122         Limit number of prefetches of a given page
3123         https://bugs.webkit.org/show_bug.cgi?id=197736
3124
3125         Reviewed by Darin Adler.
3126
3127         Limit prefetches for same url to 1.
3128
3129         * NetworkProcess/cache/PrefetchCache.cpp:
3130         (WebKit::PrefetchCache::store):
3131
3132 2019-05-09  Alex Christensen  <achristensen@webkit.org>
3133
3134         Unreviewed, rolling out most of r245151.
3135
3136         Caused assertions in High Sierra
3137
3138         Reverted most of changeset:
3139
3140         "Remove now-unnecessary Connection::sendMessageWithReply"
3141         https://bugs.webkit.org/show_bug.cgi?id=197747
3142         https://trac.webkit.org/changeset/245151
3143
3144 2019-05-09  Daniel Bates  <dabates@apple.com>
3145
3146         [iOS] Lazily request keyboard on first hardware keydown when a non-editable element is focused
3147         https://bugs.webkit.org/show_bug.cgi?id=197746
3148         <rdar://problem/50630406>
3149
3150         Reviewed by Brent Fulgham.
3151
3152         Be even lazier. We only need to create a keyboard if an editable element is focused or on
3153         the first hardware keydown when a non-editable element is focused. We currently do the former.
3154         Let's also do the latter.
3155
3156         * UIProcess/ios/WKContentViewInteraction.h:
3157         * UIProcess/ios/WKContentViewInteraction.mm:
3158         (-[WKContentView cleanupInteraction]): Reset bookkeeping.
3159         (-[WKContentView _requiresKeyboardWhenFirstResponder]): Further condition the result on
3160         whether we have seen a hardware keydown event in a non-editable element.
3161         (-[WKContentView _handleKeyUIEvent:]): If this is the first hardware key event we've seen then
3162         update state and call -reloadInputView. -reloadInputView will call us back in -_requiresKeyboardWhenFirstResponder
3163         and we will now return YES. So, it will create the keyboard.
3164         (-[WKContentView _hardwareKeyboardAvailabilityChanged]): Reset bookkeeping.
3165
3166 2019-05-08  Dean Jackson  <dino@apple.com>
3167
3168         Guard long press link preview with a USE macro rather than complicated includes
3169         https://bugs.webkit.org/show_bug.cgi?id=197728
3170         <rdar://problem/50604700>
3171
3172         Reviewed by Wenson Hsieh.
3173
3174         It was getting complicated to manage the coordination between WebKitAdditions
3175         and WebKit without having to split up the includes into multiple files
3176         or have lots of duplication.
3177
3178         Instead, WebKitAdditions will now define a USE macro which can be used
3179         in various places through WebKit.
3180
3181         * UIProcess/ios/WKContentViewInteraction.h:
3182         * UIProcess/ios/WKContentViewInteraction.mm:
3183         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
3184         (-[WKContentView _contentsOfUserInterfaceItem:]):
3185         (previewIdentifierForElementAction):
3186         (-[WKContentView shouldUsePreviewForLongPress]):
3187         (-[WKContentView _registerPreview]):
3188         (-[WKContentView _unregisterPreview]):
3189         (shouldUsePreviewForLongPress): Deleted.
3190         (-[WKContentView _registerPreviewLongPress]): Deleted.
3191         (-[WKContentView _unregisterPreviewLongPress]): Deleted.
3192
3193 2019-05-09  Alex Christensen  <achristensen@webkit.org>
3194
3195         Remove now-unnecessary Connection::sendMessageWithReply
3196         https://bugs.webkit.org/show_bug.cgi?id=197747
3197
3198         Reviewed by Tim Horton.
3199
3200         The WebProcess messages that use it already do the right thing with CompletionHandlers and can be replaced by sendWithAsyncReply.
3201         The SecItemShim message that uses it can be replaced by sendSync.
3202
3203         This patch only increases responsiveness when clearing website data and removes the need for a WorkQueue dedicated entirely to the SecItemShim.
3204
3205         * Platform/IPC/Connection.cpp:
3206         (IPC::Connection::invalidate):
3207         (IPC::Connection::processIncomingSyncReply):
3208         (IPC::Connection::connectionDidClose):
3209         (IPC::Connection::sendMessageWithReply): Deleted.
3210         * Platform/IPC/Connection.h:
3211         (IPC::Connection::send):
3212         (IPC::Connection::sendWithReply): Deleted.
3213         * Shared/mac/SecItemResponseData.h:
3214         * Shared/mac/SecItemShim.cpp:
3215         (WebKit::sendSecItemRequest):
3216         (WebKit::workQueue): Deleted.
3217         * UIProcess/WebProcessProxy.cpp:
3218         (WebKit::WebProcessProxy::fetchWebsiteData):
3219         (WebKit::WebProcessProxy::deleteWebsiteData):
3220         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
3221         * WebProcess/WebProcess.messages.in:
3222
3223 2019-05-09  Dean Jackson  <dino@apple.com>
3224
3225         Build fix for iOS.
3226
3227         * UIProcess/WKImagePreviewViewController.mm:
3228
3229 2019-05-09  Alex Christensen  <achristensen@webkit.org>
3230
3231         Remove unnecessary test SPI after r244883
3232         https://bugs.webkit.org/show_bug.cgi?id=197575
3233
3234         Reviewed by Tim Horton.
3235
3236         We now have two ways of doing the same thing.  Let's remove the one that's only for testing,
3237         and make the tests clean up like an application would.
3238
3239         * NetworkProcess/NetworkProcess.cpp:
3240         (WebKit::NetworkProcess::removeCredential): Deleted.
3241         * NetworkProcess/NetworkProcess.h:
3242         * NetworkProcess/NetworkProcess.messages.in:
3243         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3244         (WebKit::NetworkProcess::removeCredential): Deleted.
3245         * UIProcess/API/Cocoa/WKProcessPool.mm:
3246         (-[WKProcessPool _removeCredential:forProtectionSpace:completionHandler:]): Deleted.
3247         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3248         * UIProcess/WebProcessPool.cpp:
3249         (WebKit::WebProcessPool::removeCredential): Deleted.
3250         * UIProcess/WebProcessPool.h:
3251
3252 2019-05-09  Daniel Bates  <dabates@apple.com>
3253
3254         REGRESSION (r241734): 1% slower PLT on iPad
3255         https://bugs.webkit.org/show_bug.cgi?id=197745
3256         <rdar://problem/50457731>
3257
3258         Reviewed by Per Arne Vollan.
3259
3260         For now, only create a keyboard when WKContentView becomes first responder if a hardware keyboard
3261         is attached or an editable element is focused to recover the 1% loss when a keyboard is not attached.
3262         We can do better and by that I mean be lazier. We'll do this <https://bugs.webkit.org/show_bug.cgi?id=197746>.
3263
3264         In r241734 we unified the key event handling code paths so we use exactly one for both software and
3265         hardware key events. We took a simple approach of always requesting UIKit to create a keyboard when
3266         the WKContentView becomes first responder. We did this so that we could continue listening for hardware
3267         key events even when a non-editable element is focused and dispatch DOM events. As it turns out, always
3268         creating a keyboard is expensive and caused a ~1% slowdown in page load time on iPad.
3269
3270         * UIProcess/ios/WKContentViewInteraction.mm:
3271         (-[WKContentView _requiresKeyboardWhenFirstResponder]): Only create a keyboard if a hardware keyboard is
3272         attached or an editable element is focused.
3273         (-[WKContentView _hardwareKeyboardAvailabilityChanged]): Reload all input view (this will cause keyboard
3274         creation) if -_requiresKeyboardWhenFirstResponder returns YES.
3275
3276 2019-05-09  Daniel Bates  <dabates@apple.com>
3277
3278         [iOS] Unable to commit search on MSN.com, qq.com, or sina.com.cn using enter key (hardware or software keyboard)
3279         https://bugs.webkit.org/show_bug.cgi?id=197632
3280         <rdar://problem/47902054>
3281
3282         Reviewed by Brent Fulgham.
3283
3284         Fixes an issue where it is not possible to submit a <form> with target = "_blank": a form that
3285         opens a new window.
3286
3287         By default we only allow popups to open if they were user initiated (like when a person clicks
3288         on a link). We achieve this by putting a token on the stack, called the UserGestureToken when
3289         WebCore processes an event from WebKit. So long as this token is on the stack we consider
3290         all requests to open a popup to be user initiated. And we implicitly submit a form when pressing
3291         the Return key in an HTML input element during the processing of a TextInputEvent dispatched as
3292         part of inserting a '\n' into the field. On Mac, the keydown dispatches a TextInputEvent synchronously.
3293         However on iOS text insertion, and hence a dispatch of a TextInputEvent event, occurs asynchronously
3294         with respect to the keydown event. So, by the time the UI process calls back to the WebProcess
3295         to perform the text insertion of '\n' we have long since popped the UserGestureToken off the stack
3296         and hence we disallow opening a popup. To fix this, when -insertText is called we query the keyboard
3297         to determine if it's being called by the keyboard. If it is then we can assume that this is
3298         part of key event handling and hence was initiated by the user. We can pass along this detail
3299         to the WebProcess for it to push a new UserGestureToken onto the stack.
3300
3301         For now we only track whether text inserted by the keyboard was user initiated or not. In
3302         <https://bugs.webkit.org/show_bug.cgi?id=197721> we will fix this up for all editing commands.
3303
3304         * Platform/spi/ios/UIKitSPI.h: Expose SPI.
3305         * Shared/Cocoa/InsertTextOptions.cpp:
3306         (IPC::ArgumentCoder<WebKit::InsertTextOptions>::encode):
3307         (IPC::ArgumentCoder<WebKit::InsertTextOptions>::decode):
3308         Encode and decode whether we are processing a user gesture.
3309
3310         * Shared/Cocoa/InsertTextOptions.h:
3311         * UIProcess/ios/WKContentViewInteraction.mm:
3312         (-[WKContentView insertText:]): Query the keyboard to determine whether it called us or
3313         the embedding client did. We only want to privilege user initiated actions (the keyboard).
3314         * WebProcess/WebPage/WebPage.cpp:
3315         (WebKit::WebPage::insertTextAsync): Push a UserGestureToken onto the stack that is initialized
3316         depending on whether we are or are not processing a user gesture.
3317
3318 2019-05-09  Antoine Quint  <graouts@apple.com>
3319
3320         pointerevents/ios/touch-action-none-in-overflow-scrolling-touch.html is a timeout
3321         https://bugs.webkit.org/show_bug.cgi?id=197738
3322         <rdar://problem/50588613>
3323
3324         Reviewed by Antti Koivisto.
3325
3326         We clear the touch actions for a given touch identifier when the matching touch is released in -[WKContentViewInteraction _handleTouchActionsForTouchEvent:].
3327         This happens before -[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:] is called and thus, which we correctly
3328         respected the touch actions during the panning gesture, we would not be able to respect them during the deceleration animation. This caused the test to fail
3329         because it would check that no scrolling happened after the panning gesture completed, ie. during the deceleration animation.
3330
3331         To work around this, we now store the touch actions for a given UIScrollView interaction in the ScrollingTreeScrollingNodeDelegateIOS object when the interaction
3332         starts.
3333
3334         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
3335         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::activeTouchActions const):
3336         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::clearActiveTouchActions):
3337         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
3338         (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
3339         (-[WKScrollingNodeScrollViewDelegate _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]):
3340         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::computeActiveTouchActionsForGestureRecognizer):
3341         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::activeTouchActionsForGestureRecognizer const): Deleted.
3342
3343 2019-05-08  Antoine Quint  <graouts@apple.com>
3344
3345         [iOS] Correctly handle overlapping regions for elements with a touch-action property
3346         https://bugs.webkit.org/show_bug.cgi?id=194813
3347         <rdar://problem/48194708>
3348
3349         Reviewed by Antti Koivisto.
3350
3351         We now use WebKit::touchActionsForPoint() to determine the touch actions for a given touch using its location in -[WKContentViewInteraction
3352         _handleTouchActionsForTouchEvent:]. We then record these touch actions for the touch's identifier on the RemoteScrollingCoordinatorProxy.
3353
3354         Then, as we interact with a UIScrollView, we get its gesture recognizer and get its active touch identifier through the new
3355         -[WKContentViewInteraction activeTouchIdentifierForGestureRecognizer:] method, and query the RemoteScrollingCoordinatorProxy for the touch
3356         actions matching that touch identifier.
3357
3358         Tests: pointerevents/ios/touch-action-none-overlap.html
3359                pointerevents/ios/touch-action-pan-x-overlap.html
3360                pointerevents/ios/touch-action-pan-y-overlap.html
3361                pointerevents/ios/touch-action-pinch-zoom-overlap.html
3362
3363         * UIProcess/PageClient.h:
3364         (WebKit::PageClient::activeTouchIdentifierForGestureRecognizer):
3365         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: Maintain a touch identifier to touch actions map.
3366         (WebKit::RemoteScrollingCoordinatorProxy::activeTouchActionsForTouchIdentifier const):
3367         (WebKit::RemoteScrollingCoordinatorProxy::setTouchActionsForTouchIdentifier):
3368         (WebKit::RemoteScrollingCoordinatorProxy::clearTouchActionsForTouchIdentifier):
3369         (WebKit::RemoteScrollingCoordinatorProxy::touchActionDataAtPoint const): Deleted.
3370         (WebKit::RemoteScrollingCoordinatorProxy::touchActionDataForScrollNodeID const): Deleted.
3371         (WebKit::RemoteScrollingCoordinatorProxy::setTouchDataForTouchIdentifier): Deleted.
3372         (WebKit::RemoteScrollingCoordinatorProxy::clearTouchDataForTouchIdentifier): Deleted.
3373         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
3374         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
3375         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
3376         (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
3377         (-[WKScrollingNodeScrollViewDelegate _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]):
3378         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::activeTouchActionsForGestureRecognizer const):
3379         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::touchActionData const): Deleted.
3380         * UIProcess/ios/PageClientImplIOS.h:
3381         * UIProcess/ios/PageClientImplIOS.mm:
3382         (WebKit::PageClientImpl::activeTouchIdentifierForGestureRecognizer):
3383         * UIProcess/ios/WKContentViewInteraction.h:
3384         * UIProcess/ios/WKContentViewInteraction.mm:
3385         (-[WKContentView activeTouchIdentifierForGestureRecognizer:]):
3386         (-[WKContentView _handleTouchActionsForTouchEvent:]):
3387
3388 2019-05-08  Megan Gardner  <megan_gardner@apple.com>
3389
3390         Add quirks to emulate undo and redo in hidden editable areas on some websites
3391         https://bugs.webkit.org/show_bug.cgi?id=197452
3392
3393         Reviewed by Alex Christensen.
3394
3395         We need to make our own undo manager to allow undo even when 
3396         the manager is empty. This is to interface with rich editing 
3397         websites that don't actually interface with our undo abilities.
3398         Then we need to generate synthetic undo and redo in the web process.
3399
3400         * UIProcess/WebPageProxy.cpp:
3401         (WebKit::WebPageProxy::isCurrentURLHost const):
3402         * UIProcess/WebPageProxy.h:
3403         * UIProcess/ios/WKContentView.mm:
3404         (-[WKNSUndoManager initWithContentView:]):
3405         (-[WKNSUndoManager canUndo]):
3406         (-[WKNSUndoManager canRedo]):
3407         (-[WKNSUndoManager undo]):
3408         (-[WKNSUndoManager redo]):
3409         (-[WKContentView undoManager]):
3410         * UIProcess/ios/WKContentViewInteraction.h:
3411         * UIProcess/ios/WKContentViewInteraction.mm:
3412         (-[WKContentView generateSyntheticUndoRedo:]):
3413         (-[WKContentView hasHiddenContentEditable]):
3414         * UIProcess/ios/WebPageProxyIOS.mm:
3415         (WebKit::WebPageProxy::generateSyntheticUndoRedo):
3416         * WebProcess/WebPage/WebPage.h:
3417         * WebProcess/WebPage/WebPage.messages.in:
3418         * WebProcess/WebPage/ios/WebPageIOS.mm:
3419         (WebKit::WebPage::handleEditingKeyboardEvent):
3420         (WebKit::WebPage::generateSyntheticUndoRedo):
3421
3422 2019-05-08  Alex Christensen  <achristensen@webkit.org>
3423
3424         Add SPI to set HSTS storage directory
3425         https://bugs.webkit.org/show_bug.cgi?id=197259
3426         <rdar://problem/48797895>
3427
3428         Reviewed by Brady Eidson.
3429
3430         It is with great sadness that I lament the design of this SPI, which is necessitated by the process-global nature of the SPI that
3431         I must call and the time at which I must call it (before any networking calls have been made).
3432         I'm also not thrilled about the fact that the unit test infrastructure I developed for this in r244594 cannot be used because
3433         the SPI that I must call does not work on iOS simulator or Mac.  I have verified the SPI is being called and that when called on iOS,
3434         and that CFNetwork does the right thing with it.
3435
3436         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3437         (WebKit::NetworkProcessCreationParameters::encode const):
3438         (WebKit::NetworkProcessCreationParameters::decode):
3439         * NetworkProcess/NetworkProcessCreationParameters.h:
3440         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3441         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3442         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3443         (API::ProcessPoolConfiguration::copy):
3444         * UIProcess/API/APIProcessPoolConfiguration.h:
3445         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3446         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3447         (-[_WKProcessPoolConfiguration setHSTSStorageDirectory:]):
3448         (-[_WKProcessPoolConfiguration hstsStorageDirectory]):
3449         * UIProcess/WebProcessPool.cpp:
3450         (WebKit::WebProcessPool::ensureNetworkProcess):
3451
3452 2019-05-08  Daniel Bates  <dabates@apple.com>
3453
3454         Pass insertTextAsync options as a struct
3455         https://bugs.webkit.org/show_bug.cgi?id=197710
3456
3457         Reviewed by Brent Fulgham.
3458
3459         WebPageProxy::insertTextAsync() is becoming unwieldy to work with given the large number of
3460         optional arguments that can be passed to it. Let's pass a struct instead.
3461
3462         * Shared/Cocoa/InsertTextOptions.cpp: Added.
3463         (IPC::ArgumentCoder<WebKit::InsertTextOptions>::encode):
3464         (IPC::ArgumentCoder<WebKit::InsertTextOptions>::decode):
3465         * Shared/Cocoa/InsertTextOptions.h: Added.
3466         * Shared/EditingRange.h: Add EnumTrait so that we can encode the EditingRangeIsRelativeTo
3467         enumeration.
3468         * SourcesCocoa.txt: Add a new file.
3469         * UIProcess/Cocoa/WebViewImpl.mm:
3470         (WebKit::WebViewImpl::insertText): Update code now that we pass a struct.
3471         (WebKit::WebViewImpl::setMarkedText): Ditto.
3472         * UIProcess/WebPageProxy.cpp:
3473         (WebKit::WebPageProxy::insertTextAsync): Ditto.
3474         * UIProcess/WebPageProxy.h:
3475         * UIProcess/ios/WKContentViewInteraction.mm:
3476         (-[WKContentView insertText:]): Ditto.
3477         * UIProcess/mac/WebPageProxyMac.mm:
3478         (WebKit::WebPageProxy::insertDictatedTextAsync): Ditto.
3479         * WebKit.xcodeproj/project.pbxproj: Add new files.
3480         * WebProcess/WebPage/WebPage.cpp:
3481         (WebKit::WebPage::insertTextAsync): Ditto.
3482         * WebProcess/WebPage/WebPage.h:
3483         * WebProcess/WebPage/WebPage.messages.in: Ditto.
3484
3485 2019-05-08  Timothy Hatcher  <timothy@apple.com>
3486
3487         Add plumbing for inactive system colors in RenderTheme cache.
3488         https://bugs.webkit.org/show_bug.cgi?id=197699
3489         rdar://problem/49406936
3490
3491         Reviewed by Tim Horton.
3492
3493         * Shared/WebPageCreationParameters.cpp:
3494         (WebKit::WebPageCreationParameters::encode const):
3495         (WebKit::WebPageCreationParameters::decode):
3496         * Shared/WebPageCreationParameters.h:
3497         * UIProcess/Cocoa/WebViewImpl.h:
3498         * UIProcess/Cocoa/WebViewImpl.mm:
3499         (WebKit::WebViewImpl::effectiveAppearanceIsInactive):
3500         * UIProcess/PageClient.h:
3501         (WebKit::PageClient::effectiveAppearanceIsInactive const):
3502         * UIProcess/WebPageProxy.cpp:
3503         (WebKit::WebPageProxy::creationParameters):
3504         (WebKit::WebPageProxy::useInactiveAppearance const):
3505         (WebKit::WebPageProxy::effectiveAppearanceDidChange):
3506         * UIProcess/WebPageProxy.h:
3507         * UIProcess/mac/PageClientImplMac.h:
3508         * UIProcess/mac/PageClientImplMac.mm:
3509         (WebKit::PageClientImpl::effectiveAppearanceIsInactive const):
3510         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3511         (WKBundlePageSetUseDarkAppearance):
3512         * WebProcess/WebPage/WebPage.cpp:
3513         (WebKit::m_shrinkToFitContentTimer):
3514         (WebKit::WebPage::effectiveAppearanceDidChange): Renamed from setUseDarkAppearance.
3515         * WebProcess/WebPage/WebPage.h:
3516         * WebProcess/WebPage/WebPage.messages.in:
3517         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
3518         (WebKit::WebPage::effectiveAppearanceDidChange): Renamed from setUseDarkAppearance.
3519
3520 2019-05-08  Chris Dumez  <cdumez@apple.com>
3521
3522         Regression: Crash at WebKit: PAL::HysteresisActivity::start
3523         https://bugs.webkit.org/show_bug.cgi?id=197666
3524         <rdar://problem/50037153>
3525
3526         Reviewed by Geoffrey Garen.
3527
3528         We've recently made it so that the WebContent process destroys its WebSQLiteDatabaseTracker when preparing
3529         for process suspension and then re-constructs it when resuming. The issue is that the WebSQLiteDatabaseTracker
3530         internal implementation was calling callOnMainThread() and capturing |this| to start/stop its HysteresisActivity.
3531         As a result, |this| could be dead by the time we're on the main thread and we'd crash.
3532
3533         To address the issue, we no longer destroy the WebSQLiteDatabaseTracker when preparing to suspend. Instead, we
3534         set a 'isSuspended' flag on the WebSQLiteDatabaseTracker so that it stops notifying the WebProcess of changes.
3535
3536         Also clean up the class a bit so that:
3537         1. The constructor takes in a WTF::Function instead of a NetworkProcess / WebProcess reference. This is provides
3538            better layering. The WebSQLiteDatabaseTracker should not need to know anything about those objects.
3539         2. Use RunLoop::main().dispatch() instead of callOnMainThread() since we're in WebKit2 code.
3540
3541         * NetworkProcess/NetworkProcess.cpp:
3542         (WebKit::NetworkProcess::NetworkProcess):
3543         * Shared/WebSQLiteDatabaseTracker.cpp:
3544         (WebKit::WebSQLiteDatabaseTracker::WebSQLiteDatabaseTracker):
3545         (WebKit::WebSQLiteDatabaseTracker::~WebSQLiteDatabaseTracker):
3546         (WebKit::WebSQLiteDatabaseTracker::willBeginFirstTransaction):
3547         (WebKit::WebSQLiteDatabaseTracker::didFinishLastTransaction):
3548         (WebKit::WebSQLiteDatabaseTracker::hysteresisUpdated): Deleted.
3549         * Shared/WebSQLiteDatabaseTracker.h:
3550         * WebProcess/WebProcess.cpp:
3551         (WebKit::m_nonVisibleProcessCleanupTimer):
3552         (WebKit::WebProcess::initializeSQLiteDatabaseTracker):
3553         (WebKit::WebProcess::cancelPrepareToSuspend):
3554         (WebKit::WebProcess::processDidResume):
3555         (WebKit::m_webSQLiteDatabaseTracker): Deleted.
3556         * WebProcess/WebProcess.h:
3557
3558 2019-05-08  Tim Horton  <timothy_horton@apple.com>
3559
3560         iOS: Selection is dismissed even if click is preventDefault()'d
3561         https://bugs.webkit.org/show_bug.cgi?id=197686
3562         <rdar://problem/49398824>
3563
3564         Reviewed by Wenson Hsieh.
3565
3566         We currently unconditionally dismiss the selection on any tap; however
3567         if a site preventDefault()s on click, we shouldn't perform the default
3568         action of dismissing the selection.
3569
3570         Instead of clearing the selection in the UI process, clear it in the
3571         Web content process if we don't dispatch a synthetic click; the normal
3572         WebCore machinery will handle it in the case that we do.
3573
3574         * UIProcess/ios/WKContentViewInteraction.mm:
3575         (-[WKContentView _singleTapRecognized:]):
3576         * WebProcess/WebPage/WebPage.h:
3577         * WebProcess/WebPage/ios/WebPageIOS.mm:
3578         (WebKit::WebPage::commitPotentialTapFailed):
3579         (WebKit::WebPage::selectWithGesture):
3580         (WebKit::WebPage::clearSelection):
3581         (WebKit::WebPage::selectTextWithGranularityAtPoint):
3582
3583 2019-05-08  Alexander Mikhaylenko  <exalm7659@gmail.com>
3584
3585         [GTK] Support navigation gesture on touchscreens
3586         https://bugs.webkit.org/show_bug.cgi?id=197690
3587
3588         Reviewed by Michael Catanzaro.
3589
3590         Touch events generate scroll events that are handled in webkitWebViewBaseHandleWheelEvent(),
3591         bypassing webkitWebViewBaseScrollEvent(). Because of that, ViewGestureController never receives
3592         them. Hence pass scroll events to ViewGestureController in webkitWebViewBaseHandleWheelEvent()
3593         instead.
3594
3595         For touch events, gesture progress calculation has to take window width into account to make
3596         the page perfectly follow finger, and deltas are additionally divided by Scrollbar::pixelsPerLineStep(),
3597         so compensate for that.
3598
3599         For touchpad events, change delta multiplier to 10 to match GTK behavior, and introduce a 400px
3600         base width so the swipe speed doesn't change from the previous behavior.
3601
3602         Because of the multiplier change, threshold for triggering the gesture with touchpad is now 4
3603         times larger.
3604
3605         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3606         (webkitWebViewBaseHandleWheelEvent): Move ViewGestureController bits here.
3607         (webkitWebViewBaseScrollEvent): Removed ViewGestureController bits.
3608         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
3609         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe):
3610         Allow events from touchscreen devices.
3611         (WebKit::isTouchEvent): Added.
3612         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventGetScrollingDeltas):
3613         Change delta multipliers.
3614         (WebKit::ViewGestureController::SwipeProgressTracker::handleEvent):
3615         Change delta multipliers, account for view width for touchscreen events.
3616
3617 2019-05-08  Wenson Hsieh  <wenson_hsieh@apple.com>
3618
3619         [iOS] Add a quirk to synthesize mouse events when modifying the selection
3620         https://bugs.webkit.org/show_bug.cgi?id=197683
3621         <rdar://problem/48003980>
3622
3623         Reviewed by Tim Horton.
3624
3625         Introduces support for dispatching synthetic mouse events when modifying the selection on some websites. See
3626         below for more details.
3627
3628         * UIProcess/WebPageProxy.cpp:
3629         (WebKit::WebPageProxy::selectAll):
3630         * UIProcess/WebPageProxy.h:
3631
3632         Instead of executing a "SelectAll" editing command using the generic WebPage::executeEditCommand method,
3633         introduce a separate method for selectAll that executes the "SelectAll" edit command and then does some
3634         platform-specific work. See platformDidSelectAll.
3635
3636         * UIProcess/ios/WKContentViewInteraction.mm:
3637         (-[WKContentView selectAllForWebView:]):
3638         * WebProcess/WebPage/WebPage.cpp:
3639         (WebKit::WebPage::selectAll):
3640         (WebKit::WebPage::shouldDispatchSyntheticMouseEventsWhenModifyingSelection const):
3641
3642         Add a helper method to determine whether the quirk should be enabled.
3643
3644         (WebKit::WebPage::platformDidSelectAll):
3645         * WebProcess/WebPage/WebPage.h:
3646         * WebProcess/WebPage/WebPage.messages.in:
3647         * WebProcess/WebPage/ios/WebPageIOS.mm:
3648         (WebKit::elementRectInRootViewCoordinates):
3649
3650         Move this function closer to the top of the file so that it can be used in
3651         dispatchSyntheticMouseEventsForSelectionGesture.
3652
3653         (WebKit::WebPage::clearSelection):
3654         (WebKit::WebPage::dispatchSyntheticMouseEventsForSelectionGesture):
3655
3656         Add a helper method to dispatch a synthetic mouse event for a given selection gesture type. Used in several
3657         places in WebPageIOS to synthesize and dispatch mouse events during selection.
3658
3659         (WebKit::WebPage::updateSelectionWithTouches):
3660
3661         When changing the selection with selection handles, fake mousedown when the user first touches down on the
3662         selection handle; mousemove as the user is moving the handle around; and finally, mouseup when the user lets go.
3663
3664         (WebKit::WebPage::extendSelection):
3665         (WebKit::WebPage::platformDidSelectAll):
3666
3667         When tapping "Select All" and/or "Select" in the callout menu, fake a mousedown at the selection start, then a
3668         mousemove at selection end, and finally, a mouseup at selection end.
3669
3670         (WebKit::WebPage::getFocusedElementInformation):
3671
3672 2019-05-08  Alexander Mikhaylenko  <exalm7659@gmail.com>
3673
3674         [GTK] Pinch Zooming has no maximum
3675         https://bugs.webkit.org/show_bug.cgi?id=194865
3676
3677         Reviewed by Michael Catanzaro.
3678
3679         Set maximum zoom to 3.0, reflecting the value on macOS and iOS.
3680
3681         * UIProcess/gtk/GestureController.cpp:
3682         (WebKit::GestureController::ZoomGesture::scaleChanged):
3683
3684 2019-05-08  Rob Buis  <rbuis@igalia.com>
3685
3686         Link prefetch not useful for top-level navigation
3687         https://bugs.webkit.org/show_bug.cgi?id=195623
3688
3689         Reviewed by Youenn Fablet.
3690
3691         Cache cross-domain top-level prefetches in a dedicated cache. When a navigation
3692         to the same url is done within a threshold (5 seconds), reuse the
3693         prefetch cache entry, move it to the disk cache and navigate to
3694         the url, meaning no extra network trip is needed. When not used within
3695         the threshold period, the prefetch entry will be erased using a timer.
3696
3697         * NetworkProcess/NetworkProcess.cpp:
3698         (WebKit::NetworkProcess::lowMemoryHandler):
3699         * NetworkProcess/NetworkResourceLoader.cpp:
3700         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
3701         (WebKit::NetworkResourceLoader::didReceiveResponse):
3702         (WebKit::NetworkResourceLoader::didReceiveBuffer):
3703         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
3704         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const):
3705         * NetworkProcess/NetworkResourceLoader.h:
3706         * NetworkProcess/NetworkSession.h:
3707         (WebKit::NetworkSession::prefetchCache):
3708         (WebKit::NetworkSession::clearPrefetchCache):
3709         * NetworkProcess/cache/PrefetchCache.cpp: Added.
3710         (WebKit::PrefetchCache::Entry::Entry):
3711         (WebKit::PrefetchCache::PrefetchCache):
3712         (WebKit::PrefetchCache::~PrefetchCache):
3713         (WebKit::PrefetchCache::clear):
3714         (WebKit::PrefetchCache::take):
3715         (WebKit::PrefetchCache::store):
3716         (WebKit::PrefetchCache::clearExpiredEntries):
3717         * NetworkProcess/cache/PrefetchCache.h: Added.
3718         (WebKit::PrefetchCache::Entry::releaseBuffer):
3719         * Shared/WebPreferences.yaml:
3720         * Sources.txt:
3721         * WebKit.xcodeproj/project.pbxproj:
3722
3723 2019-05-07  Chris Dumez  <cdumez@apple.com>
3724
3725         Simplify logic to prevent App Nap in WebPage
3726         https://bugs.webkit.org/show_bug.cgi?id=197674
3727
3728         Reviewed by Geoff Garen.
3729
3730         Simplify logic to prevent App Nap in WebPage. We do not need both m_userActivityHysteresis and
3731         m_userActivity since UserActivity is already a HysteresisActivity. We had 2 levels of
3732         HysteresisActivity stacked on top of one another. Also rename "process suppression" to "app nap" as
3733         I find it clearer.
3734
3735         * WebProcess/WebPage/WebPage.cpp:
3736         (WebKit::WebPage::updateThrottleState):
3737         (WebKit::WebPage::mouseEvent):
3738         (WebKit::WebPage::wheelEvent):
3739         (WebKit::WebPage::keyEvent):
3740         (WebKit::WebPage::updatePreferences):
3741         (WebKit::m_userActivityHysteresis): Deleted.
3742         (WebKit::WebPage::updateUserActivity): Deleted.
3743         * WebProcess/WebPage/WebPage.h:
3744
3745 2019-05-07  Carlos Garcia Campos  <cgarcia@igalia.com>
3746
3747         REGRESSION(r244230): Web Automation: use null instead of empty string as success result of scripts when alert is open
3748         https://bugs.webkit.org/show_bug.cgi?id=197655
3749
3750         Reviewed by Devin Rousso.
3751
3752         This regressed in r244230, the case of an alert open while running a script is now handled in WebKit side, but
3753         an empty string is returned as a result, which is not a valid JSON serialized string. That made all user prompts
3754         tests to fail.
3755
3756         * UIProcess/Automation/WebAutomationSession.cpp:
3757         (WebKit::WebAutomationSession::willShowJavaScriptDialog): Use null as script result instead of an empty string.
3758
3759 2019-05-07  Ryan Haddad  <ryanhaddad@apple.com>
3760
3761         Unreviewed, rolling out r245038.
3762
3763         Breaks internal builds.
3764
3765         Reverted changeset:
3766
3767         "Add SPI to set a list of hosts to which to send custom header
3768         fields cross-origin"
3769         https://bugs.webkit.org/show_bug.cgi?id=197397
3770         https://trac.webkit.org/changeset/245038
3771
3772 2019-05-07  Jiewen Tan  <jiewen_tan@apple.com>
3773
3774         [WebAuthN] A new request should always suppress the pending request if any
3775         https://bugs.webkit.org/show_bug.cgi?id=191517
3776         <rdar://problem/46888222>
3777
3778         Reviewed by Brent Fulgham.
3779
3780         Previously we blocked new WebAuthN requests whenever a pending request was in progress
3781         to prevent background tabs from DoS foreground tabs. However, in r244938, the WebAuthN
3782         API was changed to restrict request handling to the focused document. Therefore, we no
3783         longer have a risk of DoS.
3784
3785         Apart from the vanished benefit, this behavoir actually blocks new pages to use
3786         WebAuthN API in the period between [the previous initating page is closed, the pending
3787         request is hanedled/timeout].
3788
3789         Also, it makes sense to have the current focused document preempt the pending request.
3790         Therefore, the policy will be to always cancel any pending requests whenever a new
3791         request is made. This will enforce the policy of handling only one request at a time.
3792
3793         Note that the current implementation doesn't explicitly cancel pending requests in the
3794         Authenticators, which means that we could receive responses from the Authenticator that
3795         were meant for a previous (now cancelled) request. A follow-up patch (see Bug 191523)
3796         will implement an Authenticator feature to support immediate cancellation.
3797
3798         In the meantime, to protect the atomicity of the request/response pair, i.e., preventing an old
3799         response being used for a new request, there are two safeguards:
3800         1) In web process, each request to UI process is paired with an incremental ID, and therefore an old
3801         response from UI process would have a different ID than the current request, which will then be ignored.
3802         2) In UI process, all responses from authenticators will be piped to the main run loop for processing.
3803         Therefore, when the new request comes in, the old response is either processed or waiting in the pipe.
3804         To prevent the latter being processed, the new request will immediately destroy any authenticators bound
3805         to the old response in the current run loop. Hence, in the next run loop when dealing the old response,
3806         the lambda will have no where to hand the response over.
3807
3808         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
3809         (WebKit::AuthenticatorManager::makeCredential):
3810         (WebKit::AuthenticatorManager::getAssertion):
3811         (WebKit::AuthenticatorManager::clearStateAsync):
3812         (WebKit::AuthenticatorManager::clearState):
3813         (WebKit::AuthenticatorManager::timeOutTimerFired):
3814         * UIProcess/WebAuthentication/AuthenticatorManager.h:
3815         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
3816         (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
3817         (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
3818         (WebKit::WebAuthenticatorCoordinatorProxy::requestReply):
3819         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
3820         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in:
3821         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
3822         (WebKit::WebAuthenticatorCoordinator::makeCredential):
3823         (WebKit::WebAuthenticatorCoordinator::getAssertion):
3824         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.messages.in:
3825
3826 2019-05-07  Per Arne Vollan  <pvollan@apple.com>
3827
3828         [macOS] Crash with sandbox error
3829         https://bugs.webkit.org/show_bug.cgi?id=197675
3830         <rdar://problem/50473330>
3831
3832         Reviewed by Geoffrey Garen.
3833
3834         This crash is caused by missing syscall rules in the sandbox.
3835
3836         * WebProcess/com.apple.WebProcess.sb.in:
3837
3838 2019-05-07  Alex Christensen  <achristensen@webkit.org>
3839
3840         Add SPI to set a list of hosts to which to send custom header fields cross-origin
3841         https://bugs.webkit.org/show_bug.cgi?id=197397
3842
3843         Reviewed by Geoff Garen.
3844
3845         * Shared/API/APIObject.h:
3846         * Shared/Cocoa/APIObject.mm:
3847         (API::Object::newObject):
3848         * Shared/WebsitePoliciesData.cpp:
3849         (WebKit::WebsitePoliciesData::decode):
3850         * Shared/WebsitePoliciesData.h:
3851         * SourcesCocoa.txt:
3852         * UIProcess/API/APICustomHeaderFields.h: Added.
3853         * UIProcess/API/APIWebsitePolicies.cpp:
3854         (API::WebsitePolicies::WebsitePolicies):
3855         (API::WebsitePolicies::copy const):
3856         (API::WebsitePolicies::data):
3857         * UIProcess/API/APIWebsitePolicies.h:
3858         * UIProcess/API/C/WKWebsitePolicies.cpp:
3859         (WKWebsitePoliciesCopyCustomHeaderFields):
3860         (WKWebsitePoliciesSetCustomHeaderFields):
3861         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
3862         (-[WKWebpagePreferences _customHeaderFields]):
3863         (-[WKWebpagePreferences _setCustomHeaderFields:]):
3864         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
3865         * UIProcess/API/Cocoa/_WKCustomHeaderFields.h: Added.
3866         * UIProcess/API/Cocoa/_WKCustomHeaderFields.mm: Added.
3867         (-[_WKCustomHeaderFields init]):
3868         (-[_WKCustomHeaderFields dealloc]):
3869         (-[_WKCustomHeaderFields fields]):
3870         (-[_WKCustomHeaderFields setFields:]):
3871         (-[_WKCustomHeaderFields thirdPartyDomains]):
3872         (-[_WKCustomHeaderFields setThirdPartyDomains:]):
3873         (-[_WKCustomHeaderFields _apiObject]):
3874         * UIProcess/API/Cocoa/_WKCustomHeaderFieldsInternal.h: Added.
3875         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
3876         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
3877         (-[_WKWebsitePolicies customHeaderFields]): Deleted.
3878         (-[_WKWebsitePolicies setCustomHeaderFields:]): Deleted.
3879         * UIProcess/Cocoa/WebViewImpl.h:
3880         * UIProcess/Cocoa/WebViewImpl.mm:
3881         (WebKit::WebViewImpl::takeFocus):
3882         (WebKit::WebViewImpl::accessibilityAttributeValue):
3883         * WebKit.xcodeproj/project.pbxproj:
3884
3885 2019-05-07  Adrian Perez de Castro  <aperez@igalia.com>
3886
3887         [GTK][WPE] Cannot build documentation with gtk-doc
3888         https://bugs.webkit.org/show_bug.cgi?id=197663
3889
3890         Reviewed by Philippe Normand.
3891
3892         * UIProcess/API/glib/WebKitSettings.cpp:
3893         (webkit_settings_class_init): Escape content which gets wrongly interpreted as
3894         SGML tags by gtk-doc as Markdown preformatted content, which fits well for the
3895         tag names in the documentation for the WebKitSettings:enable-media property.
3896
3897 2019-05-07  John Wilander  <wilander@apple.com>
3898
3899         Storage Access API: Make two changes requested by developers and complete refactoring and cleanup
3900         https://bugs.webkit.org/show_bug.cgi?id=197648
3901         <rdar://problem/50527493>
3902
3903         Reviewed by Chris Dumez.
3904
3905         Developers have requested two minor changes to the Storage Access API:
3906         - Only consume the user gesture when the user explicitly denies access.
3907         - Make document.hasStorageAccess() return true instead of false when the feature is off.
3908
3909         In addition to this, we have refactoring and cleanup to do. Namely:
3910         - Make use of WebCore::RegistrableDomain all the way.
3911         - Remove dead code in WebKit::NetworkProcess since the calls now go through NetworkConnectionToWebProcess.
3912         - Introduce boolean enums for state handling.
3913         - Break out the Storage Access API functionality into a supplement of WebCore::Document.
3914
3915         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3916         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
3917         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
3918         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
3919         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
3920         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
3921         (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt const):
3922             These changes are due to the new enums WebCore::StorageAccessWasGranted and
3923             WebCore::StorageAccessPromptWasShown.
3924         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
3925         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3926         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
3927         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
3928         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess):
3929         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
3930         (WebKit::ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt):
3931             These changes are due to the new enums WebCore::StorageAccessWasGranted and
3932             WebCore::StorageAccessPromptWasShown.
3933         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
3934         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
3935             These changes are due to the new enums WebCore::StorageAccessWasGranted and
3936             WebCore::StorageAccessPromptWasShown.
3937         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3938         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
3939         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
3940         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
3941             These changes are due to the new enums WebCore::StorageAccessWasGranted and
3942             WebCore::StorageAccessPromptWasShown.
3943         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted): Deleted.
3944             This function is now no longer exposed and its functionality could be folded into
3945             the existing WebResourceLoadStatisticsStore::requestStorageAccess() which is more
3946             clearly named.
3947         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3948         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3949         (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
3950         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
3951             These changes are due to the new enums WebCore::StorageAccessWasGranted and
3952             WebCore::StorageAccessPromptWasShown.
3953         * NetworkProcess/NetworkConnectionToWebProcess.h:
3954         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3955         * NetworkProcess/NetworkProcess.cpp:
3956         (WebKit::NetworkProcess::hasStorageAccessForFrame): Deleted.
3957         (WebKit::NetworkProcess::hasStorageAccess): Deleted.
3958         (WebKit::NetworkProcess::requestStorageAccess): Deleted.
3959         (WebKit::NetworkProcess::requestStorageAccessGranted): Deleted.
3960         (WebKit::NetworkProcess::grantStorageAccess): Deleted.
3961         (WebKit::NetworkProcess::removeAllStorageAccess): Deleted.
3962             These functions were left behind in the move of ITP to the network process.
3963             This communication goes through WebKit::NetworkConnectionToWebProcess since a while back.
3964         * NetworkProcess/NetworkProcess.h:
3965         * NetworkProcess/NetworkProcess.messages.in:
3966         * Scripts/webkit/messages.py:
3967             Instructions for derived IPC code on how to include the new enums
3968             WebCore::StorageAccessWasGranted and WebCore::StorageAccessPromptWasShown.
3969         * UIProcess/Network/NetworkProcessProxy.cpp:
3970         (WebKit::NetworkProcessProxy::hasStorageAccessForFrame): Deleted.
3971         (WebKit::NetworkProcessProxy::hasStorageAccess): Deleted.
3972         (WebKit::NetworkProcessProxy::requestStorageAccess): Deleted.
3973         (WebKit::NetworkProcessProxy::grantStorageAccess): Deleted.
3974         (WebKit::NetworkProcessProxy::removeAllStorageAccess): Deleted.
3975             These functions were left behind in the move of ITP to the network process.
3976             This communication goes through WebKit::NetworkConnectionToWebProcess since a while back.
3977         * UIProcess/Network/NetworkProcessProxy.h:
3978         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3979         (WebKit::WebsiteDataStore::hasStorageAccess): Deleted.