ac2ecedfd155c32c15894f379b4e4e15b2daa00b
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-07-05  Zalan Bujtas  <zalan@apple.com>
2
3         [ContentChangeObserver] REGRESSION (r247015): facebook photo/video upload button is unresponsive to user interaction.
4         https://bugs.webkit.org/show_bug.cgi?id=199502
5         <rdar://problem/52547473>
6
7         Reviewed by Simon Fraser.
8
9         Apparently it's a common practice to put transparent elements over visible click targets (button like divs) and use the invisible
10         elements to catch the user input (e.g. Facebook's Photo/Video button).
11         This patch modifies the original "do not trigger click on invisible targets" heuristic to a more restrictive "do not trigger
12         click if the click target was previously hidden and became visible through touch start".
13         If this still breaks some use cases, we could turn it into YouTube quirk.       
14
15         * WebProcess/WebPage/ios/WebPageIOS.mm:
16         (WebKit::WebPage::handleSyntheticClick):
17
18 2019-07-05  Ryan Haddad  <ryanhaddad@apple.com>
19
20         Unreviewed, rolling out r247123.
21
22         Caused TestWebKitAPI.Challenge.BasicProposedCredential to
23         fail.
24
25         Reverted changeset:
26
27         "Only allow fetching and removing session credentials from
28         WebsiteDataStore"
29         https://bugs.webkit.org/show_bug.cgi?id=199385
30         https://trac.webkit.org/changeset/247123
31
32 2019-07-05  Wenson Hsieh  <wenson_hsieh@apple.com>
33
34         Click events on outer page are not being dispatched correctly after touch-zooming within an iframe
35         https://bugs.webkit.org/show_bug.cgi?id=185001
36         <rdar://problem/40569615>
37
38         Reviewed by Simon Fraser.
39
40         Mitigations introduced in r227759 prevent a touch inside a document of origin A to result in a click event being
41         dispatched on an element inside a document of origin B. It accomplishes this by keeping track of the security
42         origin of the last touch via m_potentialTapSecurityOrigin on WebPage. However, there exists a corner case in
43         which m_potentialTapSecurityOrigin, set after touching a document in a subframe, may persist even after the user
44         has finished interacting, causing taps in subsequent documents to not result in synthetic click events due to
45         mismatched potential tap origins.
46
47         This may happen if the first user gesture happens inside an element in a subframe with touch event handlers, but
48         no click event handler (and the touch is additionally not over some clickable element). In this case,
49         m_potentialTapNode is set to null in WebPage::potentialTapAtPosition, and when we consult it in
50         WebPage::commitPotentialTap, we just end up calling commitPotentialTapFailed(); and return early. This means
51         that m_potentialTapNode, m_potentialTapLocation, and (importantly) m_potentialTapSecurityOrigin are not reset.
52         This causes subsequent taps in the top-level document to never dispatch click events, if the security origin
53         does not match with that of the subframe.
54
55         To fix this, we add a new async IPC message from the UI process to the web process to ensure that our current
56         security origin is reset before attempting to handle a tap.
57
58         Test: http/tests/events/touch/ios/click-after-handling-touch-in-cross-origin-frame.https.html
59
60         * UIProcess/WebPageProxy.cpp:
61         (WebKit::WebPageProxy::resetPotentialTapSecurityOrigin):
62
63         Reset any stale potential tap security origin if needed.
64
65         * UIProcess/WebPageProxy.h:
66         * UIProcess/ios/WKContentViewInteraction.mm:
67         (-[WKContentView _webTouchEventsRecognized:]):
68
69         Send the new IPC message when starting a touch.
70
71         * WebProcess/WebPage/WebPage.cpp:
72         (WebKit::WebPage::resetPotentialTapSecurityOrigin):
73         * WebProcess/WebPage/WebPage.h:
74         * WebProcess/WebPage/WebPage.messages.in:
75
76 2019-07-05  Wenson Hsieh  <wenson_hsieh@apple.com>
77
78         Touching media controls sometimes shows software keyboard
79         https://bugs.webkit.org/show_bug.cgi?id=199490
80         <rdar://problem/52076270>
81
82         Reviewed by Eric Carlson.
83
84         In r243044, we added a compatibility hack for Google Slides (and other G-suite properties) to allow the on-
85         screen keyboard to show up after a prevented touch event in the case where an element was already focused, even
86         if the touch event handler doesn't explicitly refocus the element. However, this means that if a regular text
87         field (or other form control) has been programmatically focused, then interacting with any other element that
88         prevents default on touchstart will cause us to show the keyboard for that focused element.
89
90         To mitigate this, only fall down this refocusing codepath in the case where the focused element is a hidden
91         editable element (in the style of many Google productivity web apps). For non-hidden editable elements that are
92         already focused, this refocusing logic is not necessary, since the user should be able to interact with the
93         control to show the keyboard anyways; for hidden editable areas, this compatibility hack is actually needed,
94         since there is typically no other way for a user to focus these elements and show an on-screen keyboard.
95
96         Tests:  fast/events/touch/ios/show-keyboard-after-preventing-touchstart.html
97                 fast/events/touch/ios/do-not-show-keyboard-after-preventing-touchstart.html
98
99         * WebProcess/WebPage/WebPage.cpp:
100         (WebKit::WebPage::dispatchTouchEvent):
101         * WebProcess/WebPage/WebPage.h:
102         * WebProcess/WebPage/ios/WebPageIOS.mm:
103         (WebKit::WebPage::isTransparentOrFullyClipped const):
104
105         Renamed from enclosingLayerIsTransparentOrFullyClipped, and pulled out into a private helper method.
106
107         (WebKit::WebPage::platformEditorState const):
108         (WebKit::WebPage::requestEvasionRectsAboveSelection):
109         (WebKit::WebPage::getFocusedElementInformation):
110         (WebKit::enclosingLayerIsTransparentOrFullyClipped): Deleted.
111
112 2019-07-04  Chris Dumez  <cdumez@apple.com>
113
114         Simplify logic that handles registering WebProcessProxy objects with their WebsiteDataStore
115         https://bugs.webkit.org/show_bug.cgi?id=199412
116         <rdar://problem/51899751>
117
118         Reviewed by Ryosuke Niwa.
119
120         Simplify logic that handles registering WebProcessProxy objects with their WebsiteDataStore to make
121         it more maintainable and less error-prone (avoid bugs like <rdar://problem/51899751>).
122
123         The following changes were made:
124         1. The WebProcess now registers / unregisters itself directly with its WebsiteDataStore when needed,
125            instead of having the WebPageProxy/ProvisionalPageProxy be in charge of calling the right
126            WebProcessLifetimeTracker / WebProcessLifetimeObserver abstractions.
127         2. The WebProcessLifetimeTracker / WebProcessLifetimeObserver abstractions were dropped. The
128            WebsiteDataStore was the only observer.
129         3. The WebProcessProxy is now registered with its WebsiteDataStore as soon as it has a page (provisional
130            or not) instead of waiting until the process has finished launching. This simplifies the logic a
131            lot and waiting until the process has launched is not needed by the WebsiteDataStore.
132            
133
134         * Sources.txt:
135         * UIProcess/ProvisionalPageProxy.cpp:
136         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
137         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
138         * UIProcess/ProvisionalPageProxy.h:
139         * UIProcess/WebPageProxy.cpp:
140         (WebKit::m_resetRecentCrashCountTimer):
141         (WebKit::WebPageProxy::finishAttachingToWebProcess):
142         (WebKit::WebPageProxy::close):
143         (WebKit::WebPageProxy::processDidTerminate):
144         * UIProcess/WebPageProxy.h:
145         * UIProcess/WebProcessCache.cpp:
146         (WebKit::WebProcessCache::CachedProcess::CachedProcess):
147         * UIProcess/WebProcessLifetimeObserver.cpp: Removed.
148         * UIProcess/WebProcessLifetimeObserver.h: Removed.
149         * UIProcess/WebProcessLifetimeTracker.cpp: Removed.
150         * UIProcess/WebProcessLifetimeTracker.h: Removed.
151         * UIProcess/WebProcessProxy.cpp:
152         (WebKit::WebProcessProxy::setWebsiteDataStore):
153         (WebKit::WebProcessProxy::updateRegistrationWithDataStore):
154         (WebKit::WebProcessProxy::addProvisionalPageProxy):
155         (WebKit::WebProcessProxy::removeProvisionalPageProxy):
156         (WebKit::WebProcessProxy::connectionWillOpen):
157         (WebKit::WebProcessProxy::processWillShutDown):
158         (WebKit::WebProcessProxy::addExistingWebPage):
159         (WebKit::WebProcessProxy::removeWebPage):
160         * UIProcess/WebProcessProxy.h:
161         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
162         (WebKit::WebsiteDataStore::registerProcess):
163         (WebKit::WebsiteDataStore::unregisterProcess):
164
165         (WebKit::WebsiteDataStore::processPoolForCookieStorageOperations):
166         Drop change that was added in r246097 to work around the fact that WebProcessProxy objects
167         were only registering themselves with their data store after their process had finished
168         launching.
169
170         (WebKit::WebsiteDataStore::fetchDataAndApply):
171         (WebKit::WebsiteDataStore::removeData):
172         (WebKit::WebsiteDataStore::processPools const):
173         * UIProcess/WebsiteData/WebsiteDataStore.h:
174         (WebKit::WebsiteDataStore::processes const):
175         * WebKit.xcodeproj/project.pbxproj:
176
177 2019-07-04  Zalan Bujtas  <zalan@apple.com>
178
179         [ContentChangeObserver] Limit mouseOut dispatching after synthetic click to YouTube.com
180         https://bugs.webkit.org/show_bug.cgi?id=199497
181         <rdar://problem/52361019>
182
183         Reviewed by Wenson Hsieh.
184
185         * WebProcess/WebPage/ios/WebPageIOS.mm:
186         (WebKit::WebPage::completeSyntheticClick):
187
188 2019-07-03  Ryosuke Niwa  <rniwa@webkit.org>
189
190         Crash in WebDragClient::startDrag because GraphicsContext is nullptr
191         https://bugs.webkit.org/show_bug.cgi?id=199491
192
193         Reviewed by Wenson Hsieh.
194
195         Added a nullptr check.
196
197         Unfortunately no new tests since we don't have a reproducible test case.
198
199         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
200         (WebKit::convertImageToBitmap):
201
202 2019-07-03  Tim Horton  <timothy_horton@apple.com>
203
204         Data Detectors are not working for context menus in clients that use the legacy preview API
205         https://bugs.webkit.org/show_bug.cgi?id=199486
206         <rdar://problem/52117322>
207
208         Reviewed by Dean Jackson.
209
210         * UIProcess/ios/WKContentViewInteraction.mm:
211         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
212         The Data Detectors code in the legacy preview path is guarded by a
213         #define that did not survive upstreaming. Remove it.
214
215 2019-07-03  Chris Dumez  <cdumez@apple.com>
216
217         StorageManager::suspend() sometimes fails to call its completion handler
218         https://bugs.webkit.org/show_bug.cgi?id=199482
219
220         Reviewed by Youenn Fablet.
221
222         Make sure the completion handler gets called in the early return cases.
223
224         * NetworkProcess/WebStorage/StorageManager.cpp:
225         (WebKit::StorageManager::suspend):
226
227 2019-07-03  Youenn Fablet  <youenn@apple.com>
228
229         Make CacheStorage::Engine directory listing operations in a background thread
230         https://bugs.webkit.org/show_bug.cgi?id=199470
231
232         Reviewed by Chris Dumez.
233
234         Use the io work queue to get the list of directories.
235         Then go back to main thread and trigger clear/fetch operation as currently done.
236
237         * NetworkProcess/cache/CacheStorageEngine.cpp:
238         (WebKit::CacheStorage::ReadOriginsTaskCounter::create):
239         (WebKit::CacheStorage::ReadOriginsTaskCounter::ReadOriginsTaskCounter):
240         (WebKit::CacheStorage::Engine::getDirectories):
241         (WebKit::CacheStorage::Engine::fetchEntries):
242         (WebKit::CacheStorage::Engine::fetchDirectoryEntries):
243         (WebKit::CacheStorage::Engine::clearCachesForOriginFromDisk):
244         (WebKit::CacheStorage::Engine::clearCachesForOriginFromDirectories):
245         * NetworkProcess/cache/CacheStorageEngine.h:
246
247 2019-07-03  Sihui Liu  <sihui_liu@apple.com>
248
249         Only allow fetching and removing session credentials from WebsiteDataStore
250         https://bugs.webkit.org/show_bug.cgi?id=199385
251
252         Reviewed by Alex Christensen.
253
254         Stop sending an extra message to network process for fetching or removing persistent credentials.
255
256         * NetworkProcess/NetworkProcess.cpp:
257         (WebKit::NetworkProcess::fetchWebsiteData):
258         (WebKit::NetworkProcess::deleteWebsiteData):
259         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
260         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
261         (WebKit::NetworkProcess::originsWithPersistentCredentials): Deleted.
262         (WebKit::NetworkProcess::removeCredentialsWithOrigins): Deleted.
263         * NetworkProcess/NetworkProcess.h:
264         * NetworkProcess/NetworkProcess.messages.in:
265         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
266         (WebKit::NetworkProcess::originsWithPersistentCredentials): Deleted.
267         (WebKit::NetworkProcess::removeCredentialsWithOrigins): Deleted.
268         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
269         (WebKit::WebsiteDataStore::fetchDataAndApply):
270         (WebKit::computeWebProcessAccessTypeForDataRemoval):
271         (WebKit::WebsiteDataStore::removeData):
272
273 2019-07-03  Tim Horton  <timothy_horton@apple.com>
274
275         UI process exception when dragging an <attachment> with no content type
276         https://bugs.webkit.org/show_bug.cgi?id=199480
277         <rdar://problem/44351353>
278
279         Reviewed by Wenson Hsieh.
280
281         * UIProcess/API/Cocoa/APIAttachmentCocoa.mm:
282         (API::Attachment::mimeType const):
283         (API::Attachment::utiType const):
284         * UIProcess/Cocoa/WebViewImpl.mm:
285         (WebKit::WebViewImpl::startDrag):
286         Make null or empty contentType fail the drag, instead of crashing.
287
288 2019-07-03  Chris Dumez  <cdumez@apple.com>
289
290         Clarify threading model for WebResourceLoadStatisticsStore::dumpResourceLoadStatistics()
291         https://bugs.webkit.org/show_bug.cgi?id=199468
292
293         Reviewed by Youenn Fablet.
294
295         Our convention is that the WebResourceLoadStatisticsStore is always created, used and
296         destroyed on the main thread, while the ResourceLoadStatisticsStore is always created,
297         used and destroyed on the background queue.
298
299         r245517 broke this convention by introducing a tryDumpResourceLoadStatistics() method
300         to WebResourceLoadStatisticsStore which gets called on the background queue. This patch
301         fixes this since this has been a huge source of thread-safety bugs in the past.
302
303         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
304         (WebKit::ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics):
305         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
306         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
307         (WebKit::ResourceLoadStatisticsMemoryStore::dumpResourceLoadStatistics):
308         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
309         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
310         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
311         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
312         (WebKit::ResourceLoadStatisticsStore::dataRecordsBeingRemoved const):
313         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
314         (WebKit::WebResourceLoadStatisticsStore::dumpResourceLoadStatistics):
315         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
316
317 2019-07-03  Jonathan Bedard  <jbedard@apple.com>
318
319         [Catalina] Enable WebKit build
320         https://bugs.webkit.org/show_bug.cgi?id=199209
321
322         Reviewed by Darin Adler.
323
324         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.h: AppSSO is SPI.
325         * WebKit2Prefix.h: SecTask.h declares SecTaskGetCodeSignStatus(...) unavailable
326         on Mac, exclude this header.
327
328 2019-07-03  Daniel Bates  <dabates@apple.com>
329
330         REGRESSION (r246817): fast/events/ios/key-events-comprehensive/key-events-{control, control-shift}.html are failing
331         https://bugs.webkit.org/show_bug.cgi?id=199465
332         <rdar://problem/52613496>
333
334         Reviewed by Wenson Hsieh.
335
336         Don't advertise that WebKit can perform cursor movements when there isn't some kind of selection.
337
338         * UIProcess/ios/WKContentViewInteraction.mm:
339         (-[WKContentView canPerformAction:withSender:]):
340
341 2019-07-03  Chris Dumez  <cdumez@apple.com>
342
343         Fix a couple of thread safety issues in ResourceLoadStatisticsStore
344         https://bugs.webkit.org/show_bug.cgi?id=199463
345
346         Reviewed by Alex Christensen.
347
348         The ResourceLoadStatisticsStore object is constructed / used / destroyed on a background queue.
349         It is therefore not safe to use a WeakPtr to the ResourceLoadStatisticsStore on the main thread.
350
351         The safe pattern is to have the ResourceLoadStatisticsStore capture a Ref<> of its m_store before
352         dispatching to the main thread and use this store on the main thread instead of weakThis->m_store.
353         ResourceLoadStatisticsStore's m_store is constructed / used / destroyed on the main thread.
354
355         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
356         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
357         (WebKit::ResourceLoadStatisticsStore::processStatisticsAndDataRecords):
358
359 2019-07-03  Youenn Fablet  <youenn@apple.com>
360
361         Isolate CacheStorage::Engine path when hopping to a background thread
362         https://bugs.webkit.org/show_bug.cgi?id=199461
363
364         Reviewed by Chris Dumez.
365
366         * NetworkProcess/cache/CacheStorageEngine.cpp:
367         (WebKit::CacheStorage::Engine::initialize):
368
369 2019-07-03  Jer Noble  <jer.noble@apple.com>
370
371         Unreviewed, rolling out r246053.
372
373         This changeset caused media playback to break when the hosting app was backgrounded.
374
375         * UIProcess/ApplicationStateTracker.mm:
376         * UIProcess/ios/ProcessAssertionIOS.mm:
377         (-[WKProcessAssertionBackgroundTaskManager init]):
378         (-[WKProcessAssertionBackgroundTaskManager _scheduleReleaseTask]):
379         (-[WKProcessAssertionBackgroundTaskManager _cancelPendingReleaseTask]):
380         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
381         (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]):
382
383 2019-07-03  Alex Christensen  <achristensen@webkit.org>
384
385         Use smarter pointers in WKDownloadProgress
386         https://bugs.webkit.org/show_bug.cgi?id=199456
387         <rdar://problem/51392926>
388
389         Reviewed by Chris Dumez.
390
391         There's still a problem related to our use of raw pointers.  Let's just not use raw pointers.
392
393         * NetworkProcess/Downloads/Download.h:
394         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
395         (WebKit::Download::publishProgress):
396         * NetworkProcess/Downloads/cocoa/WKDownloadProgress.h:
397         * NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm:
398         (-[WKDownloadProgress performCancel]):
399         (-[WKDownloadProgress initWithDownloadTask:download:URL:sandboxExtension:]):
400         (-[WKDownloadProgress progressCancelled]): Deleted.
401
402 2019-07-03  Sam Weinig  <weinig@apple.com>
403
404         Adopt simple structured bindings in more places
405         https://bugs.webkit.org/show_bug.cgi?id=199247
406
407         Reviewed by Alex Christensen.
408
409         Replaces simple uses of std::tie() with structured bindings. Does not touch
410         uses of std::tie() that are not initial declarations, use std::ignore or in
411         case where the binding is captured by a lambda, as structured bindings don't
412         work for those cases yet.
413
414         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
415         (WebKit::NetworkCache::printSpeculativeLoadingDiagnosticMessageCounts):
416         * NetworkProcess/cache/PrefetchCache.cpp:
417         (WebKit::PrefetchCache::clearExpiredEntries):
418         * Platform/IPC/MessageReceiverMap.cpp:
419         (IPC::MessageReceiverMap::removeMessageReceiver):
420         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
421         (WebKit::PlaybackSessionManagerProxy::invalidate):
422         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
423         (WebKit::VideoFullscreenManagerProxy::invalidate):
424         (WebKit::VideoFullscreenManagerProxy::requestHideAndExitFullscreen):
425         (WebKit::VideoFullscreenManagerProxy::hasMode const):
426         (WebKit::VideoFullscreenManagerProxy::mayAutomaticallyShowVideoPictureInPicture const):
427         (WebKit::VideoFullscreenManagerProxy::isPlayingVideoInEnhancedFullscreen const):
428         (WebKit::VideoFullscreenManagerProxy::applicationDidBecomeActive):
429         (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
430         (WebKit::VideoFullscreenManagerProxy::didCleanupFullscreen):
431         * UIProcess/ios/SmartMagnificationController.mm:
432         (WebKit::SmartMagnificationController::zoomFactorForTargetRect):
433         (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
434         (WebKit::SmartMagnificationController::magnify):
435         * WebProcess/Plugins/PDF/PDFPlugin.mm:
436         (WebKit:: const):
437         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
438         (WebKit::WebPage::performDictionaryLookupAtLocation):
439         (WebKit::WebPage::performDictionaryLookupForSelection):
440         * WebProcess/cocoa/PlaybackSessionManager.mm:
441         (WebKit::PlaybackSessionManager::~PlaybackSessionManager):
442         (WebKit::PlaybackSessionManager::removeContext):
443         * WebProcess/cocoa/VideoFullscreenManager.mm:
444         (WebKit::VideoFullscreenManager::~VideoFullscreenManager):
445         (WebKit::VideoFullscreenManager::removeContext):
446         (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement):
447         (WebKit::VideoFullscreenManager::requestVideoContentLayer):
448         (WebKit::VideoFullscreenManager::didSetupFullscreen):
449         (WebKit::VideoFullscreenManager::willExitFullscreen):
450         (WebKit::VideoFullscreenManager::didEnterFullscreen):
451         (WebKit::VideoFullscreenManager::didCleanupFullscreen):
452         (WebKit::VideoFullscreenManager::setVideoLayerFrameFenced):
453
454 2019-07-03  Zalan Bujtas  <zalan@apple.com>
455
456         [ContentChangeObserver] REGRESSION (r244356): Drop down menus collapse without user input - Ebay.com
457         https://bugs.webkit.org/show_bug.cgi?id=199457
458         <rdar://problem/52386563>
459
460         Reviewed by Simon Fraser.
461
462         There's a fixed, 32ms window for observing content changes after the tap is committed. r244356 introduced the fast-click behavior on form elements by omitting this fixed window and
463         dispatch the synthetic click on the target node.
464         This patch preserves the fast-click behavior, but now we stay at hover if the mouseMove event triggers a synchronous actionable visiblity change (as opposed to always proceed with click).
465
466         * WebProcess/WebPage/ios/WebPageIOS.mm:
467         (WebKit::WebPage::handleSyntheticClick):
468
469 2019-07-03  Patrick Griffis  <pgriffis@igalia.com>
470
471         [GTK][WPE] Remove Flatpak sandbox
472         https://bugs.webkit.org/show_bug.cgi?id=199416
473
474         Reviewed by Michael Catanzaro.
475
476         The flatpak-spawn based sandbox was only a proof of concept and
477         lacks flexibility for our needs so we ended up using it with very
478         permissive permissions and it still imposed limitations that our main
479         bubblewrap sandbox didn't have.
480
481         So in order to get as many applications using the sandbox as possible we
482         will just remove this for now and focus on bubblewrap. At some point
483         it may be possible to improve flatpak-spawn to fit our needs.
484
485         * SourcesGTK.txt:
486         * SourcesWPE.txt:
487         * UIProcess/Launcher/glib/FlatpakLauncher.cpp: Removed.
488         * UIProcess/Launcher/glib/FlatpakLauncher.h: Removed.
489         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
490         (WebKit::ProcessLauncher::launchProcess):
491
492 2019-07-03  Ryan Haddad  <ryanhaddad@apple.com>
493
494         Unreviewed, rolling out r246616.
495
496         Caused http/tests/inspector/network/har/har-page.html to fail
497         on Catalina.
498
499         Reverted changeset:
500
501         "Web Inspector: Network: replace CFNetwork SPI with new API
502         where able"
503         https://bugs.webkit.org/show_bug.cgi?id=198762
504         https://trac.webkit.org/changeset/246616
505
506 2019-07-03  Chris Dumez  <cdumez@apple.com>
507
508         Crash under WTF::RefCounted<WebKit::TaskCounter>::deref()
509         https://bugs.webkit.org/show_bug.cgi?id=199453
510         <rdar://problem/51991477>
511
512         Reviewed by Youenn Fablet.
513
514         The crash was caused by StorageManager::suspend() getting called on the main thread but calling
515         its completion handler on a background queue. The completion handler was capturing a TaskCounter
516         object which is RefCounted (not ThreadSafeRefCounted).
517
518         Address the issue by making sure StorageManager::suspend() calls its completion handler on the
519         main thread. Also get rid of TaskCounter and use a WTF::CallbackAggregator instead.
520
521         * NetworkProcess/NetworkProcess.cpp:
522         (WebKit::NetworkProcess::actualPrepareToSuspend):
523         (WebKit::TaskCounter::TaskCounter): Deleted.
524         (WebKit::TaskCounter::~TaskCounter): Deleted.
525         * NetworkProcess/WebStorage/StorageManager.cpp:
526         (WebKit::StorageManager::suspend):
527
528 2019-07-03  Youenn Fablet  <youenn@apple.com>
529
530         Make sure to cross-thread copy in StorageManager when hopping back to the main thread
531         https://bugs.webkit.org/show_bug.cgi?id=199423
532
533         Reviewed by Chris Dumez.
534
535         Make sure to isolate copy some strings that may not be isolated in case of ephemeral sessions.
536         Small refactoring to use crossThreadCopy instead of doing vector copy ourselves.
537
538         * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.h:
539         (WebKit::LocalStorageDatabaseTracker::OriginDetails::isolatedCopy const):
540         * NetworkProcess/WebStorage/StorageManager.cpp:
541         (WebKit::StorageManager::deleteSessionStorageEntriesForOrigins):
542         (WebKit::StorageManager::getLocalStorageOrigins):
543         (WebKit::StorageManager::getLocalStorageOriginDetails):
544         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
545
546 2019-07-02  Joonghun Park  <jh718.park@samsung.com>
547
548         Unreviewed. Fix build break introduced in r247058.
549
550         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
551
552 2019-07-02  Youenn Fablet  <youenn@apple.com>
553
554         StorageManager does not need to be a WorkQueueMessageReceiver anymore
555         https://bugs.webkit.org/show_bug.cgi?id=199421
556
557         Reviewed by Chris Dumez.
558
559         * NetworkProcess/WebStorage/StorageManager.h:
560
561 2019-07-02  Chris Dumez  <cdumez@apple.com>
562
563         ThreadSafeRefCounted<DestructionThread::Main> is not safe to use in the UIProcess
564         https://bugs.webkit.org/show_bug.cgi?id=199420
565         <rdar://problem/52289717>
566
567         Reviewed by Ryosuke Niwa.
568
569         Update IPC::Connection and DeviceIdHashSaltStorage to use DestructionThread::MainRunLoop
570         instead of DestructionThread::Main, since both classes are used in the UIProcess.
571
572         Using DestructionThread::Main is not safe in the UIProcess because its implementation relies
573         on isMainThread() / callOnMainThread(). Those get confused about which thread is the main
574         thread when an application uses both WK1 and WK2.
575
576         * Platform/IPC/Connection.h:
577         * UIProcess/DeviceIdHashSaltStorage.h:
578
579 2019-07-02  Patrick Griffis  <pgriffis@igalia.com>
580
581         [GTK][WPE] Explicitly blacklist problematic directories for sandbox
582         https://bugs.webkit.org/show_bug.cgi?id=199367
583
584         Reviewed by Michael Catanzaro.
585
586         There are some directories that simply do not make sense to bind into the sandbox
587         and will only cause issues such as `/proc` so lets just block them.
588
589         * UIProcess/API/glib/WebKitWebContext.cpp:
590         (path_is_not_blacklisted):
591         (webkit_web_context_add_path_to_sandbox):
592
593 2019-07-02  Tim Horton  <timothy_horton@apple.com>
594
595         REGRESSION (r243240): Unable to swipe back in Safari
596         https://bugs.webkit.org/show_bug.cgi?id=199394
597         <rdar://problem/51137447>
598
599         Reviewed by Wenson Hsieh.
600
601         * UIProcess/API/Cocoa/WKWebView.mm:
602         (-[WKWebView _processDidExit]):
603         r243240 started nilling out the ViewGestureController, but we don't actually
604         expect that; the only time WKWebView's ViewGestureController goes away
605         is if the client turns off the gestures... and so nothing ever puts it back.
606         Instead, just always disconnect, don't nil it out.
607
608 2019-07-02  Chris Dumez  <cdumez@apple.com>
609
610         Protect NetworkProcess::m_networkSessions against corruption
611         https://bugs.webkit.org/show_bug.cgi?id=199418
612         <rdar://problem/50614019>
613
614         Reviewed by Youenn Fablet.
615
616         I believe the most likely reason for the crash at <rdar://problem/50614019> is that NetworkProcess::m_networkSessions
617         is getting corrupted and is returning us a bad pointer.
618
619         To harden our code, I added debug assertions to make sure that this HashMap is only used on the main thread and
620         to make sure that the sessionID used as key is always valid. I have also added if checks to avoid crashing in
621         release whenever possible.
622
623         Note that we came to a similar conclusion for NetworkProcess::m_swServers when investigating rdar://problem/51859081,
624         so the two radars are potentially related. Both HashMaps are owned by the NetworkProcess and use a SessionID
625         as key.
626
627         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
628         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
629         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
630         (WebKit::NetworkConnectionToWebProcess::logUserInteraction):
631         (WebKit::NetworkConnectionToWebProcess::logWebSocketLoading):
632         (WebKit::NetworkConnectionToWebProcess::logSubresourceLoading):
633         (WebKit::NetworkConnectionToWebProcess::logSubresourceRedirect):
634         (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
635         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
636         (WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
637         * NetworkProcess/NetworkProcess.cpp:
638         (WebKit::NetworkProcess::networkSession const):
639         (WebKit::NetworkProcess::setSession):
640         (WebKit::NetworkProcess::destroySession):
641         (WebKit::NetworkProcess::addKeptAliveLoad):
642         (WebKit::NetworkProcess::removeKeptAliveLoad):
643         (WebKit::NetworkProcess::webProcessWasDisconnected):
644         * NetworkProcess/NetworkProcess.h:
645         * NetworkProcess/NetworkResourceLoader.cpp:
646         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
647         (WebKit::NetworkResourceLoader::didFinishWithRedirectResponse):
648         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
649         (WebKit::NetworkResourceLoader::shouldLogCookieInformation):
650         * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm:
651         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorBoundInterfaceIdentifier):
652         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType):
653         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationBundleIdentifier):
654         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationSecondaryIdentifier):
655
656 2019-07-02  Chris Dumez  <cdumez@apple.com>
657
658         VisitedLinkStore does not need to subclass WebProcessLifetimeObserver
659         https://bugs.webkit.org/show_bug.cgi?id=199407
660
661         Reviewed by Sam Weinig.
662
663         VisitedLinkStore does not need to subclass WebProcessLifetimeObserver, it overrides
664         only 2 of WebProcessLifetimeObserver's functions and the implementation of those
665         overrides is empty. It also does not use WebProcessLifetimeObserver::processes()
666         since the VisitedLinkStore maintains its own list of processes.
667
668         * UIProcess/API/mac/WKView.mm:
669         * UIProcess/Automation/WebAutomationSession.cpp:
670         * UIProcess/VisitedLinkStore.cpp:
671         * UIProcess/VisitedLinkStore.h:
672         * UIProcess/WebPageProxy.cpp:
673         (WebKit::m_resetRecentCrashCountTimer):
674         * UIProcess/WebProcessPool.h:
675         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
676
677 2019-07-02  Chris Dumez  <cdumez@apple.com>
678
679         Null dereference under StorageManager::destroySessionStorageNamespace()
680         https://bugs.webkit.org/show_bug.cgi?id=199388
681         <rdar://problem/52030641>
682
683         Reviewed by Youenn Fablet.
684
685         * NetworkProcess/WebStorage/StorageManager.cpp:
686         (WebKit::StorageManager::createSessionStorageNamespace):
687         Call HashMap::ensure() instead of contains() + set() to avoid double hash lookup.
688
689         (WebKit::StorageManager::destroySessionStorageNamespace):
690         Add null check to address top crasher, similarly to what was done in r246552.
691         I am keeping the debug assertion since this is not supposed to happen.
692
693 2019-07-02  Daniel Bates  <dabates@apple.com>
694
695         [iOS] Cannot tab cycle through credit card fields on antonsvpatisserie.com checkout page
696         https://bugs.webkit.org/show_bug.cgi?id=196053
697         <rdar://problem/49093034>
698
699         Reviewed by Wenson Hsieh.
700
701         Allow iframes to be keyboard focusable when pressing the Tab key on the keyboard. This
702         also allow the that the focus controller to search their content document for other
703         editable elements. This makes iOS match the behavior on Mac.
704
705         Although iframes can be focused by pressing the Tab key we maintain the current UI
706         restriction on iOS of not allowing iframes themselves to be focusable via the next and
707         previous accessory bar buttons. We do this because it's unclear what value supporting
708         such focusing brings, but it's clear that doing so makes tab cycling more confusing
709         since the default focus appearance for an iframe is indistinguishable from its non-
710         focused appearance.
711
712         * WebProcess/WebPage/ios/WebPageIOS.mm:
713         (WebKit::isAssistableElement): Do not consider an iframe as assistable.
714
715 2019-07-02  Alexander Mikhaylenko  <exalm7659@gmail.com>
716
717         [GTK] Support cancelling touchscreen back/forward gesture
718         https://bugs.webkit.org/show_bug.cgi?id=199401
719
720         Reviewed by Michael Catanzaro.
721
722         It should be possible to cancel the gesture when performing it on
723         touchscreen, for example, by moving pen too far from the screen.
724         Handle this case properly.
725
726         Only DragGesture in GestureController needs to handle this,
727         SwipeGesture simply won't emit the relevant event in this case.
728
729         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
730         * UIProcess/ViewGestureController.h:
731         * UIProcess/gtk/GestureController.cpp:
732         (WebKit::GestureController::DragGesture::cancelDrag):
733         (WebKit::GestureController::DragGesture::cancel):
734         (WebKit::GestureController::DragGesture::DragGesture):
735         * UIProcess/gtk/GestureController.h:
736         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
737         (WebKit::ViewGestureController::platformTeardown):
738         (WebKit::ViewGestureController::cancelSwipe):
739
740 2019-07-02  Devin Rousso  <drousso@apple.com>
741
742         Web Inspector: Debug: "Reset Web Inspector" should also clear the saved window size and attachment side
743         https://bugs.webkit.org/show_bug.cgi?id=198956
744
745         Reviewed by Matt Baker.
746
747         * UIProcess/WebPreferences.h:
748         * UIProcess/WebPreferences.cpp:
749         (WebKit::WebPreferences::deleteKey): Added.
750         * UIProcess/gtk/WebPreferencesGtk.cpp:
751         (WebKit::WebPreferences::platformDeleteKey): Added.
752         * UIProcess/mac/WebPreferencesMac.mm:
753         (WebKit::WebPreferences::platformDeleteKey): Added.
754         * UIProcess/wpe/WebPreferencesWPE.cpp:
755         (WebKit::WebPreferences::platformDeleteKey): Added.
756         * UIProcess/win/WebPreferencesWin.cpp:
757         (WebKit::WebPreferences::platformDeleteKey): Added.
758         * Shared/WebPreferencesStore.h:
759         * Shared/WebPreferencesStore.cpp:
760         (WebKit::WebPreferencesStore::deleteKey): Added.
761
762         * UIProcess/WebInspectorProxy.messages.in:
763         * UIProcess/WebInspectorProxy.h:
764         * UIProcess/WebInspectorProxy.cpp:
765         (WebKit::WebInspectorProxy::resetWindowState): Added.
766         (WebKit::WebInspectorProxy::platformResetWindowState): Added.
767         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
768         (WebKit::WebInspectorProxy::platformResetWindowState): Added.
769         * UIProcess/mac/WebInspectorProxyMac.mm:
770         (WebKit::WebInspectorProxy::platformResetWindowState): Added.
771         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
772         (WebKit::WebInspectorProxy::platformResetWindowState): Added.
773         * UIProcess/win/WebInspectorProxyWin.cpp:
774         (WebKit::WebInspectorProxy::platformResetWindowState): Added.
775         * WebProcess/WebPage/WebInspectorUI.h:
776         * WebProcess/WebPage/WebInspectorUI.cpp:
777         (WebKit::WebInspectorUI::resetWindowState): Added.
778
779         * UIProcess/RemoteWebInspectorProxy.messages.in:
780         * UIProcess/RemoteWebInspectorProxy.h:
781         * UIProcess/RemoteWebInspectorProxy.cpp:
782         (WebKit::RemoteWebInspectorProxy::resetWindowState): Added.
783         (WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
784         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
785         (WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
786         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
787         (WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
788         * UIProcess/win/RemoteWebInspectorProxyWin.cpp:
789         (WebKit::RemoteWebInspectorProxy::platformResetWindowState): Added.
790         * WebProcess/WebPage/RemoteWebInspectorUI.h:
791         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
792         (WebKit::RemoteWebInspectorUI::resetWindowState): Added.
793
794 2019-07-01  Chris Dumez  <cdumez@apple.com>
795
796         Remove virtual functions on WebProcessLifetimeObserver that are unused after r245540
797         https://bugs.webkit.org/show_bug.cgi?id=199383
798
799         Reviewed by Alex Christensen.
800
801         * UIProcess/WebProcessLifetimeObserver.h:
802         (WebKit::WebProcessLifetimeObserver::webProcessDidCloseConnection):
803         * UIProcess/WebProcessLifetimeTracker.cpp:
804         (WebKit::WebProcessLifetimeTracker::addObserver):
805         (WebKit::WebProcessLifetimeTracker::pageWasInvalidated):
806
807 2019-07-01  Chris Dumez  <cdumez@apple.com>
808
809         StorageManager::SessionStorageNamespace::allowedConnections() should not copy the HashSet
810         https://bugs.webkit.org/show_bug.cgi?id=199379
811
812         Reviewed by Alex Christensen.
813
814         This was pretty inefficient.
815
816         * NetworkProcess/WebStorage/StorageManager.cpp:
817         (WebKit::StorageManager::SessionStorageNamespace::allowedConnections const):
818
819 2019-07-01  Wenson Hsieh  <wenson_hsieh@apple.com>
820
821         [iOS] REGRESSION (r246757): Unable to select non-editable text in subframes
822         https://bugs.webkit.org/show_bug.cgi?id=199366
823         <rdar://problem/52460509>
824
825         Reviewed by Tim Horton.
826
827         r246757 removed logic in selectionPositionInformation responsible for setting the focused frame when handling a
828         position information request. As the FIXME formerly in InteractionInformationRequest.h alluded to, text
829         selection gestures on iOS were dependent on this behavior when selecting text in subframes, since text selection
830         helpers in WebPageIOS.mm assume that the focused frame already contains the selection being set.
831
832         Rather than calling setFocusedFrame when requesting position information, we can fix this by making
833         WebPage::selectWithGesture and WebPage::selectTextWithGranularityAtPoint both set the focused frame if needed
834         before extending or moving text selections.
835
836         Covered by layout tests that began to fail after r246757:
837         - editing/selection/ios/selection-handles-in-iframe.html
838         - editing/selection/ios/selection-handle-clamping-in-iframe.html
839
840         * WebProcess/WebPage/WebPage.h:
841         * WebProcess/WebPage/ios/WebPageIOS.mm:
842         (WebKit::WebPage::selectWithGesture):
843
844         Only call the new helper method, setFocusedFrameBeforeSelectingTextAtLocation, at the start of the gesture.
845
846         (WebKit::WebPage::setFocusedFrameBeforeSelectingTextAtLocation):
847         (WebKit::WebPage::selectTextWithGranularityAtPoint):
848
849 2019-07-01  Alex Christensen  <achristensen@webkit.org>
850
851         Add new decidePolicyForNavigationAction SPI with preferences and userInfo
852         https://bugs.webkit.org/show_bug.cgi?id=199371
853         <rdar://problem/52352905>
854
855         Reviewed by Tim Horton.
856
857         Also deprecate some older SPI so we may someday clean up this mess.
858
859         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
860         * UIProcess/Cocoa/NavigationState.h:
861         * UIProcess/Cocoa/NavigationState.mm:
862         (WebKit::NavigationState::setNavigationDelegate):
863         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
864         (WebKit::NavigationState::NavigationClient::shouldBypassContentModeSafeguards const):
865
866 2019-07-01  Alex Christensen  <achristensen@webkit.org>
867
868         Deprecate but still call _webView:showCustomSheetForElement: after transition to UIContextMenuInteraction
869         https://bugs.webkit.org/show_bug.cgi?id=199296
870         <rdar://problem/51041960>
871
872         Reviewed by Darin Adler.
873
874         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
875         * UIProcess/ios/WKContentViewInteraction.mm:
876         (-[WKContentView _showAttachmentSheet]):
877         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
878         (-[WKContentView continueContextMenuInteraction:]):
879
880 2019-07-01  Alex Christensen  <achristensen@webkit.org>
881
882         Add main thread assertions in sendWithAsyncReply code
883         https://bugs.webkit.org/show_bug.cgi?id=199324
884
885         Reviewed by Sam Weinig.
886
887         sendWithAsyncReply can only be used on the main thread because
888         the CompletionHandler will be called on the main thread, and if it's
889         called from a background thread, then HashMap corruption will likely happen.
890         Add assertions to alert developers that they should only call sendWithAsyncReply
891         from the main thread.
892
893         This is responding to good feedback from r237294
894
895         * Platform/IPC/Connection.cpp:
896         (IPC::asyncReplyHandlerMap):
897         (IPC::nextAsyncReplyHandlerID):
898         (IPC::addAsyncReplyHandler):
899         (IPC::clearAsyncReplyHandlers):
900         (IPC::CompletionHandler<void):
901
902 2019-07-01  Eric Carlson  <eric.carlson@apple.com>
903
904         [iOS] Exiting from fullscreen scrolls to top of page
905         https://bugs.webkit.org/show_bug.cgi?id=199338
906         <rdar://problem/51273017>
907
908         Reviewed by Jer Noble.
909
910         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
911         (-[WKFullScreenWindowController _completedExitFullScreen]): Restore scroll position.
912         Hide window after restoring scroll position.
913         (-[WKFullScreenWindowController _exitFullscreenImmediately]): Drive-by fix: remove code
914         already also done in _completedExitFullScreen.
915
916 2019-07-01  Zalan Bujtas  <zalan@apple.com>
917
918         Tapping on the bottom part of youtube video behaves as if controls were visible
919         https://bugs.webkit.org/show_bug.cgi?id=199349
920         <rdar://problem/51955744>
921
922         Reviewed by Simon Fraser.
923
924         * WebProcess/WebPage/WebPage.cpp:
925         (WebKit::handleTouchEvent):
926         * WebProcess/WebPage/WebPage.h:
927         * WebProcess/WebPage/ios/WebPageIOS.mm:
928         (WebKit::WebPage::handleSyntheticClick):
929         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
930         (WebKit::WebPage::completeSyntheticClick):
931         (WebKit::WebPage::potentialTapAtPosition):
932
933 2019-07-01  Wenson Hsieh  <wenson_hsieh@apple.com>
934
935         iOS: REGRESSION(async scroll): Caret doesn't scroll when scrolling textarea
936         https://bugs.webkit.org/show_bug.cgi?id=198217
937         <rdar://problem/51097296>
938
939         Reviewed by Simon Fraser.
940
941         In iOS 12, when scrolling a text selection in an fast-scrolling container, editor state updates are scheduled
942         under AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll after the end of the scrolling gesture,
943         when the scrolling layer action is ScrollingLayerPositionAction::Set. This is no longer the case in iOS 13,
944         because we now bail in ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling after scroll deceleration
945         finishes since the scroll position didn't end up changing. Additionally, we no longer use
946         ScrollingLayerPositionAction::Set in the case where scrolling finished decelerating, since
947         ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll no longer uses to value of inUserInteraction to
948         determine whether to Set or Sync scrolling layer positions.
949
950         To restore iOS 12 behavior, ensure that we send a scrolling tree update using ScrollingLayerPositionAction::Set
951         after scrolling ends.
952
953         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
954         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll):
955
956 2019-07-01  Per Arne Vollan  <pvollan@apple.com>
957
958         Perform less work when a pre-warmed WebProcess is suspended or resumed.
959         https://bugs.webkit.org/show_bug.cgi?id=199195
960
961         Reviewed by Darin Adler.
962
963         Return early from WebProcess::actualPrepareToSuspend and WebProcess::processDidResume
964         if this is a pre-warmed process. This is a confirmed improvement in page load time.
965
966         * WebProcess/WebProcess.cpp:
967         (WebKit::WebProcess::actualPrepareToSuspend):
968         (WebKit::WebProcess::cancelPrepareToSuspend):
969         (WebKit::WebProcess::processDidResume):
970
971 2019-07-01  Carlos Garcia Campos  <cgarcia@igalia.com>
972
973         WebSockets: add support for sending blob messages when using web sockets platform APIs
974         https://bugs.webkit.org/show_bug.cgi?id=199189
975
976         Reviewed by Youenn Fablet.
977
978         Add helper private class BlobLoader that uses FileReaderLoader to load the blobs. Since blob loads are
979         asynchronous, the messages are queued using another helper internal class PendingMessage.
980
981         * WebProcess/Network/WebSocketChannel.cpp:
982         (WebKit::WebSocketChannel::increaseBufferedAmount): Increase the buffered amount checking we don't overlofw.
983         (WebKit::WebSocketChannel::decreaseBufferedAmount): Decrease the buffered amount.
984         (WebKit::WebSocketChannel::sendMessage): Helper class to send message to the network process and decrease the
985         buffered amount when done.
986         (WebKit::WebSocketChannel::send): Queue the message in pending queue if there are pending messages in the queue
987         for text and binary messages. For blobs, always queue the message unless it's an empty blob that we can handle
988         as empty binary data directly.
989         (WebKit::PendingMessage::PendingMessage): Helper class to queue message requests.
990         (WebKit::PendingMessage::type const): Type of message: Text, Binary, Blob.
991         (WebKit::PendingMessage::textMessage const): The text message.
992         (WebKit::PendingMessage::binaryData const): The binary data.
993         (WebKit::PendingMessage::blobLoader const): The blob loader.
994         (WebKit::WebSocketChannel::fail): Notify the client about the error to ensure onclose is emitted.
995         (WebKit::WebSocketChannel::disconnect): Clear the pending messages queue.
996         * WebProcess/Network/WebSocketChannel.h:
997
998 2019-07-01  Miguel Gomez  <magomez@igalia.com>
999
1000         [WPE][GTK] Content disappearing when using CSS transforms
1001         https://bugs.webkit.org/show_bug.cgi?id=181757
1002
1003         Reviewed by Žan Doberšek.
1004
1005         Set the appropriate AnimatedBackingStoreClient to the TextureMapperLayers when required.
1006
1007         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1008         (WebKit::CoordinatedGraphicsScene::updateSceneState):
1009
1010 2019-06-30  Antti Koivisto  <antti@apple.com>
1011
1012         Use separate variables for moving and stationary scrolling relationships in RemoteLayerTreeNode
1013         https://bugs.webkit.org/show_bug.cgi?id=199348
1014
1015         Reviewed by Darin Adler.
1016
1017         A layer can have only one acting scroll parent. Not using a vector for that case makes the code clearer.
1018
1019         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
1020         (WebKit::RemoteLayerTreeNode::actingScrollContainerID const):
1021         (WebKit::RemoteLayerTreeNode::stationaryScrollContainerIDs const):
1022
1023         Separate fields for the acting container and stationary containers.
1024
1025         (WebKit::RemoteLayerTreeNode::setActingScrollContainerID):
1026         (WebKit::RemoteLayerTreeNode::setStationaryScrollContainerIDs):
1027         (WebKit::RemoteLayerTreeNode::relatedScrollContainerIDs const): Deleted.
1028         (WebKit::RemoteLayerTreeNode::relatedScrollContainerPositioningBehavior const): Deleted.
1029         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
1030         (WebKit::RemoteLayerTreeNode::setRelatedScrollContainerBehaviorAndIDs): Deleted.
1031         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1032         (WebKit::isScrolledBy):
1033         (WebKit::findActingScrollParent):
1034         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1035         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
1036
1037 2019-06-30  Fujii Hironori  <Hironori.Fujii@sony.com>
1038
1039         [Win] Multiline mode of tooltip control does word-wrapping very slowly
1040         https://bugs.webkit.org/show_bug.cgi?id=198989
1041
1042         Reviewed by Ross Kirsling.
1043
1044         * UIProcess/win/WebView.cpp:
1045         (WebKit::truncatedString): Added.
1046         (WebKit::WebView::setToolTip): Use truncatedString.
1047
1048 2019-06-30  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1049
1050         Pass WebProcess information to platformInitializeWebProcess().
1051         https://bugs.webkit.org/show_bug.cgi?id=199345
1052
1053         Reviewed by Darin Adler.
1054
1055         Add const reference to WebProcessProxy for first argument of
1056         WebProcessPool::platformInitializeWebProcess().
1057
1058         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1059         (WebKit::WebProcessPool::platformInitializeWebProcess):
1060         * UIProcess/WebProcessPool.cpp:
1061         (WebKit::WebProcessPool::initializeNewWebProcess):
1062         * UIProcess/WebProcessPool.h:
1063         * UIProcess/glib/WebProcessPoolGLib.cpp:
1064         (WebKit::WebProcessPool::platformInitializeWebProcess):
1065         * UIProcess/win/WebProcessPoolWin.cpp:
1066         (WebKit::WebProcessPool::platformInitializeWebProcess):
1067
1068 2019-06-28  Brent Fulgham  <bfulgham@apple.com>
1069
1070         Revise WebContent sandbox based on seed feedback
1071         https://bugs.webkit.org/show_bug.cgi?id=199339
1072         <rdar://problem/49609201>
1073
1074         Reviewed by Alexey Proskuryakov.
1075
1076         Unblock syscall needed by CoreText.
1077
1078         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1079         * WebProcess/com.apple.WebProcess.sb.in:
1080
1081 2019-06-28  Tim Horton  <timothy_horton@apple.com>
1082
1083         iOS WebKit2 find-in-page indicator doesn't move with 'overflow: scroll'
1084         https://bugs.webkit.org/show_bug.cgi?id=175032
1085         <rdar://problem/29346482>
1086
1087         Reviewed by Wenson Hsieh.
1088
1089         * WebProcess/WebPage/FindController.cpp:
1090         (WebKit::FindController::drawRect):
1091         (WebKit::FindController::didScrollAffectingFindIndicatorPosition):
1092         Adopt the macOS code that notices that the find highlight doesn't match
1093         its original position, but instead of hiding the highlight like we do on macOS,
1094         update it. We do this asynchronously to avoid mutating the layer tree
1095         in the middle of painting, which is not /truly/ unsafe, but definitely
1096         non-ideal and causes fun flashes.
1097
1098         * WebProcess/WebPage/FindController.h:
1099         * WebProcess/WebPage/ios/FindControllerIOS.mm:
1100         (WebKit::FindController::updateFindIndicator):
1101         Store m_findIndicatorRect when updating the indicator, just like we do on macOS.
1102
1103 2019-06-28  Ryan Haddad  <ryanhaddad@apple.com>
1104
1105         Unreviewed build fix attempt after r246928.
1106
1107         * UIProcess/API/Cocoa/WKWebView.mm:
1108         (-[WKWebView _closeAllMediaPresentations]):
1109
1110 2019-06-28  Youenn Fablet  <youenn@apple.com>
1111
1112         Protect NetworkProcess::m_swServers from bad session IDs
1113         https://bugs.webkit.org/show_bug.cgi?id=199298
1114         <rdar://problem/51859081>
1115
1116         Reviewed by Chris Dumez.
1117
1118         Protect NetworkProcess from receiving bad session IDs in service worker code path by checking for session ID validity whenever interacting with the map.
1119         One of the check is done in WebProcess in which case, if the session ID is bad, the SW connection to NetworkProcess will not be made.
1120         For bad session IDs, this will in that case trigger timing out of service worker operations.
1121
1122         For get/clear data, exit early in case of bad session ID.
1123
1124         Made some refactoring to remove swOriginStoreForSession method.
1125         In the one call site where it is used, the store should already be created so we reuse existingSWOriginStoreForSession.
1126
1127         Added a bunch of additional ASSERTs.
1128
1129         * NetworkProcess/NetworkProcess.cpp:
1130         (WebKit::NetworkProcess::destroySession):
1131         (WebKit::NetworkProcess::fetchWebsiteData):
1132         (WebKit::NetworkProcess::deleteWebsiteData):
1133         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
1134         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
1135         (WebKit::NetworkProcess::actualPrepareToSuspend):
1136         (WebKit::NetworkProcess::swServerForSession):
1137         (WebKit::NetworkProcess::existingSWOriginStoreForSession const):
1138         (WebKit::NetworkProcess::registerSWServerConnection):
1139         * NetworkProcess/NetworkProcess.h:
1140         * WebProcess/Network/NetworkProcessConnection.cpp:
1141         (WebKit::NetworkProcessConnection::initializeSWClientConnection):
1142         * WebProcess/Storage/WebSWClientConnection.cpp:
1143         (WebKit::WebSWClientConnection::WebSWClientConnection):
1144         (WebKit::WebSWClientConnection::initializeConnectionIfNeeded):
1145         (WebKit::WebSWClientConnection::ensureConnectionAndSend):
1146
1147 2019-06-28  Timothy Hatcher  <timothy@apple.com>
1148
1149         Rename effectiveAppearanceIsInactive and useInactiveAppearance to better match UIUserInterfaceLevel.
1150         https://bugs.webkit.org/show_bug.cgi?id=199336
1151         rdar://problem/52348938
1152
1153         Reviewed by Tim Horton.
1154
1155         * Shared/WebPageCreationParameters.cpp:
1156         (WebKit::WebPageCreationParameters::encode const):
1157         (WebKit::WebPageCreationParameters::decode):
1158         * Shared/WebPageCreationParameters.h:
1159         * UIProcess/API/Cocoa/WKWebView.mm:
1160         (-[WKWebView _effectiveUserInterfaceLevelIsElevated]):
1161         (-[WKWebView _effectiveAppearanceIsInactive]): Deleted.
1162         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1163         * UIProcess/Cocoa/WebViewImpl.h:
1164         * UIProcess/Cocoa/WebViewImpl.mm:
1165         (WebKit::WebViewImpl::effectiveUserInterfaceLevelIsElevated):
1166         (WebKit::WebViewImpl::effectiveAppearanceIsInactive): Deleted.
1167         * UIProcess/PageClient.h:
1168         (WebKit::PageClient::effectiveUserInterfaceLevelIsElevated const):
1169         (WebKit::PageClient::effectiveAppearanceIsInactive const): Deleted.
1170         * UIProcess/WebPageProxy.cpp:
1171         (WebKit::WebPageProxy::creationParameters):
1172         (WebKit::WebPageProxy::useElevatedUserInterfaceLevel const):
1173         (WebKit::WebPageProxy::effectiveAppearanceDidChange):
1174         (WebKit::WebPageProxy::useInactiveAppearance const): Deleted.
1175         * UIProcess/WebPageProxy.h:
1176         * UIProcess/ios/PageClientImplIOS.h:
1177         * UIProcess/ios/PageClientImplIOS.mm:
1178         (WebKit::PageClientImpl::effectiveUserInterfaceLevelIsElevated const):
1179         (WebKit::PageClientImpl::effectiveAppearanceIsInactive const): Deleted.
1180         * UIProcess/mac/PageClientImplMac.h:
1181         * UIProcess/mac/PageClientImplMac.mm:
1182         (WebKit::PageClientImpl::effectiveUserInterfaceLevelIsElevated const):
1183         (WebKit::PageClientImpl::effectiveAppearanceIsInactive const): Deleted.
1184         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1185         (WKBundlePageSetUseDarkAppearance):
1186         * WebProcess/WebPage/WebPage.cpp:
1187         (WebKit::m_shrinkToFitContentTimer):
1188         (WebKit::WebPage::effectiveAppearanceDidChange):
1189         * WebProcess/WebPage/WebPage.h:
1190         * WebProcess/WebPage/WebPage.messages.in:
1191
1192 2019-06-28  Jer Noble  <jer.noble@apple.com>
1193
1194         Unreviewed maccatalyst build fix; add ENABLE(FULLSCREEN) checks around calls to fullScreenManager().
1195
1196         * UIProcess/API/Cocoa/WKWebView.mm:
1197         (-[WKWebView _closeAllMediaPresentations]):
1198
1199 2019-06-28  Tim Horton  <timothy_horton@apple.com>
1200
1201         macCatalyst: Selected range sometimes wrong after autocorrection
1202         https://bugs.webkit.org/show_bug.cgi?id=199299
1203         <rdar://problem/49717224>
1204
1205         Reviewed by Wenson Hsieh.
1206
1207         * UIProcess/Cocoa/TextCheckingController.h:
1208         * UIProcess/Cocoa/TextCheckingController.mm:
1209         (WebKit::TextCheckingController::replaceRelativeToSelection):
1210         * UIProcess/ios/WKContentViewInteraction.mm:
1211         (-[WKContentView replaceSelectionOffset:length:withAnnotatedString:relativeReplacementRange:]):
1212         Plumb the whole relative replacement range through to the Web Content process.
1213
1214         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h:
1215         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.messages.in:
1216         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
1217         (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection):
1218         Only replace the text of the substring that changed (the replacement range),
1219         and fix up the selection offset math (it was really just wrong before).
1220
1221 2019-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
1222
1223         Need a way for SPI clients to know when to avoid resizing to accommodate for the input view bounds
1224         https://bugs.webkit.org/show_bug.cgi?id=199331
1225         <rdar://problem/52116170>
1226
1227         Reviewed by Tim Horton.
1228
1229         Expose new SPI, such that clients may check whether to avoid resizing the web view when changing input view
1230         bounds. In particular, resizing the web view in this case causes toolbar menus in Microsoft Word online to
1231         dismiss immediately after opening them, due to resize events fired as a result of the input view dismissing.
1232
1233         * Shared/FocusedElementInformation.cpp:
1234         (WebKit::FocusedElementInformation::encode const):
1235         (WebKit::FocusedElementInformation::decode):
1236         * Shared/FocusedElementInformation.h:
1237
1238         Add a new flag to FocusedElementInformation to indicate whether we should avoid resizing the web view when an
1239         input view is presented.
1240
1241         * UIProcess/API/Cocoa/WKWebView.mm:
1242         (-[WKWebView _shouldAvoidResizingWhenInputViewBoundsChange]):
1243         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1244         * UIProcess/ios/WKContentViewInteraction.h:
1245         * UIProcess/ios/WKContentViewInteraction.mm:
1246         (-[WKContentView _elementDidBlur]):
1247
1248         Reset the value of the flag.
1249
1250         (-[WKContentView _shouldAvoidResizingWhenInputViewBoundsChange]):
1251         * WebProcess/WebPage/ios/WebPageIOS.mm:
1252         (WebKit::WebPage::getFocusedElementInformation):
1253
1254 2019-06-28  Jer Noble  <jer.noble@apple.com>
1255
1256         Add new -[WKWebView _closeAllMediaPresentations] SPI
1257         https://bugs.webkit.org/show_bug.cgi?id=199294
1258         <rdar://problem/51965958>
1259
1260         Reviewed by Alex Christensen.
1261
1262         Add a new SPI that will close all out-of-window media presentations, including
1263         picture-in-picture, video fullscreen, and element fullscreen.
1264
1265         Drive-by fixes:
1266
1267         + -[WKApplicationStateTrackingView didMoveToWindow] incorrectly assumes that a WKWebView will
1268           never be moved frome one window to another, and asserts.
1269
1270         + -[WKFullScreenWindowController close] doesn't fire the correct 'webkitfullscreenchange' event
1271           when called in the middle of animating into fullscreen.
1272
1273         * UIProcess/API/Cocoa/WKWebView.mm:
1274         (-[WKWebView _closeAllMediaPresentations]):
1275         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1276         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
1277         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1278         (WebKit::VideoFullscreenManagerProxy::forEachSession):
1279         * UIProcess/ios/WKApplicationStateTrackingView.mm:
1280         (-[WKApplicationStateTrackingView didMoveToWindow]):
1281         * UIProcess/mac/WKFullScreenWindowController.h:
1282         * UIProcess/mac/WKFullScreenWindowController.mm:
1283         (-[WKFullScreenWindowController exitFullScreenImmediately]):
1284         (-[WKFullScreenWindowController close]):
1285
1286 2019-06-28  Antti Koivisto  <antti@apple.com>
1287
1288         [iOS Scrolling] Propagate scrolls to non-nested UIScrollViews
1289         https://bugs.webkit.org/show_bug.cgi?id=199222
1290
1291         Reviewed by Simon Fraser.
1292
1293         We may generate scrolling hierarchies where the scrolling ancestor of a layer is not
1294         an ancestor in the layer tree. We  handle this in most situations but there is still
1295         a problem where a scroller fails to propage scroll to the ancestor when it reaches
1296         the edge.
1297
1298         This patch hooks up a new SPI that allows us to tell UIKit about non-ancestor scrolling
1299         relations and solve this problem.
1300
1301         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
1302         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1303         (WebKit::findActingScrollParent):
1304         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
1305         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1306         (-[WKScrollingNodeScrollViewDelegate _actingParentScrollViewForScrollView:]):
1307
1308         Hook into UIKit SPI.
1309
1310         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::findActingScrollParent):
1311
1312 2019-06-28  Konstantin Tokarev  <annulen@yandex.ru>
1313
1314         Remove traces of ENABLE_ICONDATABASE remaining after its removal in 219733
1315         https://bugs.webkit.org/show_bug.cgi?id=199317
1316
1317         Reviewed by Michael Catanzaro.
1318
1319         While IconDatabase and all code using it was removed,
1320         ENABLE_ICONDATABASE still exists as build option and C++ macro.
1321
1322         * Configurations/FeatureDefines.xcconfig:
1323         * PlatformGTK.cmake: Remove reference to unused urlIcon.png file.
1324
1325 2019-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
1326
1327         -[WKContentView _selectionClipRects] returns a bogus value in -reloadInputViews when focusing an element
1328         https://bugs.webkit.org/show_bug.cgi?id=199310
1329         <rdar://problem/52292137>
1330
1331         Reviewed by Megan Gardner.
1332
1333         When reloading input views under -_elementDidFocus:, -_selectionClipRect returns the value of the previously
1334         focused element; this is because _selectionClipRect depends on EditorState's post layout data, which is only
1335         guaranteed to arrive during the next remote layer tree commit after the element is focused.
1336
1337         However, some clients need to inspect this value under the call to -reloadInputViews when an element is focused;
1338         to make this work, simply check whether we are currently waiting for post-layout EditorState data to arrive
1339         following element focus; if so, return the FocusedElementInformation's elementRect, which represents the initial
1340         state of the focused element. Otherwise, use the EditorState's post layout data, which is guaranteed to be more
1341         up-to-date than the FocusedElementInformation's element rect.
1342
1343         Test: KeyboardInputTests.SelectionClipRectsWhenPresentingInputView
1344
1345         * UIProcess/WebPageProxy.h:
1346         (WebKit::WebPageProxy::waitingForPostLayoutEditorStateUpdateAfterFocusingElement const):
1347         * UIProcess/ios/WKContentViewInteraction.mm:
1348         (-[WKContentView _selectionClipRect]):
1349
1350 2019-06-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1351
1352         [SOUP] WebSockets: runtime critical warning when closing the connection in some cases
1353         https://bugs.webkit.org/show_bug.cgi?id=199265
1354
1355         Reviewed by Michael Catanzaro.
1356
1357         Ensure the connection is still open before calling soup_websocket_connection_close().
1358
1359         * NetworkProcess/soup/WebSocketTaskSoup.cpp:
1360         (WebKit::WebSocketTask::close):
1361
1362 2019-06-27  Zan Dobersek  <zdobersek@igalia.com>
1363
1364         Unreviewed WPE build fix.
1365
1366         * SourcesWPE.txt: Add WebSocketTaskSoup.cpp to the build.
1367
1368 2019-06-27  Dean Jackson  <dino@apple.com>
1369
1370         Provide overrides for UIKit's suggested actions in UIContextMenuInteraction
1371         https://bugs.webkit.org/show_bug.cgi?id=199301
1372         <rdar://problem/52297380>
1373
1374         Reviewed by Tim Horton.
1375
1376         We were previously wrapping the actionMenuProvider with our own block
1377         in order to ensure the correct suggestedActions were passed to the provider.
1378         UIKit added API for us to override the actions separately.
1379
1380         Unfortunately we can't quite yet get rid of our access into the
1381         UIContextMenuConfiguration, because we still need to override the preview
1382         handler in the case where the user does not want link previews.
1383
1384         * Platform/spi/ios/UIKitSPI.h:
1385         * UIProcess/ios/WKContentViewInteraction.h:
1386         * UIProcess/ios/WKContentViewInteraction.mm:
1387         (-[WKContentView continueContextMenuInteraction:]):
1388         (-[WKContentView _contextMenuInteraction:overrideSuggestedActionsForConfiguration:]):
1389         Implement the new delegate SPI to provide our own actions.
1390
1391 2019-06-27  Daniel Bates  <dabates@apple.com>
1392
1393         [iOS] Select all with existing range selection replaces range instead of selecting all text
1394         https://bugs.webkit.org/show_bug.cgi?id=197950
1395         <rdar://problem/50245131>
1396
1397         Reviewed by Wenson Hsieh.
1398
1399         Following <rdar://problem/47333786>, UIKit now asks WebKit whether it can handle Command + A as
1400         "select all" instead of just demanding that we handle it. So, WebKit needs to be able to correctly
1401         tell UIKit in advance whether it can handle it. Currenlty WebKit tells UIKit it cannot handle a
1402         "select all" whenever there is an existing range selection. So, UIKit does not tell WebKit to
1403         perform the "select all". Moreover, since UIKit has no other means to handle this key command
1404         itself it tells WebKit the key command was not handled. So, WebKit tells the keyboard to insert
1405         the "a". Instead, WebKit should tell UIKit it can handle a "select all" even when this is an
1406         existing range selection. However we need to keep the current logic just for when UIKit is
1407         asking us with respect to populating the callout menu to not regress platform behavior.
1408
1409         * UIProcess/ios/WKContentViewInteraction.mm:
1410         (-[WKContentView canPerformActionForWebView:withSender:]): Do what we do now if we are called
1411         when populating the callout menu and action is Select All. Otherwise, return YES for the Select All
1412         action if we have a non-empty selection.
1413
1414 2019-06-27  Andy Estes  <aestes@apple.com>
1415
1416         [iOS] Stop using cached UITargetedPreviews from previous interactions when starting a new context menu interaction
1417         https://bugs.webkit.org/show_bug.cgi?id=199285
1418         <rdar://problem/52074916>
1419
1420         Reviewed by Tim Horton.
1421
1422         WKContentView was caching the UITargetedPreview created in
1423         -contextMenuInteraction:previewForHighlightingMenuWithConfiguration: for later reuse by
1424         -contextMenuInteraction:previewForDismissingMenuWithConfiguration:. The cached value was
1425         then cleared in -contextMenuInteractionDidEnd:.
1426
1427         This was wrong, because -contextMenuInteractionDidEnd: can be called before
1428         -contextMenuInteraction:previewForDismissingMenuWithConfiguration:, so we would clear the
1429         cache then create and cache a new UITargetedPreview during dismissal. Then when a new
1430         context menu interaction started, we'd reuse the targeted preview created for the previous
1431         dismissal (which has the wrong geometry).
1432
1433         Stop assuming an ordering between
1434         -contextMenuInteraction:previewForDismissingMenuWithConfiguration: and
1435         -contextMenuInteractionDidEnd:. Instead, always create and cache a new UITargetedPreview in
1436         -contextMenuInteraction:previewForHighlightingMenuWithConfiguration:, then reuse it and
1437         clear the cache in -contextMenuInteraction:previewForDismissingMenuWithConfiguration:.
1438
1439         * UIProcess/ios/WKContentViewInteraction.mm:
1440         (-[WKContentView _createTargetedPreviewIfPossible]):
1441         (-[WKContentView contextMenuInteraction:previewForDismissingMenuWithConfiguration:]):
1442         (-[WKContentView contextMenuInteractionDidEnd:]):
1443
1444 2019-06-27  Sihui Liu  <sihui_liu@apple.com>
1445
1446         Regression(r246526): StorageManager thread hangs
1447         https://bugs.webkit.org/show_bug.cgi?id=199278
1448         <rdar://problem/52202948>
1449
1450         Reviewed by Geoffrey Garen.
1451
1452         r246526 adds a lock m_localStorageNamespacesMutex to protect m_localStorageNamespaces, because 
1453         m_localStorageNamespaces is destroyed at main thread while accesses to m_localStorageNamespaces happen in the 
1454         background thread.
1455         After r246526, getOrCreateLocalStorageNamespace acquires lock m_localStorageNamespacesMutex when 
1456         m_localStorageNamespacesMutex is already acquired in cloneSessionStorageNamespace, so the StorageManager thread
1457         hangs.
1458         To solve this issue, we can remove the lock in getOrCreateLocalStorageNamespace, or we can remove the 
1459         m_localStorageNamespacesMutex. waitUntilWritesFinished() before ~StorageManager() already guarantees nothing 
1460         will be running in the background thread, so it is unlikely we the access to m_localStorageNamespaces in the 
1461         background thread would collide with the destruction of m_localStorageNamespaces. Also, we don't need 
1462         didDestroyStorageArea as LocalStorageNamespace can hold the last reference of StorageArea after r245881.
1463
1464         * NetworkProcess/WebStorage/StorageManager.cpp:
1465         (WebKit::StorageManager::StorageArea::StorageArea):
1466         (WebKit::StorageManager::StorageArea::~StorageArea):
1467         (WebKit::StorageManager::LocalStorageNamespace::LocalStorageNamespace):
1468         (WebKit::StorageManager::cloneSessionStorageNamespace):
1469         (WebKit::StorageManager::getLocalStorageOrigins):
1470         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
1471         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
1472         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
1473         (WebKit::StorageManager::getOrCreateLocalStorageNamespace):
1474         (WebKit::StorageManager::LocalStorageNamespace::didDestroyStorageArea): Deleted.
1475         * NetworkProcess/WebStorage/StorageManager.h:
1476
1477 2019-06-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1478
1479         WebSockets: avoid data copies when queuing tasks in WebSocketChannel
1480         https://bugs.webkit.org/show_bug.cgi?id=199262
1481
1482         Reviewed by Alex Christensen.
1483
1484         For IPC message handler arguments we can receive rvalue references instead of const references.
1485
1486         * WebProcess/Network/WebSocketChannel.cpp:
1487         (WebKit::WebSocketChannel::didConnect):
1488         (WebKit::WebSocketChannel::didReceiveText):
1489         (WebKit::WebSocketChannel::didReceiveBinaryData):
1490         (WebKit::WebSocketChannel::didClose):
1491         (WebKit::WebSocketChannel::didReceiveMessageError):
1492         * WebProcess/Network/WebSocketChannel.h:
1493
1494 2019-06-27  Youenn Fablet  <youenn@apple.com>
1495
1496         Fix build after revision 246877
1497         https://bugs.webkit.org/show_bug.cgi?id=199276
1498
1499         Unreviewed.
1500
1501         Pass protocol parameter to NetworkSocketChannel.
1502
1503         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1504         (-[WKNetworkSessionDelegate URLSession:webSocketTask:didOpenWithProtocol:]):
1505         * NetworkProcess/cocoa/WebSocketTaskCocoa.h:
1506         * NetworkProcess/cocoa/WebSocketTaskCocoa.mm:
1507         (WebKit::WebSocketTask::didConnect):
1508
1509 2019-06-27  Beth Dakin  <bdakin@apple.com>
1510
1511         Upstream use of MACCATALYST
1512         https://bugs.webkit.org/show_bug.cgi?id=199245
1513         rdar://problem/51687723
1514
1515         Reviewed by Tim Horton.
1516
1517         * Configurations/Base.xcconfig:
1518         * Configurations/FeatureDefines.xcconfig:
1519         * Configurations/Network-iOSMac.entitlements: Removed.
1520         * Configurations/Network-macCatalyst.entitlements: Copied from Source/WebKit/Configurations/Network-iOSMac.entitlements.
1521         * Configurations/NetworkService.xcconfig:
1522         * Configurations/SDKVariant.xcconfig:
1523         * Configurations/WebContent-iOSMac.entitlements: Removed.
1524         * Configurations/WebContent-macCatalyst.entitlements: Copied from Source/WebKit/Configurations/WebContent-iOSMac.entitlements.
1525         * Configurations/WebContentService.xcconfig:
1526         * Configurations/WebKit.xcconfig:
1527         * NetworkProcess/ios/NetworkProcessIOS.mm:
1528         * NetworkProcess/mac/NetworkProcessMac.mm:
1529         (WebKit::NetworkProcess::initializeProcess):
1530         (WebKit::NetworkProcess::initializeProcessName):
1531         * Platform/mac/LayerHostingContext.mm:
1532         (WebKit::LayerHostingContext::createForExternalHostingProcess):
1533         * Platform/spi/ios/ManagedConfigurationSPI.h:
1534         * Platform/spi/ios/UIKitSPI.h:
1535         * Shared/WebPreferencesDefaultValues.cpp:
1536         (WebKit::defaultCustomPasteboardDataEnabled):
1537         * Shared/ios/AuxiliaryProcessIOS.mm:
1538         (WebKit::AuxiliaryProcess::initializeSandbox):
1539         * Shared/ios/InteractionInformationAtPosition.h:
1540         * Shared/ios/InteractionInformationAtPosition.mm:
1541         (WebKit::InteractionInformationAtPosition::encode const):
1542         (WebKit::InteractionInformationAtPosition::decode):
1543         * Shared/mac/AuxiliaryProcessMac.mm:
1544         (WebKit::enableSandboxStyleFileQuarantine):
1545         * Shared/mac/CodeSigning.mm:
1546         * UIProcess/API/Cocoa/WKWebView.mm:
1547         (-[WKWebView _webViewPrintFormatter]):
1548         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1549         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1550         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1551         (WebKit::RemoteLayerTreeHost::updateLayerTree):
1552         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1553         (-[WKRemoteView initWithFrame:contextID:]):
1554         * UIProcess/_WKWebViewPrintFormatter.mm:
1555         * UIProcess/_WKWebViewPrintFormatterInternal.h:
1556         * UIProcess/ios/WKActionSheetAssistant.mm:
1557         (-[WKActionSheetAssistant _elementActionForDDAction:]):
1558         * UIProcess/ios/WKContentView.mm:
1559         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
1560         * UIProcess/ios/WKContentViewInteraction.h:
1561         * UIProcess/ios/WKContentViewInteraction.mm:
1562         (-[WKContentView setupInteraction]):
1563         (-[WKContentView cleanupInteraction]):
1564         (-[WKContentView _removeDefaultGestureRecognizers]):
1565         (-[WKContentView _addDefaultGestureRecognizers]):
1566         (-[WKContentView _showTapHighlight]):
1567         (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]):
1568         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1569         (-[WKContentView canPerformActionForWebView:withSender:]):
1570         (-[WKContentView _defineForWebView:]):
1571         (-[WKContentView setSelectedTextRange:]):
1572         (-[WKContentView closestPositionToPoint:]):
1573         (-[WKContentView _showShareSheet:inRect:completionHandler:]):
1574         * UIProcess/ios/WebPageProxyIOS.mm:
1575         (WebKit::desktopClassBrowsingSupported):
1576         (WebKit::desktopClassBrowsingRecommended):
1577         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1578         (-[WKFileUploadPanel _showDocumentPickerMenu]):
1579         * WebKit.xcodeproj/project.pbxproj:
1580         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
1581         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1582         (WebKit::WebPage::dictionaryPopupInfoForRange):
1583         * WebProcess/WebPage/ios/WebPageIOS.mm:
1584         (WebKit::WebPage::platformEditorState const):
1585         (WebKit::WebPage::selectWithGesture):
1586         (WebKit::selectionPositionInformation):
1587         * WebProcess/cocoa/WebProcessCocoa.mm:
1588         (WebKit::WebProcess::initializeSandbox):
1589         * WebProcess/com.apple.WebProcess.sb.in:
1590
1591 2019-06-27  Saam Barati  <sbarati@apple.com>
1592
1593         Make WEBGPU enabled only on Mojave and later.
1594
1595         Rubber-stamped by Myles C. Maxfield.
1596
1597         * Configurations/FeatureDefines.xcconfig:
1598
1599 2019-06-27  Adrian Perez de Castro  <aperez@igalia.com>
1600
1601         [GTK][WPE] Fix build non-unified builds after r246856
1602         https://bugs.webkit.org/show_bug.cgi?id=199263
1603
1604         Reviewed by Michael Catanzaro.
1605
1606         * UIProcess/API/C/WKMessageListener.cpp: Added missing inclusion of WKAPICast.h and usage of WebKit namespace.
1607
1608 2019-06-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1609
1610         [SOUP] WebSockets: handle TLS certificate and errors
1611         https://bugs.webkit.org/show_bug.cgi?id=199223
1612
1613         Reviewed by Michael Catanzaro.
1614
1615         Connect to accept-certificate signal on the WebSocket message connection to decide what to do in case of TLS errors.
1616
1617         * NetworkProcess/soup/NetworkSessionSoup.cpp:
1618         (WebKit::webSocketAcceptCertificateCallback):
1619         (WebKit::webSocketMessageNetworkEventCallback):
1620         (WebKit::NetworkSessionSoup::createWebSocketTask):
1621
1622 2019-06-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1623
1624         [SOUP] Use libsoup WebSockets API
1625         https://bugs.webkit.org/show_bug.cgi?id=199151
1626
1627         Reviewed by Michael Catanzaro.
1628
1629         Use the new WebSockets code path that depends on platform specific WebSockets implementation using the libsoup
1630         API. This is an initial implementation manually tested using the layout tests, which most of them fail due to
1631         missing console messages, missing features in the new code path or differences in the platform
1632         implementation. It will be disabled by default until it's feature complete compared to the internal WebKit
1633         implementation.
1634
1635         * NetworkProcess/NetworkSocketChannel.cpp:
1636         (WebKit::NetworkSocketChannel::NetworkSocketChannel): Null check m_socket before using it, because
1637         createWebSocketTask() can return nullptr;
1638         (WebKit::NetworkSocketChannel::didConnect): Receive the protocol accepted by the server.
1639         (WebKit::NetworkSocketChannel::didReceiveMessageError): Something failed in the server side.
1640         * NetworkProcess/NetworkSocketChannel.h:
1641         * NetworkProcess/WebSocketTask.h:
1642         * NetworkProcess/soup/NetworkSessionSoup.cpp:
1643         (WebKit::NetworkSessionSoup::createWebSocketTask): Create a WebSocketTask.
1644         * NetworkProcess/soup/NetworkSessionSoup.h:
1645         * NetworkProcess/soup/WebSocketTaskSoup.cpp: Added.
1646         (WebKit::WebSocketTask::WebSocketTask):
1647         (WebKit::WebSocketTask::~WebSocketTask):
1648         (WebKit::WebSocketTask::didConnect):
1649         (WebKit::WebSocketTask::didReceiveMessageCallback):
1650         (WebKit::WebSocketTask::didReceiveErrorCallback):
1651         (WebKit::WebSocketTask::didFail):
1652         (WebKit::WebSocketTask::didCloseCallback):
1653         (WebKit::WebSocketTask::didClose):
1654         (WebKit::WebSocketTask::sendString):
1655         (WebKit::WebSocketTask::sendData):
1656         (WebKit::WebSocketTask::close):
1657         (WebKit::WebSocketTask::cancel):
1658         (WebKit::WebSocketTask::resume):
1659         * NetworkProcess/soup/WebSocketTaskSoup.h: Copied from Source/WebKit/NetworkProcess/WebSocketTask.h.
1660         * SourcesGTK.txt:
1661         * WebProcess/Network/WebSocketChannel.cpp:
1662         (WebKit::WebSocketChannel::subprotocol): Return the protocol accepted by the server.
1663         (WebKit::WebSocketChannel::didConnect): Set the protocol accepted by the server.
1664         (WebKit::WebSocketChannel::didReceiveMessageError): It's now an IPC message handler and receives the reason as parameter.
1665         (WebKit::WebSocketChannel::networkProcessCrashed): Pass empty reason.
1666         * WebProcess/Network/WebSocketChannel.h:
1667         * WebProcess/Network/WebSocketChannel.messages.in:
1668
1669 2019-06-21  Konstantin Tokarev  <annulen@yandex.ru>
1670
1671         [cmake] Switch to built-in handling of C++ standard instead of hardcoding -std=c++17
1672         https://bugs.webkit.org/show_bug.cgi?id=199108
1673
1674         Reviewed by Don Olmstead.
1675
1676         Rationale:
1677
1678         1. It provides an abstraction over exact flags of particular compilers -
1679            we just specify required version of C++ standard
1680         2. External libraries (like Qt used in WPEQt) may require particular C++
1681            standard or even particular C++ features to be availabe (e.g. Qt
1682            requires INTERFACE_COMPILE_FEATURES cxx_decltype, which causes cmake
1683            to add -std=gnu++11 unless proper CXX_STANDARD is defined)
1684
1685         * PlatformWPE.cmake: Use project-level default for CXX_STANDARD
1686         property.
1687
1688 2019-06-26  Jiewen Tan  <jiewen_tan@apple.com>
1689
1690         SubFrameSOAuthorizationSession should preserve the referrer header when fall back to web path
1691         https://bugs.webkit.org/show_bug.cgi?id=199232
1692         <rdar://problem/51718328>
1693
1694         Reviewed by Youenn Fablet.
1695
1696         The fall back to web path mechanism in SubFrameSOAuthorizationSession doesn't actually resume
1697         the previous navigation. Instead it starts a new one. The current implementation doesn't carry
1698         any information from the previous navigation. It is problematic when it comes to http referrer
1699         as the server might use that to determine what kind of responses to send back. Therefore, we
1700         add that information now.
1701
1702         To accomplish the above, the patch teaches WebFrameProxy::loadURL to carry referrer information
1703         when it is available. Then SubFrameSOAuthorizationSession can reuses the referrer from the
1704         original request.
1705
1706         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm:
1707         (WebKit::SubFrameSOAuthorizationSession::fallBackToWebPathInternal):
1708         * UIProcess/WebFrameProxy.cpp:
1709         (WebKit::WebFrameProxy::loadURL):
1710         * UIProcess/WebFrameProxy.h:
1711         * WebProcess/WebPage/WebPage.cpp:
1712         (WebKit::WebPage::loadURLInFrame):
1713         * WebProcess/WebPage/WebPage.h:
1714         * WebProcess/WebPage/WebPage.messages.in:
1715
1716 2019-06-26  Fujii Hironori  <Hironori.Fujii@sony.com>
1717
1718         testRunner.setAlwaysAcceptCookies should wait for cookie accept policy to be set
1719         https://bugs.webkit.org/show_bug.cgi?id=199230
1720         <rdar://problem/52217933>
1721
1722         Unreviewed build fix for WinCairo WK2 since r246856.
1723
1724         * PlatformWin.cmake: Added WKMessageListener.h to WebKit_PUBLIC_FRAMEWORK_HEADERS.
1725
1726 2019-06-26  Dean Jackson  <dino@apple.com>
1727
1728         Add type to UIImage symbol mapping for _WKElementAction
1729         https://bugs.webkit.org/show_bug.cgi?id=199255
1730
1731         Reviewed by Sam Weinig.
1732
1733         Moving some code in from WebKitAdditions now
1734         that the API is public.
1735
1736         * UIProcess/API/Cocoa/_WKElementAction.mm:
1737         (+[_WKElementAction imageForElementActionType:]):
1738         (elementActionTypeToUIActionIdentifier):
1739         (uiActionIdentifierToElementActionType):
1740
1741 2019-06-26  Dean Jackson  <dino@apple.com>
1742
1743         Expose UIAction identifiers for _WKElementActions
1744         https://bugs.webkit.org/show_bug.cgi?id=199246
1745         <rdar://problem/52218950>
1746
1747         Reviewed by Tim Horton.
1748
1749         In order for clients to create a contextual menu, they are given
1750         a set of suggested UIActions, created from _WKElementActions.
1751         By associating identifiers (strings) with the UIActions, clients
1752         can inspect the suggestions and make a decision on whether or
1753         not to include them in the final menu.
1754
1755         * UIProcess/API/Cocoa/_WKElementAction.h: Typedef UIActionIdentifier,
1756         add a method to create a UIAction from an _WKElementAction, and a
1757         helper to map between identifiers and types.
1758
1759         * UIProcess/API/Cocoa/_WKElementAction.mm:
1760         (elementActionTypeToUIActionIdentifier): Helper to convert between the two types.
1761         (uiActionIdentifierToElementActionType): The inverse of above.
1762         (+[_WKElementAction elementActionTypeForUIActionIdentifier:]): A client given
1763         a UIAction object can use this helper method to see what _WKElementActionType it
1764         corresponds to.
1765         (-[_WKElementAction uiActionForElementInfo:]): Used by WKContentViewInteraction to
1766         create a UIAction from this _WKElementAction.
1767
1768         * UIProcess/ios/WKContentViewInteraction.mm:
1769         (uiActionForLegacyPreviewAction): Renamed to make it clear this is a legacy approach.
1770         (menuFromLegacyPreviewOrDefaultActions): Split these functions to separate the legacy
1771         and non-legacy approach.
1772         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
1773         (-[WKContentView continueContextMenuInteraction:]):
1774         (uiActionForPreviewAction): Deleted.
1775         (menuFromPreviewOrDefaults): Deleted.
1776
1777 2019-06-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1778
1779         [iPadOS] Fix another crash in -[UIPreviewTarget initWithContainer:center:transform:] when generating a fallback targeted preview
1780         https://bugs.webkit.org/show_bug.cgi?id=199243
1781         <rdar://problem/51554509>
1782
1783         Reviewed by Tim Horton.
1784
1785         Additionally make createFallbackTargetedPreview robust in the case where the content view is unparented, and
1786         rename _ensureTargetedPreview to _createTargetedPreviewIfPossible, to reflect the fact that it may now return
1787         nil.
1788
1789         * UIProcess/ios/WKContentViewInteraction.mm:
1790         (createTargetedPreview):
1791         (createFallbackTargetedPreview):
1792         (-[WKContentView _createTargetedPreviewIfPossible]):
1793         (-[WKContentView contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
1794         (-[WKContentView contextMenuInteraction:previewForDismissingMenuWithConfiguration:]):
1795         (-[WKContentView _ensureTargetedPreview]): Deleted.
1796
1797 2019-06-26  Alex Christensen  <achristensen@webkit.org>
1798
1799         testRunner.setAlwaysAcceptCookies should wait for cookie accept policy to be set
1800         https://bugs.webkit.org/show_bug.cgi?id=199230
1801         <rdar://51757107>
1802
1803         Reviewed by Andy Estes.
1804
1805         This patch adds an optional callback to WKCookieManagerSetHTTPCookieAcceptPolicy which is luckily only used for testing.
1806         It also adds listener-based asynchronous versions of didReceiveSynchronousMessageFromInjectedBundle.
1807         WebKitTestRunner uses these new abilities to wait for the cookie accept policy to be set in the network process while the web process is hung.
1808         This removes the race condition that was causing some flakiness in tests that use testRunner.setAlwaysAcceptCookies
1809
1810         * Shared/API/APIObject.h:
1811         * Shared/API/c/WKBase.h:
1812         * Sources.txt:
1813         * UIProcess/API/APIInjectedBundleClient.h:
1814         (API::InjectedBundleClient::didReceiveSynchronousMessageFromInjectedBundle):
1815         * UIProcess/API/APIMessageListener.h: Copied from Source/WebKit/UIProcess/API/APIInjectedBundleClient.h.
1816         (API::MessageListener::create):
1817         (API::MessageListener::sendReply):
1818         (API::MessageListener::MessageListener):
1819         * UIProcess/API/C/WKAPICast.h:
1820         * UIProcess/API/C/WKContextInjectedBundleClient.h:
1821         * UIProcess/API/C/WKCookieManager.cpp:
1822         (WKCookieManagerSetHTTPCookieAcceptPolicy):
1823         * UIProcess/API/C/WKCookieManager.h:
1824         * UIProcess/API/C/WKMessageListener.cpp: Copied from Source/WebKit/UIProcess/API/APIInjectedBundleClient.h.
1825         (WKMessageListenerGetTypeID):
1826         (WKMessageListenerSendReply):
1827         * UIProcess/API/C/WKMessageListener.h: Copied from Source/WebKit/UIProcess/API/APIInjectedBundleClient.h.
1828         * UIProcess/API/C/WKPageInjectedBundleClient.h:
1829         * UIProcess/WebContextInjectedBundleClient.cpp:
1830         (WebKit::WebContextInjectedBundleClient::didReceiveSynchronousMessageFromInjectedBundle):
1831         * UIProcess/WebContextInjectedBundleClient.h:
1832         * UIProcess/WebPageInjectedBundleClient.cpp:
1833         (WebKit::WebPageInjectedBundleClient::didReceiveSynchronousMessageFromInjectedBundle):
1834         * UIProcess/WebPageInjectedBundleClient.h:
1835         * UIProcess/WebPageProxy.cpp:
1836         (WebKit::WebPageProxy::handleSynchronousMessage):
1837         * UIProcess/WebPageProxy.h:
1838         (WebKit::WebPageProxy::injectedBundleClient): Deleted.
1839         * UIProcess/WebProcessPool.cpp:
1840         (WebKit::WebProcessPool::handleSynchronousMessage):
1841         * WebKit.xcodeproj/project.pbxproj:
1842
1843 2019-06-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1844
1845         [iPadOS] eddm.usps.com scrolls horizontally due to explicit width set in viewport meta tag
1846         https://bugs.webkit.org/show_bug.cgi?id=199219
1847         <rdar://problem/50425765>
1848
1849         Reviewed by Tim Horton.
1850
1851         Currently, the heuristic to determine whether the page should be shrunk to fit the content width after loading
1852         works by checking whether the page's content is wider than the layout width we've provided for the page.
1853         However, in the case where an explicit width larger than the true view width is specified by the page's meta
1854         viewport, we'll end up believing that the page's content is not wider than the layout width, which is dictated
1855         by the fixed meta viewport width. Instead, we can shrink the page down in this scenario by comparing the content
1856         width against the scaled size of the view when computing the amount of horizontal overflow.
1857
1858         Test: fast/viewport/ios/shrink-to-fit-content-large-constant-width.html
1859
1860         * WebProcess/WebPage/ios/WebPageIOS.mm:
1861         (WebKit::WebPage::immediatelyShrinkToFitContent):
1862
1863 2019-06-26  Zalan Bujtas  <zalan@apple.com>
1864
1865         [ContentChangeObserver] Dispatch synthetic mouse event asynchronously in completePendingSyntheticClickForContentChangeObserver
1866         https://bugs.webkit.org/show_bug.cgi?id=199220
1867         <rdar://problem/51787961>
1868
1869         Reviewed by Simon Fraser.
1870
1871         WebPage::completePendingSyntheticClickForContentChangeObserver should not dispatch mouse events synchronously.
1872         Mouse events, through style updates could destroy the element that initiated this change.
1873         WebPage::handleSyntheticClick() already implements this pattern.
1874
1875         * WebProcess/WebPage/ios/WebPageIOS.mm:
1876         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
1877
1878 2019-06-25  Jiewen Tan  <jiewen_tan@apple.com>
1879
1880         Implement a new SPI to inform clients about AppSSO
1881         https://bugs.webkit.org/show_bug.cgi?id=199085
1882         <rdar://problem/50028246>
1883
1884         Reviewed by Geoffrey Garen.
1885
1886         This patch implements a new SPI to inform clients about incoming AppSSO interceptions during
1887         navigations. Therefore, clients can make an informed decision about whether this is the right
1888         moment to do the interception as interceptions often show native UI. Also, the SPI is designed
1889         to pass along a human readable name for the extension such that clients can do whatever they
1890         want to inform users about what's going on.
1891
1892         Here is the new SPI:
1893         - (void)_webView:(WKWebView *)webView decidePolicyForSOAuthorizationLoadWithCurrentPolicy:(_WKSOAuthorizationLoadPolicy)policy forExtension:(NSString *)extension completionHandler:(void (^)(_WKSOAuthorizationLoadPolicy policy))completionHandler;
1894
1895         * UIProcess/API/APINavigationClient.h:
1896         (API::NavigationClient::decidePolicyForSOAuthorizationLoad):
1897         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1898         * UIProcess/Cocoa/NavigationState.h:
1899         * UIProcess/Cocoa/NavigationState.mm:
1900         (WebKit::NavigationState::setNavigationDelegate):
1901         (WebKit::soAuthorizationLoadPolicy):
1902         (WebKit::wkSOAuthorizationLoadPolicy):
1903         (WebKit::NavigationState::NavigationClient::decidePolicyForSOAuthorizationLoad):
1904         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationLoadPolicy.h: Added.
1905         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
1906         (WebKit::SOAuthorizationSession::start):
1907         * UIProcess/WebPageProxy.cpp:
1908         (WebKit::WebPageProxy::decidePolicyForSOAuthorizationLoad):
1909         * UIProcess/WebPageProxy.h:
1910         * WebKit.xcodeproj/project.pbxproj:
1911
1912 2019-06-25  Simon Fraser  <simon.fraser@apple.com>
1913
1914         [iOS WK2 Debug] scrollingcoordinator/scrolling-tree/scroller-with-negative-z-child.html asserts
1915         https://bugs.webkit.org/show_bug.cgi?id=199218
1916
1917         Reviewed by Zalan Bujtas.
1918
1919         Followup to r246766; don't assert in the UI process if a ScrollingTreeOverflowScrollProxyNode
1920         doesn't have a related overflow node; this is currently expected behavior with negative z-order
1921         children of a scroller.
1922
1923         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1924         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
1925
1926 2019-06-25  Daniel Bates  <dabates@apple.com>
1927
1928         Non-editable text selections should be modifiable with hardware keyboard
1929         https://bugs.webkit.org/show_bug.cgi?id=199204
1930         <rdar://problem/51651496>
1931
1932         Reviewed by Wenson Hsieh.
1933
1934         UIKit changes are need for this to work, including <rdar://problem/48322899>.
1935         Note that without these changes, -canPerformAction is never called for _move*
1936         selectors.
1937
1938         * UIProcess/ios/WKContentViewInteraction.mm:
1939         (-[WKContentView canPerformAction:withSender:]):
1940
1941 2019-06-25  Daniel Bates  <dabates@apple.com>
1942
1943         [iOS] Should not process key events in non-editable elements using IME
1944         https://bugs.webkit.org/show_bug.cgi?id=199122
1945         <rdar://problem/52006654>
1946
1947         Reviewed by Brent Fulgham.
1948
1949         Use the non-Input Method code path (the one we use for US keyboard input) for all key events
1950         targeting a non-editable element. Such key events will never require Input Method support
1951         (i.e. show candidate suggestions). Moreover, this behavior matches the behavior on Mac.
1952
1953         * UIProcess/ios/WKContentViewInteraction.mm:
1954         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
1955
1956 2019-06-25  Alex Christensen  <achristensen@webkit.org>
1957
1958         Make HTTPCookieAcceptPolicy an enum class
1959         https://bugs.webkit.org/show_bug.cgi?id=199081
1960
1961         Reviewed by Michael Catanzaro.
1962
1963         Doing so reveals some interesting bugs in the C API that are also fixed:
1964         WKPreferencesGetIncrementalRenderingSuppressionTimeout was using its toAPI function to convert a double to a double because HTTPCookieAcceptPolicy used to be an unsigned integer.
1965         toAPI(WebCore::MouseButton) was also using the toAPI(HTTPCookieAcceptPolicy) because HTTPCookieAcceptPolicy used to be an unsigned integer.
1966         Yikes!  Type safety is our friend.
1967
1968         * NetworkProcess/Cookies/WebCookieManager.messages.in:
1969         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
1970         (WebKit::toCFHTTPCookieStorageAcceptPolicy):
1971         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
1972         (WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy):
1973         * Shared/API/c/WKSharedAPICast.h:
1974         (WebKit::toAPI):
1975         * Shared/HTTPCookieAcceptPolicy.h:
1976         (): Deleted.
1977         * UIProcess/API/C/WKAPICast.h:
1978         (WebKit::toHTTPCookieAcceptPolicy):
1979         (WebKit::toAPI):
1980         * UIProcess/API/C/WKPreferences.cpp:
1981         (WKPreferencesGetIncrementalRenderingSuppressionTimeout):
1982         * UIProcess/API/Cocoa/WKProcessPool.mm:
1983         (toHTTPCookieAcceptPolicy):
1984         * UIProcess/WebCookieManagerProxy.cpp:
1985         (WebKit::WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy):
1986         * UIProcess/WebCookieManagerProxy.h:
1987         * UIProcess/WebCookieManagerProxy.messages.in:
1988
1989 2019-06-25  Tim Horton  <timothy_horton@apple.com>
1990
1991         Wrong title for Data Detectors tap action menu
1992         https://bugs.webkit.org/show_bug.cgi?id=199198
1993         <rdar://problem/51957842>
1994
1995         Reviewed by Wenson Hsieh.
1996
1997         * UIProcess/ios/WKActionSheetAssistant.mm:
1998         (-[WKActionSheetAssistant showDataDetectorsSheet]):
1999         Always pass the results array through to DataDetectors; they need it
2000         to figure out the title too!
2001
2002 2019-06-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2003
2004         [iOS] Occasional crash under -[UIPreviewTarget initWithContainer:center:transform:] when generating a drag preview
2005         https://bugs.webkit.org/show_bug.cgi?id=199192
2006         <rdar://problem/51554509>
2007
2008         Reviewed by Tim Horton.
2009
2010         Tweak our preview generation code (for both the context menu and dragging) to be robust in the case where the
2011         content view's unscaled view is nil; this may happen in the case after the web content process is terminated
2012         and -cleanupInteraction is called, but before -setupInteraction is subsequently called.
2013
2014         Additionally, make our logic for creating targeted previews robust in the case where the view is removed from
2015         the view hierarchy right before the platform asks for a targeted preview.
2016
2017         Test:   DragAndDropTests.WebProcessTerminationDuringDrag
2018                 DragAndDropTests.WebViewRemovedFromViewHierarchyDuringDrag
2019
2020         * UIProcess/ios/WKContentViewInteraction.mm:
2021         (-[WKContentView containerViewForTargetedPreviews]):
2022         (-[WKContentView _deliverDelayedDropPreviewIfPossible:]):
2023         (-[WKContentView dragInteraction:previewForLiftingItem:session:]):
2024         (-[WKContentView _ensureTargetedPreview]):
2025
2026 2019-06-25  Youenn Fablet  <youenn@apple.com>
2027
2028         Close sockets with too high file descriptor
2029         https://bugs.webkit.org/show_bug.cgi?id=199116
2030
2031         Reviewed by Eric Carlson.
2032
2033         Log the case of failing to open a socket.
2034
2035         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
2036         (WebKit::NetworkRTCProvider::createSocket):
2037
2038 2019-06-25  Tim Horton  <timothy_horton@apple.com>
2039
2040         When Caps Lock is enabled on the Smart Keyboard, can't scroll with space or arrow keys
2041         https://bugs.webkit.org/show_bug.cgi?id=199187
2042         <rdar://problem/51521709>
2043
2044         Reviewed by Anders Carlsson.
2045
2046         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
2047         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
2048         When deciding whether a key event should start a scroll, ignore all
2049         modifiers other than the ones we actually care about (including Caps Lock).
2050
2051 2019-06-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2052
2053         Fully rename WebKitGTK+ -> WebKitGTK everywhere
2054         https://bugs.webkit.org/show_bug.cgi?id=199159
2055
2056         Reviewed by Carlos Garcia Campos.
2057
2058         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
2059
2060 2019-06-24  Brady Eidson  <beidson@apple.com>
2061
2062         Null deref in WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad.
2063         <rdar://problem/51535942> and https://bugs.webkit.org/show_bug.cgi?id=199123
2064
2065         Reviewed by Andy Estes.
2066
2067         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2068         (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): Properly detect this null DocumentLoader
2069           and try to learn more about the state of things.
2070
2071 2019-06-24  Chris Dumez  <cdumez@apple.com>
2072
2073         Pages using Google's anti-flicker optimization may take ~5 seconds to do initial paint
2074         https://bugs.webkit.org/show_bug.cgi?id=199173
2075         <rdar://problem/45968770>
2076
2077         Reviewed by Geoffrey Garen.
2078
2079         Add experimental feature for the quirk.
2080
2081         * Shared/WebPreferences.yaml:
2082
2083 2019-06-24  John Wilander  <wilander@apple.com>
2084
2085         Remove IsITPFirstPartyWebsiteDataRemovalEnabled as runtime check
2086         https://bugs.webkit.org/show_bug.cgi?id=199164
2087         <rdar://problem/52061147>
2088
2089         Reviewed by Brent Fulgham.
2090
2091         We've had this toggle as a safety thing since mid-March. No need for it any longer.
2092
2093         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2094         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor const):
2095         * NetworkProcess/NetworkProcess.cpp:
2096         (WebKit::NetworkProcess::initializeNetworkProcess):
2097         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2098         (WebKit::NetworkProcessCreationParameters::encode const):
2099         (WebKit::NetworkProcessCreationParameters::decode):
2100         * NetworkProcess/NetworkProcessCreationParameters.h:
2101         * Shared/WebPreferences.yaml:
2102         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2103         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2104
2105 2019-06-24  Daniel Bates  <dabates@apple.com>
2106
2107         m_focusedElement != &element in WebPage::elementDidBlur() sometimes
2108         https://bugs.webkit.org/show_bug.cgi?id=198928
2109         <rdar://problem/51814327>
2110
2111         Reviewed by Brent Fulgham.
2112
2113         This can happen when the focused editable element is inside a nested frame and a person
2114         taps outside that frame. For reasons that seem lost to time, WebKit2 on iOS would mutate
2115         the focused frame whenever computing selection positioning information (say, for a tap).
2116         This "quirk" was added in r163476, but that code has go through multiple iterations and
2117         is no longer comparable to the current code. Yet, the original mutation of the focused
2118         frame remained. As a result the UI process and Web process go out of sync with respect
2119         to what each thinks is the focused element and this visually manifest itself in at least
2120         two ways:
2121
2122             1. A non-sensical DOM focus event would be dispatched at the frame tapped, but
2123             we would keep the focused element focused.
2124
2125             2. Because we would keep the focused element focused in (1), even though its frame
2126             is not focused, the keyboard would be active (software keyboard on screen or candidate bar
2127             on screen if a hardware keyboard is attached), but appear unresponsive: any keys pressed
2128             would not cause text to be typed into the editable field.
2129
2130         Because of (1) it was possible for m_focusedElement != &element in WebPage::elementDidBlur().
2131         When this happens the UI process would never receive an ElementDidBlur message and hence would
2132         not clear out the focused element state and hide the keyboard.
2133
2134         We neither do this frame focus mutation in Legacy WebKit on iOS nor Mac. Let's remove this quirk.
2135         If it turns out that it causes a compatibility issue then we will be in a better position to
2136         understand its purpose and consider bringing this quirk back, if needed.
2137
2138         * Shared/ios/InteractionInformationRequest.cpp:
2139         (WebKit::InteractionInformationRequest::encode const):
2140         (WebKit::InteractionInformationRequest::decode):
2141         (WebKit::InteractionInformationRequest::isValidForRequest):
2142         (WebKit::InteractionInformationRequest::isApproximatelyValidForRequest):
2143         * Shared/ios/InteractionInformationRequest.h:
2144         * UIProcess/API/Cocoa/WKWebView.mm:
2145         (-[WKWebView _requestActivatedElementAtPosition:completionBlock:]):
2146         * UIProcess/ios/WKContentViewInteraction.mm:
2147         (-[WKContentView _webTouchEventsRecognized:]):
2148         Remove the readOnly field.
2149
2150         * WebProcess/WebPage/ios/WebPageIOS.mm:
2151         (WebKit::selectionPositionInformation): Remove code to mutate the focused frame.
2152
2153 2019-06-24  Per Arne Vollan  <pvollan@apple.com>
2154
2155         [Cocoa] Avoid creating a PlatformMediaSessionManager when the WebProcess is suspended or resumed
2156         https://bugs.webkit.org/show_bug.cgi?id=199160
2157
2158         Reviewed by Brent Fulgham.
2159
2160         When the WebProcess suspends or resumes, the PlatformMediaSessionManager is notified about this.
2161         Avoid creating a new PlatformMediaSessionManager if it does not already exist.
2162
2163         * WebProcess/WebProcess.cpp:
2164         (WebKit::WebProcess::actualPrepareToSuspend):
2165         (WebKit::WebProcess::cancelPrepareToSuspend):
2166         (WebKit::WebProcess::processDidResume):
2167
2168 2019-06-24  Adrian Perez de Castro  <aperez@igalia.com>
2169
2170         [WPE][GTK] Fixes for compilation with unified builds disabled
2171         https://bugs.webkit.org/show_bug.cgi?id=199155
2172
2173         Reviewed by Michael Catanzaro.
2174
2175         * NetworkProcess/glib/DNSCache.cpp: Add missing inclusion of wtf/glib/RunLoopSourcePriority.h
2176         * NetworkProcess/glib/DNSCache.h: Add missing forward declaration for GInetAddress
2177
2178 2019-06-24  Alexander Mikhaylenko  <exalm7659@gmail.com>
2179
2180         [GTK] Navigation gesture should use dark fallback bg color on dark themes
2181         https://bugs.webkit.org/show_bug.cgi?id=199104
2182
2183         Reviewed by Michael Catanzaro.
2184
2185         Use theme_base_color instead of white background for swipe gesture fallback if no snapshot is found and
2186         the page did not specify a color. This allows it to use dark colors for dark themes. If the color was
2187         not found, still fall back to white.
2188
2189         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
2190         (WebKit::ViewGestureController::beginSwipeGesture):
2191
2192 2019-06-23  Dan Bernstein  <mitz@apple.com>
2193
2194         Platform font class gets needlessly initialized in the Networking process
2195         https://bugs.webkit.org/show_bug.cgi?id=199140
2196
2197         Reviewed by Tim Horton.
2198
2199         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: Revert a change that was made in
2200           r246702, which is not needed anymore.
2201         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Ditto.
2202
2203         * Shared/Cocoa/ArgumentCodersCocoa.mm:
2204         (IPC::platformColorClass): Added getter that uses NSClassFromString, thereby avoiding
2205           initializing the class.
2206         (IPC::platformFontClass): Ditto.
2207         (IPC::typeFromObject): Changed to use the above getters instead of +class.
2208
2209 2019-06-23  Simon Fraser  <simon.fraser@apple.com>
2210
2211         [Async overflow scroll] Clipped composited layers inside overflow scroll jitter and get incorrectly clipped
2212         https://bugs.webkit.org/show_bug.cgi?id=199133
2213         rdar://problem/43614439
2214
2215         Reviewed by Antti Koivisto.
2216         
2217         LayoutConstraints -> AbsolutePositionConstraints rename.
2218
2219         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2220         (ArgumentCoder<ScrollingStatePositionedNode>::decode):
2221         * Shared/WebCoreArgumentCoders.cpp:
2222         (IPC::ArgumentCoder<AbsolutePositionConstraints>::encode):
2223         (IPC::ArgumentCoder<AbsolutePositionConstraints>::decode):
2224         (IPC::ArgumentCoder<LayoutConstraints>::encode): Deleted.
2225         (IPC::ArgumentCoder<LayoutConstraints>::decode): Deleted.
2226         * Shared/WebCoreArgumentCoders.h:
2227         * Shared/WebRenderLayer.cpp:
2228         (WebKit::WebRenderLayer::WebRenderLayer):
2229         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2230         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations): ScrollingTreeOverflowScrollProxyNode
2231         have overflow scroll relations now too.
2232
2233 2019-06-23  Simon Fraser  <simon.fraser@apple.com>
2234
2235         Add OverflowScrollProxyNodes to the scrolling tree
2236         https://bugs.webkit.org/show_bug.cgi?id=199132
2237
2238         Reviewed by Antti Koivisto.
2239
2240         Add ScrollingStateOverflowScrollProxyNode and ScrollingTreeOverflowScrollProxyNode. These
2241         nodes represent clip and scroll position for an overflow:scroll in the containing block chain,
2242         but not the paint ancestor chain of a layer. They will be used to correctly manipulate clip
2243         rects for composited layers in non-stacking-context scrollers, and in a future patch will
2244         replace the functionality of "Moves" positioned nodes.
2245
2246         An OverflowScrollProxyNode has the ScrollingNodeID of the scrolling node that it relates to,
2247         and we use the existing "related overflow nodes" to create the back references in the scrolling tree.
2248
2249         These nodes are not instantiated yet; a future patch will hook them up.
2250
2251         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2252         (ArgumentCoder<ScrollingStateOverflowScrollProxyNode>::encode):
2253         (ArgumentCoder<ScrollingStateOverflowScrollProxyNode>::decode):
2254         (WebKit::encodeNodeAndDescendants):
2255         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
2256         (WebKit::dump):
2257         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2258         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2259         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
2260         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
2261         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2262         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2263         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
2264         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers):
2265
2266 2019-06-21  Jiewen Tan  <jiewen_tan@apple.com>
2267
2268         Unreviewed, a build fix after r246701
2269
2270         * Shared/LoadParameters.h:
2271         Add a default value for shouldOpenExternalURLsPolicy.
2272
2273 2019-06-21  Brent Fulgham  <bfulgham@apple.com>
2274
2275         Adjust sandboxes based on seed feedback
2276         https://bugs.webkit.org/show_bug.cgi?id=199119
2277         <rdar://problem/50164879>
2278
2279         Reviewed by Geoffrey Garen.
2280
2281         Update our sandboxes to address test failures and bugs encountered during initial iOS 13 and
2282         macOS Catalina testing.
2283
2284         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2285         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2286         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2287         * WebProcess/com.apple.WebProcess.sb.in:
2288
2289 2019-06-21  Jiewen Tan  <jiewen_tan@apple.com>
2290
2291         WebPageProxy::loadData should accept ShouldOpenExternalURLsPolicy
2292         https://bugs.webkit.org/show_bug.cgi?id=199114
2293         <rdar://problem/51671674>
2294
2295         Reviewed by Youenn Fablet.
2296
2297         This patch teaches WebPageProxy::loadData to accept ShouldOpenExternalURLsPolicy policy,
2298         and then utilize it in RedirectSOAuthorizationSession. Therefore, the response loaded after
2299         successful interceptions will be able to propagate the same policy from the last navigation
2300         as it were continuous loading.
2301
2302         Besides the above, this patch also fixes some minor issues.
2303
2304         * Shared/LoadParameters.h:
2305         * UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm:
2306         (WebKit::NavigationSOAuthorizationSession::shouldStartInternal):
2307         (WebKit::NavigationSOAuthorizationSession::webViewDidMoveToWindow):
2308         * UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.h:
2309         * UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm:
2310         (WebKit::PopUpSOAuthorizationSession::completeInternal):
2311         * UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.h:
2312         * UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm:
2313         (WebKit::shouldOpenExternalURLsPolicy):
2314         (WebKit::RedirectSOAuthorizationSession::completeInternal):
2315         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.h:
2316         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
2317         (WebKit::SOAuthorizationSession::complete):
2318         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h:
2319         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm:
2320         (WebKit::SubFrameSOAuthorizationSession::fallBackToWebPathInternal):
2321         (WebKit::SubFrameSOAuthorizationSession::completeInternal):
2322         (WebKit::SubFrameSOAuthorizationSession::loadDataToFrame):
2323         (WebKit::SubFrameSOAuthorizationSession::postDidCancelMessageToParent):
2324         * UIProcess/WebPageProxy.cpp:
2325         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
2326         (WebKit::WebPageProxy::loadFile):
2327         (WebKit::WebPageProxy::loadData):
2328         (WebKit::WebPageProxy::loadDataWithNavigationShared):
2329         * UIProcess/WebPageProxy.h:
2330         * WebProcess/WebPage/WebPage.cpp:
2331         (WebKit::WebPage::loadDataImpl):
2332         (WebKit::WebPage::loadData):
2333         * WebProcess/WebPage/WebPage.h:
2334
2335 2019-06-21  Tim Horton  <timothy_horton@apple.com>
2336
2337         WebKit context menu highlights include extra padding
2338         https://bugs.webkit.org/show_bug.cgi?id=199080
2339         <rdar://problem/51140126>
2340
2341         Reviewed by Dean Jackson.
2342
2343         * Shared/ios/InteractionInformationRequest.cpp:
2344         (WebKit::InteractionInformationRequest::encode const):
2345         (WebKit::InteractionInformationRequest::decode):
2346         (WebKit::InteractionInformationRequest::isValidForRequest):
2347         (WebKit::InteractionInformationRequest::isApproximatelyValidForRequest):
2348         * Shared/ios/InteractionInformationRequest.h:
2349         * UIProcess/ios/WKContentViewInteraction.mm:
2350         (-[WKContentView gestureRecognizerShouldBegin:]):
2351         (-[WKContentView positionInformationForActionSheetAssistant:]):
2352         (-[WKContentView updatePositionInformationForActionSheetAssistant:]):
2353         (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]):
2354         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
2355         * WebProcess/WebPage/ios/WebPageIOS.mm:
2356         (WebKit::linkIndicatorPositionInformation):
2357         Disable the margin going forward, but leave it if we're using the legacy
2358         API, because there is no way to add margin at the platform level with
2359         the legacy API.
2360
2361         In the future we should always have no margin in our indicator, and just
2362         apply it in whatever consumes the indicator, so that there is no
2363         disagreement between clients about the size of the margin.
2364
2365 2019-06-21  Youenn Fablet  <youenn@apple.com>
2366
2367         WebPageProxy should use the right path for sandbox extension
2368         https://bugs.webkit.org/show_bug.cgi?id=198902
2369         <rdar://problem/50772810>
2370
2371         Reviewed by Geoffrey Garen.
2372
2373         Store the sandbox path, if any, in UIProcess for each page in its PageLoadState.
2374         This allows proper sandbox handling for reload after crash and process swap cases.
2375         Store the sandbox path, if any, in the b/w list so that the sandbox path can be properly computed
2376         during b/f navigation works.
2377
2378         Add SPI for test purposes to check what is the current sandbox path.
2379
2380         * Shared/WebBackForwardListItem.h:
2381         (WebKit::WebBackForwardListItem::resourceDirectoryURL const):
2382         (WebKit::WebBackForwardListItem::setResourceDirectoryURL):
2383         * UIProcess/API/Cocoa/WKWebView.mm:
2384         (-[WKWebView _resourceDirectoryURL]):
2385         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2386         * UIProcess/PageLoadState.cpp:
2387         (WebKit::PageLoadState::resourceDirectoryURL const):
2388         (WebKit::PageLoadState::setPendingAPIRequestURL):
2389         * UIProcess/PageLoadState.h:
2390         (WebKit::PageLoadState::setPendingAPIRequestURL):
2391         * UIProcess/WebPageProxy.cpp:
2392         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
2393         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
2394         (WebKit::WebPageProxy::loadFile):
2395         (WebKit::WebPageProxy::reload):
2396         (WebKit::WebPageProxy::backForwardAddItem):
2397         (WebKit::WebPageProxy::backForwardGoToItemShared):
2398         (WebKit::WebPageProxy::currentResourceDirectoryURL const):
2399         * UIProcess/WebPageProxy.h:
2400
2401 2019-06-21  Antoine Quint  <graouts@apple.com>
2402
2403         [iOS] Compatibility mouse events aren't prevented by calling preventDefault() on pointerdown
2404         https://bugs.webkit.org/show_bug.cgi?id=198124
2405         <rdar://problem/50410863>
2406
2407         Reviewed by Dean Jackson.
2408
2409         Ensure we wait until completion of a tap before removing the pointer ID and the preventDefault() state along with it.
2410
2411         * UIProcess/ios/WKContentViewInteraction.h:
2412         * UIProcess/ios/WKContentViewInteraction.mm:
2413         (-[WKContentView _singleTapDidReset:]):
2414         (-[WKContentView _commitPotentialTapFailed]):
2415         (-[WKContentView _didCompleteSyntheticClick]):
2416         (-[WKContentView _singleTapRecognized:]):
2417
2418 2019-06-21  Keith Rollin  <krollin@apple.com>
2419
2420         Address reference to UIColor.groupTableViewBackgroundColor in WKPasswordView.mm
2421         https://bugs.webkit.org/show_bug.cgi?id=199111
2422         <rdar://problem/51992107>
2423
2424         Reviewed by Timothy Hatcher.
2425
2426         WKPasswordView.mm is used on iOS-family devices. However, it doesn't
2427         build on tvOS or watchOS when "treat deprecation warnings as errors"
2428         is enabled. This build failure is due to a reference to
2429         UIColor.groupTableViewBackgroundColor in a branch of non-dark-mode
2430         code. Address this by surrounding the reference with
2431         ALLOW_DEPRECATED_DECLARATIONS_* macros.
2432
2433         Attempting to address the build failure by unconditionally enabling
2434         the dark-mode code works for tvOS, but fails for watchOS due to lack
2435         of dark-mode support on that platform.
2436
2437         * UIProcess/ios/WKPasswordView.mm:
2438         (-[WKPasswordView showInScrollView:]):
2439
2440 2019-06-21  Michael Catanzaro  <mcatanzaro@igalia.com>
2441
2442         [WPE][GTK] Bump minimum versions of GLib, GTK, libsoup, ATK, GStreamer, and Cairo
2443         https://bugs.webkit.org/show_bug.cgi?id=199094
2444
2445         Reviewed by Carlos Garcia Campos.
2446
2447         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2448         (WebKit::NetworkDataTaskSoup::createRequest):
2449         (WebKit::NetworkDataTaskSoup::writeDownloadCallback):
2450         (WebKit::NetworkDataTaskSoup::writeDownload):
2451         (WebKit::NetworkDataTaskSoup::startingCallback):
2452         (WebKit::NetworkDataTaskSoup::requestStartedCallback): Deleted.
2453         * Shared/gtk/WebEventFactory.cpp:
2454         (WebKit::buttonForEvent):
2455         (WebKit::WebEventFactory::createWebMouseEvent):
2456         (WebKit::WebEventFactory::createWebWheelEvent):
2457         (WebKit::WebEventFactory::createWebKeyboardEvent):
2458         (WebKit::WebEventFactory::createWebTouchEvent):
2459         * UIProcess/API/gtk/PageClientImpl.cpp:
2460         (WebKit::PageClientImpl::doneWithTouchEvent):
2461         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2462         (ClickCounter::currentClickCountForGdkButtonEvent):
2463         (webkitWebViewBaseRealize):
2464         (webkitWebViewBaseHandleMouseEvent):
2465         (webkitWebViewBaseGetTouchPointsForEvent):
2466         (webkitWebViewBaseTouchEvent):
2467         (webkitWebViewBaseGestureController):
2468         (webkitWebViewBaseEvent):
2469         (deviceScaleFactorChanged):
2470         (webkitWebViewBaseCreateWebPage):
2471         (webkitWebViewBaseTakeViewSnapshot):
2472         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
2473         * UIProcess/API/gtk/WebKitWebViewDialog.cpp:
2474         (webkitWebViewDialogDraw):
2475         (webkitWebViewDialogConstructed):
2476         (webkit_web_view_dialog_class_init):
2477         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
2478         (fileChooserDialogResponseCallback):
2479         (webkitWebViewRunFileChooser):
2480         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
2481         (WebKit::doMouseEvent):
2482         (WebKit::doMotionEvent):
2483         (WebKit::doKeyStrokeEvent):
2484         * UIProcess/WebPageProxy.h:
2485         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
2486         (WebKit::AcceleratedBackingStoreWayland::~AcceleratedBackingStoreWayland):
2487         (WebKit::AcceleratedBackingStoreWayland::tryEnsureGLContext):
2488         (WebKit::AcceleratedBackingStoreWayland::makeContextCurrent):
2489         (WebKit::AcceleratedBackingStoreWayland::paint):
2490         * UIProcess/gtk/AcceleratedBackingStoreWayland.h:
2491         * UIProcess/gtk/DragAndDropHandler.cpp:
2492         (WebKit::DragAndDropHandler::startDrag):
2493         (WebKit::DragAndDropHandler::fillDragData):
2494         (WebKit::DragAndDropHandler::finishDrag):
2495         * UIProcess/gtk/DragAndDropHandler.h:
2496         * UIProcess/gtk/GestureController.cpp:
2497         (WebKit::GestureController::handleEvent):
2498         * UIProcess/gtk/GestureController.h:
2499         * UIProcess/gtk/InputMethodFilter.cpp:
2500         (WebKit::InputMethodFilter::filterKeyEvent):
2501         (WebKit::InputMethodFilter::logHandleKeyboardEventForTesting):
2502         (WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting):
2503         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
2504         (WebKit::isEventStop):
2505         (WebKit::createScrollEvent):
2506         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
2507         (WebKit::WebContextMenuProxyGtk::append):
2508         (WebKit::WebContextMenuProxyGtk::WebContextMenuProxyGtk):
2509         (WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk):
2510         * UIProcess/gtk/WebKitInspectorWindow.cpp:
2511         (webkit_inspector_window_init):
2512         (webkitInspectorWindowSetSubtitle):
2513         * UIProcess/gtk/WebPageProxyGtk.cpp:
2514         (WebKit::WebPageProxy::getCenterForZoomGesture):
2515         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
2516         (WebKit::WebPopupMenuProxyGtk::showPopupMenu):
2517         (WebKit::WebPopupMenuProxyGtk::hidePopupMenu):
2518         * WebProcess/WebPage/WebPage.h:
2519         * WebProcess/WebPage/WebPage.messages.in:
2520         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2521         (WebKit::WebPage::getCenterForZoomGesture):
2522
2523 2019-06-20  Patrick Griffis  <pgriffis@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
2524
2525         [GTK][WPE] Implement a basic DNS cache
2526         https://bugs.webkit.org/show_bug.cgi?id=196094
2527
2528         Reviewed by Michael Catanzaro.
2529
2530         This adds a simple cache to all DNS operations in the network process.
2531
2532         * NetworkProcess/glib/DNSCache.cpp: Added.
2533         (WebKit::DNSCache::DNSCache):
2534         (WebKit::DNSCache::mapForType):
2535         (WebKit::DNSCache::lookup):
2536         (WebKit::DNSCache::update):
2537         (WebKit::DNSCache::removeExpiredResponsesInMap):
2538         (WebKit::DNSCache::pruneResponsesInMap):
2539         (WebKit::DNSCache::removeExpiredResponsesFired):
2540         (WebKit::DNSCache::clear):
2541         * NetworkProcess/glib/DNSCache.h: Added.
2542         * NetworkProcess/glib/WebKitCachedResolver.cpp: Added.
2543         (addressListVectorToGList):
2544         (addressListGListToVector):
2545         (webkitCachedResolverLookupByName):
2546         (webkitCachedResolverLookupByNameAsync):
2547         (webkitCachedResolverLookupByNameFinish):
2548         (dnsCacheType):
2549         (webkitCachedResolverLookupByNameWithFlags):
2550         (webkitCachedResolverLookupByNameWithFlagsAsync):
2551         (webkitCachedResolverLookupByNameWithFlagsFinish):
2552         (webkitCachedResolverLookupByAddress):
2553         (webkitCachedResolverLookupByAddressAsync):
2554         (webkitCachedResolverLookupByAddressFinish):
2555         (webkitCachedResolverLookupRecords):
2556         (webkitCachedResolverLookupRecordsAsync):
2557         (webkitCachedResolverLookupRecordsFinish):
2558         (webkitCachedResolverReload):
2559         (webkit_cached_resolver_class_init):
2560         (webkitCachedResolverNew):
2561         * NetworkProcess/glib/WebKitCachedResolver.h: Added.
2562         * NetworkProcess/soup/NetworkProcessSoup.cpp:
2563         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
2564         * PlatformGTK.cmake:
2565         * PlatformWPE.cmake:
2566         * SourcesGTK.txt:
2567         * SourcesWPE.txt:
2568
2569 2019-06-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2570
2571         [GTK] Stop pretending WebCore::Widget can have a platform widget
2572         https://bugs.webkit.org/show_bug.cgi?id=199066
2573
2574         Reviewed by Michael Catanzaro.
2575
2576         Rename PlatformWidget as PlatformViewWidget to avoid conflict with PlatformWidget defined in WebCore.
2577
2578         * UIProcess/WebPageProxy.h:
2579         * UIProcess/win/WebPageProxyWin.cpp:
2580         (WebKit::WebPageProxy::viewWidget):
2581
2582 2019-06-20  Megan Gardner  <megan_gardner@apple.com>
2583
2584         Remove change that was causing hangs
2585         https://bugs.webkit.org/show_bug.cgi?id=199055
2586         <rdar://problem/51820516>
2587
2588         Reviewed by Darin Adler.
2589
2590         This fix can sometimes cause deadlocks in the UIProcess.
2591         We have a different fix that will go into UIKit <rdar://problem/51927701>.
2592
2593         * UIProcess/ios/WKContentViewInteraction.mm:
2594         (-[WKContentView _selectionChanged]):
2595
2596 2019-06-20  Daniel Bates  <dabates@apple.com>
2597
2598         [iOS] Evernote crashes when creating a note
2599         https://bugs.webkit.org/show_bug.cgi?id=199083
2600         <rdar://problem/51759247>
2601
2602         Reviewed by Brent Fulgham.
2603
2604         Add a hack just for Evernote linked before iOS 13 that dynamically adds a placeholder -[WKContentView keyCommands]
2605         method (it just calls super). Evernote swizzles the IPI -[WKContentView keyCommands], but this
2606         method may not always be present in the WebKit binary following r240514. So, Evernote may end
2607         up swizzling -[UIResponder keyCommands], but their implementation doesn't account for this
2608         scenario and they end up crashing because they call an unrecognized selector.
2609
2610         * UIProcess/Cocoa/VersionChecks.h: Add version check.
2611         * UIProcess/ios/WKContentView.mm:
2612         (keyCommandsPlaceholderHackForEvernote): Added.
2613         (-[WKContentView _commonInitializationWithProcessPool:configuration:]): Install the hack.
2614
2615 2019-06-20  Brady Eidson  <beidson@apple.com>
2616
2617         WebURLSchemeHandlerProxy::loadSynchronously crash with sync request.
2618         <rdar://problem/51862206> and https://bugs.webkit.org/show_bug.cgi?id=199063
2619
2620         Reviewed by Geoffrey Garen.
2621
2622         Don't use a DataReference for the sync reply type.
2623
2624         * UIProcess/WebPageProxy.messages.in:
2625         * UIProcess/WebURLSchemeHandler.h:
2626
2627         * UIProcess/WebURLSchemeTask.cpp:
2628         (WebKit::WebURLSchemeTask::didComplete):
2629         * UIProcess/WebURLSchemeTask.h:
2630
2631         * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
2632         (WebKit::WebURLSchemeHandlerProxy::loadSynchronously):
2633
2634 2019-06-20  Alex Christensen  <achristensen@webkit.org>
2635
2636         Add unit test for UIContextMenuConfiguration API
2637         https://bugs.webkit.org/show_bug.cgi?id=199043
2638
2639         Reviewed by Wenson Hsieh.
2640
2641         * UIProcess/API/APIPageConfiguration.cpp:
2642         (API::PageConfiguration::copy const):
2643         * UIProcess/API/APIPageConfiguration.h:
2644         (API::PageConfiguration::clickInteractionDriverForTesting const):
2645         (API::PageConfiguration::setClickInteractionDriverForTesting):
2646         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2647         (-[WKWebViewConfiguration _setClickInteractionDriverForTesting:]):
2648         (-[WKWebViewConfiguration _clickInteractionDriverForTesting]):
2649         * UIProcess/ios/WKContentViewInteraction.mm:
2650         (-[WKContentView _registerPreview]):
2651
2652 2019-06-20  Alexander Mikhaylenko  <exalm7659@gmail.com>
2653
2654         [GTK] Enable navigation swipe layout tests
2655         https://bugs.webkit.org/show_bug.cgi?id=198995
2656
2657         Reviewed by Michael Catanzaro.
2658
2659         Implement API for enabling and controlling swipes from WebKitTestRunner.
2660
2661         Implement beginSimulatedSwipeInDirectionForTesting() and completeSimulatedSwipeInDirectionForTesting()
2662         in ViewGestureController for controlling the test swipes. Add functions in WebKitWebViewBase for calling
2663         them.
2664
2665         Simulate the gesture by generating two scroll events: one to begin the gesture and one to complete it.
2666
2667         Since there's no reliable way to set source device type of the generated events to touchpad, don't check
2668         source device type for simulated swipes.
2669
2670         * UIProcess/API/C/gtk/WKView.cpp:
2671         (WKViewSetEnableBackForwardNavigationGesture): Added.
2672         (WKViewBeginBackSwipeForTesting): Added.
2673         (WKViewCompleteBackSwipeForTesting): Added.
2674         * UIProcess/API/C/gtk/WKViewPrivate.h:
2675         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2676         (webkitWebViewBaseBeginBackSwipeForTesting): Added.
2677         (webkitWebViewBaseCompleteBackSwipeForTesting): Added.
2678         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
2679         * UIProcess/ViewGestureController.h:
2680         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
2681         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe):
2682         Skip source device type check for simulated swipes. Also, remove an incorrect FIXME.
2683         (WebKit::createScrollEvent): Added.
2684         (WebKit::ViewGestureController::beginSimulatedSwipeInDirectionForTesting): Implemented.
2685         (WebKit::ViewGestureController::completeSimulatedSwipeInDirectionForTesting): Implemented.
2686
2687 2019-06-20  Charlie Turner  <cturner@igalia.com>
2688
2689         [GTK] Make startup pause available in DEVELOPER_MODE rather than DEBUG.
2690         https://bugs.webkit.org/show_bug.cgi?id=199069
2691
2692         Reviewed by Michael Catanzaro.
2693
2694         * WebProcess/gtk/WebProcessMainGtk.cpp: Allow developers to pause
2695         the web process in DEVELOPER_MODE rather than only DEBUG, matching
2696         the WPE behaviour and also the purpose of DEVELOPER_MODE.
2697
2698 2019-06-20  Alexander Mikhaylenko  <exalm7659@gmail.com>
2699
2700         [GTK] The Previous/Next gesture should handle RTL
2701         https://bugs.webkit.org/show_bug.cgi?id=198707
2702
2703         Reviewed by Michael Catanzaro.
2704
2705         The gesture uses PageClientImpl::userInterfaceLayoutDirection() to determine the text
2706         direction. Implement that method, then adjust drawing so that the pages move from/to
2707         the left instead of right side for RTL locales.
2708
2709         * UIProcess/API/gtk/PageClientImpl.cpp:
2710         (WebKit::): Implemented.
2711         * UIProcess/API/gtk/PageClientImpl.h:
2712         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
2713         (WebKit::ViewGestureController::draw):
2714
2715 2019-06-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2716
2717         [GTK] Remove support for GTK2 plugins
2718         https://bugs.webkit.org/show_bug.cgi?id=199065
2719
2720         Reviewed by Sergio Villar Senin.
2721
2722         * PlatformGTK.cmake:
2723         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
2724         (WebKit::moduleMixesGtkSymbols):
2725         * Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp:
2726         (WebKit::NetscapePluginModule::getPluginInfo):
2727         * Shared/Plugins/PluginModuleInfo.h:
2728         * Shared/gtk/WebEventFactory.cpp:
2729         (WebKit::isGdkKeyCodeFromKeyPad):
2730         (WebKit::buttonForEvent):
2731         (WebKit::WebEventFactory::createWebMouseEvent):
2732         (WebKit::WebEventFactory::createWebWheelEvent):
2733         (WebKit::WebEventFactory::createWebKeyboardEvent):
2734         (WebKit::WebEventFactory::createWebTouchEvent):
2735         * SourcesGTK.txt:
2736         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2737         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2738         (WebKit::ProcessLauncher::launchProcess):
2739         * UIProcess/Plugins/PluginProcessProxy.h:
2740         * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
2741         (WebKit::PluginInfoCache::getPluginInfo):
2742         (WebKit::PluginInfoCache::updatePluginInfo):
2743         * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:
2744         (WebKit::PluginInfoStore::getPluginInfo):
2745         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
2746         (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes):
2747         (WebKit::PluginProcessProxy::scanPlugin):
2748         * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
2749
2750 2019-06-19  Dean Jackson  <dino@apple.com>
2751
2752         No menu pop-up when long pressing on a link in Firefox app
2753         https://bugs.webkit.org/show_bug.cgi?id=199045
2754         <rdar://problem/51422407>
2755
2756         Reviewed by Tim Horton.
2757
2758         Add a version check for linking on-or-after iOS 13. When
2759         that isn't true, we don't use UIContextMenuInteraction
2760         and instead fall back on the legacy UIPreviewItem API.
2761
2762         * UIProcess/Cocoa/VersionChecks.h: Add FirstThatHasUIContextMenuInteraction.
2763         * UIProcess/ios/WKContentViewInteraction.h: 
2764         * UIProcess/ios/WKContentViewInteraction.mm:
2765         (-[WKContentView _shouldUseContextMenus]): New method to decide if we should
2766         use context menus or preview items.
2767         (-[WKContentView setupInteraction]): Make the decision at runtime rather than
2768         compile time.
2769         (-[WKContentView _contentsOfUserInterfaceItem:]): Ditto.
2770         (-[WKContentView _registerPreview]): Ditto.
2771         (-[WKContentView _unregisterPreview]): Ditto.
2772
2773 2019-06-19  Andy Estes  <aestes@apple.com>
2774
2775         [iOS] Fall back to taking a UIView snapshohot for UITargetedPreviews if InteractionInformationAtPosition does not have an image
2776         https://bugs.webkit.org/show_bug.cgi?id=199038
2777         <rdar://problem/50555810>
2778
2779         Reviewed by Tim Horton.
2780
2781         In -contextMenuInteraction:previewForHighlightingMenuWithConfiguration: and friend, we
2782         should always return a non-nil UITargetedPreview. When we do return nil, UIKit uses the web
2783         view itself as the snapshot view, creating an unsightly animation.
2784
2785         For cases where we fail to create a UITargetedPreview from the information in
2786         InteractionInformationAtPosition, this patch falls back to creating a UITargetedPreview with
2787         a snapshot view obtained from
2788         -[UIView resizableSnapshotViewFromRect:afterScreenUpdates:withCapInsets:].
2789
2790         Also renamed -targetedPreview to -_ensureTargetedPreview and cached the UITargetedPreview
2791         for reuse in -contextMenuInteraction:previewForDismissingMenuWithConfiguration:.
2792
2793         * UIProcess/ios/WKContentViewInteraction.h:
2794         * UIProcess/ios/WKContentViewInteraction.mm:
2795         (createFallbackTargetedPreview):
2796         (-[WKContentView _ensureTargetedPreview]):
2797         (-[WKContentView contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
2798         (-[WKContentView contextMenuInteraction:previewForDismissingMenuWithConfiguration:]):
2799         (-[WKContentView contextMenuInteractionDidEnd:]):
2800         (-[WKContentView _targetedPreview]): Renamed to _ensureTargetedPreview.
2801
2802 2019-06-19  Devin Rousso  <drousso@apple.com>
2803
2804         Web Inspector: Network: replace CFNetwork SPI with new API where able
2805         https://bugs.webkit.org/show_bug.cgi?id=198762
2806
2807         Reviewed by Timothy Hatcher.
2808
2809         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2810         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
2811
2812 2019-06-19  Alex Christensen  <achristensen@webkit.org>
2813
2814         DownloadMonitor::measuredThroughputRate should approach zero with no throughput
2815         https://bugs.webkit.org/show_bug.cgi?id=198981
2816         <rdar://problem/51456914>
2817
2818         Reviewed by Geoffrey Garen.
2819
2820         When the timer fires to approximate the download rate, add a new timestamp with 0 bytes received since the last time we received bytes.
2821         Then, if there's only one timestamp, assume the throughput rate is 0 instead of infinite.
2822         This will prevent false positives estimating large download rates based on old data when the throughput drops to 0.
2823
2824         * NetworkProcess/Downloads/DownloadMonitor.cpp:
2825         (WebKit::DownloadMonitor::measuredThroughputRate const):
2826         (WebKit::DownloadMonitor::timerFired):
2827
2828 2019-06-19  Sihui Liu  <sihui_liu@apple.com>
2829
2830         Remove unused originsWithCredentials from WebsiteData
2831         https://bugs.webkit.org/show_bug.cgi?id=199020
2832
2833         Reviewed by Geoffrey Garen.
2834
2835         * Shared/WebsiteData/WebsiteData.cpp:
2836         (WebKit::WebsiteData::encode const):
2837         (WebKit::WebsiteData::decode):
2838         * Shared/WebsiteData/WebsiteData.h:
2839
2840 2019-06-19  Sihui Liu  <sihui_liu@apple.com>
2841
2842         Crash at com.apple.WebKit: WebKit::WebsiteDataStore::processPools const
2843         https://bugs.webkit.org/show_bug.cgi?id=198935
2844         <rdar://problem/51549308>
2845
2846         Reviewed by Geoffrey Garen.
2847
2848         When WebProcessProxy is in WebProcessCache or is pre-warmed, it does not hold a strong reference of 
2849         WebProcessPool. In this case, we should not store the raw pointer of WebProcessPool and perform websiteDataStore
2850         operations with it.
2851         This patch should fix the crash at dereferencing null pointer of WebProcessPool in 
2852         WebsiteDataStore::processPools, but it is unclear why websiteDataStore comes to observe cached or prewarmed web 
2853         process that should not have web page. The release log may help us find the cause.
2854
2855         * UIProcess/WebProcessProxy.cpp:
2856         (WebKit::WebProcessProxy::processPoolIfExists const):
2857         * UIProcess/WebProcessProxy.h:
2858         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2859         (WebKit::WebsiteDataStore::processPools const):
2860
2861 2019-06-19  Alex Christensen  <achristensen@webkit.org>
2862
2863         Add a unit test for client certificate authentication
2864         https://bugs.webkit.org/show_bug.cgi?id=197800
2865
2866         Reviewed by Youenn Fablet.
2867
2868         * Shared/cf/ArgumentCodersCF.cpp:
2869         Move SPI declarations to SecuritySPI.h.
2870
2871 2019-06-19  Alex Christensen  <achristensen@webkit.org>
2872
2873         Update preview API deprecation message.
2874         https://bugs.webkit.org/show_bug.cgi?id=198974
2875
2876         * UIProcess/API/Cocoa/WKUIDelegate.h:
2877
2878 2019-06-19  Adrian Perez de Castro  <aperez@igalia.com>
2879
2880         [GTK] Fix compilation errors for the GTK2 plugin process
2881         https://bugs.webkit.org/show_bug.cgi?id=199000
2882
2883         Reviewed by Michael Catanzaro.
2884
2885         * Shared/gtk/WebEventFactory.cpp: Use the GdkEvent union fields
2886         when directly accessing event struct fields.
2887         (WebKit::buttonForEvent):
2888         (WebKit::WebEventFactory::createWebMouseEvent):
2889         (WebKit::WebEventFactory::createWebKeyboardEvent):
2890
2891 2019-06-19  Adrian Perez de Castro  <aperez@igalia.com>
2892
2893         [WPE][GTK] Fix build with unified sources disabled
2894         https://bugs.webkit.org/show_bug.cgi?id=198752
2895
2896         Reviewed by Michael Catanzaro.
2897
2898         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
2899         (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker): Qualify SQLiteDatabase
2900         with its namespace.
2901         * UIProcess/WebFrameProxy.h: Replace forward declaration of WebPageProxy with inclusion
2902         of WebPageProxy.h to avoid build error due to usage of undefined class. Moved DataCallback
2903         definition from WebPageProxy.h to avoid code using the type before its declaration.
2904         * UIProcess/WebPageProxy.h: Remove definition of DataCallback.
2905         * UIProcess/wpe/WebInspectorProxyWPE.cpp: Add missing forward declaration of
2906         WebCore::FloatRect.
2907         (WebKit::WebInspectorProxy::platformSetSheetRect): Qualify FloatRect with its namespace.
2908         * WebProcess/Automation/WebAutomationSessionProxy.cpp: Qualify all occurrences of
2909         PageIdentifier with its namespace.
2910         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
2911         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
2912         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
2913         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
2914         (WebKit::WebAutomationSessionProxy::resolveParentFrame):
2915         (WebKit::WebAutomationSessionProxy::focusFrame):
2916         (WebKit::WebAutomationSessionProxy::computeElementLayout):
2917         (WebKit::WebAutomationSessionProxy::selectOptionElement):
2918         (WebKit::WebAutomationSessionProxy::takeScreenshot):
2919         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
2920         (WebKit::WebAutomationSessionProxy::deleteCookie):
2921         * WebProcess/Cache/WebCacheStorageConnection.cpp: Ditto.
2922         (WebKit::WebCacheStorageConnection::open):
2923         (WebKit::WebCacheStorageConnection::remove):
2924         (WebKit::WebCacheStorageConnection::retrieveCaches):
2925         (WebKit::WebCacheStorageConnection::retrieveRecords):
2926         (WebKit::WebCacheStorageConnection::batchDeleteOperation):
2927         (WebKit::WebCacheStorageConnection::batchPutOperation):
2928         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp: Add missing inclusion of WebPage.h
2929         * WebProcess/WebPage/gtk/WebPageGtk.cpp: Add missing inclusion of gtk/gtk.h
2930         * WebProcess/WebPage/wpe/WebPageWPE.cpp: Add missing inclusion of WebPageProxy.h
2931
2932 2019-06-19  Alexander Mikhaylenko  <exalm7659@gmail.com>
2933
2934         [GTK] Page blinks after navigation swipe if it triggered PSON
2935         https://bugs.webkit.org/show_bug.cgi?id=198996
2936
2937         Reviewed by Michael Catanzaro.
2938
2939         Disconnect and then reconnect ViewGestureController during process swap
2940         instead of destroying and re-creating it.
2941
2942         * UIProcess/API/gtk/PageClientImpl.cpp:
2943         (WebKit::PageClientImpl::PageClientImpl::processWillSwap): Added.
2944         (WebKit::PageClientImpl::PageClientImpl::processDidExit): Implemented.
2945         * UIProcess/API/gtk/PageClientImpl.h:
2946         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2947         (webkitWebViewBaseWillSwapWebProcess): Added.
2948         Disconnect ViewGestureController if it exists.
2949         (webkitWebViewBaseDidExitWebProcess): Added.
2950         Destroy ViewGestureController.
2951         (webkitWebViewBaseDidRelaunchWebProcess):
2952         Reconnect the ViewGestureController if it exists.
2953         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
2954
2955 2019-06-19  Takashi Komori  <Takashi.Komori@sony.com>
2956
2957         [Curl] CurlRequestScheduler doesn't terminate worker thread in a certain situation.
2958         https://bugs.webkit.org/show_bug.cgi?id=198993
2959
2960         Cancel CurlRequest before invalidation to remove tasks from CurlRequestScheduler certainly in ~NetworkDataTaskCurl.
2961
2962         Reviewed by Fujii Hironori.
2963
2964         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2965         (WebKit::NetworkDataTaskCurl::~NetworkDataTaskCurl):
2966
2967 2019-06-19  Zan Dobersek  <zdobersek@igalia.com>
2968
2969         [Nicosia] Invalidate SceneIntegration in LayerTreeHost::invalidate()
2970         https://bugs.webkit.org/show_bug.cgi?id=198992
2971
2972         Reviewed by Carlos Garcia Campos.
2973
2974         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
2975         (WebKit::LayerTreeHost::invalidate): Invalidate the
2976         Nicosia::SceneIntegration object. This should properly disassociate
2977         the now-invalited LayerTreeHost (a SceneIntegration client) from the
2978         SceneIntegration object that can still be shared with platform layers
2979         originating from this LayerTreeHost.
2980
2981 2019-06-18  Dean Jackson  <dino@apple.com>
2982
2983         UIContextMenuInteraction implementation for WKContentView
2984         https://bugs.webkit.org/show_bug.cgi?id=198986
2985         <rdar://problem/51875189>
2986
2987         Reviewed by Andy Estes.
2988
2989         Implement UIContextMenuInteraction and its delegate as a
2990         replacement for UIPreviewItemController in iOS 13.
2991
2992         In order to preserve existing behaviour as much as possible,
2993         we check for the implementation of new WebKit API to configure
2994         the menu. If that is not present, we attempt to convert
2995         the results of the existing WebKit WKPreviewAction delegates
2996         into something that works with UIContextMenus.
2997
2998         * UIProcess/ios/WKContentViewInteraction.h:
2999         * UIProcess/ios/WKContentViewInteraction.mm:
3000         (-[WKContentView setupInteraction]):
3001         (-[WKContentView _contentsOfUserInterfaceItem:]):
3002         (-[WKContentView _registerPreview]):
3003         (-[WKContentView _unregisterPreview]):
3004         (-[WKContentView _showLinkPreviewsPreferenceChanged:]):
3005         (needsDeprecatedPreviewAPI):
3006         (uiActionForPreviewAction):
3007         (menuFromPreviewOrDefaults):
3008         (titleForMenu):
3009         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
3010         (-[WKContentView contextMenuInteraction:configurationForMenuAtLocation:]):
3011         (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]):
3012         (-[WKContentView continueContextMenuInteraction:]):
3013         (uiImageForImage):
3014         (createTargetedPreview):
3015         (-[WKContentView _targetedPreview]):
3016         (-[WKContentView contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
3017         (-[WKContentView contextMenuInteractionWillPresent:]):
3018         (-[WKContentView contextMenuInteraction:previewForDismissingMenuWithConfiguration:]):
3019         (-[WKContentView contextMenuInteraction:willCommitWithAnimator:]):
3020         (-[WKContentView contextMenuInteractionDidEnd:]):
3021         (-[WKContentView shouldUsePreviewForLongPress]): Deleted.
3022
3023 2019-06-18  Ryan Haddad  <ryanhaddad@apple.com>
3024
3025         Unreviewed, rolling out r246575.
3026
3027         Breaks internal builds.
3028
3029         Reverted changeset:
3030
3031         "Update WebKit API to separately retrieve actions and use
3032         context menus"
3033         https://bugs.webkit.org/show_bug.cgi?id=198974
3034         https://trac.webkit.org/changeset/246575
3035
3036 2019-06-18  Alex Christensen  <achristensen@webkit.org>
3037
3038         Update WebKit API to separately retrieve actions and use context menus
3039         https://bugs.webkit.org/show_bug.cgi?id=198974
3040         <rdar://problem/50735687>
3041
3042         Reviewed by Tim Horton.
3043
3044         Update API and SPI, and add infrastructure for asynchronously requesting interaction information.
3045
3046         * UIProcess/API/Cocoa/WKUIDelegate.h:
3047         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3048
3049 2019-06-18  Daniel Bates  <dabates@apple.com>
3050
3051         REGRESSION (r240757): Cannot dismiss the keyboard on http://apple.com/apple-tv-plus
3052         https://bugs.webkit.org/show_bug.cgi?id=198922
3053         <rdar://problem/50300056>
3054
3055         Reviewed by Wenson Hsieh.
3056
3057         Actually dismiss the keyboard as intended in r240757. Do not wait for the round-trip
3058         to the WebProcess to run through the -elementDidBlur steps in the UIProcess and hide
3059         the keyboard when a person explicitly dismisses the keyboard via the Done button (iPhone)
3060         or hide keyboard button (iPad).
3061
3062         Note that r240757 revealed another bug in this code, <https://bugs.webkit.org/show_bug.cgi?id=198928>.
3063         I am unclear of the implications of that bug, but it is clear for this bug that it
3064         never makes sense to round-trip to the WebProcess when the keyboard is dismissed by
3065         a user gesture.
3066
3067         * UIProcess/ios/WKContentViewInteraction.mm:
3068         (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]): Invoke -_elementDidBlur
3069         to blur the element in the UIProcess and hide the keyboard.
3070         (-[WKContentView _elementDidBlur]): Prevent duplicate invocations of -didEndFormControlInteraction
3071         and setIsShowingInputViewForFocusedElement messages by only doing these actions when
3072         editablity changes. This covers the case where -_elementDidBlur may be invoked a second
3073         time (the reply in the round-trip). In that case we don't need to do these actions.
3074
3075 2019-06-18  Alex Christensen  <achristensen@webkit.org>
3076
3077         NetworkSession::networkStorageSession can return null
3078         https://bugs.webkit.org/show_bug.cgi?id=198947
3079         <rdar://problem/51394449>
3080
3081         Reviewed by Youenn Fablet.
3082
3083         We are seeing evidence of crashes from the map owning NetworkSessions and the map owning NetworkStorageSessions becoming out of sync
3084         because NetworkSession is refcounted but NetworkStorageSession is not.  I started the complete fix in https://bugs.webkit.org/show_bug.cgi?id=194926
3085         but for now let's add less risky null checks to prevent fallout.
3086
3087         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
3088         (WebKit::ResourceLoadStatisticsStore::updateClientSideCookiesAgeCap):
3089         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3090         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccessForFrame):
3091         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
3092         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
3093         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
3094         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
3095         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
3096         (WebKit::WebResourceLoadStatisticsStore::removePrevalentDomains):
3097         * NetworkProcess/NetworkProcess.cpp:
3098         (WebKit::NetworkProcess::initializeNetworkProcess):
3099         * NetworkProcess/NetworkSession.cpp:
3100         (WebKit::NetworkSession::networkStorageSession const):
3101         * NetworkProcess/NetworkSession.h:
3102         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3103         (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy):
3104         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3105         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
3106         (WebKit::NetworkDataTaskCocoa::tryPasswordBasedAuthentication):
3107
3108 2019-06-18  Brady Eidson  <beidson@apple.com>
3109
3110         Handle NSProgress calling our cancellation handler on background threads (and calling it more than once).
3111         <rdar://problem/51392926> and https://bugs.webkit.org/show_bug.cgi?id=198945
3112
3113         Reviewed by Alex Christensen.
3114
3115         If you have a download in progress and quickly tap the button to cancel it multiple times, then:
3116             - NSProgress calls our cancellation handler on a non-main thread, which we can't handle.
3117             - They do it more than once, which is also bad.
3118             - They might even do it multiple times concurrently (on different background dispatch queues)
3119         
3120         Let's work around these.
3121
3122         * NetworkProcess/Downloads/Download.cpp:
3123         (WebKit::Download::cancel): Double check we're on the main thread, and handle being called twice.
3124
3125         * NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm:
3126         (-[WKDownloadProgress performCancel]): Actually cancel the WebKit::Download if we still have one.
3127         (-[WKDownloadProgress progressCancelled]): Called when NSProgress calls the cancellation handler, no matter
3128           which thread it does it on. By leveraging std::call_once we handle multiple calls as well as being called
3129           concurrently from different threads. call_once punts the *actual* cancel operation off to the main thread.
3130         (-[WKDownloadProgress initWithDownloadTask:download:URL:sandboxExtension:]): The cancellation handler is
3131           now simply calling 'progressCancelled' on self, assuming the weak pointer for self is still valid.
3132
3133 2019-06-18  Daniel Bates  <dabates@apple.com>
3134
3135         [iOS] Pressing key while holding Command should not insert character
3136         https://bugs.webkit.org/show_bug.cgi?id=198925
3137         <rdar://problem/51778811>
3138
3139         Reviewed by Brent Fulgham.
3140
3141         Do not insert a character for an unhandled key command that has a Command modifier.
3142         For example, pressing Command + Shift + v, which is an unhandled key command (at the
3143         time of writing) should not insert v. This matches iOS and Mac platform conventions.
3144
3145         * UIProcess/ios/WKContentViewInteraction.mm:
3146         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
3147
3148 2019-06-18  John Wilander  <wilander@apple.com>
3149
3150         Change log channel name from ResourceLoadStatisticsDebug to ITPDebug and remove unnecessary #if !RELEASE_LOG_DISABLED
3151         https://bugs.webkit.org/show_bug.cgi?id=198970
3152         <rdar://problem/51855836>
3153
3154         Reviewed by Brent Fulgham.
3155
3156         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3157         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
3158         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
3159         (WebKit::ResourceLoadStatisticsDatabaseStore::ensurePrevalentResourcesForDebugMode):
3160         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking):
3161         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3162         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
3163         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
3164         (WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode):
3165         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
3166         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
3167         (WebKit::domainsToString):
3168         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
3169         (WebKit::ResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
3170         (WebKit::ResourceLoadStatisticsStore::debugLogDomainsInBatches):
3171         * Platform/Logging.h:
3172
3173 2019-06-18  Youenn Fablet  <youenn@apple.com>
3174
3175         StorageManager::removeAllowedSessionStorageNamespaceConnection should make sure its storageNamespaceID is valid
3176         https://bugs.webkit.org/show_bug.cgi?id=198966
3177         rdar://problem/51352080
3178
3179         Reviewed by Alex Christensen.
3180
3181         Make sure the namespace ID is a key of the map before using the value.
3182         The namespace ID is coming straight from IPC so should not be trusted.
3183         Also, namespace IDs are added/removed based on web pages being created/deleted.
3184         Namespace IDs are supposed to be scoped by session IDs.
3185         Using page IDs for namespace IDs works as long as the page does not change of session ID during its lifetime, which is not guaranteed.
3186
3187         * NetworkProcess/WebStorage/StorageManager.cpp:
3188         (WebKit::StorageManager::removeAllowedSessionStorageNamespaceConnection):
3189
3190 2019-06-18  David Quesada  <david_quesada@apple.com>
3191
3192         Network process crash in SandboxExtension::consume() via Download::publishProgress
3193         https://bugs.webkit.org/show_bug.cgi?id=198968
3194         rdar://problem/51732997
3195
3196         Reviewed by Alex Christensen.
3197
3198         Add an early return if the network process fails to resolve a sandbox extension handle for publishing
3199         progress on a download. Creating the NSProgress doesn't do much since the progress reporting service
3200         won't honor the attempt to publish progress on a URL the process does not have access to, and nothing
3201         else in the Network process makes any use of the progress.
3202
3203         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
3204         (WebKit::Download::publishProgress):
3205
3206 2019-06-18  Adrian Perez de Castro  <aperez@igalia.com>
3207
3208         Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.25.1 release
3209
3210         * wpe/NEWS: Add release notes for 2.25.1
3211
3212 2019-06-18  Tim Horton  <timothy_horton@apple.com>
3213
3214         Expose DataDetectors context generation on WKContentViewInteraction
3215         https://bugs.webkit.org/show_bug.cgi?id=198950
3216         <rdar://problem/51116021>
3217
3218         Reviewed by Andy Estes.
3219
3220         * UIProcess/ios/WKActionSheetAssistant.h:
3221         * UIProcess/ios/WKActionSheetAssistant.mm:
3222         (-[WKActionSheetAssistant currentPositionInformation]):
3223         (-[WKActionSheetAssistant showDataDetectorsSheet]):
3224         * UIProcess/ios/WKContentViewInteraction.h:
3225         * UIProcess/ios/WKContentViewInteraction.mm:
3226         (-[WKContentView dataDetectionContextForPositionInformation:]):
3227         (-[WKContentView dataDetectionContextForActionSheetAssistant:]):
3228         For use by other clients, add -dataDetectionContextForPositionInformation:
3229         and make -dataDetectionContextForActionSheetAssistant: use it.
3230         Also, pull the code to augment the context with surrounding text out of
3231         from WKActionSheetAssistant.
3232
3233 2019-06-18  Adrian Perez de Castro  <aperez@igalia.com>
3234
3235         [WPE] Fix building the documentation
3236
3237         Unreviewed.
3238
3239         * UIProcess/API/wpe/docs/wpe-docs.sgml: Fix typo "2.62" -> "2.26"
3240
3241 2019-06-18  Truitt Savell  <tsavell@apple.com>
3242
3243         Unreviewed, rolling out r246531.
3244
3245         Broke internal builds.
3246
3247         Reverted changeset:
3248
3249         "Expose DataDetectors context generation on
3250         WKContentViewInteraction"
3251         https://bugs.webkit.org/show_bug.cgi?id=198950
3252         https://trac.webkit.org/changeset/246531
3253
3254 2019-06-18  Simon Fraser  <simon.fraser@apple.com>
3255
3256         Convert macOS to scroll by changing layer boundsOrigin
3257         https://bugs.webkit.org/show_bug.cgi?id=198917
3258
3259         Reviewed by Antti Koivisto.
3260
3261         Remove unreached and confusing code.
3262
3263         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
3264         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::repositionScrollingLayers):
3265
3266 2019-06-18  Dean Jackson  <dino@apple.com>
3267
3268         Attachment elements are missing context menu previews
3269         https://bugs.webkit.org/show_bug.cgi?id=198946
3270
3271         Reviewed by Tim Horton.
3272
3273         When requesting position information on an <attachment> element,
3274         we were not providing a snapshot image.
3275
3276         * WebProcess/WebPage/WebPage.h: New common method to take a snapshot.
3277         * WebProcess/WebPage/ios/WebPageIOS.mm:
3278         (WebKit::WebPage::shareableBitmapSnapshotForNode): New helper.
3279         (WebKit::WebPage::positionInformation): If the element is an attachment,
3280         then ask for a snapshot.
3281
3282 2019-06-17  Tim Horton  <timothy_horton@apple.com>
3283
3284         Expose DataDetectors context generation on WKContentViewInteraction
3285         https://bugs.webkit.org/show_bug.cgi?id=198950
3286         <rdar://problem/51116021>
3287
3288         Reviewed by Andy Estes.
3289
3290         * UIProcess/ios/WKActionSheetAssistant.h:
3291         * UIProcess/ios/WKActionSheetAssistant.mm:
3292         (-[WKActionSheetAssistant currentPositionInformation]):
3293         (-[WKActionSheetAssistant showDataDetectorsSheet]):
3294         * UIProcess/ios/WKContentViewInteraction.h:
3295         * UIProcess/ios/WKContentViewInteraction.mm:
3296         (-[WKContentView dataDetectionContextForPositionInformation:]):
3297         (-[WKContentView dataDetectionContextForActionSheetAssistant:]):
3298         For use by other clients, add -dataDetectionContextForPositionInformation:
3299         and make -dataDetectionContextForActionSheetAssistant: use it.
3300         Also, pull the code to augment the context with surrounding text out of
3301         from WKActionSheetAssistant.
3302
3303 2019-06-17  Sihui Liu  <sihui_liu@apple.com>
3304
3305         -[WKWebsiteDataStore removeDataOfTypes:modifiedSince:completionHandler:] doesn't delete _WKWebsiteDataTypeCredentials
3306         https://bugs.webkit.org/show_bug.cgi?id=198854
3307         <rdar://problem/51386058>
3308
3309         Reviewed by Geoffrey Garen.
3310
3311         Clear persistent credentials in deleteWebsiteData of network process.
3312
3313         Also, merge originsWithPersistentCredentials and removeCredentialsWithOrigins into fetchWebsiteData and
3314         deleteWebsiteData, and move credentials handling to WebCore.
3315
3316         * NetworkProcess/NetworkProcess.cpp:
3317         (WebKit::NetworkProcess::fetchWebsiteData):
3318         (WebKit::NetworkProcess::deleteWebsiteData):
3319         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
3320         (WebKit::NetworkProcess::originsWithPersistentCredentials): Deleted.
3321         (WebKit::NetworkProcess::removeCredentialsWithOrigins): Deleted.
3322         * NetworkProcess/NetworkProcess.h:
3323         * NetworkProcess/NetworkProcess.messages.in:
3324         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3325         (WebKit::NetworkProcess::originsWithPersistentCredentials): Deleted.
3326         (WebKit::NetworkProcess::removeCredentialsWithOrigins): Deleted.
3327         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3328         (WebKit::WebsiteDataStore::fetchDataAndApply):
3329         (WebKit::computeWebProcessAccessTypeForDataRemoval):
3330         (WebKit::WebsiteDataStore::removeData):
3331
3332 2019-06-17  Tim Horton  <timothy_horton@apple.com>
3333
3334         Fix the build with case-sensitive includes
3335         <rdar://problem/51828273>
3336
3337         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
3338         FileSystem, not Filesystem.
3339
3340 2019-06-17  Jiewen Tan  <jiewen_tan@apple.com>
3341
3342         Unreviewed, build fix after r246514
3343
3344         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.h:
3345         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.mm:
3346         (+[NSURL _web_canPerformAuthorizationWithURL:]):
3347         Expose the above method as a SPI for Safari.
3348         * WebKit.xcodeproj/project.pbxproj:
3349
3350 2019-06-17  Alex Christensen  <achristensen@webkit.org>
3351
3352         Protect StorageManager::m_localStorageNamespaces with a Lock
3353         https://bugs.webkit.org/show_bug.cgi?id=198939
3354         <rdar://problem/51784225>
3355
3356         Reviewed by Geoff Garen.
3357
3358         StorageManager::LocalStorageNamespace::didDestroyStorageArea is called from StorageArea::~StorageArea which is called on the main thread.
3359         All other access of m_localStorageNamespaces is from the non-main thread.  Sometimes this causes hash table corruption, so wait for a mutex
3360         before accessing this member variable.
3361
3362         * NetworkProcess/WebStorage/StorageManager.cpp:
3363         (WebKit::StorageManager::LocalStorageNamespace::didDestroyStorageArea):
3364         (WebKit::StorageManager::cloneSessionStorageNamespace):
3365         (WebKit::StorageManager::getLocalStorageOrigins):
3366         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
3367         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
3368         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
3369         (WebKit::StorageManager::getOrCreateLocalStorageNamespace):
3370         * NetworkProcess/WebStorage/StorageManager.h:
3371
3372 2019-06-17  Alex Christensen  <achristensen@webkit.org>
3373
3374         Add null check in WebFrameLoaderClient::assignIdentifierToInitialRequest
3375         https://bugs.webkit.org/show_bug.cgi?id=198926
3376         <rdar://problem/50079713>
3377
3378         Reviewed by Brady Eidson.
3379
3380         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3381         (WebKit::WebFrameLoaderClient::assignIdentifierToInitialRequest):
3382         WebKitLegacy's version already checks null for the corresponding call.
3383
3384 2019-06-17  Alex Christensen  <achristensen@webkit.org>
3385
3386         Fix internal build after r246514
3387         https://bugs.webkit.org/show_bug.cgi?id=198874
3388
3389         * UIProcess/API/APINavigationAction.h:
3390         A problematic reference to APINavigationActionAdditions.h was left.
3391         Its contents had been sprinkled into the correct places, though.
3392
3393 2019-06-17  Jiewen Tan  <jiewen_tan@apple.com>
3394
3395         Move SOAuthorization from WebKitAdditions to WebKit
3396         https://bugs.webkit.org/show_bug.cgi?id=198874
3397         <rdar://problem/47573431>
3398
3399         Reviewed by Brent Fulgham.
3400
3401         This patch basically moves everything from existing WebKitAdditions to WebKit.
3402         It also replaces the LoadOptimizer nonsense with the actual SOAuthorization API.
3403
3404         * Configurations/WebKit.xcconfig:
3405         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3406         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3407         * PluginProcess/mac/PluginProcessMac.mm:
3408         (WebKit::PluginProcess::platformInitializePluginProcess):
3409         * SourcesCocoa.txt:
3410         * UIProcess/API/APINavigationAction.h:
3411         * UIProcess/Cocoa/NavigationState.mm:
3412         (WebKit::trySOAuthorization):
3413         (WebKit::tryInterceptNavigation):
3414         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3415         (WebKit::tryOptimizingLoad): Deleted.
3416         * UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.h: Added.
3417         (WebKit::NavigationSOAuthorizationSession::callback):
3418         * UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
3419         (WebKit::NavigationSOAuthorizationSession::NavigationSOAuthorizationSession):
3420         (WebKit::NavigationSOAuthorizationSession::~NavigationSOAuthorizationSession):
3421         (WebKit::NavigationSOAuthorizationSession::shouldStartInternal):
3422         (WebKit::NavigationSOAuthorizationSession::webViewDidMoveToWindow):
3423         * UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.h: Added.
3424         * UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm: Added.
3425         (-[WKSOSecretDelegate initWithSession:]):
3426         (-[WKSOSecretDelegate webViewDidClose:]):
3427         (-[WKSOSecretDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
3428         (-[WKSOSecretDelegate webView:didFinishNavigation:]):
3429         (WebKit::PopUpSOAuthorizationSession::PopUpSOAuthorizationSession):
3430         (WebKit::PopUpSOAuthorizationSession::~PopUpSOAuthorizationSession):
3431         (WebKit::PopUpSOAuthorizationSession::shouldStartInternal):
3432         (WebKit::PopUpSOAuthorizationSession::fallBackToWebPathInternal):
3433         (WebKit::PopUpSOAuthorizationSession::abortInternal):
3434         (WebKit::PopUpSOAuthorizationSession::completeInternal):
3435         (WebKit::PopUpSOAuthorizationSession::close):
3436         (WebKit::PopUpSOAuthorizationSession::initSecretWebView):
3437         * UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.h: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
3438         * UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm: Added.
3439         (WebKit::RedirectSOAuthorizationSession::RedirectSOAuthorizationSession):
3440         (WebKit::RedirectSOAuthorizationSession::fallBackToWebPathInternal):
3441         (WebKit::RedirectSOAuthorizationSession::abortInternal):
3442         (WebKit::RedirectSOAuthorizationSession::completeInternal):
3443         (WebKit::RedirectSOAuthorizationSession::beforeStart):
3444         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationCoordinator.h: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
3445         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationCoordinator.mm: Added.
3446         (WebKit::SOAuthorizationCoordinator::SOAuthorizationCoordinator):
3447         (WebKit::SOAuthorizationCoordinator::canAuthorize const):
3448         (WebKit::SOAuthorizationCoordinator::tryAuthorize):
3449         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.h: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
3450         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.mm: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
3451         (+[NSURL _web_canPerformAuthorizationWithURL:]):
3452         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.h: Added.
3453         (WebKit::SOAuthorizationSession::page const):
3454         (WebKit::SOAuthorizationSession::state const):
3455         (WebKit::SOAuthorizationSession::setState):
3456         (WebKit::SOAuthorizationSession::navigationAction):
3457         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm: Added.
3458         (WebKit::SOAuthorizationSession::SOAuthorizationSession):
3459         (WebKit::SOAuthorizationSession::~SOAuthorizationSession):
3460         (WebKit::SOAuthorizationSession::releaseNavigationAction):
3461         (WebKit::SOAuthorizationSession::becomeCompleted):
3462         (WebKit::SOAuthorizationSession::shouldStart):
3463         (WebKit::SOAuthorizationSession::start):
3464         (WebKit::SOAuthorizationSession::fallBackToWebPath):
3465         (WebKit::SOAuthorizationSession::abort):
3466         (WebKit::SOAuthorizationSession::complete):
3467         (WebKit::SOAuthorizationSession::presentViewController):
3468         (WebKit::SOAuthorizationSession::dismissViewController):
3469         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h: Copied from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
3470         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm: Added.
3471         (WebKit::SubFrameSOAuthorizationSession::SubFrameSOAuthorizationSession):
3472         (WebKit::SubFrameSOAuthorizationSession::fallBackToWebPathInternal):
3473         (WebKit::SubFrameSOAuthorizationSession::abortInternal):
3474         (WebKit::SubFrameSOAuthorizationSession::completeInternal):
3475         (WebKit::SubFrameSOAuthorizationSession::beforeStart):
3476         (WebKit::SubFrameSOAuthorizationSession::loadDataToFrame):
3477         (WebKit::SubFrameSOAuthorizationSession::postDidCancelMessageToParent):
3478         * UIProcess/Cocoa/SOAuthorization/WKSOAuthorizationDelegate.h: Renamed from Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm.
3479         * UIProcess/Cocoa/SOAuthorization/WKSOAuthorizationDelegate.mm: Added.
3480         (-[WKSOAuthorizationDelegate authorization:presentViewController:withCompletion:]):
3481         (-[WKSOAuthorizationDelegate authorizationDidNotHandle:]):
3482         (-[WKSOAuthorizationDelegate authorizationDidCancel:]):
3483         (-[WKSOAuthorizationDelegate authorizationDidComplete:]):
3484         (-[WKSOAuthorizationDelegate authorization:didCompleteWithHTTPAuthorizationHeaders:]):
3485         (-[WKSOAuthorizationDelegate authorization:didCompleteWithHTTPResponse:httpBody:]):
3486         (-[WKSOAuthorizationDelegate authorization:didCompleteWithError:]):
3487         (-[WKSOAuthorizationDelegate setSession:]):
3488         * UIProcess/WebPageProxy.cpp:
3489         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3490         (WebKit::trySOAuthorization):
3491         (WebKit::WebPageProxy::createNewPage):
3492         (WebKit::tryOptimizingLoad): Deleted.
3493         * UIProcess/WebPageProxy.h:
3494         (WebKit::WebPageProxy::setShouldSuppressSOAuthorizationInAllNavigationPolicyDecision):
3495         (WebKit::WebPageProxy::setShouldSuppressSOAuthorizationInNextNavigationPolicyDecision):
3496         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3497         (WebKit::WebsiteDataStore::WebsiteDataStore):
3498         * UIProcess/WebsiteData/WebsiteDataStore.h:
3499         (WebKit::WebsiteDataStore::soAuthorizationCoordinator):
3500         * WebKit.xcodeproj/project.pbxproj:
3501         * WebProcess/cocoa/WebProcessCocoa.mm:
3502         (WebKit::WebProcess::platformInitializeProcess):
3503
3504 2019-06-17  Tim Horton  <timothy_horton@apple.com>
3505
3506         Fix the build.
3507
3508         * UIProcess/Gamepad/ios/UIGamepadProviderIOS.mm:
3509         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
3510         * UIProcess/_WKTouchEventGenerator.mm:
3511         (-[_WKTouchEventGenerator _sendHIDEvent:]):
3512         (-[_WKTouchEventGenerator _sendMarkerHIDEventWithCompletionBlock:]):
3513
3514 2019-06-17  Dan Bernstein  <mitz@apple.com>
3515
3516         REGRESSION (r242686): Paths in XPC services’ LC_DYLD_ENVIRONMENT are incorrect in built products directory
3517         https://bugs.webkit.org/show_bug.cgi?id=198904
3518
3519         Reviewed by Alex Christensen.
3520
3521         After r242686, in local builds, the XPC service executables run from their location at the
3522         top of the built products directory, rather than inside the framework.
3523
3524         * Configurations/BaseXPCService.xcconfig: Updated the load commands that set
3525           DYLD_FRAMEWORK_PATH and DYLD_LIBRARY_PATH for the new location in the built products
3526           directory. Also removed WK_XPC_SERVICE_INSERT_LIBRARIES_DIR that had been unused.
3527
3528         * WebKit.xcodeproj/project.pbxproj: Made the creation of symbolic links inside the
3529           framework’s XPCServices directory predicated on whether this is an install build, rather
3530           than on the build configuration, for consistency with the condition used in the .xcconfig.
3531
3532 2019-06-17  Brent Fulgham  <bfulgham@apple.com>
3533
3534         Ensure ITP state is relayed to Network Process on restart
3535         https://bugs.webkit.org/show_bug.cgi?id=198797
3536         <rdar://problem/51646944>
3537
3538         Reviewed by Youenn Fablet.
3539
3540         Now that the ITP state is maintained in the Network Process, we have to make sure that we update
3541         that process with current ITP state if the Network Process crashes and is relaunched. This wasn't a
3542         problem in earlier releases because we tracked all ITP state in the UIProcess.
3543
3544         This patch does the following:
3545         1. Add a new method to WKWebsiteDataStore to allow us to trigger statistics processing, which has the
3546            side effect of syncing ITP state persistently so that it will be available after bouncing the process.
3547         2. Adds a new test that sets a tracking domain, bounces the process, and confirms the state is still
3548            consistent.
3549
3550         Tested by TestWebKitAPI.
3551
3552         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
3553         (WebKit::ResourceLoadStatisticsStore::processStatisticsAndDataRecords):
3554         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3555         (-[WKWebsiteDataStore _clearPrevalentDomain:completionHandler:]):
3556         (-[WKWebsiteDataStore _processStatisticsAndDataRecords:]):
3557         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3558         * UIProcess/WebProcessPool.cpp:
3559         (WebKit::WebProcessPool::ensureNetworkProcess):
3560         (WebKit::WebProcessPool::setResourceLoadStatisticsEnabled):
3561         * UIProcess/WebProcessPool.h:
3562         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3563         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
3564
3565 2019-06-17  Ludovico de Nittis  <ludovico.denittis@collabora.com>
3566
3567         [GTK] Stop accessing GdkEvent fields when possible
3568         https://bugs.webkit.org/show_bug.cgi?id=198829
3569
3570         Reviewed by Michael Catanzaro.
3571
3572         Direct access to GdkEvent structs is no longer possible in GTK 4.
3573
3574         * Shared/gtk/WebEventFactory.cpp:
3575         (WebKit::buttonForEvent):
3576         (WebKit::WebEventFactory::createWebMouseEvent):
3577         (WebKit::WebEventFactory::createWebWheelEvent):
3578         (WebKit::WebEventFactory::createWebKeyboardEvent):
3579         (WebKit::WebEventFactory::createWebTouchEvent):
3580         * UIProcess/API/gtk/WebKitEmojiChooser.cpp:
3581         * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp:
3582         (webkitScriptDialogImplKeyPressEvent):
3583         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3584         (ClickCounter::currentClickCountForGdkButtonEvent):
3585         (webkitWebViewBaseKeyPressEvent):
3586         (webkitWebViewBaseHandleMouseEvent):
3587         (webkitWebViewBaseCrossingNotifyEvent):
3588         (webkitWebViewBaseGetTouchPointsForEvent):
3589         (webkitWebViewBaseTouchEvent):
3590         (webkitWebViewBaseEvent):
3591         * UIProcess/gtk/GestureController.cpp:
3592         (WebKit::GestureController::handleEvent):
3593         * UIProcess/gtk/InputMethodFilter.cpp:
3594         (WebKit::InputMethodFilter::filterKeyEvent):
3595         (WebKit::InputMethodFilter::logHandleKeyboardEventForTesting):
3596         (WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting):
3597         * UIProcess/gtk/KeyBindingTranslator.cpp:
3598         (WebKit::KeyBindingTranslator::commandsForKeyEvent):
3599         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
3600         (WebKit::isEventStop):
3601         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe):
3602         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventGetScrollingDeltas):
3603         (WebKit::ViewGestureController::SwipeProgressTracker::handleEvent):
3604         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
3605         (WebKit::WebPopupMenuProxyGtk::treeViewButtonReleaseEventCallback):
3606         (WebKit::WebPopupMenuProxyGtk::keyPressEventCallback):
3607
3608 2019-06-17  Carlos Garcia Campos  <cgarcia@igalia.com>
3609
3610         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.25.2 release
3611
3612         * gtk/NEWS: Add release notes for 2.25.2.
3613
3614 2019-06-17  Carlos Garcia Campos  <cgarcia@igalia.com>
3615
3616         Unreviewed, rolling out r246467.
3617
3618         It broke scrolling with mouse wheel
3619
3620         Reverted changeset:
3621
3622         "[GTK] Stop accessing GdkEvent fields when possible"
3623         https://bugs.webkit.org/show_bug.cgi?id=198829
3624         https://trac.webkit.org/changeset/246467
3625
3626 2019-06-16  Darin Adler  <darin@apple.com>
3627
3628         Rename AtomicString to AtomString
3629         https://bugs.webkit.org/show_bug.cgi?id=195276
3630
3631         Reviewed by Michael Catanzaro.
3632
3633         * many files: Let do-webcore-rename do the renaming.
3634
3635 2019-06-16  Simon Fraser  <simon.fraser@apple.com>
3636
3637         Implement ScrollableArea::scrollOffset()
3638         https://bugs.webkit.org/show_bug.cgi?id=198895
3639
3640         Reviewed by Antti Koivisto.
3641
3642         * UIProcess/win/WebPopupMenuProxyWin.cpp:
3643         (WebKit::PopupMenuWin::scrollPosition const):
3644         (WebKit::WebPopupMenuProxyWin::onKeyDown): Just use m_scrollOffset.
3645         (WebKit::WebPopupMenuProxyWin::scrollSize const): Deleted.
3646         * UIProcess/win/WebPopupMenuProxyWin.h: Remove the one-axis scrollOffset()
3647         * WebProcess/Plugins/PDF/PDFPlugin.h:
3648         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3649         (WebKit::PDFPlugin::scrollSize const): Deleted.
3650         (WebKit::PDFPlugin::scrollOffset const): Deleted.
3651         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
3652         (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect):
3653
3654 2019-06-15  Youenn Fablet  <youenn@apple.com>
3655
3656         WebProcessPool::clearWebProcessHasUploads cannot assume its given processIdentifier is valid
3657         https://bugs.webkit.org/show_bug.cgi?id=198865
3658
3659         Unreviewed.
3660
3661         * UIProcess/WebProcessPool.cpp:
3662         (WebKit::WebProcessPool::clearWebProcessHasUploads):
3663         Remove wrong debug assertion in case of WebProcessProxy destruction.
3664
3665 2019-06-15  Ludovico de Nittis  <ludovico.denittis@collabora.com>
3666
3667         [GTK] Stop accessing GdkEvent fields when possible
3668         https://bugs.webkit.org/show_bug.cgi?id=198829
3669
3670         Reviewed by Michael Catanzaro.
3671
3672         Direct access to GdkEvent structs is no longer possible in GTK 4.
3673
3674         * Shared/gtk/WebEventFactory.cpp:
3675         (WebKit::buttonForEvent):
3676         (WebKit::WebEventFactory::createWebMouseEvent):
3677         (WebKit::WebEventFactory::createWebWheelEvent):
3678         (WebKit::WebEventFactory::createWebKeyboardEvent):
3679         (WebKit::WebEventFactory::createWebTouchEvent):
3680         * UIProcess/API/gtk/WebKitEmojiChooser.cpp:
3681         * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp:
3682         (webkitScriptDialogImplKeyPressEvent):
3683         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3684         (ClickCounter::currentClickCountForGdkButtonEvent):
3685         (webkitWebViewBaseKeyPressEvent):
3686         (webkitWebViewBaseHandleMouseEvent):
3687         (webkitWebViewBaseCrossingNotifyEvent):
3688         (webkitWebViewBaseGetTouchPointsForEvent):
3689         (webkitWebViewBaseTouchEvent):
3690         (webkitWebViewBaseEvent):
3691         * UIProcess/gtk/GestureController.cpp:
3692         (WebKit::GestureController::handleEvent):
3693         * UIProcess/gtk/InputMethodFilter.cpp:
3694         (WebKit::InputMethodFilter::filterKeyEvent):
3695         (WebKit::InputMethodFilter::logHandleKeyboardEventForTesting):
3696         (WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting):
3697         * UIProcess/gtk/KeyBindingTranslator.cpp:
3698         (WebKit::KeyBindingTranslator::commandsForKeyEvent):
3699         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
3700         (WebKit::isEventStop):
3701         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe):
3702         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventGetScrollingDeltas):
3703         (WebKit::ViewGestureController::SwipeProgressTracker::handleEvent):
3704         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
3705         (WebKit::WebPopupMenuProxyGtk::treeViewButtonReleaseEventCallback):
3706         (WebKit::WebPopupMenuProxyGtk::keyPressEventCallback):
3707
3708 2019-06-15  Rob Buis  <rbuis@igalia.com>
3709
3710         Store prefetch redirects in the prefetch cache
3711         https://bugs.webkit.org/show_bug.cgi?id=197371
3712
3713         Reviewed by Youenn Fablet.
3714
3715         Store prefetch redirects in the prefetch cache and use them when
3716         navigating.
3717
3718         * NetworkProcess/NetworkResourceLoader.cpp:
3719         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
3720         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
3721         (WebKit::NetworkResourceLoader::didFinishWithRedirectResponse):
3722         * NetworkProcess/NetworkResourceLoader.h:
3723         * NetworkProcess/cache/PrefetchCache.cpp:
3724         (WebKit::PrefetchCache::Entry::Entry):
3725         (WebKit::PrefetchCache::storeRedirect):
3726         * NetworkProcess/cache/PrefetchCache.h:
3727
3728 2019-06-14  Devin Rousso  <drousso@apple.com>
3729
3730         waitForNavigationToComplete may be called before WebPageProxy knows it's loading
3731         https://bugs.webkit.org/show_bug.cgi?id=198741
3732         <rdar://problem/31164316>
3733
3734         Reviewed by Joseph Pecoraro.
3735
3736         There's a potential race in `WebAutomationSession::waitForNavigationToCompleteOnPage` when
3737         querying for the `WebPageProxy`'s loading state (via `PageLoadingState::isLoading`), in that
3738         a pending load may be committed _after_ the `WebAutomationSession` checks it's value. This
3739         makes the automation session think that it isn't loading, so it will continue running
3740         commands, which can lead to a JavaScript error ("Callback was not called before the unload
3741         event") as any injected scripts will be cleared by the impending navigation, leaving the
3742         script evaluation callbacks "dangling".
3743
3744         Expose more information from `PageLoadState` about whether it thinks there _may_ be a
3745         navigation currently happening, which the `WebAutomationSession` can use to delay commands.
3746
3747         In the best case, no navigations are "missed".
3748
3749         In the worst case, the automation session will wait `pageLoadTimeout` before continuing.
3750
3751         * UIProcess/Automation/WebAutomationSession.cpp:
3752         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage):
3753
3754         * UIProcess/PageLoadState.h:
3755         * UIProcess/PageLoadState.cpp:
3756         (WebKit::PageLoadState::hasUncommittedLoad const): Added.
3757
3758 2019-06-14  Youenn Fablet  <youenn@apple.com>
3759
3760         WebProcessPool::clearWebProcessHasUploads cannot assume its given processIdentifier is valid
3761         https://bugs.webkit.org/show_bug.cgi?id=198865
3762         <rdar://problem/51618878>
3763
3764         Reviewed by Brady Eidson.
3765
3766         NetworkProcess currently instructs UIProcess whether a given WebProcess is doing upload.
3767         There is no guarantee though that the WebProcessProxy is still there when the IPC is arriving at UIProcess.
3768         Instead, let WebProcess handles its upload state and notify WebProcessPool about its state.
3769         Make sure WebProcessProxy unregisters itself in case of crash.
3770         In case of NetworkProcess crash, WebProcesses will see all their uploads fail
3771         and will notify automatically UIProcess to update their state.
3772
3773         Since the processID given to WebProcessPool is coming from IPC, we cannot not trust it.
3774         Add early return in case of not finding a WebProcessProxy for WebProcessPool clear/set methods.
3775
3776         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3777         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
3778         * NetworkProcess/NetworkConnectionToWebProcess.h:
3779         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3780         * NetworkProcess/NetworkResourceLoadMap.cpp:
3781         (WebKit::NetworkResourceLoadMap::add):
3782         (WebKit::NetworkResourceLoadMap::take):
3783         * NetworkProcess/NetworkResourceLoadMap.h:
3784         * UIProcess/WebProcessPool.cpp:
3785         (WebKit::WebProcessPool::setWebProcessHasUploads):
3786         (WebKit::WebProcessPool::clearWebProcessHasUploads):
3787         * UIProcess/WebProcessProxy.cpp:
3788         (WebKit::WebProcessProxy::~WebProcessProxy):
3789         * WebProcess/Network/WebLoaderStrategy.cpp:
3790         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3791         (WebKit::WebLoaderStrategy::remove):
3792         (WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
3793         * WebProcess/Network/WebLoaderStrategy.h:
3794         * WebProcess/WebProcess.cpp:
3795         (WebKit::WebProcess::ensureNetworkProcessConnection):
3796
3797 2019-06-14  Youenn Fablet  <youenn@apple.com>
3798
3799         WebResourceLoadStatisticsStore should not use its network session if invalidated
3800         https://bugs.webkit.org/show_bug.cgi?id=198814
3801
3802         Reviewed by Geoffrey Garen.
3803
3804         Tell WebResourceLoadStatisticsStore that its network session is invalidated.
3805         WebResourceLoadStatisticsStore will then clear its reference to the network session.
3806
3807         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3808         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
3809         Added for test purposes to trigger further cookie processing.
3810         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3811         (WebKit::WebResourceLoadStatisticsStore::invalidateAndCancel):
3812         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3813         * NetworkProcess/NetworkSession.cpp:
3814         (WebKit::NetworkSession::invalidateAndCancel):
3815
3816 2019-06-14  Joseph Pecoraro  <pecoraro@apple.com>
3817
3818         [Cocoa] NSFileWrapper associated with _WKAttachment
3819         https://bugs.webkit.org/show_bug.cgi?id=198871
3820         <rdar://problem/51760625>
3821
3822         Reviewed by Wenson Hsieh.
3823
3824         * UIProcess/API/Cocoa/_WKAttachment.mm:
3825         (-[_WKAttachment dealloc]):
3826         Ensure we destruct the API::Object associated with this so RetainPtrs can release.
3827
3828 2019-06-14  Tim Horton  <timothy_horton@apple.com>
3829
3830         WebKit's NSAttributedString.h is not included in the WebKit.h umbrella header
3831         https://bugs.webkit.org/show_bug.cgi?id=198869
3832         <rdar://problem/51754437>
3833
3834         Reviewed by Timothy Hatcher.
3835
3836         * Shared/API/Cocoa/WebKit.h:
3837         Make the new API available to modularized clients and folks who just import WebKit.h
3838
3839 2019-06-14  Jiewen Tan  <jiewen_tan@apple.com>
3840
3841         Disable AppSSO for web processes and plugin processes
3842         https://bugs.webkit.org/show_bug.cgi?id=198843
3843         <rdar://problem/51642920>
3844
3845         Reviewed by Sam Weinig.
3846
3847         This patch moves the disabling of AppSSO from AuxiliaryProcess to PluginProcess
3848         and WebProcess such that NetworkingProcess will not be affected.
3849
3850         * PluginProcess/mac/PluginProcessMac.mm:
3851         (WebKit::PluginProcess::platformInitializePluginProcess):
3852         * Shared/ios/AuxiliaryProcessIOS.mm:
3853         (WebKit::AuxiliaryProcess::platformInitialize):
3854         * Shared/mac/AuxiliaryProcessMac.mm:
3855         (WebKit::AuxiliaryProcess::platformInitialize):
3856         * WebProcess/cocoa/WebProcessCocoa.mm:
3857         (WebKit::WebProcess::platformInitializeProcess):
3858
3859 2019-06-14  Megan Gardner  <megan_gardner@apple.com>
3860
3861         Move Synthetic Editing Commands to behind an experimental feature flag
3862         https://bugs.webkit.org/show_bug.cgi?id=198842
3863         <rdar://problem/50594700>
3864
3865         Reviewed by Simon Fraser.
3866
3867         Add a feature flag to gate synthetic editing commands.
3868
3869         * Shared/WebPreferences.yaml:
3870         * WebProcess/WebPage/ios/WebPageIOS.mm:
3871         (WebKit::WebPage::getFocusedElementInformation):
3872
3873 2019-06-13  Megan Gardner  <megan_gardner@apple.com>
3874
3875         Fix selection hang in Mail
3876         https://bugs.webkit.org/show_bug.cgi?id=198845
3877         <rdar://problem/51388180>
3878
3879         Reviewed by Tim Horton.
3880
3881         SelectionDidChange requires a selectionWillChange in order to keep things in line.
3882
3883         * UIProcess/ios/WKContentViewInteraction.mm:
3884         (-[WKContentView _selectionChanged]):
3885
3886 2019-06-13  Tim Horton  <timothy_horton@apple.com>
3887
3888         No content shows up for WKWebView while locked even with _canShowWhileLocked is YES
3889         https://bugs.webkit.org/show_bug.cgi?id=198819
3890         <rdar://problem/51636240>
3891
3892         Reviewed by Simon Fraser.
3893
3894         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3895         (WebKit::WebPageProxy::didCreateContextForVisibilityPropagation):
3896         * UIProcess/WebPageProxy.h:
3897         (WebKit::WebPageProxy::contextIDForVisibilityPropagation const):
3898         * UIProcess/WebPageProxy.messages.in:
3899         * UIProcess/WebProcessProxy.h:
3900         (WebKit::WebProcessProxy::contextIDForVisibilityPropagation): Deleted.
3901         * UIProcess/WebProcessProxy.messages.in:
3902         * UIProcess/ios/WKContentView.mm:
3903         (-[WKContentView _setupVisibilityPropagationView]):
3904         * UIProcess/ios/WebPageProxyIOS.mm:
3905         (WebKit::WebPageProxy::didCreateContextForVisibilityPropagation): Deleted.
3906         * UIProcess/ios/WebProcessProxyIOS.mm:
3907         (WebKit::WebProcessProxy::didCreateContextForVisibilityPropagation): Deleted.
3908         * WebProcess/WebPage/WebPage.cpp:
3909         (WebKit::m_shrinkToFitContentTimer):
3910         * WebProcess/WebPage/WebPage.h:
3911         * WebProcess/WebProcess.h:
3912         * WebProcess/cocoa/WebProcessCocoa.mm:
3913         (WebKit::WebProcess::platformInitializeWebProcess):
3914         Move the creation of the visibility propagation context to WebPage instead of WebProcess,
3915         because canShowWhileLocked is per-page, not per-process.
3916
3917         Also, pass canShowWhileLocked into the context creation function for the visibility
3918         propagation context, not just RemoteLayerTree contexts.
3919
3920 2019-06-13  Antoine Quint  <graouts@apple.com>
3921
3922         "display: contents" Content click does not trigger
3923         https://bugs.webkit.org/show_bug.cgi?id=198559
3924         <rdar://problem/51488524>
3925
3926         Reviewed by Antti Koivisto.
3927
3928         * WebProcess/WebPage/ios/WebPageIOS.mm:
3929         (WebKit::WebPage::commitPotentialTap):
3930
3931 2019-06-13  Takashi Komori  <Takashi.Komori@sony.com>
3932
3933         [curl] Remove member objects of CurlRequest not to share by different threads.
3934         https://bugs.webkit.org/show_bug.cgi?id=198747
3935
3936         Reviewed by Fujii Hironori.
3937
3938         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3939         (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
3940         (WebKit::NetworkDataTaskCurl::curlDidComplete):
3941         (WebKit::NetworkDataTaskCurl::curlDidFailWithError):
3942         * NetworkProcess/curl/NetworkDataTaskCurl.h:
3943
3944 2019-06-13  Zan Dobersek  <zdobersek@igalia.com>
3945
3946         [Nicosia] Add SceneIntegration
3947         https://bugs.webkit.org/show_bug.cgi?id=198791
3948
3949         Reviewed by Carlos Garcia Campos.
3950
3951         Have the LayerTreeHost own the SceneIntegration object that's to be
3952         associated with layers used inside the LayerTreeHost's scene. The
3953         class now also inherits the SceneIntegration::Client interface, with the
3954         requestUpdate() method scheduling a scene update in ThreadedCompositor.
3955
3956         CompositingCoordinator now retrieves the SceneIntegration object from
3957         the LayerTreeHost instance and manages association to that object for
3958         layers under the coordinator's control.
3959
3960         ThreadedCompositor class gets a new public updateScene() method that
3961         schedules an update, enabling the SceneIntegration class to invoke
3962         scene updates.
3963
3964         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3965         (WebKit::ThreadedCompositor::updateScene):
3966         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
3967         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3968         (WebKit::CompositingCoordinator::createGraphicsLayer):
3969         (WebKit::CompositingCoordinator::detachLayer):
3970         (WebKit::CompositingCoordinator::attachLayer):
3971         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
3972         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
3973         (WebKit::LayerTreeHost::LayerTreeHost):
3974         (WebKit::LayerTreeHost::sceneIntegration):
3975         (WebKit::LayerTreeHost::requestUpdate):
3976         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
3977
3978 2019-06-13  Ludovico de Nittis  <ludovico.denittis@collabora.com>
3979
3980         [GTK] gdk_display_get_device_manager and gdk_screen_get_width/height are deprecated
3981         https://bugs.webkit.org/show_bug.cgi?id=198822
3982
3983         Reviewed by Carlos Garcia Campos.
3984
3985         GdkSeat and GdkRectangle should be used, respectively.
3986
3987         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
3988         (WebKit::doMouseEvent):
3989         (WebKit::doMotionEvent):
3990         (WebKit::doKeyStrokeEvent):
3991
3992 2019-06-12  Antoine Quint  <graouts@apple.com>
3993
3994         Show the web page URL when sharing an AR model
3995         https://bugs.webkit.org/show_bug.cgi?id=198812
3996         <rdar://problem/48689498>
3997
3998         Reviewed by Dean Jackson.
3999
4000         * UIProcess/Cocoa/DownloadClient.mm:
4001         (WebKit::DownloadClient::didStart):
4002         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
4003         (-[_WKPreviewControllerDataSource initWithMIMEType:originatingPageURL:]):
4004         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
4005         (WebKit::SystemPreviewController