[GTK] Implement connected and disconnected events of GAMEPAD API with libmanette
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2020-05-20  ChangSeok Oh  <changseok@webkit.org>
2
3         [GTK] Implement connected and disconnected events of GAMEPAD API with libmanette
4         https://bugs.webkit.org/show_bug.cgi?id=133854
5
6         Reviewed by Carlos Garcia Campos.
7
8         This patch brings initial GAMEPAD API support to the gtk port. We use libmanette,
9         a simple GObject game controller library to handle gamepad connection and input.
10
11         * SourcesGTK.txt:
12         * UIProcess/Gamepad/UIGamepadProvider.cpp: Add a build flag to void default interface
13         * UIProcess/Gamepad/gtk/UIGamepadProviderGtk.cpp: Added to retrieve WebPageProxy to which
14           a gamepad connects. The returned WebPageProxy handles input events from the gamepad.
15         (WebKit::getWebPageProxy):
16         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
17         * UIProcess/Gamepad/manette/UIGamepadProviderManette.cpp: Added.
18         (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider):
19         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
20         (WebKit::UIGamepadProvider::platformStopMonitoringInput):
21         (WebKit::UIGamepadProvider::platformStartMonitoringInput):
22
23 2020-05-20  Kate Cheney  <katherine_cheney@apple.com>
24
25         Support operating dates in ResourceLoadStatisticsDatabaseStore
26         https://bugs.webkit.org/show_bug.cgi?id=212034
27         <rdar://problem/63349242>
28
29         Reviewed by Brent Fulgham.
30
31         Tests: http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-database.html
32                http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed.html
33                http/tests/resourceLoadStatistics/operating-dates-all-website-data-removed-database.html
34                http/tests/resourceLoadStatistics/operating-dates-all-website-data-removed.html
35
36         Patch to support Operating Dates in the ResourceLoadStatisticsDatabaseStore.
37         Moves functions out of ResourceLoadStatisticsStore now that each store
38         needs its own implementation.
39
40         Adds a new function for testing which inserts an expired statistic
41         and makes sure the proper behavior occurs depending on additional
42         parameters.
43
44         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
45         (WebKit::createTableQueries):
46         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
47         (WebKit::ResourceLoadStatisticsDatabaseStore::checkForMissingTablesInSchema):
48         (WebKit::ResourceLoadStatisticsDatabaseStore::createUniqueIndices):
49         (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
50         (WebKit::ResourceLoadStatisticsDatabaseStore::getLeastRecentOperatingDate):
51         (WebKit::ResourceLoadStatisticsDatabaseStore::mergeOperatingDates):
52         (WebKit::ResourceLoadStatisticsDatabaseStore::includeTodayAsOperatingDateIfNecessary):
53         (WebKit::ResourceLoadStatisticsDatabaseStore::hasStatisticsExpired const):
54         (WebKit::ResourceLoadStatisticsDatabaseStore::insertExpiredStatisticForTesting):
55         Migrated Operating Dates functions from ResourceLoadStatisticsStore and implemented
56         them using SQLite instead of a vector. Functionality is
57         identical to the original in-memory implementation.
58
59         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
60         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
61         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
62         (WebKit::ResourceLoadStatisticsMemoryStore::mergeOperatingDates):
63         (WebKit::ResourceLoadStatisticsMemoryStore::includeTodayAsOperatingDateIfNecessary):
64         (WebKit::ResourceLoadStatisticsMemoryStore::hasStatisticsExpired const):
65         (WebKit::ResourceLoadStatisticsMemoryStore::insertExpiredStatisticForTesting):
66         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
67         Migrated Operating Dates functions from ResourceLoadStatisticsStore
68         now that the database store does not use them.
69
70         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp:
71         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
72         Spelling error.
73
74         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
75         (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
76         (WebKit::ResourceLoadStatisticsStore::updateCookieBlockingForDomains):
77         (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const): Deleted.
78         (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates): Deleted.
79         (WebKit::ResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary): Deleted.
80         (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const): Deleted.
81         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
82         (WebKit::OperatingDate::year const):
83         (WebKit::OperatingDate::month const):
84         (WebKit::OperatingDate::monthDay const):
85         These functions should be public now that they are needed outside
86         of this file after migrating OperatingDates functions.
87
88         (WebKit::ResourceLoadStatisticsStore::parameters const):
89         (WebKit::ResourceLoadStatisticsStore::operatingDates const): Deleted.
90         (WebKit::ResourceLoadStatisticsStore::clearOperatingDates): Deleted.
91         Moved OperatingDates functions to the memory store. Moved
92         operatingDatesWindow constexpr variables to the header file so that
93         the database and memory stores can both use them.
94
95         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
96         (WebKit::WebResourceLoadStatisticsStore::insertExpiredStatisticForTesting):
97         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
98         * NetworkProcess/NetworkProcess.cpp:
99         (WebKit::NetworkProcess::insertExpiredStatisticForTesting):
100         * NetworkProcess/NetworkProcess.h:
101         * NetworkProcess/NetworkProcess.messages.in:
102         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
103         (WKWebsiteDataStoreSetStatisticsExpiredStatistic):
104         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
105         * UIProcess/Network/NetworkProcessProxy.cpp:
106         (WebKit::NetworkProcessProxy::insertExpiredStatisticForTesting):
107         * UIProcess/Network/NetworkProcessProxy.h:
108         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
109         (WebKit::WebsiteDataStore::mergeStatisticForTesting):
110         (WebKit::WebsiteDataStore::insertExpiredStatisticForTesting):
111         * UIProcess/WebsiteData/WebsiteDataStore.h:
112         Function to add expired statistic to the ITP store.
113
114 2020-05-20  Chris Dumez  <cdumez@apple.com>
115
116         Deprecate WKBundlePageSetPolicyClient() Injected bundle C API
117         https://bugs.webkit.org/show_bug.cgi?id=212166
118
119         Reviewed by Alex Christensen.
120
121         Deprecate WKBundlePageSetPolicyClient() Injected bundle C API. Approving navigations from
122         the injected bundle can lead to WebProcess terminations like in <rdar://problem/60340647>
123         because the WebProcess is not in a position to do sandbox checks when navigating to file
124         URLs.
125
126         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
127
128 2020-05-20  Simon Fraser  <simon.fraser@apple.com>
129
130         Plumb the display's nominal refresh rate down to ScrollingTree for use in scroll synchronization
131         https://bugs.webkit.org/show_bug.cgi?id=212159
132
133         Reviewed by Tim Horton.
134
135         Plumb an Optional<unsigned> down windowScreenDidChange, which contains the nominal
136         display refresh rate (as frames per second) if available. On macOS, we get this
137         from CVDisplayLinkGetNominalOutputVideoRefreshPeriod().
138
139         To read it, WebProcessPool::nominalFramesPerSecondForDisplay() makes a DisplayLink
140         that doesn't get any observers, but that DisplayLink will very likely get used
141         as soon as we schedule a rendering update.
142
143         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
144         (WebKit::WebProcessPool::nominalFramesPerSecondForDisplay):
145         * UIProcess/Cocoa/WebViewImpl.mm:
146         (WebKit::WebViewImpl::windowDidChangeScreen):
147         * UIProcess/WebPageProxy.cpp:
148         (WebKit::WebPageProxy::windowScreenDidChange):
149         * UIProcess/WebPageProxy.h:
150         * UIProcess/WebProcessPool.h:
151         * UIProcess/mac/DisplayLink.cpp:
152         (WebKit::DisplayLink::DisplayLink):
153         (WebKit::DisplayLink::nominalFramesPerSecond const):
154         * UIProcess/mac/DisplayLink.h:
155         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
156         (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
157         * WebProcess/WebPage/WebPage.cpp:
158         (WebKit::WebPage::windowScreenDidChange):
159         * WebProcess/WebPage/WebPage.h:
160         * WebProcess/WebPage/WebPage.messages.in:
161
162 2020-05-20  Myles C. Maxfield  <mmaxfield@apple.com>
163
164         [iPadOS] -webkit-text-size-adjust:percentage doesn't work in native apps
165         https://bugs.webkit.org/show_bug.cgi?id=212122
166         <rdar://problem/54560875>
167
168         Reviewed by Wenson Hsieh.
169
170         * Shared/WebsitePoliciesData.cpp:
171         (WebKit::WebsitePoliciesData::encode const):
172         (WebKit::WebsitePoliciesData::decode):
173         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
174         * Shared/WebsitePoliciesData.h:
175         * UIProcess/API/APIWebsitePolicies.cpp:
176         (API::WebsitePolicies::copy const):
177         (API::WebsitePolicies::data):
178         * UIProcess/API/APIWebsitePolicies.h:
179         * UIProcess/ios/WebPageProxyIOS.mm:
180         (WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies):
181
182 2020-05-20  Kate Cheney  <katherine_cheney@apple.com>
183
184         REGRESSION (r261892) [ Mac Debug ] 4 API tests failing related to ResourceLoadStatistics
185         https://bugs.webkit.org/show_bug.cgi?id=212153
186         <rdar://problem/63452541>
187
188         Reviewed by Sihui Liu.
189
190         Accidentally deleted necessary reset() call for a SQLite statement
191         when converting stored statements to SQLiteStatementAutoResetScope in
192         https://trac.webkit.org/changeset/261892/webkit.
193
194         This statement is used in a loop with multiple bind() calls so it must be reset.
195
196         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
197         (WebKit::ResourceLoadStatisticsDatabaseStore::checkForMissingTablesInSchema):
198
199 2020-05-20  Eric Carlson  <eric.carlson@apple.com>
200
201         Update some media logging
202         https://bugs.webkit.org/show_bug.cgi?id=212109
203         <rdar://problem/63424816>
204
205         Unreviewed, remove a change unintentionally included in r261899.
206
207         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
208         (-[WKFullScreenWindowController _interactivePinchDismissChanged:]):
209
210 2020-05-20  Andy Estes  <aestes@apple.com>
211
212         [Mac] UI processes spin when creating the "Share" context menu item
213         https://bugs.webkit.org/show_bug.cgi?id=212137
214         <rdar://problem/54498394>
215
216         Reviewed by Wenson Hsieh.
217
218         On Mac, WebKit has been using the +[NSMenuItem standardShareMenuItemForItems:] SPI to create
219         the "Share" context submenu and menu item. This call performs synchronous IPC and can result
220         in UI process spins.
221
222         Where available, switch to using the asynchronous
223         -[NSSharingServicePicker getMenuWithCompletion:] SPI instead. This method only creates the
224         submenu, not the menu item, so when using this new method we must create the "Share" menu
225         item ourselves.
226
227         * UIProcess/mac/WebContextMenuProxyMac.h:
228         * UIProcess/mac/WebContextMenuProxyMac.mm:
229         (WebKit::getStandardShareMenuItem):
230         (WebKit::WebContextMenuProxyMac::getShareMenuItem):
231         (WebKit::WebContextMenuProxyMac::getContextMenuFromItems):
232         (WebKit::WebContextMenuProxyMac::getContextMenuItem):
233         (WebKit::WebContextMenuProxyMac::showContextMenuWithItems):
234         (WebKit::WebContextMenuProxyMac::createShareMenuItem): Deleted.
235         (WebKit::WebContextMenuProxyMac::createContextMenuFromItems): Deleted.
236         (WebKit::WebContextMenuProxyMac::createContextMenuItem): Deleted.
237
238 2020-05-20  Carlos Garcia Campos  <cgarcia@igalia.com>
239
240         Unreviewed. Fix GTK4 build with GTK 3.98.4
241
242         * PlatformGTK.cmake:
243         * UIProcess/API/gtk/WebKitPrintOperation.cpp:
244         (webkitPrintOperationRunDialog):
245         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
246         (webkitWebViewBaseAddDialog):
247         (webkitWebViewBaseRemoveChild):
248         (webkitWebViewBaseContainerForall):
249         (webkitWebViewBaseAddWebInspector):
250         (webkitWebViewBaseRemoveWebInspector):
251         (webkitWebViewBaseDispose):
252         (webkitWebViewBaseSizeAllocate):
253         (webkitWebViewBaseConstructed):
254         (webkit_web_view_base_class_init):
255         * UIProcess/API/gtk/WebKitWebViewBase.h: Removed.
256         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
257         * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp:
258         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
259         (WebKit::RemoteWebInspectorProxy::platformSave):
260         * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp:
261         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
262         (WebKit::WebInspectorProxy::platformAttach):
263         (WebKit::WebInspectorProxy::platformDetach):
264         (WebKit::WebInspectorProxy::platformSave):
265         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
266         (WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk):
267
268 2020-05-12  Carlos Garcia Campos  <cgarcia@igalia.com>
269
270         [GTK4] Add support for drag and drop operations
271         https://bugs.webkit.org/show_bug.cgi?id=211779
272
273         Reviewed by Adrian Perez de Castro.
274
275         * UIProcess/API/gtk/DragSource.h:
276         * UIProcess/API/gtk/DragSourceGtk4.cpp:
277         (WebKit::DragSource::begin):
278         * UIProcess/API/gtk/DropTarget.h:
279         * UIProcess/API/gtk/DropTargetGtk4.cpp:
280         (WebKit::DropTarget::DropTarget):
281         (WebKit::DropTarget::~DropTarget):
282         (WebKit::DropTarget::accept):
283         (WebKit::DropReadAsyncData::DropReadAsyncData):
284         (WebKit::DropTarget::loadData):
285         (WebKit::DropTarget::didLoadData):
286         (WebKit::DropTarget::enter):
287         (WebKit::DropTarget::update):
288         (WebKit::DropTarget::didPerformAction):
289         (WebKit::DropTarget::leave):
290         (WebKit::DropTarget::drop):
291
292 2020-05-19  Wenson Hsieh  <wenson_hsieh@apple.com>
293
294         REGRESSION (r258919): fast/events/ios/key-events-comprehensive/key-events-control tests are failing
295         https://bugs.webkit.org/show_bug.cgi?id=212124
296         <rdar://problem/60893744>
297
298         Reviewed by Tim Horton.
299
300         After the changes in r258919, WKContentView's text input traits report that we're in a single line input, even
301         when there is no editable focused element. This prevents UIKit from allowing WebKit to handle the `CTRL + M`
302         key command, which is interpreted at the system level as inserting a line break in a multi-line editable area.
303
304         It seems odd to consider ourselves in a single line input when there isn't even an editable element focused
305         element; for now, we can fix these failing tests by just going with the default value for the text input traits'
306         `setIsSingleLineDocument` property, but not explicitly setting it to either `NO` or `YES` when no element is
307         focused.
308
309         * UIProcess/ios/WKContentViewInteraction.mm:
310         (-[WKContentView textInputTraits]):
311
312 2020-05-19  Sam Weinig  <weinig@apple.com>
313
314         Remove almost always incorrect Color::getRGBA
315         https://bugs.webkit.org/show_bug.cgi?id=212059
316
317         Reviewed by Darin Adler and Simon Fraser.
318
319         * UIProcess/API/wpe/WebKitColor.cpp:
320         (webkitColorFillFromWebCoreColor):
321         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
322         (WebKit::ViewGestureController::beginSwipeGesture):
323         * WebProcess/WebPage/WebFrame.cpp:
324         (WebKit::WebFrame::getDocumentBackgroundColor):
325         Replace Color::getRGBA with Color::toSRGBAComponentsLossy()
326
327 2020-05-19  Simon Fraser  <simon.fraser@apple.com>
328
329         Use an ObjectIdentifier<> for DisplayLink observer IDs
330         https://bugs.webkit.org/show_bug.cgi?id=212112
331
332         Reviewed by Per Arne Vollan.
333
334         Replace unsigned observerID with DisplayLinkObserverID, which is a typesafe ObjectIdentifier<>.
335
336         Use PlatformDisplayID in more places.
337
338         * Scripts/webkit/messages.py:
339         * Shared/DisplayLinkObserverID.h: Copied from Source/WebKit/UIProcess/mac/DisplayLink.h.
340         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
341         (WebKit::WebProcessPool::startDisplayLink):
342         (WebKit::WebProcessPool::stopDisplayLink):
343         * UIProcess/WebProcessPool.h:
344         * UIProcess/WebProcessProxy.h:
345         * UIProcess/WebProcessProxy.messages.in:
346         * UIProcess/mac/DisplayLink.cpp:
347         (WebKit::DisplayLink::addObserver):
348         (WebKit::DisplayLink::removeObserver):
349         * UIProcess/mac/DisplayLink.h:
350         * UIProcess/mac/WebProcessProxyMac.mm:
351         (WebKit::WebProcessProxy::startDisplayLink):
352         (WebKit::WebProcessProxy::stopDisplayLink):
353         * WebKit.xcodeproj/project.pbxproj:
354         * WebProcess/WebPage/mac/DrawingAreaMac.cpp:
355         (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
356
357 2020-05-19  Alex Christensen  <achristensen@webkit.org>
358
359         Add _WKDownloadDelegate callback including totalBytesWritten
360         https://bugs.webkit.org/show_bug.cgi?id=212110
361         <rdar://problem/63358981>
362
363         Reviewed by Geoffrey Garen.
364
365         Without this new callback, after resuming a download, a client has no way to tell whether the download was successfully
366         resumed by a server that has proper etag and range request support or whether the download began at the beginning again.
367         A client was guessing that the download did not restart, causing incorrect reported download sizes when the download did restart.
368         Luckily, the data on disk was not corrupted, just the UI.  This allows us to fix the UI.
369
370         Testing covered by expanding the API test for resuming downloads.
371
372         * NetworkProcess/Downloads/Download.cpp:
373         (WebKit::Download::didReceiveData):
374         * NetworkProcess/Downloads/Download.h:
375         * NetworkProcess/NetworkDataTaskBlob.cpp:
376         (WebKit::NetworkDataTaskBlob::writeDownload):
377         * NetworkProcess/NetworkDataTaskBlob.h:
378         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
379         (-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]):
380         * UIProcess/API/APIDownloadClient.h:
381         (API::DownloadClient::didReceiveData):
382         * UIProcess/API/C/WKContext.cpp:
383         (WKContextSetDownloadClient):
384         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
385         * UIProcess/Cocoa/DownloadClient.h:
386         * UIProcess/Cocoa/DownloadClient.mm:
387         (WebKit::DownloadClient::DownloadClient):
388         (WebKit::DownloadClient::didReceiveResponse):
389         (WebKit::DownloadClient::didReceiveData):
390         * UIProcess/Downloads/DownloadProxy.cpp:
391         (WebKit::DownloadProxy::didReceiveData):
392         * UIProcess/Downloads/DownloadProxy.h:
393         (WebKit::DownloadProxy::expectedContentLength const): Deleted.
394         (WebKit::DownloadProxy::setExpectedContentLength): Deleted.
395         (WebKit::DownloadProxy::bytesLoaded const): Deleted.
396         (WebKit::DownloadProxy::setBytesLoaded): Deleted.
397         * UIProcess/Downloads/DownloadProxy.messages.in:
398
399 2020-05-19  Kate Cheney  <katherine_cheney@apple.com>
400
401         ITP database should finalize all prepared statements before closing
402         https://bugs.webkit.org/show_bug.cgi?id=211929
403         <rdar://problem/63246945>
404
405         Reviewed by John Wilander.
406
407         No new tests, behavior confirmed by existing tests.
408
409         Convert all SQLite statement objects to be unique pointers to better
410         manage the lifetime of each statement object. Only initialize and
411         prepare an object when it is needed instead of preparing all objects
412         at once. Set each statement to null before closing the database
413         because ~SQLiteStatement() will finalize the statement.
414
415         This patch removes all reset() commands now that we initialize
416         each statement using SQLiteStatementAutoResetScope.
417
418         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
419         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
420         (WebKit::ResourceLoadStatisticsDatabaseStore::close):
421         (WebKit::ResourceLoadStatisticsDatabaseStore::getScopedStatement const):
422         Function to initialize and prepare a statement.
423
424         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationship):
425         This function is not used and can be deleted.
426
427         (WebKit::ResourceLoadStatisticsDatabaseStore::checkForMissingTablesInSchema):
428         (WebKit::ResourceLoadStatisticsDatabaseStore::isMigrationNecessary):
429         (WebKit::ResourceLoadStatisticsDatabaseStore::openAndUpdateSchemaIfNecessary):
430         (WebKit::ResourceLoadStatisticsDatabaseStore::isEmpty const):
431         (WebKit::ResourceLoadStatisticsDatabaseStore::destroyStatements):
432         (WebKit::ResourceLoadStatisticsDatabaseStore::insertObservedDomain):
433         (WebKit::ResourceLoadStatisticsDatabaseStore::relationshipExists const):
434         (WebKit::ResourceLoadStatisticsDatabaseStore::domainID const):
435         (WebKit::ResourceLoadStatisticsDatabaseStore::merge):
436         (WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistic):
437         (WebKit::CompletionHandler<void):
438         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements): Deleted.
439         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
440         Updated all statement variables to end with "Statement" to follow the
441         established pattern.
442
443         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
444         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
445
446 2020-05-19  Per Arne Vollan  <pvollan@apple.com>
447
448         [iOS] Fix message filter sandbox violation
449         https://bugs.webkit.org/show_bug.cgi?id=212100
450         <rdar://problem/63407155>
451
452         Reviewed by Andy Estes.
453
454         A message needs to be added to the message filter in the WebContent sandbox on iOS.
455
456         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
457
458 2020-05-19  Kate Cheney  <katherine_cheney@apple.com>
459
460         Revert WebKitTestRunner to reset ITP to the memory store between all tests.
461         https://bugs.webkit.org/show_bug.cgi?id=212094
462         <rdar://problem/63405806>
463
464         Reviewed by Chris Dumez.
465
466         Changing this in https://bugs.webkit.org/show_bug.cgi?id=211637 caused
467         test flakiness.
468
469         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
470         (WKWebsiteDataStoreStatisticsResetToConsistentState):
471
472 2020-05-19  Simon Fraser  <simon.fraser@apple.com>
473
474         Push a PlatformDisplayID to scrolling trees, and allow the scrolling thread to get displayDidRefresh notifications
475         https://bugs.webkit.org/show_bug.cgi?id=211034
476
477         Reviewed by Sam Weinig.
478
479         Prep work for webkit.org/b210884.
480
481         Have EventDispatcher call displayDidRefresh() on each scrolling tree it knows about. It calls this
482         on the EventDispatcher thread; the scrolling tree is responsible for bouncing that to the scrolling thread.
483
484         * WebProcess/WebPage/EventDispatcher.cpp:
485         (WebKit::EventDispatcher::displayDidRefreshOnScrollingThread):
486         (WebKit::EventDispatcher::displayWasRefreshed):
487         * WebProcess/WebPage/EventDispatcher.h:
488
489 2020-05-19  Wenson Hsieh  <wenson_hsieh@apple.com>
490
491         [macOS] Drag and drop within a contenteditable area duplicates attachment-backed images
492         https://bugs.webkit.org/show_bug.cgi?id=212075
493         <rdar://problem/62434146>
494
495         Reviewed by Andy Estes.
496
497         When the attachment API is enabled, starting a drag on an attachment-element-backed image within a
498         contenteditable area sometimes causes the ranged selection to collapse. This is because `WebViewImpl::startDrag`
499         has a separate codepath for starting a drag with attachment metadata that doesn't invoke `NSView`'s deprecated
500         `-dragImage:at:offset:event:pasteboar:source:slideBack:` method, but instead uses
501         `-beginDraggingSessionWithItems:event:source:`. While the former spins the runloop until the end of the drag
502         session, the latter does not and returns immediately after beginning the drag. As a result,
503         `WebPageProxy::didStartDrag()` is actually invoked after the drag ends when dragging non-attachment content,
504         whereas `WebPageProxy::didStartDrag()` is invoked immediately after beginning the drag when starting a drag in
505         an attachment or attachment-backed image element.
506
507         This call to `didStartDrag()` is used to inform the web process that dragging has begun, and sets the
508         `m_isStartingDrag` flag on `WebPage` to false. As a result, `m_isStartingDrag` is true over the course of the
509         drag session when dragging non-attachment elements, but it's only true while starting the drag when dragging
510         attachments. This flag is consulted in `WebPage::mouseEvent()` to determine whether we should avoid handling the
511         incoming mouse event when beginning a drag. This prevents these incoming mouse events from triggering selection
512         changes while dragging (for more details, refer to <http://trac.webkit.org/r176687>).
513
514         Now, if we combine this with the fact that mouse events can be queued up in the UI process (refer to
515         <https://trac.webkit.org/r230817>), it's possible to end up handling these queued mouse events in the web
516         process after `m_isStartingDrag` has been set back to false when dragging an attachment. This doesn't happen
517         when dragging non-attachment content, since we don't call `didStartDrag()` until the drag has already ended, so
518         any queued mouse events are sent to the web process and immediately dropped on the floor since
519         `m_isStartingDrag` is true.
520
521         To address this, we make a couple of minor adjustments:
522
523         1.  Invoke `didStartDrag()` right before calling into `-dragImage:at:offset:event:pasteboar:source:slideBack:`,
524             so that we don't wait until the drag ends to set `m_isStartingDrag` to false. This makes the behavior of
525             both codepaths for starting a drag (attachment and non-attachment) consistent, and also makes it consistent
526             with iOS.
527
528         2.  In `didStartDrag()`, discard any queued mouse events to prevent them from being handled by the page (e.g.
529             causing the selection to change immediately after starting the drag). We already have identical logic to do
530             this when showing a context menu, so we can factor this out into a private `WebPageProxy` helper and call it
531             from both places.
532
533         Test: WKAttachmentTestsMac.DraggingAttachmentBackedImagePreservesRangedSelection
534
535         * UIProcess/Cocoa/WebViewImpl.mm:
536         (WebKit::WebViewImpl::startDrag):
537
538         Invoke `didStartDrag()` earlier when starting a drag using the deprecated method, such that we don't wait until
539         the drag ends to set `m_isStartingDrag` to false in the web process.
540
541         * UIProcess/WebPageProxy.cpp:
542         (WebKit::WebPageProxy::discardQueuedMouseEvents):
543
544         Refactor logic to discard all queued mouse events into a separate private helper.
545
546         (WebKit::WebPageProxy::didStartDrag):
547
548         Use the above helper to empty queued mouse events when starting a drag.
549
550         (WebKit::WebPageProxy::showContextMenu):
551         * UIProcess/WebPageProxy.h:
552
553 2020-05-19  Andy Estes  <aestes@apple.com>
554
555         [Apple Pay] Add testing and logging for ApplePaySetup
556         https://bugs.webkit.org/show_bug.cgi?id=211972
557         <rdar://problem/63291965>
558
559         Reviewed by Alex Christensen.
560
561         * Shared/ApplePay/PaymentSetupConfiguration.mm:
562         (WebKit::toPlatformConfiguration):
563         (WebKit::PaymentSetupConfiguration::PaymentSetupConfiguration):
564         * Shared/ApplePay/PaymentSetupConfigurationWebKit.h:
565         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
566         (WebKit::WebPaymentCoordinator::getSetupFeatures):
567         (WebKit::WebPaymentCoordinator::beginApplePaySetup):
568         * WebProcess/ApplePay/WebPaymentCoordinator.h:
569
570 2020-05-19  Brent Fulgham  <bfulgham@apple.com>
571
572         REGRESSION(r243149): createMediaElementSource not working
573         https://bugs.webkit.org/show_bug.cgi?id=211394
574         <rdar://problem/62866132>
575
576         Reviewed by Per Arne Vollan.
577
578         I removed access to some Audio services in r243149, because we believed they were already
579         blocked by a global deny command. However, Sandbox rules override generic rules with
580         explicit rules, so the imported sandbox rules were not being blocked.
581
582         This patch re-adds the rules needed to support these audio routines on iOS hardware.
583
584         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
585         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
586         (WebKit::mediaRelatedMachServices):
587
588 2020-05-19  Chris Dumez  <cdumez@apple.com>
589
590         [iOS] Port Foreground process assertion to RunningBoard
591         https://bugs.webkit.org/show_bug.cgi?id=211795
592         <rdar://problem/61831863>
593
594         Reviewed by Geoffrey Garen.
595
596         Port Foreground process assertion to RunningBoard now that <rdar://problem/62614429>
597         has been fixed.
598
599         * Configurations/WebKit.xcconfig:
600         * UIProcess/ProcessAssertion.h:
601         * UIProcess/ios/ProcessAssertionIOS.mm:
602         (WebKit::runningBoardNameForAssertionType):
603         (WebKit::ProcessAssertion::ProcessAssertion):
604         (WebKit::ProcessAssertion::~ProcessAssertion):
605         (WebKit::ProcessAssertion::isValid const):
606
607 2020-05-19  Andy Estes  <aestes@apple.com>
608
609         [Apple Pay] Add testing and logging for ApplePaySetup
610         https://bugs.webkit.org/show_bug.cgi?id=211972
611         <rdar://problem/63291965>
612
613         Reviewed by Alex Christensen.
614
615         * Shared/ApplePay/PaymentSetupConfiguration.mm:
616         (WebKit::toPlatformConfiguration):
617         (WebKit::PaymentSetupConfiguration::PaymentSetupConfiguration):
618         * Shared/ApplePay/PaymentSetupConfigurationWebKit.h:
619         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
620         (WebKit::WebPaymentCoordinator::getSetupFeatures):
621         (WebKit::WebPaymentCoordinator::beginApplePaySetup):
622         * WebProcess/ApplePay/WebPaymentCoordinator.h:
623
624 2020-05-19  Michael Catanzaro  <mcatanzaro@gnome.org>
625
626         [GTK] Add WEBKIT_EDITING_COMMAND_PASTE_AS_PLAIN_TEXT
627         https://bugs.webkit.org/show_bug.cgi?id=212038
628
629         Reviewed by Carlos Garcia Campos.
630
631         * UIProcess/API/gtk/WebKitEditingCommands.h:
632         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
633         * UIProcess/API/wpe/WebKitEditingCommands.h:
634         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
635
636 2020-05-18  David Kilzer  <ddkilzer@apple.com>
637
638         Replace TextIndicatorOptions with OptionSet<TextIndicatorOption>
639         <https://webkit.org/b/212051>
640         <rdar://problem/63368556>
641
642         Reviewed by Simon Fraser.
643
644         Use OptionSet<TextIndicatorOption> everywhere
645         TextIndicatorOptions was previously used, plus:
646         - Make TextIndicatorOption an enum class.  Remove
647           "TextIndicatorOption" prefix so TextIndicatorOptionBar becomes
648           TextIndicatorOption::Bar.
649         - Remove TextIndicatorOptionDefault because OptionSet<>
650           initializes to zero.
651         - Replace static variables (including two globals in WebCore)
652           with constexpr variables.
653
654         * Shared/WebCoreArgumentCoders.cpp:
655         (IPC::ArgumentCoder<TextIndicatorData>::encode):
656         (IPC::ArgumentCoder<TextIndicatorData>::decode):
657         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
658         (WebKit::WebPage::dictionaryPopupInfoForRange):
659         * WebProcess/WebPage/FindController.cpp:
660         (WebKit::FindController::updateFindIndicator):
661         * WebProcess/WebPage/ios/FindControllerIOS.mm:
662         * WebProcess/WebPage/ios/WebPageIOS.mm:
663         (WebKit::WebPage::insertDroppedImagePlaceholders):
664         (WebKit::WebPage::computeAndSendEditDragSnapshot):
665         (WebKit::linkIndicatorPositionInformation):
666         * WebProcess/WebPage/mac/WebPageMac.mm:
667         (WebKit::WebPage::performImmediateActionHitTestAtLocation):
668
669 2020-05-18  Andy Estes  <aestes@apple.com>
670
671         http/tests/ssl/applepay/ApplePayInstallmentConfiguration.https.html fails in public SDK builds
672         https://bugs.webkit.org/show_bug.cgi?id=212000
673         <rdar://problem/63323082>
674
675         Reviewed by Youenn Fablet.
676
677         * Configurations/FeatureDefines.xcconfig:
678         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
679         * Shared/WebCoreArgumentCoders.h:
680
681 2020-05-18  Tim Horton  <timothy_horton@apple.com>
682
683         Rare crash under -[WKContentView resignFirstResponderForWebView]
684         https://bugs.webkit.org/show_bug.cgi?id=212050
685         <rdar://problem/60187111>
686
687         Reviewed by Wenson Hsieh.
688
689         * UIProcess/ios/WKContentViewInteraction.mm:
690         (-[WKContentView resignFirstResponderForWebView]):
691         Reorganize this block so that it always takes a strong reference /before/
692         null checking and using the pointer. Also, add a _page null check.
693         This is a speculative fix for an unreproducible low-rate crash.
694
695         In theory the existing time-of-check race here should not be a problem,
696         since WKWebView is supposed to be freed on the main thread, and this code
697         runs on the main thread, but we have ample evidence of WKWebView
698         being freed off the main thread in various clients.
699
700 2020-05-18  David Kilzer  <ddkilzer@apple.com>
701
702         Use default initializers in TextIndicatorData
703         <https://webkit.org/b/212039>
704         <rdar://problem/63355619>
705
706         Reviewed by Alex Christensen.
707
708         * Shared/WebCoreArgumentCoders.cpp:
709         (IPC::ArgumentCoder<TextIndicatorData>::encode):
710         (IPC::ArgumentCoder<TextIndicatorData>::decode):
711         - Switch from decodeEnum() and encodeEnum() to modern
712           equivalents that check for valid enum values.
713
714 2020-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
715
716         Replace uses of +self with +class
717         https://bugs.webkit.org/show_bug.cgi?id=212041
718
719         Reviewed by Darin Adler.
720
721         * Shared/API/Cocoa/_WKFrameHandle.mm:
722         (-[_WKFrameHandle isEqual:]):
723         (-[_WKFrameHandle initWithCoder:]):
724         * Shared/Cocoa/APIObject.mm:
725         (API::Object::newObject):
726         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
727         (-[WKWebViewConfiguration _setAttachmentFileWrapperClass:]):
728         * UIProcess/Cocoa/NavigationState.mm:
729         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
730         * UIProcess/Cocoa/PageClientImplCocoa.mm:
731         (WebKit::PageClientImplCocoa::allocFileWrapperInstance const):
732         (WebKit::PageClientImplCocoa::serializableFileWrapperClasses const):
733         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
734         (+[WKTransformView layerClass]):
735         (+[WKSimpleBackdropView layerClass]): Deleted.
736         (+[WKShapeView layerClass]): Deleted.
737         (-[WKRemoteView initWithFrame:contextID:]): Deleted.
738         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
739         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::~ScrollingTreeScrollingNodeDelegateIOS):
740         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::resetScrollViewDelegate):
741         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollView const):
742         * UIProcess/ios/WKContentViewInteraction.mm:
743         (-[WKContentView selectFormAccessoryPickerRow:]):
744         (-[WKContentView selectFormPopoverTitle]):
745
746 2020-05-18  Alex Christensen  <achristensen@webkit.org>
747
748         WebPageProxy::DidCommitLoadForFrame should use FrameLoadType instead of casting to/from uint32_t for IPC
749         https://bugs.webkit.org/show_bug.cgi?id=212028
750         <rdar://problem/63343021>
751
752         Reviewed by David Kilzer.
753
754         * UIProcess/ProvisionalPageProxy.cpp:
755         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
756         * UIProcess/ProvisionalPageProxy.h:
757         * UIProcess/WebPageProxy.cpp:
758         (WebKit::WebPageProxy::commitProvisionalPage):
759         (WebKit::WebPageProxy::didCommitLoadForFrame):
760         * UIProcess/WebPageProxy.h:
761         * UIProcess/WebPageProxy.messages.in:
762         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
763         (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
764
765 2020-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
766
767         Single selection <select> with <optgroups> shows multiple selected options
768         https://bugs.webkit.org/show_bug.cgi?id=199485
769         <rdar://problem/52757531>
770
771         Reviewed by Megan Gardner.
772
773         Fixes a long-standing bug in WKMultipleSelectPicker. Prior to this patch, we rely on the delegate method
774         `-pickerView:row:column:checked:` to be called twice whenever an item is selected: one time for the item that is
775         no longer checked, and another for the newly checked item. This method is responsible for updating the cached
776         `FocusedElementInformation` that determines the data model for the select menu, with the expectation that the
777         unchecked item would be updated to have `isSelected = false;`, and the new checked item would have `isSelected`
778         `= true;`.
779
780         However, `-pickerView:row:column:checked:` is only called for visible item cells. This means that if the user
781         checks an item, scrolls the select menu items down so that the checked item is offscreen, and then checks a
782         different item, we only get notified that the new item is checked, and as a result, fail to uncheck the previous
783         item.
784
785         To address this, tweak our logic for handling a single select so that when an item is checked, we additionally
786         update the previously checked item to not be selected. Also, fix what seems to be a bug in the logic for
787         updating `_singleSelectionIndex`, which is currently updated even when the item is unchecked. It seems to work
788         out at the moment, because `-pickerView:row:column:checked:` seems to be called with `checked := YES` after the
789         previous item was unchecked (assuming that it was visible).
790
791         Test: fast/forms/ios/no-stale-checked-items-in-select-picker.html
792
793         * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
794         * UIProcess/API/ios/WKWebViewTestingIOS.mm:
795         (-[WKWebView selectFormAccessoryHasCheckedItemAtRow:]):
796         * UIProcess/ios/WKContentViewInteraction.h:
797         * UIProcess/ios/WKContentViewInteraction.mm:
798         (-[WKContentView selectFormAccessoryHasCheckedItemAtRow:]):
799
800         Add plumbing for a new testing hook.
801
802         * UIProcess/ios/forms/WKFormSelectControl.h:
803         * UIProcess/ios/forms/WKFormSelectControl.mm:
804         (-[WKFormSelectControl selectFormAccessoryHasCheckedItemAtRow:]):
805         * UIProcess/ios/forms/WKFormSelectPicker.mm:
806         (-[WKMultipleSelectPicker pickerView:viewForRow:forComponent:reusingView:]):
807         (-[WKMultipleSelectPicker pickerView:row:column:checked:]):
808         (-[WKMultipleSelectPicker selectRow:inComponent:extendingSelection:]):
809
810         Also, fix an existing bug in this testing helper method that crashed the test runner due to calling an
811         unimplemented selector. Instead of trying to invoke `-pickerView:didSelectRow:inComponent:`, we should be using
812         `-pickerView:row:column:checked:` instead for multiple select pickers (which, somewhat confusingly, are still
813         used for single select elements that have `optgroup`s.)
814
815         (-[WKMultipleSelectPicker selectFormAccessoryHasCheckedItemAtRow:]):
816
817 2020-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
818
819         [iOS] Unexpected capitalization of next word after repositioning caret
820         https://bugs.webkit.org/show_bug.cgi?id=211969
821         <rdar://problem/62605526>
822
823         Reviewed by Alex Christensen.
824
825         The changes in r242551 refactored synchronous autocorrection context request logic such that it uses
826         `waitForAndDispatchImmediately` instead of `sendSync`, in order to make it interruptible by unbounded sync IPC
827         sent from the web process. If the UI process receives sync IPC, it will immediately cancel the autocorrection
828         context request (returning an empty context), before proceeding to handle the incoming sync IPC.
829
830         In a more recent version of iOS, other changes around spellchecking have caused the synchronous message
831         `WebPageProxy::checkTextOfParagraph` to be sent from the web process in such a way that it now frequently
832         coincides with the synchronous autocorrection context request being sent from the UI process. The result is that
833         we now frequently end up cancelling autocorrection requests early by responding with empty contexts. This
834         manifests in the keyboard sometimes losing information about its autocapitalization context and believing that
835         it is in an empty text field, which reverts to default autocorrection suggestions and autocapitalizes the
836         software keyboard.
837
838         To fix this, instead of using the `InterruptWaitingIfSyncMessageArrives` option when waiting for the IPC
839         response, add and use a new flag that allows us to process an incoming sync IPC message if we're waiting for
840         the sync message response. We use this new IPC flag when waiting synchronously for HandleAutocorrectionContext.
841
842         Test: editing/selection/ios/changing-selection-does-not-trigger-autocapitalization.html
843
844         * Platform/IPC/Connection.cpp:
845         (IPC::Connection::processIncomingMessage):
846
847         If the new IPC flag is set and the incoming message is synchronous, allow it to immediately dispatch the sync
848         message by enqueueing it and then waking up `m_waitForMessageCondition` so that it can process the message.
849
850         * Platform/IPC/Connection.h:
851         * Platform/spi/ios/UIKitSPI.h:
852         * UIProcess/ios/WKContentViewInteraction.mm:
853         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
854
855         Use `DispatchIncomingSyncMessagesWhileWaiting` instead of `InterruptWaitingIfSyncMessageArrives`.
856
857 2020-05-18  Lauro Moura  <lmoura@igalia.com>
858
859         webkitpy: Update test data after r261776
860         https://bugs.webkit.org/show_bug.cgi?id=212008
861
862         Reviewed by Alex Christensen.
863
864         Covered by existing tests.
865
866         * Scripts/test-legacyMessageReceiver.cpp:
867         * Scripts/test-legacyMessages.h:
868         (Messages::WebPage::DidCreateWebProcessConnection::DidCreateWebProcessConnection):
869         * Scripts/webkit/messages_unittest.py:
870         * Scripts/webkit/test-legacy.messages.in:
871
872 2020-05-18  Carlos Garcia Campos  <cgarcia@igalia.com>
873
874         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.29.1 release
875
876         * gtk/NEWS: Add release notes for 2.29.1.
877
878 2020-05-18  Carlos Garcia Campos  <cgarcia@igalia.com>
879
880         Move iOS files from Source/WebKit/Sources.txt to Source/WebKit/SourcesCocoa.txt
881         https://bugs.webkit.org/show_bug.cgi?id=212014
882
883         Unreviewed. Move platform specific files to the platform sources file.
884
885         * Sources.txt:
886         * SourcesCocoa.txt:
887
888 2020-05-18  Carlos Garcia Campos  <cgarcia@igalia.com>
889
890         [GTK] "ASSERTION FAILED: !m_adoptionIsRequired" when double clicking on a word
891         https://bugs.webkit.org/show_bug.cgi?id=211957
892
893         Reviewed by Adrian Perez de Castro.
894
895         Remove WebSelectionData wrapper since we can just encode/decode WebCore::SelectionData.
896
897         * Shared/WebCoreArgumentCoders.h:
898         * Shared/gtk/ArgumentCodersGtk.cpp:
899         (IPC::ArgumentCoder<SelectionData>::decode): Use modern decoder.
900         * Shared/gtk/ArgumentCodersGtk.h:
901         * Shared/gtk/WebSelectionData.cpp: Removed.
902         * Shared/gtk/WebSelectionData.h: Removed.
903         * SourcesGTK.txt:
904         * UIProcess/API/gtk/DragSource.h:
905         * UIProcess/API/gtk/DragSourceGtk3.cpp:
906         (WebKit::DragSource::DragSource):
907         (WebKit::DragSource::begin):
908         * UIProcess/API/gtk/DragSourceGtk4.cpp:
909         (WebKit::DragSource::begin):
910         * UIProcess/API/gtk/DropTarget.h:
911         * UIProcess/API/gtk/DropTargetGtk3.cpp:
912         (WebKit::DropTarget::accept):
913         (WebKit::DropTarget::enter):
914         (WebKit::DropTarget::update):
915         (WebKit::DropTarget::leaveTimerFired):
916         (WebKit::DropTarget::drop):
917         * UIProcess/API/gtk/PageClientImpl.cpp:
918         (WebKit::PageClientImpl::startDrag):
919         * UIProcess/API/gtk/PageClientImpl.h:
920         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
921         (webkitWebViewBaseStartDrag):
922         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
923         * UIProcess/PageClient.h:
924         * UIProcess/WebPageProxy.cpp:
925         (WebKit::WebPageProxy::performDragControllerAction):
926         (WebKit::WebPageProxy::startDrag):
927         * UIProcess/WebPageProxy.h:
928         * UIProcess/WebPageProxy.messages.in:
929         * UIProcess/WebPasteboardProxy.h:
930         * UIProcess/WebPasteboardProxy.messages.in:
931         * UIProcess/gtk/Clipboard.h:
932         * UIProcess/gtk/ClipboardGtk3.cpp:
933         (WebKit::WriteAsyncData::WriteAsyncData):
934         (WebKit::Clipboard::write):
935         * UIProcess/gtk/ClipboardGtk4.cpp:
936         (WebKit::Clipboard::write):
937         * UIProcess/gtk/WebPasteboardProxyGtk.cpp:
938         (WebKit::WebPasteboardProxy::writeToClipboard):
939         (WebKit::WebPasteboardProxy::writeCustomData):
940         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
941         (WebKit::WebPlatformStrategies::writeToClipboard):
942         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
943         (WebKit::WebDragClient::startDrag):
944         * WebProcess/WebPage/WebPage.cpp:
945         (WebKit::WebPage::performDragControllerAction):
946         * WebProcess/WebPage/WebPage.h:
947         * WebProcess/WebPage/WebPage.messages.in:
948
949 2020-05-18  Carlos Garcia Campos  <cgarcia@igalia.com>
950
951         [GTK] Add WebKitContextMenuItemType for paste as plaintext
952         https://bugs.webkit.org/show_bug.cgi?id=177638
953
954         Reviewed by Michael Catanzaro.
955
956         Add WEBKIT_CONTEXT_MENU_ACTION_PASTE_AS_PLAIN_TEXT.
957
958         * Shared/API/glib/WebKitContextMenuActions.cpp:
959         (webkitContextMenuActionGetActionTag):
960         (webkitContextMenuActionGetForContextMenuItem):
961         (webkitContextMenuActionGetLabel):
962         * UIProcess/API/gtk/WebKitContextMenuActions.h:
963         * UIProcess/gtk/KeyBindingTranslator.cpp:
964
965 2020-05-17  Carlos Garcia Campos  <cgarcia@igalia.com>
966
967         [GTK] Move to new Pasteboard API
968         https://bugs.webkit.org/show_bug.cgi?id=177633
969
970         Reviewed by Adrian Perez de Castro.
971
972         Enable custom pasteboard data.
973
974         * Shared/WebPreferencesDefaultValues.h:
975         * Shared/gtk/ArgumentCodersGtk.cpp:
976         (IPC::ArgumentCoder<SelectionData>::encode):
977         (IPC::ArgumentCoder<SelectionData>::decode):
978         * UIProcess/WebPasteboardProxy.cpp:
979         * UIProcess/gtk/ClipboardGtk3.cpp:
980         (WebKit::Clipboard::write): Add support for writing URI list and custom data.
981         * UIProcess/gtk/ClipboardGtk4.cpp:
982         (WebKit::Clipboard::write): Ditto.
983         * UIProcess/gtk/WebPasteboardProxyGtk.cpp:
984         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
985         (WebKit::WebPasteboardProxy::writeCustomData):
986
987 2020-05-16  Andy Estes  <aestes@apple.com>
988
989         REGRESSION (r260717): installmentConfiguration member is no longer available on ApplePayPaymentRequest
990         https://bugs.webkit.org/show_bug.cgi?id=211911
991         <rdar://problem/63236367>
992
993         Reviewed by Tim Horton.
994
995         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
996         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::encode):
997         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::decode):
998         (IPC::finishDecoding): Deleted.
999         (IPC::finishEncoding): Deleted.
1000
1001 2020-05-16  Yury Semikhatsky  <yurys@chromium.org>
1002
1003         [GTK] Do not leak pages created by window.open
1004         https://bugs.webkit.org/show_bug.cgi?id=211970
1005
1006         Reviewed by Carlos Garcia Campos.
1007
1008         Previously webkitWebViewCreateNewPage created unbalanced refence to WebPageProxy and returned
1009         it as a raw pointer. That raw pointer was later wrapped in a RefPtr in WebKitUIClient.
1010         This change ensures that all refs are balanced by returnin RefPtr instead of
1011         a raw pointer.
1012
1013         * UIProcess/API/glib/WebKitWebView.cpp:
1014         (webkitWebViewCreateNewPage):
1015         * UIProcess/API/glib/WebKitWebViewPrivate.h:
1016
1017 2020-05-15  Alex Christensen  <achristensen@webkit.org>
1018
1019         Use enum serialization instead of casting to/from uint32_t
1020         https://bugs.webkit.org/show_bug.cgi?id=211885
1021
1022         Reviewed by Geoffrey Garen.
1023
1024         * Scripts/webkit/messages.py:
1025         * Shared/DocumentEditingContext.h:
1026         * Shared/ios/GestureTypes.h:
1027         * UIProcess/API/C/WKAPICast.h:
1028         (WebKit::toWebGLLoadPolicy):
1029         (WebKit::toAPI):
1030         * UIProcess/Cocoa/NavigationState.mm:
1031         (WebKit::toWebCoreWebGLLoadPolicy):
1032         (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const):
1033         (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const):
1034         * UIProcess/WebPageProxy.cpp:
1035         (WebKit::WebPageProxy::webGLPolicyForURL):
1036         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
1037         * UIProcess/WebPageProxy.h:
1038         * UIProcess/WebPageProxy.messages.in:
1039         * UIProcess/ios/WKContentViewInteraction.mm:
1040         (-[WKContentView selectForWebView:]):
1041         (toUIWKSelectionFlags):
1042         (toSelectionFlags):
1043         (toWKTextGranularity):
1044         (toWKSelectionDirection):
1045         (selectionChangedWithGesture):
1046         (selectionChangedWithTouch):
1047         (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:withFlags:]):
1048         (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:withFlags:]):
1049         (-[WKContentView changeSelectionWithTouchesFrom:to:withGesture:withState:]):
1050         (-[WKContentView selectWordForReplacement]):
1051         * UIProcess/ios/WebPageProxyIOS.mm:
1052         (WebKit::WebPageProxy::gestureCallback):
1053         (WebKit::WebPageProxy::touchesCallback):
1054         (WebKit::WebPageProxy::selectWithGesture):
1055         (WebKit::WebPageProxy::updateSelectionWithTouches):
1056         (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
1057         (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
1058         (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection):
1059         (WebKit::WebPageProxy::selectWithTwoTouches):
1060         (WebKit::WebPageProxy::extendSelection):
1061         (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
1062         * WebProcess/InjectedBundle/API/mac/WKDOMRange.mm:
1063         (-[WKDOMRange rangeByExpandingToWordBoundaryByCharacters:inDirection:]):
1064         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1065         (WebKit::WebFrameLoaderClient::webGLPolicyForURL const):
1066         (WebKit::WebFrameLoaderClient::resolveWebGLPolicyForURL const):
1067         * WebProcess/WebPage/WebPage.cpp:
1068         (WebKit::WebPage::webGLPolicyForURL):
1069         (WebKit::WebPage::resolveWebGLPolicyForURL):
1070         * WebProcess/WebPage/WebPage.h:
1071         * WebProcess/WebPage/WebPage.messages.in:
1072         * WebProcess/WebPage/ios/WebPageIOS.mm:
1073         (WebKit::WebPage::getPlatformEditorState const):
1074         (WebKit::WebPage::getSelectionContext):
1075         (WebKit::WebPage::selectWithGesture):
1076         (WebKit::rangeAtWordBoundaryForPosition):
1077         (WebKit::WebPage::updateSelectionWithTouches):
1078         (WebKit::WebPage::selectWithTwoTouches):
1079         (WebKit::WebPage::extendSelection):
1080         (WebKit::WebPage::selectWordBackward):
1081         (WebKit::WebPage::moveSelectionByOffset):
1082         (WebKit::WebPage::getRectsForGranularityWithSelectionOffset):
1083         (WebKit::WebPage::selectPositionAtBoundaryWithDirection):
1084         (WebKit::WebPage::moveSelectionAtBoundaryWithDirection):
1085         (WebKit::WebPage::rangeForGranularityAtPoint):
1086         (WebKit::WebPage::selectTextWithGranularityAtPoint):
1087         (WebKit::WebPage::beginSelectionInDirection):
1088         (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
1089         (WebKit::WebPage::requestDictationContext):
1090         (WebKit::WebPage::applyAutocorrectionInternal):
1091         (WebKit::WebPage::autocorrectionContext):
1092         (WebKit::dataDetectorLinkPositionInformation):
1093         (WebKit::moveByGranularityRespectingWordBoundary):
1094         (WebKit::WebPage::requestDocumentEditingContext):
1095         * WebProcess/WebPage/mac/WebPageMac.mm:
1096         (WebKit::WebPage::webGLPolicyForURL):
1097         (WebKit::WebPage::resolveWebGLPolicyForURL):
1098
1099 2020-05-15  Alex Christensen  <achristensen@webkit.org>
1100
1101         [iOS Simulator] TestWebKitAPI._WKDownload.Resume is a flaky crash
1102         https://bugs.webkit.org/show_bug.cgi?id=211786
1103
1104         Reviewed by Geoffrey Garen.
1105
1106         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1107         (-[WKNetworkSessionDelegate URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:]):
1108
1109 2020-05-15  Alex Christensen  <achristensen@webkit.org>
1110
1111         Regression (iOS 13.4, r249142): WKWebView.loading is never reset after a Back navigation in an iframe
1112         https://bugs.webkit.org/show_bug.cgi?id=211449
1113
1114         Reviewed by Geoffrey Garen.
1115
1116         Always call clearPendingAPIRequest in WebPageProxy::didStartProvisionalLoadForFrameShared.
1117         r249142 regressed this and caused more "loading appears to continue forever" bugs fixed in r249890.
1118         This should fix both, by removing the problematic half of r249142.
1119
1120         Covered by an API test.
1121
1122         * UIProcess/WebPageProxy.cpp:
1123         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
1124
1125 2020-05-15  Adrian Perez de Castro  <aperez@igalia.com>
1126
1127         [GTK3] Bring back usage of GtkMenu for context menus
1128         https://bugs.webkit.org/show_bug.cgi?id=211557
1129
1130         Reviewed by Carlos Garcia Campos.
1131
1132         * UIProcess/API/glib/WebKitWebView.cpp:
1133         (contextMenuDismissed): Removed.
1134         (webkitWebViewPopulateContextMenu): Use WebContextMenuProxyGtk::widgetDismissedSignal
1135         and move the code from contextMenuDismissed() into an inline lambda.
1136         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1137         (activeContextMenuClosed): Removed.
1138         (webkitWebViewBaseSetActiveContextMenuProxy): Use WebContextMenuProxyGtk::widgetDismissedSignal
1139         and move the code from activeContextMenuClosed() into an inline lambda.
1140         * UIProcess/gtk/WebContextMenuProxyGtk.cpp: Add helper functions to manipulate the actual
1141         widget used for context menus depending on whether GTK3 or GTK4 is being used. The GTK3
1142         versions bring back bits of code removed in r260889.
1143         (WebKit::createMenuWidget): Added.
1144         (WebKit::popupMenuWidget): Added.
1145         (WebKit::popdownMenuWidget): Added.
1146         (WebKit::menuWidgetHasItems): Added.
1147         (WebKit::bindModelToMenuWidget): Added.
1148         (WebKit::WebContextMenuProxyGtk::populate): Use context menu widget helper functions.
1149         (WebKit::WebContextMenuProxyGtk::showContextMenuWithItems): Ditto.
1150         (WebKit::WebContextMenuProxyGtk::WebContextMenuProxyGtk): Ditto. Also handle the
1151         signal triggered when the context menu is dismissed and arrange to call
1152         webkitWebViewContextMenuDismissed() and webkitWebViewBaseContextMenuDismissed().
1153         (WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk): Use helper functions.
1154         * UIProcess/gtk/WebContextMenuProxyGtk.h: Add WebContextMenuProxyGtk::widgetDismissedSignal
1155         constant.
1156
1157 2020-05-14  Kate Cheney  <katherine_cheney@apple.com>
1158
1159         Attribute non-network loads and loads with html strings as automatically app-bound
1160         https://bugs.webkit.org/show_bug.cgi?id=211913
1161         <rdar://problem/63157801
1162
1163         Reviewed by Brent Fulgham.
1164
1165         Move logic from WebsiteDataStoreCocoa to WebPageProxy to check for
1166         special app-bound protocols and set m_limitsNavigationToAppBoundDomains
1167         to force these WebViews into app-bound mode.
1168
1169         * UIProcess/API/Cocoa/WKWebView.mm:
1170         (-[WKWebView _isForcedIntoAppBoundMode:]):
1171         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1172         Testing SPI to see whether m_limitsNavigationsToAppBoundDomains was
1173         set.
1174
1175         * UIProcess/WebPageProxy.cpp:
1176         (WebKit::WebPageProxy::loadData):
1177         Check for html string loads and force WebView into app-bound mode if needed.
1178         No need to worry about setting this variable even if the app hasn't
1179         opted in because setIsNavigatingToAppBoundDomainAndCheckIfPermitted
1180         does an early return before checking this variable if
1181         WKAppBoundDomains does not exist.
1182
1183         (WebKit::shouldTreatURLProtocolAsAppBound):
1184         Adds javascript protocols to this check.
1185
1186         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted):
1187         Check for special protocols here and force WebView into app-bound mode.
1188
1189         (WebKit::WebPageProxy::isForcedIntoAppBoundModeTesting):
1190         * UIProcess/WebPageProxy.h:
1191         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1192         (WebKit::WebsiteDataStore::beginAppBoundDomainCheck):
1193         (WebKit::shouldTreatURLProtocolAsAppBound): Deleted.
1194
1195 2020-05-14  Timothy Hatcher  <timothy@apple.com>
1196
1197         Add baseURL version of _WKUserStyleSheet forWKWebView.
1198         https://bugs.webkit.org/show_bug.cgi?id=211926
1199         rdar://problem/62074675
1200
1201         Reviewed by Devin Rousso.
1202
1203         * UIProcess/API/Cocoa/_WKUserStyleSheet.h:
1204         * UIProcess/API/Cocoa/_WKUserStyleSheet.mm:
1205         (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:baseURL:level:userContentWorld:]): Added.
1206         (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:level:userContentWorld:]): Clean up WebCore::UserStyleSheet initializer.
1207         (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:]): Ditto.
1208         (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]): Ditto.
1209         (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]): Ditto.
1210         (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:level:userContentWorld:]): Ditto.
1211
1212 2020-05-14  John Wilander  <wilander@apple.com>
1213
1214         Add quirk for cookie blocking latch mode aolmail.com redirecting to aol.com under aol.com
1215         https://bugs.webkit.org/show_bug.cgi?id=211925
1216         <rdar://problem/61901041>
1217
1218         Reviewed by Brent Fulgham.
1219
1220         No new tests. Just a new quirk for a pair of domains added by request.
1221
1222         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1223         (WebKit::NetworkDataTaskCocoa::needsFirstPartyCookieBlockingLatchModeQuirk const):
1224
1225 2020-05-14  Chris Dumez  <cdumez@apple.com>
1226
1227         Regression(r261163) Causes crashes on builds without libwebrtc.dylib
1228         https://bugs.webkit.org/show_bug.cgi?id=211924
1229         <rdar://problem/63206792>
1230
1231         Reviewed by Jer Noble.
1232
1233         * WebProcess/Network/NetworkProcessConnection.cpp:
1234         (WebKit::NetworkProcessConnection::NetworkProcessConnection):
1235
1236 2020-05-14  Timothy Hatcher  <timothy@apple.com>
1237
1238         Add sourceURL to _evaluateJavaScript: so the scripts appear in Web Inspector.
1239         https://bugs.webkit.org/show_bug.cgi?id=211904
1240         rdar://problem/62074376
1241
1242         Reviewed by Devin Rousso.
1243
1244         Added sourceURL version of _evaluateJavaScript: that passes the sourceURL to RunJavaScriptParameters.
1245         If the sourceURL is invalid, generate a unique user script URL so the source code errors are not showing
1246         up with the frame's document URL and bogus locations.
1247
1248         * UIProcess/API/C/WKPage.cpp:
1249         (WKPageRunJavaScriptInMainFrame): pass API::UserScript::generateUniqueURL() for the sourceURL.
1250         * UIProcess/API/Cocoa/WKUserScript.mm:
1251         (-[WKUserScript initWithSource:injectionTime:forMainFrameOnly:]): Clean up WebCore::UserScript initializer.
1252         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]): Ditto.
1253         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:userContentWorld:]): Ditto.
1254         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:contentWorld:]): Ditto.
1255         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:contentWorld:]): Ditto.
1256         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:contentWorld:deferRunningUntilNotification:]): Ditto.
1257         * UIProcess/API/Cocoa/WKWebView.mm:
1258         (-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]): Renamed to add sourceURL.
1259         (-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]): Added sourceURL.
1260         (-[WKWebView _evaluateJavaScript:withSourceURL:inFrame:inContentWorld:completionHandler:]): Added. Pass sourceURL through.
1261         (-[WKWebView evaluateJavaScript:completionHandler:]): Call new method with sourceURL as nil.
1262         (-[WKWebView evaluateJavaScript:inContentWorld:completionHandler:]): Ditto.
1263         (-[WKWebView callAsyncJavaScript:arguments:inContentWorld:completionHandler:]): Ditto.
1264         (-[WKWebView _callAsyncJavaScript:arguments:inFrame:inContentWorld:completionHandler:]): Ditto.
1265         (-[WKWebView _evaluateJavaScript:inFrame:inContentWorld:completionHandler:]): Ditto.
1266         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1267
1268 2020-05-14  Chris Dumez  <cdumez@apple.com>
1269
1270         WebsiteDataStore functions should only send IPC to WebProcesses that are associated with its session
1271         https://bugs.webkit.org/show_bug.cgi?id=211917
1272
1273         Reviewed by Alex Christensen.
1274
1275         WebsiteDataStore functions should only send IPC to WebProcesses that are associated with its session.
1276         setResourceLoadStatisticsEnabled() / clearResourceLoadStatisticsInWebProcesses() were talking to all
1277         WebProcesses, even those associated with other sessions, which was wrong.
1278
1279         * UIProcess/WebProcessPool.cpp:
1280         (WebKit::WebProcessPool::clearResourceLoadStatistics): Deleted.
1281         * UIProcess/WebProcessPool.h:
1282         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1283         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
1284         (WebKit::WebsiteDataStore::clearResourceLoadStatisticsInWebProcesses):
1285
1286 2020-05-14  Daniel Bates  <dabates@apple.com>
1287
1288         [iOS] Remove dead dictation code
1289         https://bugs.webkit.org/show_bug.cgi?id=211871
1290
1291         Reviewed by Wenson Hsieh.
1292
1293         UIKit has long removed all callers that would call -nextUnperturbedDictationResultBoundaryFromPosition
1294         and -previousUnperturbedDictationResultBoundaryFromPosition. So, remove the implementations.
1295
1296         * UIProcess/ios/WKContentViewInteraction.mm:
1297         (-[WKContentView previousUnperturbedDictationResultBoundaryFromPosition:]): Deleted.
1298         (-[WKContentView nextUnperturbedDictationResultBoundaryFromPosition:]): Deleted.
1299
1300 2020-05-14  Brady Eidson  <beidson@apple.com>
1301
1302         Crash in PDFPlugin::ensureDataBufferLength
1303         <rdar://problem/62932155> and https://bugs.webkit.org/show_bug.cgi?id=211818
1304
1305         Reviewed by Tim Horton.
1306
1307         There's some currently unreproducible case(s) where a range request finishes
1308         while there's no m_data to append it to.
1309         
1310         It's fair hardening to handle that case.
1311
1312         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1313         (WebKit::PDFPlugin::getResourceBytesAtPositionMainThread): Handle null m_data.
1314         (WebKit::PDFPlugin::ensureDataBufferLength): Ditto.
1315
1316 2020-05-14  Per Arne Vollan  <pvollan@apple.com>
1317
1318         [iOS] Update message filtering rules in the WebContent process' sandbox
1319         https://bugs.webkit.org/show_bug.cgi?id=211188
1320
1321         Reviewed by Brent Fulgham.
1322
1323         Based on telemetry and local testing, update the message filtering rules in the WebContent process' sandbox on iOS.
1324         Messages that have not been observed being in use, should be denied.
1325
1326         No new tests, covered by existing tests.
1327
1328         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1329
1330 2020-05-14  Adrian Perez de Castro  <aperez@igalia.com>
1331
1332         Non-unified build fixed, mid May 2020 edition
1333         https://bugs.webkit.org/show_bug.cgi?id=211859
1334
1335         Unreviewed build fix.
1336
1337         * UIProcess/gtk/Clipboard.cpp: Add missing includes for <mutex>, wtf/NeverDestroyed.h, and
1338         wtf/text/WTFString.h.
1339         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: Add missing
1340         SharedBufferDataReference.h include.
1341         * WebProcess/WebCoreSupport/WebPlatformStrategies.h: Add missing namespace to usage of
1342         the WebCore::SharedBuffer type.
1343
1344 2020-05-13  David Kilzer  <ddkilzer@apple.com>
1345
1346         [IPC] Use templates to reduce duplicate code in IPC::Decoder and IPC::Encoder classes
1347         <https://webkit.org/b/211861>
1348         <rdar://problem/62360390>
1349
1350         Reviewed by Alex Christensen.
1351
1352         In broad strokes, this change fixes the following issues:
1353         - Change `unsigned` type to `size_t` for `alignment` parameters
1354           for consistency on 32-bit platforms.
1355         - Templatize Encoder::encode(), Decoder::decode() and
1356           Decoder::operator>>() methods to reduce duplicate code.  This
1357           deleted code in source files, added template methods to header
1358           files, and required a few changes to existing templates in
1359           header files to disambiguate std::is_arithmetic parameter
1360           types.
1361         - Use `typename E` for all template methods that handle enum
1362           types.
1363         - Use `typename T` for all other template method types.
1364         - Move WARN_UNUSED_RETURN to same line as `bool` return type.
1365         - Add FIXME comments to validate enum values.
1366
1367         * Platform/IPC/Decoder.cpp:
1368         (IPC::roundUpToAlignment):
1369         (IPC::Decoder::alignBufferPosition):
1370         (IPC::Decoder::bufferIsLargeEnoughToContain const):
1371         (IPC::Decoder::decodeFixedLengthData):
1372         (IPC::decodeValueFromBuffer): Delete.
1373         (IPC::Decoder::getOptional): Delete.
1374         (IPC::Decoder::operator>>): Delete.
1375         (IPC::Decoder::decode): Delete.
1376         * Platform/IPC/Decoder.h:
1377         (IPC::Decoder::decode):
1378         (IPC::Decoder::operator>>):
1379         (IPC::Decoder::decodeEnum):
1380         * Platform/IPC/Encoder.cpp:
1381         (IPC::roundUpToAlignment):
1382         (IPC::Encoder::grow):
1383         (IPC::Encoder::encodeFixedLengthData):
1384         (IPC::copyValueToBuffer): Delete.
1385         (IPC::Encoder::encode): Delete.
1386         * Platform/IPC/Encoder.h:
1387
1388 2020-05-13  Devin Rousso  <drousso@apple.com>
1389
1390         Web Inspector: `RuntimeEnabledFeatures` should also be enabled when remotely inspecting
1391         https://bugs.webkit.org/show_bug.cgi?id=211874
1392
1393         Reviewed by Timothy Hatcher.
1394
1395         * WebProcess/Inspector/WebInspectorUI.h:
1396         * WebProcess/Inspector/WebInspectorUI.cpp:
1397         (WebKit::WebInspectorUI::enableFrontendFeatures): Added.
1398         (WebKit::WebInspectorUI::WebInspectorUI):
1399         * WebProcess/Inspector/RemoteWebInspectorUI.cpp:
1400         (WebKit::RemoteWebInspectorUI::RemoteWebInspectorUI):
1401
1402 2020-05-13  Megan Gardner  <megan_gardner@apple.com>
1403
1404         Unreviewed Build Fix.
1405
1406         * UIProcess/ios/PageClientImplIOS.mm:
1407         (WebKit::PageClientImpl::setMouseEventPolicy):
1408         * UIProcess/ios/forms/WKDateTimeInputControl.mm:
1409         (-[WKDateTimePicker dealloc]):
1410         (-[WKDateTimePicker controlBeginEditing]):
1411         (-[WKDateTimePicker controlEndEditing]):
1412
1413 2020-05-13  Kate Cheney  <katherine_cheney@apple.com>
1414
1415         SHOULD NEVER BE REACHED in WebKit::ResourceLoadStatisticsDatabaseStore::openAndUpdateSchemaIfNecessary
1416         https://bugs.webkit.org/show_bug.cgi?id=211637
1417         <rdar://problem/63031185>
1418
1419         Reviewed by John Wilander.
1420
1421         No new tests, behavior confirmed by existing tests.
1422
1423         Stop reseting ITP to use the memory store between tests. This results
1424         in consecutive calls to NetworkSession::recreateResourceLoadStatisticStore
1425         if two database tests occur in a row, which can set the m_resourceLoadStatistics
1426         object before a previous call to WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore
1427         is done.
1428
1429         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1430         (WKWebsiteDataStoreStatisticsResetToConsistentState):
1431
1432 2020-05-13  Megan Gardner  <megan_gardner@apple.com>
1433
1434         Change Date/Time popovers to contextMenus.
1435         https://bugs.webkit.org/show_bug.cgi?id=211825
1436         <rdar://problem/63102524>
1437
1438         Reviewed by Wenson Hsieh.
1439
1440         Update the Date/Time picker to use UIContextMenus instead of popovers.
1441         Removed all the unneeded popover code.
1442         Renamed WKFormInputControl to WKDateTimeInputControl because it was only used
1443         for date and time controls, unneccessary abstraction.
1444         We need to ensure the poisition information is up to date before presenting
1445         the context menu, or the position it will be presented from can be stale.
1446
1447         * SourcesCocoa.txt:
1448         * UIProcess/ios/WKContentViewInteraction.h:
1449         * UIProcess/ios/WKContentViewInteraction.mm:
1450         (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]):
1451         (-[WKContentView requiresAccessoryView]):
1452         (-[WKContentView _updateAccessory]):
1453         (mayContainSelectableText):
1454         (createInputPeripheralWithView):
1455         (-[WKContentView inputLabelText]):
1456         (-[WKContentView _removeContextMenuViewIfPossible]):
1457         (-[WKContentView inputLabelTextForViewController:]):
1458         (-[WKContentView formInputControl]):
1459         (-[WKContentView setTimePickerValueToHour:minute:]):
1460         (-[WKContentView timePickerValueHour]):
1461         (-[WKContentView timePickerValueMinute]):
1462         * UIProcess/ios/forms/WKDateTimeInputControl.h: Renamed from Source/WebKit/UIProcess/ios/forms/WKFormInputControl.h.
1463         * UIProcess/ios/forms/WKDateTimeInputControl.mm: Renamed from Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm.
1464         (-[WKDateTimeContextMenuViewController init]):
1465         (-[WKDateTimeContextMenuViewController preferredContentSize]):
1466         (-[WKDateTimePicker initWithView:datePickerMode:]):
1467         (-[WKDateTimePicker contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
1468         (-[WKDateTimePicker _contextMenuInteraction:styleForMenuWithConfiguration:]):
1469         (-[WKDateTimePicker contextMenuInteraction:configurationForMenuAtLocation:]):
1470         (-[WKDateTimePicker contextMenuInteraction:willEndForConfiguration:animator:]):
1471         (-[WKDateTimePicker removeContextMenuInteraction]):
1472         (-[WKDateTimePicker ensureContextMenuInteraction]):
1473         (-[WKDateTimePicker showDateTimePicker]):
1474         (-[WKDateTimePicker reset:]):
1475         (-[WKDateTimePicker calendarType]):
1476         (-[WKDateTimePicker dealloc]):
1477         (-[WKDateTimePicker setDateTimePickerToInitialValue]):
1478         (-[WKDateTimePicker controlBeginEditing]):
1479         (-[WKDateTimePicker viewController]):
1480         (-[WKDateTimePicker controlEndEditing]):
1481         (-[WKDateTimeInputControl initWithView:]):
1482         (-[WKDateTimeInputControl setTimePickerHour:minute:]):
1483         (-[WKDateTimeInputControl dateTimePickerCalendarType]):
1484         (-[WKDateTimeInputControl timePickerValueHour]):
1485         (-[WKDateTimeInputControl timePickerValueMinute]):
1486         * WebKit.xcodeproj/project.pbxproj:
1487
1488 2020-05-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1489
1490         Unreviewed, fix tvOS and watchOS builds after r261638
1491
1492         `-[UIPasteboard itemProviders]` is not present on watchOS and tvOS.
1493
1494         * UIProcess/ios/WKContentViewInteraction.mm:
1495         (-[WKContentView _writePromisedAttachmentToPasteboard:]):
1496
1497 2020-05-13  Timothy Horton  <timothy_horton@apple.com>
1498
1499         Build fix.
1500
1501         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
1502
1503 2020-05-13  Jer Noble  <jer.noble@apple.com>
1504
1505         Replace isNullFunctionPointer with real weak-linking support
1506         https://bugs.webkit.org/show_bug.cgi?id=211751
1507
1508         Reviewed by Sam Weinig.
1509
1510         Use the new WTF_WEAK_LINK_FORCE_IMPORT macro.
1511
1512         * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp:
1513         (WebKit::ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction):
1514
1515 2020-05-13  Tim Horton  <timothy_horton@apple.com>
1516
1517         Add SPI for reverting to touch events for iPad trackpad interactions
1518         https://bugs.webkit.org/show_bug.cgi?id=211824
1519         <rdar://problem/61363084>
1520
1521         Reviewed by Megan Gardner.
1522
1523         New Test: IOSMouseSupport.WebsiteMouseEventPolicies
1524
1525         Plumb a "mouse event policy" WKWebpagePreference, which has two values:
1526
1527         - Default, which means that WebKit decides whether or not indirect
1528         pointing devices send mouse or touch events.
1529
1530         - SynthesizeTouchEvents, which ensures that WebKit will always send
1531         touch events from indirect pointing devices.
1532         This value is only available on platforms that implement touch events.
1533
1534         We use the WKWebpagePreferences mechanism in order to make it easy to
1535         implement it as a "per-site" quirk, but unlike most WKWebpagePreferences,
1536         it turns around and changes UI process state (the enablement of the
1537         WKMouseGestureRecgonizer).
1538
1539         * Scripts/webkit/messages.py:
1540         * Shared/WebsitePoliciesData.cpp:
1541         (WebKit::WebsitePoliciesData::encode const):
1542         (WebKit::WebsitePoliciesData::decode):
1543         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
1544         * Shared/WebsitePoliciesData.h:
1545         * UIProcess/API/APIWebsitePolicies.cpp:
1546         (API::WebsitePolicies::copy const):
1547         (API::WebsitePolicies::data):
1548         * UIProcess/API/APIWebsitePolicies.h:
1549         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
1550         (WebKit::mouseEventPolicy):
1551         (WebKit::coreMouseEventPolicy):
1552         (-[WKWebpagePreferences _setMouseEventPolicy:]):
1553         (-[WKWebpagePreferences _mouseEventPolicy]):
1554         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
1555         * UIProcess/PageClient.h:
1556         (WebKit::PageClient::setMouseEventPolicy):
1557         * UIProcess/ProvisionalPageProxy.cpp:
1558         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
1559         * UIProcess/ProvisionalPageProxy.h:
1560         * UIProcess/WebPageProxy.cpp:
1561         (WebKit::WebPageProxy::commitProvisionalPage):
1562         (WebKit::WebPageProxy::didCommitLoadForFrame):
1563         * UIProcess/WebPageProxy.h:
1564         * UIProcess/WebPageProxy.messages.in:
1565         * UIProcess/ios/PageClientImplIOS.h:
1566         * UIProcess/ios/PageClientImplIOS.mm:
1567         (WebKit::PageClientImpl::setMouseEventPolicy):
1568         * UIProcess/ios/WKContentViewInteraction.h:
1569         * UIProcess/ios/WKContentViewInteraction.mm:
1570         (-[WKContentView shouldUseMouseGestureRecognizer]):
1571         (-[WKContentView setUpMouseGestureRecognizer]):
1572         (-[WKContentView _configureMouseGestureRecognizer]):
1573         (-[WKContentView _setMouseEventPolicy:]):
1574         * UIProcess/ios/WKMouseGestureRecognizer.mm:
1575         (-[WKMouseGestureRecognizer setEnabled:]):
1576         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1577         (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
1578
1579 2020-05-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1580
1581         [iOS] "Copy" context menu action for attachment element does not work in Mail
1582         https://bugs.webkit.org/show_bug.cgi?id=211817
1583         <rdar://problem/58043110>
1584
1585         Reviewed by Tim Horton.
1586
1587         Implements support for copying an attachment element, via context menu actions. To achieve this, we first
1588         refactor code in WebCore that is currently responsible for converting an attachment element into a
1589         PromisedAttachmentInfo, which provides a handle to an UI-process-side API attachment object. We then use this
1590         helper in WebKit to send PromisedAttachmentInfo back to the UI process when handling the copy action from the
1591         context menu on iOS.
1592
1593         On iOS, we then take this promised attachment info in the UI process, map it to an API::Attachment object, and
1594         use the file handle to create and write an NSItemProvider to the general pasteboard. (In the future, similar
1595         logic could be implemented on macOS as well to handle copying attachment elements by implementing a version of
1596         writePromisedAttachmentToPasteboard in PageClientImplMac. Currently, we fall back to treating this case as if
1597         we're copying a text selection containing a single attachment element).
1598
1599         * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
1600
1601         Add a new helper function to simulate an element action (_WKElementActionType) for an element at the given
1602         location. This is used by the new API test.
1603
1604         * UIProcess/API/ios/WKWebViewTestingIOS.mm:
1605         (-[WKWebView _simulateElementAction:atLocation:]):
1606         * UIProcess/PageClient.h:
1607         (WebKit::PageClient::writePromisedAttachmentToPasteboard):
1608         * UIProcess/WebPageProxy.cpp:
1609         (WebKit::WebPageProxy::writePromisedAttachmentToPasteboard):
1610         * UIProcess/WebPageProxy.h:
1611         * UIProcess/WebPageProxy.messages.in:
1612
1613         Add an IPC message for the UI process to receive a PromisedAttachmentInfo, and copy it to the system pasteboard
1614         if it maps to an actual API::Attachment. For now, we only support copying data if the attachment is backed by
1615         a file wrapper in the UI process (as opposed to blob data written by the web process).
1616
1617         * UIProcess/ios/PageClientImplIOS.h:
1618         * UIProcess/ios/PageClientImplIOS.mm:
1619         (WebKit::PageClientImpl::writePromisedAttachmentToPasteboard):
1620         * UIProcess/ios/WKContentViewInteraction.h:
1621         * UIProcess/ios/WKContentViewInteraction.mm:
1622         (createItemProvider):
1623
1624         Create a helper function to convert PromisedAttachmentInfo into an NSItemProvider. This is similar to
1625         `-_prepareToDragPromisedAttachment:`, but with a couple differences: (1) we only create an NSItemProvider
1626         instead of going through `WebItemProviderRegistrationInfoList`; (2) since there's no opportunity to clean up
1627         temporary after pasting, serialize the attachment data using `-serializedRepresentation`, and provide the
1628         attachment data instead of a file URL.
1629
1630         Ideally, we would offer the data directly to the pasteboard so that even if Mail terminates, the contents of the
1631         pasteboard can still be provided when pasting; however, it doesn't seem like we can do this while being able to
1632         offer a suggested name for the item we're writing. Some other apps work around this limitation by writing the
1633         file name as plain text on the pasteboard, but this doesn't work then attempting to copy a plain text file that
1634         has a file name.
1635
1636         (-[WKContentView _writePromisedAttachmentToPasteboard:]):
1637         (-[WKContentView _simulateElementAction:atLocation:]):
1638         * WebProcess/WebPage/ios/WebPageIOS.mm:
1639         (WebKit::WebPage::performActionOnElement):
1640
1641 2020-05-13  Per Arne Vollan  <pvollan@apple.com>
1642
1643         [iOS] Update message filtering rules in the WebContent process' sandbox
1644         https://bugs.webkit.org/show_bug.cgi?id=211188
1645
1646         Reviewed by Brent Fulgham.
1647
1648         Based on telemetry and local testing, update the message filtering rules in the WebContent process' sandbox on iOS.
1649         Messages that have not been observed being in use, should be denied.
1650
1651         No new tests, covered by existing tests.
1652
1653         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1654
1655 2020-05-13  Per Arne Vollan  <pvollan@apple.com>
1656
1657         [iOS] In CFPrefs direct mode, the WebContent sandbox needs to allow access to plist files
1658         https://bugs.webkit.org/show_bug.cgi?id=211782
1659
1660         Reviewed by Brent Fulgham.
1661
1662         Since preference files will be read directly in CFPrefs direct mode, the WebContent sandbox on iOS needs to allow reading these files.
1663
1664         No new tests. There is API test coverage for this in PreferenceChanges.mm, but these tests are only run on simulator, not device.
1665
1666         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1667
1668 2020-05-13  Peng Liu  <peng.liu6@apple.com>
1669
1670         Add the feature flags plist file back
1671         https://bugs.webkit.org/show_bug.cgi?id=211816
1672
1673         Reviewed by Jer Noble.
1674
1675         Add the WebKit.plist file to the WebKit project and use it instead of the one from the WebKitAdditions.
1676
1677         * FeatureFlags/WebKit.plist: Added.
1678         * WebKit.xcodeproj/project.pbxproj:
1679
1680 2020-05-13  Youenn Fablet  <youenn@apple.com>
1681
1682         Allow WebAudioBufferList to dynamically change its number of frames
1683         https://bugs.webkit.org/show_bug.cgi?id=211720
1684
1685         Reviewed by Eric Carlson.
1686
1687         * WebProcess/cocoa/RemoteCaptureSampleManager.cpp:
1688         (WebKit::RemoteCaptureSampleManager::RemoteAudio::setStorage):
1689         (WebKit::RemoteCaptureSampleManager::RemoteAudio::audioSamplesAvailable):
1690         * WebProcess/cocoa/RemoteCaptureSampleManager.h:
1691
1692 2020-05-13  Per Arne Vollan  <pvollan@apple.com>
1693
1694         Unreviewed compile fix after r261584.
1695
1696         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1697         (WebKit::WebProcessPool::platformInitializeWebProcess):
1698
1699 2020-05-13  Chris Dumez  <cdumez@apple.com>
1700
1701         REGRESSION (r261254): Broke Apple Pay on macOS
1702         https://bugs.webkit.org/show_bug.cgi?id=211826
1703         <rdar://problem/63161750>
1704
1705         Reviewed by Alex Christensen.
1706
1707         r261254 dropped the code needed to add the WebPaymentCoordinatorProxy as an IPC message receiver.
1708         This patch re-introduces the code in order to address the regression.
1709
1710         No new tests, tested manually on https://applepaydemo.apple.com.
1711
1712         * NetworkProcess/NetworkConnectionToWebProcess.h:
1713         * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm:
1714         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAddMessageReceiver):
1715         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorRemoveMessageReceiver):
1716         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
1717         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1718         (WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy):
1719         (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy):
1720         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1721         (WebKit::WebPageProxy::paymentCoordinatorAddMessageReceiver):
1722         (WebKit::WebPageProxy::paymentCoordinatorRemoveMessageReceiver):
1723         * UIProcess/WebPageProxy.h:
1724
1725 2020-05-13  Zan Dobersek  <zdobersek@igalia.com>
1726
1727         REGRESSION(r260571): RequestedScrollPosition doesn't have its scroll change applied to layers anymore
1728         https://bugs.webkit.org/show_bug.cgi?id=211374
1729
1730         Reviewed by Carlos Garcia Campos.
1731
1732         Use WebPage::finalizeRenderingUpdate() to perform the compositing state flush
1733         and the scrolling tree layer positioning, instead of doing things half-baked
1734         by manually invoking the FrameView method.
1735
1736         Additional WebPage calls (updateRendering(), flushPendingEditorStateUpdate())
1737         are moved into CompositingCoordinator::flushPendingLayerChanges() from the
1738         LayerTreeHost::layerFlushTimerFired() method for consistency. The additional
1739         CompositingCoordinator::syncDisplayState() method call is removed -- this call
1740         triggered any necessary layout, but that's already done through WebPage::updateRendering().
1741
1742         CompositingCoordinator::flushPendingLayerChanges() doesn't rely on the
1743         FrameView flush return value since that's not available anymore -- instead,
1744         true is returned always.
1745
1746         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1747         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
1748         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
1749         (WebKit::LayerTreeHost::layerFlushTimerFired):
1750
1751 2020-05-13  Per Arne Vollan  <pvollan@apple.com>
1752
1753         Unreviewed compile fix after r261584.
1754
1755         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1756
1757 2020-05-13  Tomoki Imai  <Tomoki.Imai@sony.com>
1758
1759         Selected element on Web Inspector is not highlighted with CPU Rendering.
1760         https://bugs.webkit.org/show_bug.cgi?id=195933
1761
1762         Reviewed by Devin Rousso.
1763
1764         Since WebInspectorClient::drawHighlight was not called while non accelerated compositing mode, we cannot see element highlight on web inspector.
1765         This patch adds WebInspectorClient::drawHighlight call in WebPage::drawRect, which draws webpage image while non accelerated compositing mode, to overlay the highlight.
1766         WebInspectorClient::highlight and WebInspectorClient::hideHighlight currently requests re-paint whole web page, but it should be able to optimize by only updating dirty rects in the future.
1767
1768         * WebProcess/Inspector/WebInspectorClient.cpp:
1769         (WebKit::WebInspectorClient::highlight): If it's not acceleratedCompositingEnabled, then just request repaint.
1770         (WebKit::WebInspectorClient::hideHighlight): If it's not acceleratedCompositingEnabled, then just request repaint.
1771         * WebProcess/WebPage/WebPage.cpp:
1772         (WebKit::WebPage::drawRect): Draw inspector overlay here if it's not accelerated compositing mode.
1773
1774 2020-05-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1775
1776         Unreviewed. Fix GTK debug build after r261554
1777
1778         Remove writeToClipboard that receives a const SelectionData& that is no longer used.
1779
1780         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1781         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1782
1783 2020-05-12  Peng Liu  <peng.liu6@apple.com>
1784
1785         Add the feature flag plist file parser
1786         https://bugs.webkit.org/show_bug.cgi?id=211457
1787
1788         Reviewed by Tim Horton.
1789
1790         WebKit needs to parse the feature flags plist by itself in some cases.
1791
1792         * Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm: Added.
1793         (WebKit::featureFlagEnabled):
1794         * Shared/WebPreferencesDefaultValues.cpp:
1795         (WebKit::defaultAsyncFrameAndOverflowScrollingEnabled):
1796         (WebKit::defaultUseGPUProcessForMedia):
1797         (WebKit::defaultRenderCanvasInGPUProcessEnabled):
1798         (WebKit::defaultCaptureAudioInGPUProcessEnabled):
1799         (WebKit::defaultCaptureVideoInGPUProcessEnabled):
1800         (WebKit::defaultWebRTCCodecsInGPUProcess):
1801         (WebKit::defaultWebGL2Enabled):
1802         (WebKit::defaultWebGPUEnabled):
1803         (WebKit::defaultInAppBrowserPrivacy):
1804         (WebKit::defaultIncrementalPDFEnabled):
1805         (WebKit::defaultWebXREnabled):
1806         * Shared/WebPreferencesDefaultValues.h:
1807         * SourcesCocoa.txt:
1808         * WebKit.xcodeproj/project.pbxproj:
1809
1810 2020-05-12  Alex Christensen  <achristensen@webkit.org>
1811
1812         Give some NetworkLoadMetrics to WebCoreNSURLSession's delegate
1813         https://bugs.webkit.org/show_bug.cgi?id=211759
1814         <rdar://problem/62909440>
1815
1816         Reviewed by Jer Noble.
1817
1818         This also reduces duplicate lookups in RemoteMediaResourceManager
1819
1820         * GPUProcess/media/RemoteMediaResource.cpp:
1821         (WebKit::RemoteMediaResource::loadFinished):
1822         * GPUProcess/media/RemoteMediaResource.h:
1823         * GPUProcess/media/RemoteMediaResourceManager.cpp:
1824         (WebKit::RemoteMediaResourceManager::responseReceived):
1825         (WebKit::RemoteMediaResourceManager::redirectReceived):
1826         (WebKit::RemoteMediaResourceManager::dataSent):
1827         (WebKit::RemoteMediaResourceManager::dataReceived):
1828         (WebKit::RemoteMediaResourceManager::accessControlCheckFailed):
1829         (WebKit::RemoteMediaResourceManager::loadFailed):
1830         (WebKit::RemoteMediaResourceManager::loadFinished):
1831         * GPUProcess/media/RemoteMediaResourceManager.h:
1832         * GPUProcess/media/RemoteMediaResourceManager.messages.in:
1833         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1834         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
1835         * WebProcess/GPU/media/RemoteMediaResourceProxy.cpp:
1836         (WebKit::RemoteMediaResourceProxy::loadFinished):
1837         * WebProcess/GPU/media/RemoteMediaResourceProxy.h:
1838
1839 2020-05-12  Jiewen Tan  <jiewen_tan@apple.com>
1840
1841         [WebAuthn] Don't assume extensions always exist
1842         https://bugs.webkit.org/show_bug.cgi?id=211760
1843         <rdar://problem/61217642>
1844
1845         Reviewed by Brent Fulgham.
1846
1847         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1848         (WebKit::WebCore::processGoogleLegacyAppIdSupportExtension):
1849         * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
1850         (WebKit::CtapAuthenticator::processGoogleLegacyAppIdSupportExtension):
1851
1852 2020-05-12  Chris Dumez  <cdumez@apple.com>
1853
1854         [WK2] Neuter WKFrameIsFrameSet() / WKPageGetFrameSetLargestFrame() C API
1855         https://bugs.webkit.org/show_bug.cgi?id=211808
1856
1857         Reviewed by Darin Adler.
1858
1859         Neuter WKFrameIsFrameSet() / WKPageGetFrameSetLargestFrame() C API. This is only SPI and is only used for slightly
1860         different printing behavior in Safari. Framesets are no longer supported in HTML5 and are now super rare. Support
1861         for this C API adds quite a bit of code complexity and crashes such as <rdar://problem/60322282>, it just does not
1862         seem worth it anymore.
1863
1864         * UIProcess/API/C/WKFrame.cpp:
1865         (WKFrameIsFrameSet):
1866         * UIProcess/API/C/WKPage.cpp:
1867         (WKPageGetFrameSetLargestFrame):
1868         * UIProcess/WebFrameProxy.cpp:
1869         (WebKit::WebFrameProxy::didCommitLoad):
1870         * UIProcess/WebFrameProxy.h:
1871         (WebKit::WebFrameProxy::setIsFrameSet): Deleted.
1872         (WebKit::WebFrameProxy::isFrameSet const): Deleted.
1873         * UIProcess/WebPageProxy.cpp:
1874         (WebKit::WebPageProxy::resetState):
1875         (WebKit::WebPageProxy::frameDidBecomeFrameSet): Deleted.
1876         (WebKit::WebPageProxy::frameSetLargestFrameChanged): Deleted.
1877         * UIProcess/WebPageProxy.h:
1878         (WebKit::WebPageProxy::focusedFrame const):
1879         (WebKit::WebPageProxy::frameSetLargestFrame const): Deleted.
1880         * UIProcess/WebPageProxy.messages.in:
1881         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1882         (WebKit::WebChromeClient::contentsSizeChanged const):
1883         (WebKit::findLargestFrameInFrameSet): Deleted.
1884         * WebProcess/WebCoreSupport/WebChromeClient.h:
1885         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1886         (WebKit::WebFrameLoaderClient::dispatchDidBecomeFrameset): Deleted.
1887         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1888
1889 2020-05-12  Per Arne Vollan  <pvollan@apple.com>
1890
1891         [iOS] Rebuild MobileGestalt cache if needed
1892         https://bugs.webkit.org/show_bug.cgi?id=211739
1893
1894         Reviewed by Darin Adler.
1895
1896         This patch was written by Geoff Garen and myself. Rebuild the MobileGestalt cache in the UI process if the
1897         MobileGestalt cache is stale. This should be done before starting a new WebContent process. If the cache
1898         is not rebuilt, every MobileGestalt query in the WebContent process will fail, since access to the daemon
1899         is denied.
1900
1901         No new tests, since testing this is not trivial. It would involve deleting the MobileGestalt cache and
1902         making sure it is rebuilt afterwards. This could be an API test, but API tests are not supported on iOS
1903         devices.
1904
1905         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1906         (WebKit::WebProcessPool::platformInitializeWebProcess):
1907
1908 2020-05-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1909
1910         [GTK] Rework drag and drop handling in preparation for GTK4
1911         https://bugs.webkit.org/show_bug.cgi?id=211723
1912
1913         Reviewed by Adrian Perez de Castro.
1914
1915         Split DragAndDropHelper class into DragSource and DropTarget classes. This separates the source and destination
1916         parts making it easier to follow. This patch also adds PageClient::didPerformDragControllerAction() to notify
1917         back the view when an operation is done to update the result.
1918
1919         * SourcesGTK.txt:
1920         * UIProcess/API/gtk/DragSource.h: Added.
1921         * UIProcess/API/gtk/DragSourceGtk3.cpp: Added.
1922         (WebKit::DragSource::DragSource):
1923         (WebKit::DragSource::~DragSource):
1924         (WebKit::DragSource::begin):
1925         * UIProcess/API/gtk/DropTarget.h: Added.
1926         * UIProcess/API/gtk/DropTargetGtk3.cpp: Added.
1927         (WebKit::DropTarget::DropTarget):
1928         (WebKit::DropTarget::~DropTarget):
1929         (WebKit::DropTarget::accept):
1930         (WebKit::DropTarget::enter):
1931         (WebKit::DropTarget::update):
1932         (WebKit::DropTarget::dataReceived):
1933         (WebKit::DropTarget::didPerformAction):
1934         (WebKit::DropTarget::leaveTimerFired):
1935         (WebKit::DropTarget::leave):
1936         (WebKit::DropTarget::drop):
1937         * UIProcess/API/gtk/PageClientImpl.cpp:
1938         (WebKit::PageClientImpl::startDrag):
1939         (WebKit::PageClientImpl::didPerformDragControllerAction):
1940         * UIProcess/API/gtk/PageClientImpl.h:
1941         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1942         (webkitWebViewBaseConstructed):
1943         (webkit_web_view_base_class_init):
1944         (webkitWebViewBaseStartDrag):
1945         (webkitWebViewBaseDidPerformDragControllerAction):
1946         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
1947         * UIProcess/PageClient.h:
1948         (WebKit::PageClient::didPerformDragControllerAction):
1949         * UIProcess/WebPageProxy.cpp:
1950         (WebKit::WebPageProxy::didPerformDragControllerAction):
1951         * UIProcess/gtk/DragAndDropHandler.cpp: Removed.
1952         * WebProcess/WebPage/WebPage.cpp:
1953         (WebKit::WebPage::performDragControllerAction):
1954         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1955
1956 2020-05-12  Jacob Uphoff  <jacob_uphoff@apple.com>
1957
1958         Unreviewed, reverting r261557.
1959
1960         This commit caused testing to exit early due to too many
1961         crashes on macOS Catalina Asan
1962
1963         Reverted changeset:
1964
1965         "Allow WebAudioBufferList to dynamically change its number of
1966         frames"
1967         https://bugs.webkit.org/show_bug.cgi?id=211720
1968         https://trac.webkit.org/changeset/261557
1969
1970 2020-05-12  Per Arne Vollan  <pvollan@apple.com>
1971
1972         Unreviewed crash fix.
1973
1974         Use correct global name for icon service in RELEASE_ASSERT.
1975
1976         * WebProcess/WebPage/WebPage.cpp:
1977         (WebKit::WebPage::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
1978
1979 2020-05-12  Youenn Fablet  <youenn@apple.com>
1980
1981         Allow WebAudioBufferList to dynamically change its number of frames
1982         https://bugs.webkit.org/show_bug.cgi?id=211720
1983
1984         Reviewed by Eric Carlson.
1985
1986         * WebProcess/cocoa/RemoteCaptureSampleManager.cpp:
1987         (WebKit::RemoteCaptureSampleManager::RemoteAudio::setStorage):
1988         (WebKit::RemoteCaptureSampleManager::RemoteAudio::audioSamplesAvailable):
1989         * WebProcess/cocoa/RemoteCaptureSampleManager.h:
1990
1991 2020-05-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1992
1993         [GTK4] Add support for clipboard operations
1994         https://bugs.webkit.org/show_bug.cgi?id=211561
1995
1996         Reviewed by Adrian Perez de Castro.
1997
1998         * UIProcess/gtk/Clipboard.h:
1999         * UIProcess/gtk/ClipboardGtk4.cpp:
2000         (WebKit::Clipboard::Clipboard):
2001         (WebKit::Clipboard::type const):
2002         (WebKit::Clipboard::formats):
2003         (WebKit::ReadTextAsyncData::ReadTextAsyncData):
2004         (WebKit::Clipboard::readText):
2005         (WebKit::ReadFilePathsAsyncData::ReadFilePathsAsyncData):
2006         (WebKit::Clipboard::readFilePaths):
2007         (WebKit::ReadBufferAsyncData::ReadBufferAsyncData):
2008         (WebKit::Clipboard::readBuffer):
2009         (WebKit::Clipboard::write):
2010         (WebKit::Clipboard::clear):
2011
2012 2020-05-12  Carlos Garcia Campos  <cgarcia@igalia.com>
2013
2014         [GTK] Rework clipboard handling in preparation for GTK4
2015         https://bugs.webkit.org/show_bug.cgi?id=211511
2016
2017         Reviewed by Adrian Perez de Castro.
2018
2019         Use async APIs to avoid blocking the UI process during the communication with the clipboard. In GTK4 only async
2020         APIs are available. Add Clipboard class to handle the communication with the clipboard with the GTK
2021         implementation in ClipboardGtk3 and ClipboardGtk4 files.
2022
2023         * Shared/gtk/WebSelectionData.cpp:
2024         (WebKit::WebSelectionData::WebSelectionData): Add constructor receivnig an rvalue reference.
2025         * Shared/gtk/WebSelectionData.h:
2026         * SourcesGTK.txt:
2027         * UIProcess/WebPasteboardProxy.h:
2028         * UIProcess/WebPasteboardProxy.messages.in:
2029         * UIProcess/gtk/Clipboard.cpp: Added.
2030         (WebKit::clipboard):
2031         (WebKit::primary):
2032         (WebKit::Clipboard::get):
2033         * UIProcess/gtk/Clipboard.h: Added.
2034         * UIProcess/gtk/ClipboardGtk3.cpp: Added.
2035         (WebKit::Clipboard::Clipboard):
2036         (WebKit::isPrimaryClipboard):
2037         (WebKit::Clipboard::type const):
2038         (WebKit::FormatsAsyncData::FormatsAsyncData):
2039         (WebKit::Clipboard::formats):
2040         (WebKit::ReadTextAsyncData::ReadTextAsyncData):
2041         (WebKit::Clipboard::readText):
2042         (WebKit::ReadFilePathsAsyncData::ReadFilePathsAsyncData):
2043         (WebKit::Clipboard::readFilePaths):
2044         (WebKit::ReadBufferAsyncData::ReadBufferAsyncData):
2045         (WebKit::Clipboard::readBuffer):
2046         (WebKit::Clipboard::write):
2047         (WebKit::Clipboard::clear):
2048         * UIProcess/gtk/ClipboardGtk4.cpp: Added.
2049         (WebKit::Clipboard::Clipboard):
2050         (WebKit::Clipboard::type const):
2051         (WebKit::Clipboard::formats):
2052         (WebKit::Clipboard::readText):
2053         (WebKit::Clipboard::readFilePaths):
2054         (WebKit::Clipboard::readBuffer):
2055         (WebKit::Clipboard::write):
2056         (WebKit::Clipboard::clear):
2057         * UIProcess/gtk/WebPasteboardProxyGtk.cpp:
2058         (WebKit::WebPasteboardProxy::getTypes):
2059         (WebKit::WebPasteboardProxy::readText):
2060         (WebKit::WebPasteboardProxy::readFilePaths):
2061         (WebKit::WebPasteboardProxy::readBuffer):
2062         (WebKit::WebPasteboardProxy::writeToClipboard):
2063         (WebKit::WebPasteboardProxy::clearClipboard):
2064         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2065         (WebKit::WebPlatformStrategies::types):
2066         (WebKit::WebPlatformStrategies::readTextFromClipboard):
2067         (WebKit::WebPlatformStrategies::readFilePathsFromClipboard):
2068         (WebKit::WebPlatformStrategies::readBufferFromClipboard):
2069         (WebKit::WebPlatformStrategies::writeToClipboard):
2070         (WebKit::WebPlatformStrategies::clearClipboard):
2071         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
2072
2073 2020-05-12  Youenn Fablet  <youenn@apple.com>
2074
2075         Introduce a RealtimeMediaSource video sample observer
2076         https://bugs.webkit.org/show_bug.cgi?id=211718
2077
2078         Reviewed by Eric Carlson.
2079
2080         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2081         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::SourceProxy):
2082         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::~SourceProxy):
2083         * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp:
2084         (WebKit::MediaRecorderPrivate::MediaRecorderPrivate):
2085         (WebKit::MediaRecorderPrivate::~MediaRecorderPrivate):
2086         (WebKit::MediaRecorderPrivate::videoSampleAvailable):
2087         (WebKit::MediaRecorderPrivate::stopRecording):
2088         (WebKit::MediaRecorderPrivate::sampleBufferUpdated): Deleted.
2089         * WebProcess/GPU/webrtc/MediaRecorderPrivate.h:
2090
2091 2020-05-12  Mark Lam  <mark.lam@apple.com>
2092
2093         Wasm::enableFastMemory() was called too late.
2094         https://bugs.webkit.org/show_bug.cgi?id=211773
2095
2096         Reviewed by Yusuke Suzuki.
2097
2098         Previously, we were calling Wasm::enableFastMemory() in WebProcess::initializeWebProcess().
2099         By then, it is too late because the JSC::Config and WTF::Config have already been
2100         frozen.  There is nothing special about Wasm::enableFastMemory() that it needs to
2101         be called this late.  This patch moves it into JSC::initializeThreading() where
2102         it belongs.
2103
2104         This change also make the initialization of Wasm fast memory consistent with how
2105         we have always done it for the jsc shell i.e. it is initialized at the end of
2106         JSC::initializeThreading().
2107
2108         * WebProcess/WebProcess.cpp:
2109         (WebKit::WebProcess::initializeWebProcess):
2110
2111 2020-05-11  Darin Adler  <darin@apple.com>
2112
2113         Fix problems caught by replacing WTF::Optional with std::optional
2114         https://bugs.webkit.org/show_bug.cgi?id=211703
2115
2116         Reviewed by Chris Dumez.
2117
2118         * WebProcess/WebPage/ios/WebPageIOS.mm:
2119         (WebKit::plainTextForContext): Clarified ambiguous overload resolution by writing
2120         the conversion from a live range to a SimpleRange out explicitly. Also fixed a typo
2121         where there was a missing "&" in a "const&" argument.
2122
2123 2020-05-11  Simon Fraser  <simon.fraser@apple.com>
2124
2125         [ macOS ] scrollingcoordinator/mac/latching/scrolling-select-should-not-latch-mainframe.html is a flaky failure
2126         https://bugs.webkit.org/show_bug.cgi?id=211747
2127
2128         Reviewed by Tim Horton.
2129
2130         Add an option to monitorWheelEvents to reset latching.
2131
2132         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2133         (WKBundlePageStartMonitoringScrollOperations):
2134         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
2135
2136 2020-05-11  Kate Cheney  <katherine_cheney@apple.com>
2137
2138         Fail navigations to non app-bound domains after use of app-bound APIs
2139         https://bugs.webkit.org/show_bug.cgi?id=211647
2140         <rdar://problem/62978159>
2141
2142         Reviewed by Brent Fulgham.
2143
2144         A lot of this patch is deleting the unnecessary variable/function
2145         hasNavigatedAwayFromAppBoundDomain now that navigating away from an
2146         app-bound domain is not possible.
2147         
2148         To address the bug, this sets the default isNavigatingToAppBoundDomain
2149         value to be WTF::nullopt. This will allow app-bound behaviors until
2150         a navigation has been attempted, in which case it will fail or will
2151         update isNavigatingToAppBoundDomain to the correct value.
2152
2153
2154         * Shared/LoadParameters.cpp:
2155         (WebKit::LoadParameters::encode const):
2156         (WebKit::LoadParameters::decode):
2157         * Shared/LoadParameters.h:
2158         * Shared/PolicyDecision.h:
2159         (WebKit::PolicyDecision::encode const):
2160         (WebKit::PolicyDecision::decode):
2161         * UIProcess/ProvisionalPageProxy.cpp:
2162         (WebKit::ProvisionalPageProxy::loadData):
2163         (WebKit::ProvisionalPageProxy::loadRequest):
2164         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync):
2165         * UIProcess/ProvisionalPageProxy.h:
2166         * UIProcess/WebPageProxy.cpp:
2167         (WebKit::WebPageProxy::loadRequest):
2168         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
2169         (WebKit::WebPageProxy::loadData):
2170         (WebKit::WebPageProxy::loadDataWithNavigationShared):
2171         (WebKit::WebPageProxy::receivedPolicyDecision):
2172         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2173         (WebKit::WebPageProxy::decidePolicyForNavigationActionSyncShared):
2174         (WebKit::WebPageProxy::hasNavigatedAwayFromAppBoundDomain const): Deleted.
2175         Remove hasNavigatedAwayFromAppBoundDomain.
2176
2177         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted):
2178         Check for new m_hasExecutedAppBoundBehaviorBeforeNavigation parameter
2179         and fail the navigation if a WebView has used app-bound behavior then
2180         tries to navigate to a non app-bound domain.
2181
2182         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2183         Update error message to be more general now that more than one error
2184         can occur.
2185
2186         * UIProcess/WebPageProxy.h:
2187         (WebKit::WebPageProxy::setHasExecutedAppBoundBehaviorBeforeNavigation):
2188         * UIProcess/WebPageProxy.messages.in:
2189         New parameter to indicate a WebView has used app-bound APIs before
2190         navigating.
2191
2192         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2193         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2194         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2195         (WebKit::WebFrameLoaderClient::shouldEnableInAppBrowserPrivacyProtections):
2196         (WebKit::WebFrameLoaderClient::hasNavigatedAwayFromAppBoundDomain): Deleted.
2197         (WebKit::WebFrameLoaderClient::needsInAppBrowserPrivacyQuirks const): Deleted.
2198         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2199         Combined two functions into a simpler function:
2200         shouldEnableInAppBrowserPrivacyProtections().
2201
2202         * WebProcess/WebPage/WebPage.cpp:
2203         (WebKit::m_limitsNavigationsToAppBoundDomains):
2204         (WebKit::WebPage::updatePreferences):
2205         Store the special app-bound domain flag to gate the service worker
2206         API. This should be stored separately from
2207         m_isNavigatingToAppBoundDomain, because in the WebPage constructor we
2208         don't yet know whether the WKAppBoundDomains key exists.
2209
2210         (WebKit::WebPage::loadRequest):
2211         (WebKit::WebPage::loadDataImpl):
2212         (WebKit::WebPage::loadData):
2213         (WebKit::WebPage::loadAlternateHTML):
2214         (WebKit::WebPage::didReceivePolicyDecision):
2215         Remove hasNavigatedAwayFromAppBoundDomain.
2216
2217         (WebKit::WebPage::runJavaScript):
2218         (WebKit::WebPage::setIsNavigatingToAppBoundDomain):
2219         (WebKit::WebPage::shouldEnableInAppBrowserPrivacyProtections):
2220         If m_needsInAppBrowserPrivacyQuirks are on for testing, don't enable
2221         protections. Only notify the WebPageProxy of app-bound behavior if
2222         a navigation has not occured and we know the webView is not app-bound
2223         (in order to limit IPC).
2224
2225         (WebKit::m_isNavigatingToAppBoundDomain): Deleted.
2226         * WebProcess/WebPage/WebPage.h:
2227         (WebKit::WebPage::isNavigatingToAppBoundDomain const):
2228         (WebKit::WebPage::setIsNavigatingToAppBoundDomain): Deleted.
2229         (WebKit::WebPage::hasNavigatedAwayFromAppBoundDomain const): Deleted.
2230         (WebKit::WebPage::setHasNavigatedAwayFromAppBoundDomain): Deleted.
2231         (WebKit::WebPage::needsInAppBrowserPrivacyQuirks const): Deleted.
2232
2233 2020-05-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2234
2235         Remove some unnecessary indirection when getting Document’s Editor
2236         https://bugs.webkit.org/show_bug.cgi?id=211744
2237
2238         Reviewed by Geoffrey Garen.
2239
2240         See WebCore ChangeLog for more information. No change in behavior.
2241
2242         * WebProcess/WebPage/ios/WebPageIOS.mm:
2243         (WebKit::WebPage::performActionOnElement):
2244
2245 2020-05-11  Simon Fraser  <simon.fraser@apple.com>
2246
2247         Fix possible crash in ViewGestureController on macOS
2248         https://bugs.webkit.org/show_bug.cgi?id=211745
2249
2250         Reviewed by Tim Horton.
2251
2252         When ViewGestureController::resetState() clears m_swipeCancellationTracker, it should set it to canceled so that
2253         any pending -trackSwipeEventWithOptions:... which is holding a reference to the WKSwipeCancellationTracker knows
2254         to stop.
2255
2256         * UIProcess/mac/ViewGestureControllerMac.mm:
2257         (WebKit::ViewGestureController::resetState):
2258         (WebKit::ViewGestureController::reset):
2259
2260 2020-05-11  Peng Liu  <peng.liu6@apple.com>
2261
2262         Enable the mock video presentation mode in related layout tests and fix test failures
2263         https://bugs.webkit.org/show_bug.cgi?id=211645
2264
2265         Reviewed by Darin Adler.
2266
2267         Fix the mistake in VideoFullscreenManager::supportsVideoFullscreen() introduced in r202274.
2268
2269         * WebProcess/cocoa/VideoFullscreenManager.mm:
2270         (WebKit::VideoFullscreenManager::supportsVideoFullscreen const):
2271
2272 2020-05-11  Per Arne Vollan  <pvollan@apple.com>
2273
2274         [iOS] Update message filtering rules in the WebContent process' sandbox
2275         https://bugs.webkit.org/show_bug.cgi?id=211188
2276         <rdar://problem/60922910>
2277
2278         Reviewed by Brent Fulgham.
2279
2280         Based on telemetry and local testing, update the message filtering rules in the WebContent process' sandbox on iOS.
2281         Messages that have not been observed being in use, should be denied.
2282
2283         No new tests, covered by existing tests.
2284
2285         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2286
2287 2020-05-11  Chris Dumez  <cdumez@apple.com>
2288
2289         [iOS] WKWebView.evaluateJavaScript should run at foreground priority when app is foreground
2290         https://bugs.webkit.org/show_bug.cgi?id=211734
2291
2292         Reviewed by Darin Adler.
2293
2294         * UIProcess/WebPageProxy.cpp:
2295         (WebKit::WebPageProxy::runJavaScriptInFrameInScriptWorld):
2296
2297 2020-05-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2298
2299         REGRESSION (r253267): issues on touchstart/touchend/touchmove (pointerdown/pointerup/pointermove) events
2300         https://bugs.webkit.org/show_bug.cgi?id=211521
2301         <rdar://problem/62942374>
2302
2303         Reviewed by Darin Adler.
2304
2305         As a brief refresher, deferring gesture recognizers allow us to handle otherwise blocking touch events
2306         asynchronously by having all preventable native gesture recognizers require the deferring gesture recognizer to
2307         fail; we only fail the deferring gesture recognizer once the web process has handled the touch event, and did
2308         not call `preventDefault()`.
2309
2310         These additional failure requirements can cause preventable gestures to be linked together in the same gesture
2311         dependency subgraph; since each subgraph is reset only once all gestures in the subgraph have failed or ended,
2312         this might cause some gestures to be reset after a delay (rather than being reset immediately). To mitigate
2313         this, we divide the set of preventable gestures into multiple (currently, 2) subgraphs: one for gestures that
2314         are reset after a delay, and another for gestures that are immediately resettable. This way, immediately
2315         resettable gestures are able to reset and recognize again, without having to wait for other slower preventable
2316         gesture recognizers to reset.
2317
2318         When fast-clicking is disabled (e.g. when loading a desktop web page on a mobile form factor, or when the
2319         viewport has been zoomed in), the blocking synthetic double tap gesture recognizer (that is, `WKContentView`'s
2320         `_doubleTapGestureRecognizer`) is enabled, and adds itself as a dynamic failure requirement to the content
2321         view's synthetic single tap gesture recognizer (`_singleTapGestureRecognizer`). In terms of the gesture
2322         dependency graph, this causes the single tap gesture to form an edge with the double tap gesture, which ends up
2323         uniting both deferring gesture recognizers under the same subgraph. This means UIWebTouchEventsGestureRecognizer,
2324         which should be one of the gestures in the immediately resettable subgraph, is now connected to the rest of the
2325         delayed resettable gestures, meaning that it cannot recognize until "slowly resettable" gestures such as the
2326         tap-and-half text selection gesture have also been reset. This delay causes touch events to be dropped, as is
2327         the case in this bug.
2328
2329         To fix this, simply quarantine the single tap and double tap gestures inside their own subgraph by introducing a
2330         separate deferring gesture recognizer for them. When fast-clicking is enabled, this does not hinder the ability
2331         for the single tap gesture to fire in rapid succession, since the double tap gesture is disabled (and thus, not
2332         a part of the graph at all). when fast-clicking is disabled, then the double tap gesture will prevent the single
2333         tap gesture from being immediately reset anyways, due to the direct failure requirement between the double and
2334         single tap gesture.
2335
2336         Doing this ensures that no other immediately resettable gesture (`UIWebTouchEventsGestureRecognizer` included)
2337         is accidentally blocked from immediately resetting due to being linked to the delayed resettable gestures by way
2338         of the synthetic single and double tap gestures.
2339
2340         Test: fast/events/touch/ios/tap-and-half-when-viewport-is-not-responsive.html
2341
2342         * UIProcess/ios/WKContentViewInteraction.h:
2343
2344         Add a dedicated deferring gesture recognizer for the synthetic single tap and double tap gesture recognizers.
2345
2346         * UIProcess/ios/WKContentViewInteraction.mm:
2347         (-[WKContentView setUpInteraction]):
2348         (-[WKContentView cleanUpInteraction]):
2349
2350         Use -_deferringGestureRecognizers instead of hard-coding logic for each deferring gesture.
2351
2352         (-[WKContentView _removeDefaultGestureRecognizers]): Ditto.
2353         (-[WKContentView _addDefaultGestureRecognizers]): Ditto.
2354         (-[WKContentView _deferringGestureRecognizers]):
2355
2356         We now have 3 distinct deferring gestures; instead of handling the three deferring gestures individually in
2357         various places in this file, group them all behind a getter that returns an array of deferring gestures, and use
2358         this instead.
2359
2360         (-[WKContentView _doneDeferringNativeGestures:]): Ditto.
2361         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): Ditto.
2362         (-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]):
2363
2364         Partition the synthetic single tap and double tap gestures into their own subgraph.
2365
2366 2020-05-11  Per Arne Vollan  <pvollan@apple.com>
2367
2368         Unreviewed, reverting r261296.
2369
2370         Rolling r260769 back in, since this was not causing a
2371         regression.
2372
2373         Reverted changeset:
2374
2375         "Unreviewed, reverting r260769."
2376         https://bugs.webkit.org/show_bug.cgi?id=211578
2377         https://trac.webkit.org/changeset/261296
2378
2379 2020-05-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2380
2381         Unreviewed, fix the watchOS build after r261457
2382
2383         Put -[WKActionSheetAssistant suggestedActionsForContextMenuWithPositionInformation:] behind a USE(UICONTEXTMENU)
2384         compiler guard; currently, it is declared everywhere, but only implemented if ENABLE(DATA_DETECTION) &&
2385         USE(UICONTEXTMENU). However, WKContentView only invokes it behind code that is guarded by USE(UICONTEXTMENU).
2386
2387         * UIProcess/ios/WKActionSheetAssistant.h:
2388         * UIProcess/ios/WKActionSheetAssistant.mm:
2389         (-[WKActionSheetAssistant suggestedActionsForContextMenuWithPositionInformation:]):
2390
2391 2020-05-11  Philippe Normand  <pnormand@igalia.com>
2392
2393         [GTK] Media and audio permission request unit tests are timing out
2394         https://bugs.webkit.org/show_bug.cgi?id=158257
2395
2396         Reviewed by Carlos Garcia Campos.
2397
2398         Add new private API to disable secure capture device contexts.
2399         This is needed for the API tests.
2400
2401         * UIProcess/API/glib/WebKitWebView.cpp:
2402         (webkitWebViewSetMediaCaptureRequiresSecureConnection):
2403         * UIProcess/API/glib/WebKitWebViewPrivate.h:
2404
2405 2020-05-10  Basuke Suzuki  <basuke.suzuki@sony.com>
2406
2407         Add ENABLE_PERIODIC_MEMORY_MONITOR flag.
2408         https://bugs.webkit.org/show_bug.cgi?id=211704
2409
2410         Reviewed by Yusuke Suzuki.
2411
2412         No new tests because there's no behavior change.
2413
2414         Replace PLATFORM() macros with ENABLE() macro.
2415
2416         * WebProcess/WebProcess.cpp:
2417         (WebKit::WebProcess::initializeWebProcess):
2418
2419 2020-05-10  Michael Catanzaro  <mcatanzaro@gnome.org>
2420
2421         REGRESSION(r261270): Broke build with python3
2422         https://bugs.webkit.org/show_bug.cgi?id=211699
2423
2424         Reviewed by Yusuke Suzuki.
2425
2426         Remove the problematic print statement. It causes the script to fail. If fixed, it spams the
2427         build output. We only print messages during the build when there are problems to be fixed.
2428
2429         * Scripts/generate-message-receiver.py:
2430         (main):
2431
2432 2020-05-10  Tim Horton  <timothy_horton@apple.com>
2433
2434         Clicking a tel:// link on iPad with a trackpad presents different UI than tapping on it
2435         https://bugs.webkit.org/show_bug.cgi?id=211686
2436         <rdar://problem/57941589>
2437
2438         Reviewed by Wenson Hsieh.
2439
2440         Previously, iOS WebKit had code in handleTap, handleTwoFingerTapAtPoint, and commitPotentialTap,
2441         which introspected the hit element /before/ dispatching the tap (or synthetic click) to the DOM,
2442         short circuiting all normal event handling machinery in order to prevent the default action
2443         and present the Data Detectors UI for the given link.
2444
2445         There's one immediate problem with this, which is that there is no similar code in the direct
2446         click event handler path, which we now use for trackpad/mouse input on iPad. There's also a
2447         secondary problem (which we have not seen in practice), which is that pages cannot preventDefault
2448         to avoid launching the Data Detectors UI on a link, like they could to prevent an ordinary
2449         link from being followed.
2450
2451         In order to resolve both issues and reduce duplication of logic, move the code that introspects
2452         the element and invokes Data Detectors UI from high-level WebKit event dispatch code (where it
2453         doesn't really belong) down to WebCore's default click event handler for anchors, right next to
2454         the code that would ordinarily cause a navigation. This way, no matter how we get here, whether
2455         by synthetic click or real click, we'll invoke the Data Detectors UI.
2456
2457         One alternative considered at length: we could actually let the navigation happen, and instead
2458         handle the switch in navigation policy code, but there are a few reasons that did not seem ideal:
2459         1) We'd need to plumb platform-specific data structures through a ton of FrameLoader code.
2460         2) Clients often block non-HTTP(S) navigations, so in order to keep the feature functional,
2461            we'd have to disregard the client's policy decision, defeating much of the purpose of making
2462            use of the navigation mechanism in the first place.
2463
2464         * UIProcess/PageClient.h:
2465         * UIProcess/WebPageProxy.h:
2466         * UIProcess/WebPageProxy.messages.in:
2467         * UIProcess/ios/PageClientImplIOS.h:
2468         * UIProcess/ios/PageClientImplIOS.mm:
2469         (WebKit::PageClientImpl::showDataDetectorsUIForPositionInformation):
2470         * UIProcess/ios/WebPageProxyIOS.mm:
2471         (WebKit::WebPageProxy::showDataDetectorsUIForPositionInformation):
2472         * WebProcess/WebCoreSupport/WebChromeClient.h:
2473         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
2474         (WebKit::WebChromeClient::showDataDetectorsUIForElement):
2475         Plumb showDataDetectorsUIForPositionInformation from iOS WebKit's ChromeClient
2476         implementation all the way to WKContentView.
2477
2478         * UIProcess/ios/WKActionSheetAssistant.h:
2479         * UIProcess/ios/WKActionSheetAssistant.mm:
2480         (-[WKActionSheetAssistant showDataDetectorsUIForPositionInformation:]):
2481         (-[WKActionSheetAssistant contextMenuInteraction:configurationForMenuAtLocation:]):
2482         (-[WKActionSheetAssistant contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
2483         (-[WKActionSheetAssistant showDataDetectorsSheet]): Deleted.
2484         Make it possible to push InteractionInformationAtPosition into WKActionSheetAssistant,
2485         instead of having it always pull a fresh one upon invocation, so that we can use the
2486         position information passed along with the showDataDetectorsUIForPositionInformation message.
2487
2488         (-[WKActionSheetAssistant _contextMenuInteraction:overrideSuggestedActionsForConfiguration:]):
2489         (-[WKActionSheetAssistant suggestedActionsForContextMenuWithPositionInformation:]):
2490         Fix an existing bug where Data Detectors context menus would show extra default actions,
2491         by moving our implementation of the -_contextMenuInteraction:overrideSuggestedActionsForConfiguration:
2492         delegate here, sharing it with WKContentViewInteraction.
2493
2494         In a future patch, we should reconsider having three separate UIContextMenuInteractions.
2495
2496         Also, remove the contextMenuPresentationLocationForActionSheetAssistant: delegate,
2497         since it will be wrong in the case of pushed-in position information, and instead
2498         use the position information's original hit test point.
2499
2500         * UIProcess/ios/WKContentViewInteraction.h:
2501         * UIProcess/ios/WKContentViewInteraction.mm:
2502         (-[WKContentView _showDataDetectorsUI]):
2503         (-[WKContentView _showDataDetectorsUIForPositionInformation:]):
2504         (-[WKContentView _actionForLongPressFromPositionInformation:]):
2505         (-[WKContentView _didNotHandleTapAsClick:]):
2506         (-[WKContentView dataDetectionContextForPositionInformation:]):
2507         (-[WKContentView dataDetectionContextForActionSheetAssistant:positionInformation:]):
2508         (-[WKContentView _showDataDetectorsSheet]): Deleted.
2509         (-[WKContentView currentPositionInformation]): Deleted.
2510         (-[WKContentView dataDetectionContextForActionSheetAssistant:]): Deleted.
2511         Instead of exposing an unnecessary -currentPositionInformation getter on WKActionSheetAssistant,
2512         provide it as an argument to the WKActionSheetAssistantDelegate methods that actually need it.
2513
2514         (-[WKContentView contextMenuPresentationLocationForActionSheetAssistant:]): Deleted.
2515         (-[WKContentView _contextMenuInteraction:overrideSuggestedActionsForConfiguration:]):
2516         Adopt WKActionSheetAssistant's suggestedActions mechanism so we can share code.
2517
2518         * UIProcess/ios/WKPDFView.mm:
2519         (-[WKPDFView _showActionSheetForURL:atLocation:withAnnotationRect:]):
2520         (-[WKPDFView dataDetectionContextForActionSheetAssistant:positionInformation:]):
2521         (-[WKPDFView dataDetectionContextForActionSheetAssistant:]): Deleted.
2522         Adapt to some WKActionSheetAssistantDelegate changes.
2523
2524         * WebProcess/WebPage/WebPage.h:
2525         * WebProcess/WebPage/ios/WebPageIOS.mm:
2526         (WebKit::WebPage::handleTap):
2527         (WebKit::WebPage::handleTwoFingerTapAtPoint):
2528         (WebKit::WebPage::commitPotentialTap):
2529         Remove the aforementioned short-circuiting paths for Data Detectors links.
2530 2020-05-09  David Kilzer  <ddkilzer@apple.com>
2531
2532         Attempt #2 to fix internal iOS build
2533
2534         * UIProcess/ios/WKMouseGestureRecognizer.mm:
2535         - Use ALLOW_DEPRECATED_IMPLEMENTATIONS_{BEGIN,END}.
2536
2537 2020-05-09  David Kilzer  <ddkilzer@apple.com>
2538
2539         Attemp to fix internal iOS build
2540
2541         * Platform/spi/ios/UIKitSPI.h:
2542         - Define @class UIHoverEvent using header if available, else
2543           fall back to local class definition.
2544         - Define methods separately from class definition.
2545         * UIProcess/ios/WKMouseGestureRecognizer.mm:
2546         (-[WKMouseGestureRecognizer setView:]):
2547         - Use new method if it is available.
2548
2549 2020-05-09  Commit Queue  <commit-queue@webkit.org>
2550
2551         Unreviewed, reverting r261389.
2552         https://bugs.webkit.org/show_bug.cgi?id=211678
2553
2554         Introduced page loading regression. (Requested by perarne on
2555         #webkit).
2556
2557         Reverted changeset:
2558
2559         "[iOS] Update message filtering rules in the WebContent
2560         process' sandbox"
2561         https://bugs.webkit.org/show_bug.cgi?id=211188
2562         https://trac.webkit.org/changeset/261389
2563
2564 2020-05-09  David Kilzer  <ddkilzer@apple.com>
2565
2566         Adapt LocalCurrentGraphicsContext for iOS
2567         <https://webkit.org/b/211660>
2568
2569         Reviewed by Darin Adler.
2570
2571         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2572         (WebKit::convertPlatformImageToBitmap):
2573         - Use LocalCurrentGraphicsContext for both iOS and Mac code
2574           paths.
2575
2576         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
2577         - Switch from PLATFORM(MAC) and PLATFORM(IOS_FAMIY) to
2578           USE(APPKIT) to separate platform code.
2579         (WebKit::convertDragImageToBitmap):
2580         (WebKit::convertImageToBitmap): Delete.
2581         (WebKit::convertCGImageToBitmap): Delete.
2582         - Combine Mac-specific convertImageToBitmap() and iOS-specific
2583           convertCGImageToBitmap() into a single method using DragImage
2584           type and special-casing one line of code.
2585         (WebKit::WebDragClient::startDrag):
2586         (WebKit::WebDragClient::didConcludeEditDrag):
2587         - Combine iOS and Mac methods into a singe method.
2588
2589 2020-05-09  David Quesada  <david_quesada@apple.com>
2590
2591         Remove HAVE_UI_SCROLL_VIEW_INDICATOR_FLASHING_SPI
2592         https://bugs.webkit.org/show_bug.cgi?id=211662
2593         rdar://problem/63048713
2594
2595         Reviewed by Darin Adler.
2596
2597         Remove this platform conditional and unconditionally use -[UIScrolView _flashScrollIndicatorsForAxes:
2598         persistingPreviousFlashes:]. All supported platforms with UIScrollView have this SPI, and the conditional
2599         was excluding Mac Catalyst, making WKKeyboardScrollViewAnimator send a message to its scroll view that
2600         is no longer implemented.
2601
2602         * Platform/spi/ios/UIKitSPI.h:
2603             Remove the declaration of the now unused -_flashScrollIndicatorsPersistingPreviousFlashes:.
2604         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
2605         (axesForDelta):
2606         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
2607
2608 2020-05-08  David Kilzer  <ddkilzer@apple.com>
2609
2610         Remove empty directories from from svn.webkit.org repository
2611         <https://webkit.org/b/211644>
2612
2613         Reviewed by Darin Adler.
2614
2615         * UIProcess/API/win: Removed.
2616
2617 2020-05-08  Chris Dumez  <cdumez@apple.com>
2618
2619         Regression(r210945): No attachment when sharing to mail
2620         https://bugs.webkit.org/show_bug.cgi?id=211651
2621         <rdar://problem/63040170>
2622
2623         Reviewed by Tim Horton.
2624
2625         When failing to determine foreground state, the code before r210945 was assuming
2626         'foreground', while the code in r210945 assume 'background'. This causes things
2627         to not render properly when we fail to determine the foreground state.
2628
2629         This patch merely restores pre-r210945 behavior. I will investigate why we are
2630         unable to determinate the host application PID for the MailCompositionService.
2631
2632         * UIProcess/ApplicationStateTracker.mm:
2633         (WebKit::isApplicationForeground):
2634
2635 2020-05-08  Nikos Mouchtaris  <nmouchtaris@apple.com>
2636
2637         Implement web-share v2 for files
2638         https://bugs.webkit.org/show_bug.cgi?id=209265
2639
2640         Reviewed by Andy Estes.
2641
2642         Added support for passing file objects over IPC and
2643         sharing of files to share sheet.
2644
2645         * Shared/WebCoreArgumentCoders.cpp:
2646         (IPC::ArgumentCoder<Vector<RawFile>>::encode):
2647         (IPC::ArgumentCoder<Vector<RawFile>>::decode):
2648         (IPC::ArgumentCoder<ShareDataWithParsedURL>::encode):
2649         (IPC::ArgumentCoder<ShareDataWithParsedURL>::decode):
2650         * Shared/WebCoreArgumentCoders.h:
2651         * UIProcess/Cocoa/ShareableFileWrite.h: Added.
2652         * UIProcess/Cocoa/ShareableFileWrite.mm: Added.
2653         (+[WKShareableFileWrite getSharingDirectoryPath]):
2654         (+[WKShareableFileWrite getFileDirectoryForSharing]):
2655         (+[WKShareableFileWrite removeFileDirectoryForSharing]):
2656         (+[WKShareableFileWrite setQuarantineInformationForFilePath:]):
2657         (+[WKShareableFileWrite applyQuarantineSandboxAndDownloadFlagsToFileAtPath:]):
2658         (+[WKShareableFileWrite createFilename:]):
2659         (+[WKShareableFileWrite writeFileToShareableURL:data:]):
2660         * UIProcess/Cocoa/WKShareSheet.mm:
2661         (-[WKShareSheet presentWithParameters:inRect:completionHandler:]):
2662         (-[WKShareSheet _didCompleteWithSuccess:]):
2663         * WebKit.xcodeproj/project.pbxproj:
2664
2665 2020-05-08  Brent Fulgham  <bfulgham@apple.com>
2666
2667         Revise sandbox to stop logging some commonly-used properties 
2668         https://bugs.webkit.org/show_bug.cgi?id=211636
2669         <rdar://problem/63014244>
2670
2671         Reviewed by Per Arne Vollan.
2672
2673         Further living on and testing has shown a handful of sysctl entries that are in regular use, and do not need
2674         to be logged or considered for removal. This patch has no change in behavior, just reduces logging.
2675
2676         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2677         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2678
2679 2020-05-08  Chris Dumez  <cdumez@apple.com>
2680
2681         Make WKWebViewConfiguration._alwaysRunsAtForegroundPriority an alias for _clientNavigationsRunAtForegroundPriority
2682         https://bugs.webkit.org/show_bug.cgi?id=211632
2683
2684         Reviewed by Darin Adler.
2685
2686         Make WKWebViewConfiguration._alwaysRunsAtForegroundPriority an alias for _clientNavigationsRunAtForegroundPriority.
2687         _alwaysRunsAtForegroundPriority is a frequent source of process assertion leaks that get blamed on WebKit. Clients
2688         are using this in order to be able to do loads in background views so _clientNavigationsRunAtForegroundPriority
2689         should suffice and is not leak prone since the process assertion is released after the navigation has completed.
2690
2691         * UIProcess/API/APIPageConfiguration.cpp:
2692         (API::PageConfiguration::copy const):
2693         * UIProcess/API/APIPageConfiguration.h:
2694         (API::PageConfiguration::alwaysRunsAtForegroundPriority const): Deleted.
2695         (API::PageConfiguration::setAlwaysRunsAtForegroundPriority): Deleted.
2696         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2697         (-[WKWebViewConfiguration _alwaysRunsAtForegroundPriority]):
2698         (-[WKWebViewConfiguration _setAlwaysRunsAtForegroundPriority:]):
2699         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2700         * UIProcess/WebPageProxy.cpp:
2701         (WebKit::WebPageProxy::close):
2702         (WebKit::WebPageProxy::updateThrottleState):
2703         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2704         * UIProcess/WebPageProxy.h:
2705
2706 2020-05-08  Alex Christensen  <achristensen@webkit.org>
2707
2708         Revert r260390
2709         https://bugs.webkit.org/show_bug.cgi?id=210759
2710         <rdar://problem/62608140>
2711
2712         r260390 was intended to stop hitting some assertions in ~PendingFrameLoad, but it seems to have caused a regression.
2713         Reverting it and removing the invalid assertions.
2714
2715         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2716         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::~PendingFrameLoad):
2717         (WebKit::NetworkCache::SpeculativeLoadManager::~SpeculativeLoadManager):
2718
2719 2020-05-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2720
2721         [iOS] caret appears in the middle of a search field when field is focused on agoda.com
2722         https://bugs.webkit.org/show_bug.cgi?id=211591
2723         <rdar://problem/60605873>
2724
2725         Reviewed by Antoine Quint.
2726
2727         The main search field on the mobile version of this website begins offscreen, with a CSS transform that moves it
2728         to the far right; tapping the button element that (visually) has a search-field-like appearance on the front
2729         page programmatically focuses the real offscreen search field, and animates it onscreen by changing the CSS
2730         transform attribute to remove the x-axis translation.
2731
2732         On iOS, the caret rect is computed and sent to the UI process via editor state updates; however, the editor
2733         state is computed immediately after focusing the input field. As such, the caret rect at this moment is computed
2734         in the middle of the animation, leaving it stuck in an unpredictable location.
2735
2736         To fix this, add plumbing to call into the WebKit client layer when an animation has ended. On iOS, if the
2737         selection is visible (i.e. a ranged selection, or editable caret), then check to see whether the element that
2738         has finished animating contains either endpoint of the selection. If so, then schedule a followup editor state
2739         update to push updated selection information to the UI process.
2740
2741         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2742         (WebKit::WebChromeClient::animationDidFinishForElement):
2743         * WebProcess/WebCoreSupport/WebChromeClient.h:
2744
2745         Add a new client hook for when animations end.
2746
2747         * WebProcess/WebPage/WebPage.cpp:
2748         (WebKit::WebPage::animationDidFinishForElement):
2749         * WebProcess/WebPage/WebPage.h:
2750         * WebProcess/WebPage/ios/WebPageIOS.mm:
2751
2752         Add logic to schedule a new editor state update if needed, after an animation ends that might affect either
2753         the start or end of the selection.
2754
2755         (WebKit::WebPage::animationDidFinishForElement):
2756
2757 2020-05-08  David Kilzer  <ddkilzer@apple.com>
2758
2759         REGRESSION (r260228): Linker warning about limitsNavigationsToAppBoundDomains property overriding instance methods from class
2760         <https://webkit.org/b/211393>
2761
2762         Reviewed by Brent Fulgham.
2763
2764         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2765         (-[WKWebViewConfiguration limitsNavigationsToAppBoundDomains]):
2766         (-[WKWebViewConfiguration setLimitsNavigationsToAppBoundDomains:]):
2767         - Move from WKPrivate category to main category to fix linker
2768           warnings.
2769
2770 2020-05-08  Chris Dumez  <cdumez@apple.com>
2771
2772         REGRESSION(r259209) Webview's pending URL is null after restoring session state
2773         https://bugs.webkit.org/show_bug.cgi?id=211626
2774         <rdar://problem/62992262>
2775
2776         Reviewed by Alex Christensen.
2777
2778         The issue was that WebPageProxy::goToBackForwardItem() would behave differently whether
2779         the page has a running process or not. In particular, when the page did not have a
2780         running process, goToBackForwardItem() would return early and call launchProcessWithItem()
2781         instead. Unlike goToBackForwardItem(), launchProcessWithItem() would fail to set the
2782         pending API request.
2783
2784         To address the issue, I am getting rid of launchProcessWithItem() and merging its logic
2785         into goToBackForwardItem() instead. Both methods shared a lot of code anyway and having
2786         2 separate code paths that may diverge is error prone.
2787
2788         Change is covered by new API test.
2789
2790         * UIProcess/WebPageProxy.cpp:
2791         (WebKit::WebPageProxy::goToBackForwardItem):
2792         (WebKit::WebPageProxy::launchProcessWithItem): Deleted.
2793         * UIProcess/WebPageProxy.h:
2794
2795 2020-05-08  Alex Christensen  <achristensen@webkit.org>
2796
2797         WKWebView.title should be safe browsing warning's title during a safe browsing warning
2798         https://bugs.webkit.org/show_bug.cgi?id=211403
2799
2800         Reviewed by Tim Horton.
2801
2802         Add a new property to PageLoadState, which allows the title to be set underneath it.
2803         That way, once the safe browsing warning is closed, we can update the title to what it would've been,
2804         including any changes that happened while the warning was open.
2805
2806         Covered by an API test.  I also manually verified this fixes rdar://problem/56201982
2807
2808         * UIProcess/PageLoadState.cpp:
2809         (WebKit::PageLoadState::commitChanges):
2810         (WebKit::PageLoadState::reset):
2811         (WebKit::PageLoadState::didCommitLoad):
2812         (WebKit::PageLoadState::title const):
2813         (WebKit::PageLoadState::setTitleFromSafeBrowsingWarning):
2814         * UIProcess/PageLoadState.h:
2815         * UIProcess/WebPageProxy.cpp:
2816         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2817
2818 2020-05-08  Per Arne Vollan  <pvollan@apple.com>
2819
2820         [iOS] Update message filtering rules in the WebContent process' sandbox
2821         https://bugs.webkit.org/show_bug.cgi?id=211188
2822
2823         Reviewed by Brent Fulgham.
2824
2825         Based on telemetry and local testing, update the message filtering rules in the WebContent process' sandbox on iOS.
2826         Messages that have not been observed being in use should be denied.
2827
2828         No new tests, covered by existing tests.
2829
2830         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2831
2832 2020-05-08  Chris Dumez  <cdumez@apple.com>
2833
2834         Turn processDidBecomeUnresponsive logging into error logging
2835         https://bugs.webkit.org/show_bug.cgi?id=211629
2836
2837         Reviewed by Youenn Fablet.
2838
2839         * UIProcess/WebPageProxy.cpp:
2840         (WebKit::WebPageProxy::processDidBecomeUnresponsive):
2841
2842 2020-05-08  Per Arne Vollan  <pvollan@apple.com>
2843
2844         [Cocoa] Close connections to Launch Services after revoking extension
2845         https://bugs.webkit.org/show_bug.cgi?id=211594
2846
2847         Reviewed by Brent Fulgham.
2848
2849         In <https://trac.webkit.org/changeset/258915/webkit>, connections to the Launch Services database mapping
2850         services were denied, by creating a temporary extension. After revoking this extension in the WebContent
2851         process, it is important to close any open connections to Launch Services initiated by the mapping.
2852
2853         No new tests, covered by existing UTI/MIME type tests.
2854
2855         * WebProcess/cocoa/WebProcessCocoa.mm:
2856         (WebKit::WebProcess::platformInitializeWebProcess):
2857
2858 2020-05-08  Youenn Fablet  <youenn@apple.com>
2859
2860         Handle remote audio capture IPC messages in a background thread
2861         https://bugs.webkit.org/show_bug.cgi?id=211583
2862
2863         Reviewed by Eric Carlson.
2864
2865         We introduce RemoteCaptureSampleManager which is responsible to get remote capture sample IPC messages and treat them from a background thread.
2866         It is currently used to handle audio capture IPC messages.
2867         We move UserMediaCaptureManager::Source in its own file and rename it to RemoteRealtimeMediaSource.
2868
2869         Covered by existing tests.
2870
2871         * DerivedSources-input.xcfilelist:
2872         * DerivedSources-output.xcfilelist:
2873         * DerivedSources.make:
2874         * PlatformMac.cmake:
2875         * SourcesCocoa.txt:
2876         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2877         * WebKit.xcodeproj/project.pbxproj:
2878         * WebProcess/cocoa/RemoteCaptureSampleManager.cpp: Added.
2879         (WebKit::RemoteCaptureSampleManager::RemoteCaptureSampleManager):
2880         (WebKit::RemoteCaptureSampleManager::~RemoteCaptureSampleManager):
2881         (WebKit::RemoteCaptureSampleManager::setConnection):
2882         (WebKit::RemoteCaptureSampleManager::addSource):
2883         (WebKit::RemoteCaptureSampleManager::removeSource):
2884         (WebKit::RemoteCaptureSampleManager::dispatchToThread):
2885         (WebKit::RemoteCaptureSampleManager::storageChanged):
2886         (WebKit::RemoteCaptureSampleManager::audioSamplesAvailable):
2887         * WebProcess/cocoa/RemoteCaptureSampleManager.h: Added.
2888         * WebProcess/cocoa/RemoteCaptureSampleManager.messages.in: Added.
2889         * WebProcess/cocoa/RemoteRealtimeMediaSource.cpp: Added.
2890         (WebKit::RemoteRealtimeMediaSource::RemoteRealtimeMediaSource):
2891         (WebKit::RemoteRealtimeMediaSource::~RemoteRealtimeMediaSource):
2892         (WebKit::RemoteRealtimeMediaSource::whenReady):
2893         (WebKit::RemoteRealtimeMediaSource::didFail):
2894         (WebKit::RemoteRealtimeMediaSource::setAsReady):
2895         (WebKit::RemoteRealtimeMediaSource::clone):
2896         (WebKit::RemoteRealtimeMediaSource::setCapabilities):
2897         (WebKit::RemoteRealtimeMediaSource::setSettings):
2898         (WebKit::RemoteRealtimeMediaSource::remoteAudioSamplesAvailable):
2899         (WebKit::RemoteRealtimeMediaSource::remoteVideoSampleAvailable):
2900         (WebKit::RemoteRealtimeMediaSource::connection):
2901         (WebKit::RemoteRealtimeMediaSource::startProducingData):
2902         (WebKit::RemoteRealtimeMediaSource::stopProducingData):
2903         (WebKit::RemoteRealtimeMediaSource::setShouldApplyRotation):
2904         (WebKit::RemoteRealtimeMediaSource::capabilities):
2905         (WebKit::RemoteRealtimeMediaSource::applyConstraints):
2906         (WebKit::RemoteRealtimeMediaSource::applyConstraintsSucceeded):
2907         (WebKit::RemoteRealtimeMediaSource::applyConstraintsFailed):
2908         (WebKit::RemoteRealtimeMediaSource::hasEnded):
2909         (WebKit::RemoteRealtimeMediaSource::stopBeingObserved):
2910         (WebKit::RemoteRealtimeMediaSource::requestToEnd):
2911         * WebProcess/cocoa/RemoteRealtimeMediaSource.h: Added.
2912         (WebKit::RemoteRealtimeMediaSource::identifier const):
2913         (WebKit::RemoteRealtimeMediaSource::settings const):
2914         (WebKit::RemoteRealtimeMediaSource::setShouldCaptureInGPUProcess):
2915         (WebKit::RemoteRealtimeMediaSource::shouldCaptureInGPUProcess const):
2916         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2917         (WebKit::UserMediaCaptureManager::createCaptureSource):
2918         (WebKit::UserMediaCaptureManager::cloneSource):
2919         (WebKit::UserMediaCaptureManager::cloneVideoSource):
2920         (WebKit::UserMediaCaptureManager::AudioFactory::createAudioCaptureSource):
2921         (WebKit::UserMediaCaptureManager::AudioFactory::setShouldCaptureInGPUProcess):
2922         (WebKit::UserMediaCaptureManager::VideoFactory::createVideoCaptureSource):
2923         (WebKit::UserMediaCaptureManager::DisplayFactory::createDisplayCaptureSource):
2924         * WebProcess/cocoa/UserMediaCaptureManager.h:
2925         * WebProcess/cocoa/UserMediaCaptureManager.messages.in:
2926
2927 2020-05-08  Youenn Fablet  <youenn@apple.com>
2928
2929         Video capture does not get unmuted in case of tab switch on iOS
2930         https://bugs.webkit.org/show_bug.cgi?id=211509
2931
2932         Reviewed by Eric Carlson.
2933
2934         Remove no longer needed code.
2935
2936         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2937         (WebKit::UserMediaCaptureManager::VideoFactory::setActiveSource):
2938         * WebProcess/cocoa/UserMediaCaptureManager.h:
2939
2940 2020-05-08  Carlos Garcia Campos  <cgarcia@igalia.com>
2941
2942         Unreviewed. Fix GTK4 build after r261370
2943
2944         * UIProcess/API/gtk/WebKitScriptDialogGtk.cpp:
2945         (webkitScriptDialogIsUserHandled):
2946
2947 2020-05-08  Lauro Moura  <lmoura@igalia.com>
2948
2949         [WPE][WebDriver] Implement user prompt support
2950         https://bugs.webkit.org/show_bug.cgi?id=207372
2951
2952         Reviewed by Carlos Garcia Campos.
2953
2954         Provide a default implementation for WebDriver dialog commands.
2955         This implementation will mimic the expected browser behavior of
2956         accepting/dismissing the dialogs, while not exposing any new API.
2957
2958         * UIProcess/API/glib/WebKitScriptDialogPrivate.h:
2959         - Expose new private function to check whether the dialog is using a
2960         default implementation or is handled by the user.
2961         * UIProcess/API/glib/WebKitWebView.cpp:
2962         - Avoid default WebDriver behavior if the dialog is user-handled.
2963         (webkitWebViewSetCurrentScriptDialogUserInput):
2964         (webkitWebViewAcceptCurrentScriptDialog):
2965         (webkitWebViewDismissCurrentScriptDialog):
2966         * UIProcess/API/gtk/WebKitScriptDialogGtk.cpp:
2967         (webkitScriptDialogIsUserHandled):
2968         - Return whether the dialog is user handled.
2969         * UIProcess/API/wpe/WebKitScriptDialogWPE.cpp:
2970         - Added basic behavior for the WebDriver dialog callbacks for WPE.
2971         (webkitScriptDialogAccept):
2972         (webkitScriptDialogDismiss):
2973         (webkitScriptDialogSetUserInput):
2974         (webkitScriptDialogIsUserHandled):
2975
2976         * UIProcess/API/wpe/WebKitWebViewWPE.cpp:
2977         (webkitWebViewScriptDialog):
2978         - Hold a dialog ref if the webview is controlled by automation and ends
2979         up calling the default "script-dialog" event handler.
2980
2981 2020-05-07  Jiewen Tan  <jiewen_tan@apple.com>
2982
2983         [WebAuthn] Roll back newly created credentials if an error occurs
2984         https://bugs.webkit.org/show_bug.cgi?id=183530
2985         <rdar://problem/43357305>
2986
2987         Reviewed by Brent Fulgham.
2988
2989         We should clean up any newly created credentials if an error occurs before the relying party
2990         registers the identity. Otherwise we are left with a dangling credential.
2991
2992         Covered by API tests.
2993
2994         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h:
2995         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
2996         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification):
2997         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserVerification):
2998         (WebKit::LocalAuthenticator::receiveException const):
2999
3000 2020-05-07  Chris Dumez  <cdumez@apple.com>
3001
3002         Unreviewed, reverting r261252.
3003
3004         Reland r260684 now that a proper fix has landed in Reader
3005
3006         Reverted changeset:
3007
3008         "REGRESSION (r260684): Reader background is lost after
3009         multitasking"
3010         https://bugs.webkit.org/show_bug.cgi?id=211533
3011         https://trac.webkit.org/changeset/261252
3012
3013 2020-05-07  Megan Gardner  <megan_gardner@apple.com>
3014
3015         Build Fix for MacCatalyst
3016         https://bugs.webkit.org/show_bug.cgi?id=211601
3017
3018         Reviewed by Tim Horton.
3019
3020         * UIProcess/ios/WKContentViewInteraction.mm:
3021         (-[WKContentView _removeContextMenuViewIfPossible]):
3022
3023 2020-05-07  Chris Dumez  <cdumez@apple.com>
3024
3025         Crash under WebKit::XPCServiceMain
3026         https://bugs.webkit.org/show_bug.cgi?id=211600
3027         <rdar://problem/62875458>
3028
3029         Reviewed by Darin Adler.
3030
3031         Made the following changes:
3032         - Crash under strcmp() could in theory happen if expectedBundleVersion.UTF8String was null, which could
3033           happen if expectedBundleVersion was null. I now use higher level String types for the versions, make
3034           sure they are not null and use String comparison to compare them.
3035         - Call CRASH() instead of __builtin_trap(), to guarantee that we crash with a SIGTRAP (see comment next
3036           to CRASH() macro).
3037         - Move CRASH() call to a crashDueWebKitFrameworkVersionMismatch() never inlined function to make it
3038           clear when it crashes due to a framework version mismatch and distinguish from proper crashes.
3039
3040         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
3041         (WebKit::crashDueWebKitFrameworkVersionMismatch):
3042         (WebKit::XPCServiceMain):
3043
3044 2020-05-07  Youenn Fablet  <youenn@apple.com>
3045
3046         Remove AudioMediaStreamTrackRenderer::muted
3047         https://bugs.webkit.org/show_bug.cgi?id=211289
3048
3049         Reviewed by Eric Carlson.
3050
3051         muted is unnecessary since we are using start/stop instead.
3052
3053         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp:
3054         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h:
3055         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.messages.in:
3056         * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp:
3057         * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.h:
3058
3059 2020-05-07  Don Olmstead  <don.olmstead@sony.com>
3060
3061         Remove unused USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
3062         https://bugs.webkit.org/show_bug.cgi?id=211582
3063
3064         Reviewed by Fujii Hironori.
3065
3066         After r261264 all ports implemented USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR.
3067
3068         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3069         (WebKit::ThreadedCompositor::ThreadedCompositor):
3070         (WebKit::m_displayRefreshMonitor):
3071         (WebKit::ThreadedCompositor::invalidate):
3072         (WebKit::ThreadedCompositor::sceneUpdateFinished):
3073         (WebKit::ThreadedCompositor::displayRefreshMonitor):
3074         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
3075         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
3076         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h:
3077         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3078         (WebKit::WebChromeClient::createDisplayRefreshMonitor const):
3079         * WebProcess/WebCoreSupport/WebChromeClient.h:
3080         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
3081         (WebKit::DrawingAreaCoordinatedGraphics::createDisplayRefreshMonitor):
3082         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h:
3083         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
3084         (WebKit::LayerTreeHost::createDisplayRefreshMonitor):
3085         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
3086         (WebKit::LayerTreeHost::deviceOrPageScaleFactorChanged):
3087         * WebProcess/WebPage/DrawingArea.cpp:
3088         * WebProcess/WebPage/DrawingArea.h:
3089         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.h:
3090         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
3091         * WebProcess/WebPage/mac/DrawingAreaMac.cpp:
3092
3093 2020-05-07  Darin Adler  <darin@apple.com>
3094
3095         Add some missing null checks for DocumentLoader
3096         https://bugs.webkit.org/show_bug.cgi?id=211544
3097         rdar://62843516
3098
3099         Reviewed by Anders Carlsson.
3100
3101         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3102         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
3103         Add a null check before calling DocumentLoader::response.
3104
3105 2020-05-07  Darin Adler  <darin@apple.com>
3106
3107         Remove USE(INSERTION_UNDO_GROUPING) checks in macOS platform code
3108         https://bugs.webkit.org/show_bug.cgi?id=211525
3109
3110         Reviewed by Anders Carlsson.
3111
3112         * UIProcess/Cocoa/WebViewImpl.mm: Use NSTextInputContextSPI.h.
3113         (WebKit::WebViewImpl::validAttributesForMarkedText): Removed
3114         USE(INSERTION_UNDO_GROUPING) from the macOS-specific code here.
3115         (WebKit::WebViewImpl::insertText): Ditto.
3116         * UIProcess/PageClient.h: Ditto.
3117         * UIProcess/ios/PageClientImplIOS.mm:
3118         (WebKit::PageClientImpl::registerInsertionUndoGrouping): Deleted.
3119         This function is not needed at all on iOS.
3120         * UIProcess/mac/PageClientImplMac.h: Removed USE(INSERTION_UNDO_GROUPING).
3121         * UIProcess/mac/PageClientImplMac.mm:
3122         (WebKit::PageClientImpl::registerInsertionUndoGrouping): Ditto.
3123
3124 2020-05-07  Chris Dumez  <cdumez@apple.com>
3125
3126         Drop dead platformPrepareToSuspend / platformProcessDidResume in NetworkProcess
3127         https://bugs.webkit.org/show_bug.cgi?id=211579
3128
3129         Reviewed by Geoffrey Garen.
3130
3131         * NetworkProcess/NetworkProcess.cpp:
3132         (WebKit::NetworkProcess::prepareToSuspend):
3133         (WebKit::NetworkProcess::resume):
3134         * NetworkProcess/NetworkProcess.h:
3135         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3136         (WebKit::NetworkProcess::platformPrepareToSuspend): Deleted.
3137         (WebKit::NetworkProcess::platformProcessDidResume): Deleted.
3138         * NetworkProcess/curl/NetworkProcessCurl.cpp:
3139         (WebKit::NetworkProcess::platformPrepareToSuspend): Deleted.
3140         (WebKit::NetworkProcess::platformProcessDidResume): Deleted.
3141         * NetworkProcess/soup/NetworkProcessSoup.cpp:
3142         (WebKit::NetworkProcess::platformPrepareToSuspend): Deleted.
3143         (WebKit::NetworkProcess::platformProcessDidResume): Deleted.
3144
3145 2020-05-07  Megan Gardner  <megan_gardner@apple.com>
3146
3147         ContextMenu: entire webpage pops and disappears to generate preview of embedded image
3148         https://bugs.webkit.org/show_bug.cgi?id=211272
3149         <rdar://problem/62482013>
3150
3151         Reviewed by Tim Horton.
3152
3153         The ActionSheetAssistant is always around, so using the presence of one
3154         to determine if we need to remove the _contextMenuHintContainerView is incorrect
3155         and causes it to be around on the next invocation of the context menu, and 
3156         causing the failure of the creation of a new preview, which then will default to
3157         popping the whole page. We need to ask the ActionSheetAssistant if it is actively showing
3158         anything, and then correctly clean up the _contextMenuHintContainerView after the 
3159         end of the interactions for FileUploadMenu and ActionSheetAssistant are done with their
3160         interactions. 
3161
3162         * UIProcess/ios/WKActionSheetAssistant.h:
3163         * UIProcess/ios/WKActionSheetAssistant.mm:
3164         (-[WKActionSheetAssistant removeContextMenuInteraction]):
3165         (-[WKActionSheetAssistant hasContextMenuInteraction]):
3166         * UIProcess/ios/WKContentViewInteraction.h:
3167         * UIProcess/ios/WKContentViewInteraction.mm:
3168         (-[WKContentView removeContextMenuViewIfPossibleForActionSheetAssistant:]):
3169         (-[WKContentView _canRemoveContextMenuView]):
3170         (-[WKContentView _removeContextMenuViewIfPossible]):
3171         (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]):
3172         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3173         (-[WKFileUploadPanel removeContextMenuInteraction]):
3174
3175 2020-05-07  Chris Dumez  <cdumez@apple.com>
3176
3177         Simplify several IPC sending call sites in the UIProcess
3178         https://bugs.webkit.org/show_bug.cgi?id=211575
3179
3180         Reviewed by Alex Christensen.
3181
3182         Simplify several IPC sending call sites in the UIProcess by leveraging the fact
3183         that WebPageProxy subclasses IPC::MessageSender.
3184
3185         * UIProcess/Cocoa/TextCheckingController.mm:
3186         (WebKit::TextCheckingController::replaceRelativeToSelection):
3187         (WebKit::TextCheckingController::removeAnnotationRelativeToSelection):
3188         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3189         (WebKit::WebPageProxy::performDictionaryLookupAtLocation):
3190         (WebKit::WebPageProxy::performDictionaryLookupOfCurrentSelection):
3191         (WebKit::WebPageProxy::insertDictatedTextAsync):
3192         (WebKit::WebPageProxy::speakingErrorOccurred):
3193         (WebKit::WebPageProxy::boundaryEventOccurred):
3194         (WebKit::WebPageProxy::voicesDidChange):
3195         * UIProcess/GeolocationPermissionRequestManagerProxy.cpp:
3196         (WebKit::GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision):
3197         * UIProcess/Inspector/RemoteWebInspectorProxy.cpp:
3198         (WebKit::RemoteWebInspectorProxy::setDiagnosticLoggingAvailable):
3199         * UIProcess/Inspector/WebInspectorProxy.cpp:
3200         (WebKit::WebInspectorProxy::setDiagnosticLoggingAvailable):
3201         * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp:
3202         (WebKit::remoteFileReplaceContentsCallback):
3203         * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp:
3204         (WebKit::fileReplaceContentsCallback):
3205         * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm:
3206         (WebKit::RemoteWebInspectorProxy::platformSave):
3207         (WebKit::RemoteWebInspectorProxy::platformAppend):
3208         * UIProcess/Inspector/mac/WebInspectorProxyMac.mm:
3209         (WebKit::WebInspectorProxy::platformSave):
3210         (WebKit::WebInspectorProxy::platformAppend):
3211         * UIProcess/Notifications/NotificationPermissionRequestManagerProxy.cpp:
3212         (WebKit::NotificationPermissionRequestManagerProxy::createRequest):
3213         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3214         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
3215         (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest):
3216         * UIProcess/WebFrameProxy.cpp:
3217         (WebKit::WebFrameProxy::collapseSelection):
3218         * UIProcess/WebFullScreenManagerProxy.cpp:
3219         (WebKit::WebFullScreenManagerProxy::willEnterFullScreen):
3220         (WebKit::WebFullScreenManagerProxy::didEnterFullScreen):
3221         (WebKit::WebFullScreenManagerProxy::willExitFullScreen):
3222         (WebKit::WebFullScreenManagerProxy::didExitFullScreen):
3223         (WebKit::WebFullScreenManagerProxy::setAnimatingFullScreen):
3224         (WebKit::WebFullScreenManagerProxy::requestExitFullScreen):
3225         (WebKit::WebFullScreenManagerProxy::saveScrollPosition):
3226         (WebKit::WebFullScreenManagerProxy::restoreScrollPosition):
3227         (WebKit::WebFullScreenManagerProxy::setFullscreenInsets):
3228         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideDuration):
3229         (WebKit::WebFullScreenManagerProxy::setFullscreenControlsHidden):
3230         * UIProcess/gtk/WebPageProxyGtk.cpp:
3231         (WebKit::WebPageProxy::getCenterForZoomGesture):
3232         * UIProcess/ios/SmartMagnificationController.mm:
3233         (WebKit::SmartMagnificationController::handleSmartMagnificationGesture):
3234         * UIProcess/ios/WKContentViewInteraction.mm:
3235         (-[WKContentView ensurePositionInformationIsUpToDate:]):
3236         * UIProcess/ios/WebPageProxyIOS.mm:
3237         (WebKit::WebPageProxy::handleTwoFingerTapAtPoint):
3238         (WebKit::WebPageProxy::handleStylusSingleTapAtPoint):
3239         (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens):
3240         (WebKit::WebPageProxy::willStartUserTriggeredZooming):
3241         (WebKit::WebPageProxy::potentialTapAtPosition):
3242         (WebKit::WebPageProxy::commitPotentialTap):
3243         (WebKit::WebPageProxy::cancelPotentialTap):
3244         (WebKit::WebPageProxy::tapHighlightAtPosition):
3245         (WebKit::WebPageProxy::handleTap):
3246         (WebKit::WebPageProxy::didRecognizeLongPress):
3247         (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
3248         (WebKit::WebPageProxy::inspectorNodeSearchMovedToPosition):
3249         (WebKit::WebPageProxy::inspectorNodeSearchEndedAtPosition):
3250         (WebKit::WebPageProxy::blurFocusedElement):
3251         (WebKit::WebPageProxy::setIsShowingInputViewForFocusedElement):
3252         (WebKit::WebPageProxy::setFocusedElementValue):
3253         (WebKit::WebPageProxy::setFocusedElementValueAsNumber):
3254         (WebKit::WebPageProxy::setFocusedElementSelectedIndex):
3255         (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
3256         (WebKit::WebPageProxy::contentSizeCategoryDidChange):
3257         (WebKit::WebPageProxy::generateSyntheticEditingCommand):
3258         * UIProcess/mac/ViewGestureControllerMac.mm:
3259         (WebKit::ViewGestureController::handleMagnificationGestureEvent):
3260         (WebKit::ViewGestureController::handleSmartMagnificationGesture):
3261         * UIProcess/mac/WebPageProxyMac.mm:
3262         (WebKit::WebPageProxy::windowAndViewFramesChanged):
3263         (WebKit::WebPageProxy::setMainFrameIsScrollable):
3264         (WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync):
3265         (WebKit::WebPageProxy::fontAtSelection):
3266         (WebKit::WebPageProxy::stringSelectionForPasteboard):
3267         (WebKit::WebPageProxy::dataSelectionForPasteboard):
3268         (WebKit::WebPageProxy::readSelectionFromPasteboard):
3269         (WebKit::WebPageProxy::replaceSelectionWithPasteboardData):
3270         (WebKit::WebPageProxy::sendComplexTextInputToPlugin):
3271         (WebKit::WebPageProxy::uppercaseWord):
3272         (WebKit::WebPageProxy::lowercaseWord):
3273         (WebKit::WebPageProxy::capitalizeWord):
3274         (WebKit::WebPageProxy::setSmartInsertDeleteEnabled):
3275         (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens):
3276         (WebKit::WebPageProxy::shouldDelayWindowOrderingForEvent):
3277         (WebKit::WebPageProxy::acceptsFirstMouse):
3278
3279 2020-05-07  Commit Queue  <commit-queue@webkit.org>
3280
3281         Unreviewed, reverting r260769.
3282         https://bugs.webkit.org/show_bug.cgi?id=211578
3283
3284         Introduced regressions related to sharing (Requested by
3285         perarne on #webkit).
3286
3287         Reverted changeset:
3288
3289         "[Cocoa] After r258891, r255119 can be reverted"
3290         https://bugs.webkit.org/show_bug.cgi?id=211083
3291         https://trac.webkit.org/changeset/260769
3292
3293 2020-05-07  Chris Dumez  <cdumez@apple.com>
3294
3295         [iOS] AuxiliaryProcessProxy::sendWithAsyncReply() should prevent auxiliary process suspension while processing the IPC
3296         https://bugs.webkit.org/show_bug.cgi?id=209928
3297
3298         Reviewed by Youenn Fablet.
3299
3300         AuxiliaryProcessProxy::sendWithAsyncReply() should prevent auxiliary process suspension
3301         on iOS while processing the IPC. If the process is suspended either before or during
3302         the IPC, this could result in hangs. This is a speculative fix for the flaky timeouts
3303         we see on many tests on iOS only. We know that missing activities with
3304         sendWithAsyncReply has caused test timeouts in the past (Bug 211421).
3305
3306         * UIProcess/AuxiliaryProcessProxy.cpp:
3307         (WebKit::AuxiliaryProcessProxy::sendMessage):
3308         * UIProcess/AuxiliaryProcessProxy.h:
3309         (WebKit::AuxiliaryProcessProxy::sendWithAsyncReply):
3310         * UIProcess/GPU/GPUProcessProxy.cpp:
3311         (WebKit::GPUProcessProxy::getGPUProcessConnection):
3312         * UIProcess/GPU/GPUProcessProxy.h:
3313         * UIProcess/Network/NetworkProcessProxy.cpp:
3314         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
3315         (WebKit::NetworkProcessProxy::setUseITPDatabase):
3316         (WebKit::NetworkProcessProxy::resetCacheMaxAgeCapForPrevalentResources):
3317         (WebKit::NetworkProcessProxy::resetParametersToDefaultValues):
3318         (WebKit::NetworkProcessProxy::scheduleClearInMemoryAndPersistent):
3319         (WebKit::NetworkProcessProxy::resetCrossSiteLoadsWithLinkDecorationForTesting):
3320         (WebKit::NetworkProcessProxy::setAppBoundDomainsForResourceLoadStatistics):
3321         (WebKit::NetworkProcessProxy::setShouldDowngradeReferrerForTesting):
3322         (WebKit::NetworkProcessProxy::setThirdPartyCookieBlockingMode):
3323         (WebKit::NetworkProcessProxy::setShouldEnbleSameSiteStrictEnforcementForTesting):
3324         (WebKit::NetworkProcessProxy::setFirstPartyWebsiteDataRemovalModeForTesting):
3325         (WebKit::NetworkProcessProxy::sendPrepareToSuspend):
3326         * UIProcess/Network/NetworkProcessProxy.h:
3327         * UIProcess/Plugins/PluginProcessProxy.cpp:
3328         (WebKit::PluginProcessProxy::PluginProcessProxy):
3329         * UIProcess/Plugins/PluginProcessProxy.h:
3330         * UIProcess/ProcessThrottler.h:
3331         (WebKit::ProcessThrottler::Activity::Activity):
3332         (WebKit::ProcessThrottler::Activity::isQuietActivity const):
3333         (WebKit::ProcessThrottler::Activity::invalidate):
3334         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3335         (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest):
3336         * UIProcess/WebBackForwardCacheEntry.cpp:
3337         (WebKit::WebBackForwardCacheEntry::~WebBackForwardCacheEntry):
3338         * UIProcess/WebCookieManagerProxy.cpp:
3339         (WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
3340         (WebKit::WebCookieManagerProxy::deleteCookie):
3341         (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
3342         (WebKit::WebCookieManagerProxy::setCookies):
3343         (WebKit::WebCookieManagerProxy::getAllCookies):
3344         (WebKit::WebCookieManagerProxy::getCookies):
3345         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
3346         (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
3347         * UIProcess/WebPageProxy.cpp:
3348         (WebKit::WebPageProxy::getProcessDisplayName):
3349         * UIProcess/WebProcessProxy.cpp:
3350         (WebKit::WebProcessProxy::setThirdPartyCookieBlockingMode):
3351         (WebKit::WebProcessProxy::fetchWebsiteData):
3352         (WebKit::WebProcessProxy::deleteWebsiteData):
3353         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
3354         (WebKit::WebProcessProxy::sendPrepareToSuspend):
3355         (WebKit::WebProcessProxy::activePagesDomainsForTesting):
3356         (WebKit::WebProcessProxy::establishServiceWorkerContext):
3357         * UIProcess/WebProcessProxy.h:
3358         * UIProcess/ios/WebPageProxyIOS.mm:
3359         (WebKit::WebPageProxy::insertTextPlaceholder):
3360         (WebKit::WebPageProxy::removeTextPlaceholder):
3361         (WebKit::WebPageProxy::requestAutocorrectionData):
3362         (WebKit::WebPageProxy::requestEvasionRectsAboveSelection):
3363         (WebKit::WebPageProxy::updateSelectionWithDelta):
3364         (WebKit::WebPageProxy::requestDocumentEditingContext):
3365         (WebKit::WebPageProxy::insertDroppedImagePlaceholders):
3366
3367 2020-05-07  Carlos Garcia Campos  <cgarcia@igalia.com>
3368
3369         [GTK] REGRESSION(r260996): Pressing <Tab> in an HTTP authentication dialog makes the dialog lose focus
3370         https://bugs.webkit.org/show_bug.cgi?id=211555
3371
3372         Reviewed by Philippe Normand.
3373
3374         Bring back webkitWebViewBaseFocus to GTK3. I made it GTK4 only by mistake in r260996.
3375
3376         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3377         (webkitWebViewBaseFocus):
3378         (webkit_web_view_base_class_init):
3379
3380 2020-05-07  Philippe Normand  <pnormand@igalia.com>
3381
3382         [GTK] Build warning fixes
3383
3384         Rubber-stamped by Žan Doberšek.
3385
3386         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3387         (webkitWebViewBaseGrabFocus):
3388         * UIProcess/GPU/GPUProcessProxy.cpp:
3389         (WebKit::GPUProcessProxy::getGPUProcessConnection):
3390         * UIProcess/Network/NetworkProcessProxy.cpp:
3391         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
3392
3393 2020-05-07  Youenn Fablet  <youenn@apple.com>
3394
3395         Sending WebRTC network packets should not go through the main thread
3396         https://bugs.webkit.org/show_bug.cgi?id=211291
3397
3398         Reviewed by Eric Carlson.
3399
3400         Following on receiving RTC packets from a background thread, we also send RTC packets from a background thread.
3401         Creation of the sockets also happens in a background thread.
3402         LibWebRTCNetwork is getting the connection whenever a new connection to network process is created.
3403         It will then hop to the RTC network thread to set the IPC connection to the libwebrtc socket factory.
3404
3405         At creation of the socket, we get the IPC connection to the network process and keep a ref in the RTC socket.
3406         In case network process crashed and the IPC connection of the RTC network is null, we hop to the main thread to create a new IPC connection.
3407         This will fail the creation of the socket (as well as new ones as well) as long as the IPC connection to network process is not valid again.
3408
3409         Covered by existing tests.
3410
3411         * WebProcess/Network/webrtc/LibWebRTCNetwork.cpp: