[iOS WK2] Hide previews when an inner overflow or frame scrollview scrolls
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-08-08  Simon Fraser  <simon.fraser@apple.com>
2
3         [iOS WK2] Hide previews when an inner overflow or frame scrollview scrolls
4         https://bugs.webkit.org/show_bug.cgi?id=200552
5         rdar://problem/54086338
6
7         Reviewed by Wenson Hsieh.
8
9         Give UITargetedPreview the UIScrollView that the target element is inside of,
10         so it can clean up if the user starts to scroll that view.
11
12         * Platform/spi/ios/UIKitSPI.h:
13         * UIProcess/ios/WKContentViewInteraction.mm:
14         (-[WKContentView _createTargetedPreviewIfPossible]):
15
16 2019-08-08  Chris Dumez  <cdumez@apple.com>
17
18         Add threading assertions to WebStorage code
19         https://bugs.webkit.org/show_bug.cgi?id=200550
20
21         Reviewed by Geoffrey Garen.
22
23         Add threading assertions to WebStorage code for extra safety.
24
25         * NetworkProcess/WebStorage/LocalStorageNamespace.cpp:
26         (WebKit::LocalStorageNamespace::LocalStorageNamespace):
27         (WebKit::LocalStorageNamespace::~LocalStorageNamespace):
28         (WebKit::LocalStorageNamespace::getOrCreateStorageArea):
29         (WebKit::LocalStorageNamespace::clearStorageAreasMatchingOrigin):
30         (WebKit::LocalStorageNamespace::clearAllStorageAreas):
31         (WebKit::LocalStorageNamespace::ephemeralOrigins const):
32         (WebKit::LocalStorageNamespace::cloneTo):
33         * NetworkProcess/WebStorage/SessionStorageNamespace.cpp:
34         (WebKit::SessionStorageNamespace::SessionStorageNamespace):
35         (WebKit::SessionStorageNamespace::~SessionStorageNamespace):
36         (WebKit::SessionStorageNamespace::addAllowedConnection):
37         (WebKit::SessionStorageNamespace::removeAllowedConnection):
38         (WebKit::SessionStorageNamespace::getOrCreateStorageArea):
39         (WebKit::SessionStorageNamespace::cloneTo):
40         (WebKit::SessionStorageNamespace::origins const):
41         (WebKit::SessionStorageNamespace::clearStorageAreasMatchingOrigin):
42         (WebKit::SessionStorageNamespace::clearAllStorageAreas):
43         * NetworkProcess/WebStorage/StorageArea.cpp:
44         (WebKit::StorageArea::StorageArea):
45         (WebKit::StorageArea::~StorageArea):
46         (WebKit::StorageArea::addListener):
47         (WebKit::StorageArea::removeListener):
48         (WebKit::StorageArea::hasListener const):
49         (WebKit::StorageArea::clone const):
50         (WebKit::StorageArea::setItem):
51         (WebKit::StorageArea::setItems):
52         (WebKit::StorageArea::removeItem):
53         (WebKit::StorageArea::clear):
54         (WebKit::StorageArea::items const):
55         (WebKit::StorageArea::openDatabaseAndImportItemsIfNeeded const):
56         (WebKit::StorageArea::dispatchEvents const):
57         * NetworkProcess/WebStorage/StorageManager.cpp:
58         (WebKit::StorageManager::createSessionStorageNamespace):
59         (WebKit::StorageManager::destroySessionStorageNamespace):
60         (WebKit::StorageManager::addAllowedSessionStorageNamespaceConnection):
61         (WebKit::StorageManager::removeAllowedSessionStorageNamespaceConnection):
62         (WebKit::StorageManager::cloneSessionStorageNamespace):
63         (WebKit::StorageManager::processDidCloseConnection):
64         (WebKit::StorageManager::getSessionStorageOrigins):
65         (WebKit::StorageManager::deleteSessionStorageOrigins):
66         (WebKit::StorageManager::deleteSessionStorageEntriesForOrigins):
67         (WebKit::StorageManager::getLocalStorageOrigins):
68         (WebKit::StorageManager::getLocalStorageOriginDetails):
69         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
70         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
71         (WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
72         (WebKit::StorageManager::waitUntilTasksFinished):
73         (WebKit::StorageManager::suspend):
74         (WebKit::StorageManager::resume):
75         (WebKit::StorageManager::findStorageArea const):
76         (WebKit::StorageManager::getOrCreateLocalStorageNamespace):
77         (WebKit::StorageManager::getOrCreateTransientLocalStorageNamespace):
78         * NetworkProcess/WebStorage/TransientLocalStorageNamespace.cpp:
79         (WebKit::TransientLocalStorageNamespace::TransientLocalStorageNamespace):
80         (WebKit::TransientLocalStorageNamespace::~TransientLocalStorageNamespace):
81         (WebKit::TransientLocalStorageNamespace::getOrCreateStorageArea):
82         (WebKit::TransientLocalStorageNamespace::origins const):
83         (WebKit::TransientLocalStorageNamespace::clearStorageAreasMatchingOrigin):
84         (WebKit::TransientLocalStorageNamespace::clearAllStorageAreas):
85
86 2019-08-08  Brent Fulgham  <bfulgham@apple.com>
87
88         [FTW] Get WebKit, WebKit2, and MiniBrowser building and executing
89         https://bugs.webkit.org/show_bug.cgi?id=200539
90         <rdar://problem/54082550>
91
92         Reviewed by Dean Jackson.
93
94         * PlatformFTW.cmake: Added.
95         * Shared/ShareableBitmap.h:
96         * Shared/win/ShareableBitmapDirect2D.cpp: Added.
97         * UIProcess/BackingStore.cpp:
98         * UIProcess/BackingStore.h:
99         (WebKit::BackingStore::renderTarget):
100         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
101         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h:
102         * UIProcess/win/BackingStoreDirect2D.cpp: Added.
103         * UIProcess/win/WebInspectorProxyWin.cpp:
104         (WebKit::WebInspectorProxy::inspectorPageURL):
105         (WebKit::WebInspectorProxy::inspectorTestPageURL):
106         (WebKit::WebInspectorProxy::inspectorBaseURL):
107         * UIProcess/win/WebView.cpp:
108         (WebKit::WebView::paint):
109         * UIProcess/win/WebView.h:
110         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
111         (WebKit::DrawingAreaCoordinatedGraphics::display):
112         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h:
113         * WebProcess/WebPage/win/WebInspectorUIWin.cpp:
114         (WebKit::WebInspectorUI::localizedStringsURL):
115         (WebKit::RemoteWebInspectorUI::localizedStringsURL):
116         * WebProcess/win/WebProcessMainWin.cpp:
117         (WebKit::WebProcessMainWin):
118
119 2019-08-08  Per Arne Vollan  <pvollan@apple.com>
120
121         [Mac] Use the PID of the WebContent process when issuing local file read sandbox extensions
122         https://bugs.webkit.org/show_bug.cgi?id=200543
123
124         Reviewed by Brent Fulgham.
125
126         Adopt SPI to issue a process-specific sandbox extension for local file read, passing it the process
127         identifier of the WebContent process.
128
129         * Shared/Cocoa/SandboxExtensionCocoa.mm:
130         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
131         (WebKit::SandboxExtension::createHandleForReadByPid):
132         * Shared/SandboxExtension.h:
133         * UIProcess/WebPageProxy.cpp:
134         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
135
136 2019-08-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
137
138         [iOS] Position image information should respect the image orientation
139         https://bugs.webkit.org/show_bug.cgi?id=200487
140
141         Reviewed by Simon Fraser.
142
143         imagePositionInformation() should respect the image orientation when
144         drawing an Image to a ShareableBitmap context.
145
146         boundsPositionInformation() already takes care of the image orientation
147         because it gets RenderImage::enclosingBoundingBox().
148
149         * WebProcess/WebPage/ios/WebPageIOS.mm:
150         (WebKit::imagePositionInformation):
151
152 2019-08-08  Timothy Hatcher  <timothy@apple.com>
153
154         Set WKWebView opaque based on drawsBackground in PageConfiguration.
155         https://bugs.webkit.org/show_bug.cgi?id=200528
156
157         Reviewed by Tim Horton.
158
159         * UIProcess/API/Cocoa/WKWebView.mm:
160         (-[WKWebView _initializeWithConfiguration:]): Set self.opaque = NO when !self.opaque || !pageConfiguration->drawsBackground().
161         It is almost impossible to have !self.opaque be NO at this point, since we are still inside initWithFrame:. A subclass could
162         override opaque and return NO, but checking pageConfiguration's drawsBackground is a good alternative.
163         * WebProcess/WebPage/WebPage.h: Remove unused m_drawsBackground member.
164
165 2019-08-08  Wenson Hsieh  <wenson_hsieh@apple.com>
166
167         [iOS 13] Taps that interrupt momentum scrolling are recognized as clicks
168         https://bugs.webkit.org/show_bug.cgi?id=200516
169         <rdar://problem/53889373>
170
171         Reviewed by Tim Horton.
172
173         After <https://trac.webkit.org/r247656>, the -tracksImmediatelyWhileDecelerating property of WKScrollView and
174         WKChildScrollView is set to NO. This means that if a user interacts with the page while the scroll view is
175         decelerating (e.g. after momentum scrolling), the pan gesture recognizer will not be immediately recognized.
176         This gives other gesture recognizers, such as the synthetic click (single tap) gesture a chance to instead
177         recognize first. In this particular bug, this causes taps on the web view that are intended to only stop
178         momentum scrolling to instead activate clickable elements beneath the touch, such as links and buttons.
179
180         To mitigate this, we add some logic to prevent the click gesture recognizer from firing in the case where the
181         tap also causes the scroll view to decelerate. This heuristic is similar to the one introduced in r219310, which
182         has the same purpose of hiding gestures that stop momentum scrolling from the page, and also consults
183         -[UIScrollView _isInterruptingDeceleration].
184
185         Tests:  fast/scrolling/ios/click-events-during-momentum-scroll-in-main-frame.html
186                 fast/scrolling/ios/click-events-during-momentum-scroll-in-overflow-after-tap-on-body.html
187                 fast/scrolling/ios/click-events-during-momentum-scroll-in-overflow.html
188
189         * UIProcess/ios/WKContentViewInteraction.mm:
190         (-[WKContentView gestureRecognizerShouldBegin:]):
191
192         Return NO in the case of the single tap gesture if the UIScrollView most recently touched by the single tap
193         gesture (or one of its enclosing scroll views, up to the main WKScrollView) is being interrupted while
194         decelerating.
195
196         * UIProcess/ios/WKSyntheticTapGestureRecognizer.h:
197         * UIProcess/ios/WKSyntheticTapGestureRecognizer.mm:
198         (-[WKSyntheticTapGestureRecognizer reset]):
199         (-[WKSyntheticTapGestureRecognizer touchesBegan:withEvent:]):
200
201         Teach WKSyntheticTapGestureRecognizer to keep track of the last WKScrollView that was touched, for later use in
202         -gestureRecognizerShouldBegin:. To do this, we keep a weak reference to the first UIScrollView we find in the
203         set of touches.
204
205         (-[WKSyntheticTapGestureRecognizer lastTouchedScrollView]):
206
207 2019-08-08  Dean Jackson  <dino@apple.com>
208
209         Use "safari" glyph for "Show Link Previews" contextual menu
210         https://bugs.webkit.org/show_bug.cgi?id=200544
211         <rdar://problem/54087842>
212
213         Reviewed by Tim Horton.
214
215         Use the system image for the compass.
216
217         * UIProcess/API/Cocoa/_WKElementAction.mm:
218         (+[_WKElementAction imageForElementActionType:]):
219
220 2019-08-08  Chris Dumez  <cdumez@apple.com>
221
222         Move classes declared inside StorageManager.cpp into their own headers
223         https://bugs.webkit.org/show_bug.cgi?id=200527
224
225         Reviewed by Alex Christensen.
226
227         Move classes declared inside StorageManager.cpp into their own headers
228         for clarity. StorageManager.cpp was getting really big.
229
230         * NetworkProcess/WebStorage/LocalStorageNamespace.cpp: Added.
231         (WebKit::LocalStorageNamespace::LocalStorageNamespace):
232         (WebKit::LocalStorageNamespace::~LocalStorageNamespace):
233         (WebKit::LocalStorageNamespace::getOrCreateStorageArea):
234         (WebKit::LocalStorageNamespace::clearStorageAreasMatchingOrigin):
235         (WebKit::LocalStorageNamespace::clearAllStorageAreas):
236         (WebKit::LocalStorageNamespace::ephemeralOrigins const):
237         (WebKit::LocalStorageNamespace::cloneTo):
238         * NetworkProcess/WebStorage/LocalStorageNamespace.h: Added.
239         (WebKit::LocalStorageNamespace::create):
240         (WebKit::LocalStorageNamespace::storageManager const):
241         * NetworkProcess/WebStorage/SessionStorageNamespace.cpp: Added.
242         (WebKit::SessionStorageNamespace::SessionStorageNamespace):
243         (WebKit::SessionStorageNamespace::~SessionStorageNamespace):
244         (WebKit::SessionStorageNamespace::addAllowedConnection):
245         (WebKit::SessionStorageNamespace::removeAllowedConnection):
246         (WebKit::SessionStorageNamespace::getOrCreateStorageArea):
247         (WebKit::SessionStorageNamespace::cloneTo):
248         (WebKit::SessionStorageNamespace::origins const):
249         (WebKit::SessionStorageNamespace::clearStorageAreasMatchingOrigin):
250         (WebKit::SessionStorageNamespace::clearAllStorageAreas):
251         * NetworkProcess/WebStorage/SessionStorageNamespace.h: Added.
252         (WebKit::SessionStorageNamespace::create):
253         (WebKit::SessionStorageNamespace::isEmpty const):
254         (WebKit::SessionStorageNamespace::allowedConnections const):
255         * NetworkProcess/WebStorage/StorageArea.cpp: Added.
256         (WebKit::StorageArea::StorageArea):
257         (WebKit::StorageArea::~StorageArea):
258         (WebKit::StorageArea::addListener):
259         (WebKit::StorageArea::removeListener):
260         (WebKit::StorageArea::hasListener const):
261         (WebKit::StorageArea::clone const):
262         (WebKit::StorageArea::setItem):
263         (WebKit::StorageArea::setItems):
264         (WebKit::StorageArea::removeItem):
265         (WebKit::StorageArea::clear):
266         (WebKit::StorageArea::items const):
267         (WebKit::StorageArea::openDatabaseAndImportItemsIfNeeded const):
268         (WebKit::StorageArea::dispatchEvents const):
269         * NetworkProcess/WebStorage/StorageArea.h: Added.
270         (WebKit::StorageArea::create):
271         (WebKit::StorageArea::securityOrigin const):
272         (WebKit::StorageArea::isEphemeral const):
273         * NetworkProcess/WebStorage/StorageManager.cpp:
274         (WebKit::StorageManager::createLocalStorageMap):
275         (WebKit::StorageManager::findStorageArea const):
276         (WebKit::StorageManager::getOrCreateLocalStorageNamespace):
277         (WebKit::StorageManager::getOrCreateTransientLocalStorageNamespace):
278         * NetworkProcess/WebStorage/StorageManager.h:
279         (WebKit::StorageManager::create):
280         (WebKit::StorageManager::localStorageDatabaseTracker const):
281         (WebKit::StorageManager::workQueue const):
282         * NetworkProcess/WebStorage/TransientLocalStorageNamespace.cpp: Added.
283         (WebKit::TransientLocalStorageNamespace::TransientLocalStorageNamespace):
284         (WebKit::TransientLocalStorageNamespace::~TransientLocalStorageNamespace):
285         (WebKit::TransientLocalStorageNamespace::getOrCreateStorageArea):
286         (WebKit::TransientLocalStorageNamespace::origins const):
287         (WebKit::TransientLocalStorageNamespace::clearStorageAreasMatchingOrigin):
288         (WebKit::TransientLocalStorageNamespace::clearAllStorageAreas):
289         * NetworkProcess/WebStorage/TransientLocalStorageNamespace.h: Added.
290         (WebKit::TransientLocalStorageNamespace::create):
291         * NetworkProcess/cache/NetworkCache.cpp:
292         (WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):
293         * Sources.txt:
294         * WebKit.xcodeproj/project.pbxproj:
295
296 2019-08-08  Rob Buis  <rbuis@igalia.com>
297
298         Add runtime flag for lazy image loading
299         https://bugs.webkit.org/show_bug.cgi?id=199794
300
301         Reviewed by Darin Adler.
302
303         Add LazyImageLoading preference.
304
305         * Shared/WebPreferences.yaml:
306         * UIProcess/API/C/WKPreferences.cpp:
307         (WKPreferencesSetLazyImageLoadingEnabled):
308         (WKPreferencesGetLazyImageLoadingEnabled):
309         * UIProcess/API/C/WKPreferencesRefPrivate.h:
310
311 2019-08-07  Chris Dumez  <cdumez@apple.com>
312
313         Turn some ITP threading ASSERTs into RELEASE_ASSERTs
314         https://bugs.webkit.org/show_bug.cgi?id=200521
315
316         Reviewed by Ryosuke Niwa.
317
318         Turn some ITP threading ASSERTs into RELEASE_ASSERTs to help catch more bugs.
319
320         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
321         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
322         (WebKit::ResourceLoadStatisticsMemoryStore::isEmpty const):
323         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp:
324         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
325         (WebKit::ResourceLoadStatisticsPersistentStorage::~ResourceLoadStatisticsPersistentStorage):
326         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
327         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
328         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
329         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
330
331 2019-08-07  Kate Cheney  <katherine_cheney@apple.com>
332
333         Adopt non-deprecated CGColorSpace API
334         https://bugs.webkit.org/show_bug.cgi?id=184358
335
336         Reviewed by Darin Adler.
337
338         * Shared/mac/ColorSpaceData.mm:
339         (WebKit::ColorSpaceData::decode):
340
341         We changed the deprecated CGColorSpaceCreateWithICCProfile function to 
342         CGColorSpaceCreateWithICCData. 
343
344 2019-08-07  Alex Christensen  <achristensen@webkit.org>
345
346         Remove speculative workaround for upload crash
347         https://bugs.webkit.org/show_bug.cgi?id=200514
348
349         Reviewed by Geoffrey Garen.
350
351         This workaround didn't help anyways, and the crash has been resolved.  Let's clean up.
352
353         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
354         (-[WKNetworkSessionDelegate URLSession:task:needNewBodyStream:]):
355
356 2019-08-07  Chris Dumez  <cdumez@apple.com>
357
358         Regression(r247784) ResourceLoadStatisticsMemoryStore / ResourceLoadStatisticsPersistentStorage may get destroyed on the wrong thread
359         https://bugs.webkit.org/show_bug.cgi?id=200517
360
361         Reviewed by Geoffrey Garen.
362
363         The issue is that WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore() is null checking
364         m_persistentStorage and m_statisticsStore on the main thread, even though those members are initialized
365         and destroyed on the background thread. As a result, if flushAndDestroyPersistentStore() is called *before*
366         the background task to initialize those members has had a chance to run, then we'd return early without
367         destroying those members. Later on, the background task would then initialize those data members and we
368         would then destroy them on the main thread when the WebResourceLoadStatisticsStore is destroyed on the
369         main thread.
370
371         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
372         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
373
374 2019-08-06  Dean Jackson  <dino@apple.com>
375
376         Context menu on a universal link produces a blank preview
377         https://bugs.webkit.org/show_bug.cgi?id=200485
378         <rdar://problem/53699620>
379
380         Reviewed by Tim Horton.
381
382         If the context menu is activated on an iTunesStore URL, pass it
383         on to DataDetectors, who should know how to handle it.
384
385         Two drive-by fixes:
386         - make it clear that early returns do not produce a value. Instead call the
387           completion handler first, then return.
388         - The new API DataDetectors case doesn't need to worry about hiding link previews
389           as DataDetectors itself will handle that.
390
391         * UIProcess/ios/WKContentViewInteraction.mm: If the URL is an iTunesStoreURL
392         (as defined by CoreServices), let DataDetectors handle it.
393         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
394         (-[WKContentView continueContextMenuInteraction:]):
395         (-[WKContentView continueContextMenuInteractionWithDataDetectors:]): New method to
396         use DataDetectors if possible.
397
398 2019-08-08  Simon Fraser  <simon.fraser@apple.com>
399
400         Add to InteractionInformationAtPosition information about whether the element is in a subscrollable region
401         https://bugs.webkit.org/show_bug.cgi?id=200374
402         rdar://problem/54095519
403
404         Reviewed by Tim Horton.
405         
406         Add InteractionInformationAtPosition.containerScrollingNodeID and initialize it in elementPositionInformation()
407         by asking the scrolling coordinator.
408         
409         Also add a way to get from a ScrollingNodeID to a UIScrollView to RemoteScrollingCoordinatorProxy,
410         which gets the scrolling node and asks the delegate for the UIView.
411
412         * Shared/ios/InteractionInformationAtPosition.h:
413         * Shared/ios/InteractionInformationAtPosition.mm:
414         (WebKit::InteractionInformationAtPosition::encode const):
415         (WebKit::InteractionInformationAtPosition::decode):
416         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
417         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
418         (WebKit::RemoteScrollingCoordinatorProxy::scrollViewForScrollingNodeID const):
419         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
420         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
421         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollView const):
422         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
423         * WebProcess/WebPage/ios/WebPageIOS.mm:
424         (WebKit::elementPositionInformation):
425
426 2019-08-07  Priyanka Agarwal  <pagarwal999@apple.com>
427
428         Allow clients to toggle a text input field between being viewable and having characters hidden while maintaining 
429         a yellow auto-filled appearance
430         https://bugs.webkit.org/show_bug.cgi?id=200037
431         rdar://problem/51900961
432
433         Reviewed by Daniel Bates.
434
435         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
436         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
437         (-[WKWebProcessPlugInNodeHandle HTMLInputElementIsAutoFilledAndViewable]):
438         Accessor function for boolean which represents if the input element is autofilled and viewable.
439
440         (-[WKWebProcessPlugInNodeHandle setHTMLInputElementIsAutoFilledAndViewable:]):
441         Setter function for boolean which represents if the input element is autofilled and viewable.
442
443         * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
444         (WKBundleNodeHandleSetHTMLInputElementAutoFilledAndViewable):
445         Accessor function for boolean which represents if the input element is autofilled and viewable.
446
447        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
448         Creating function declaration for boolean setter.
449
450         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
451         Accessor function for boolean which represents if the input element is autofilled and viewable.
452
453         (WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutoFilledAndViewable const):
454         Setter function for boolean which represents if the input element is autofilled and viewable.
455
456         (WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutoFilledAndViewable):
457         Setter function for boolean which represents if the input element is autofilled and viewable.
458
459         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
460         Adding setter and getter functions for the boolean which represents if the input element is autofilled
461         and viewable.
462
463 2019-08-07  Chris Dumez  <cdumez@apple.com>
464
465         Add more threading assertions to ITP code
466         https://bugs.webkit.org/show_bug.cgi?id=200505
467
468         Reviewed by Brent Fulgham.
469
470         Add more threading assertions to ITP code to help catch bugs and protect against future bad usage.
471
472         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
473         (WebKit::ResourceLoadStatisticsMemoryStore::isEmpty const):
474         (WebKit::ResourceLoadStatisticsMemoryStore::setPersistentStorage):
475         (WebKit::ResourceLoadStatisticsMemoryStore::incrementRecordsDeletedCountForDomains):
476         (WebKit::ResourceLoadStatisticsMemoryStore::classifyPrevalentResources):
477         (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageIfNeeded):
478         (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageImmediately):
479         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherDataForDomains):
480         (WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode):
481         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
482         (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const):
483         (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates):
484         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
485         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccessForFrame):
486         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
487         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
488         (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
489         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
490         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading):
491         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading):
492         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect):
493         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
494         (WebKit::WebResourceLoadStatisticsStore::removePrevalentDomains):
495         (WebKit::WebResourceLoadStatisticsStore::networkSession):
496         (WebKit::WebResourceLoadStatisticsStore::invalidateAndCancel):
497         (WebKit::WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue const):
498         (WebKit::WebResourceLoadStatisticsStore::notifyPageStatisticsTelemetryFinished const):
499
500 2019-08-07  Ryan Haddad  <ryanhaddad@apple.com>
501
502         Unreviewed, rolling out r248330.
503
504         Breaks internal builds.
505
506         Reverted changeset:
507
508         "Context menu on a universal link produces a blank preview"
509         https://bugs.webkit.org/show_bug.cgi?id=200485
510         https://trac.webkit.org/changeset/248330
511
512 2019-08-06  Ryosuke Niwa  <rniwa@webkit.org>
513
514         [iPadOS] slides.google.com: tapping near cursor in a slide title focuses the speaker notes
515         https://bugs.webkit.org/show_bug.cgi?id=200216
516
517         Reviewed by Wenson Hsieh.
518
519         The bug was caused by a race condition between Google slides removing inputmode="none" from the hidden
520         content editable and updating the focused region upon receiving a pointerup event, which happens after
521         the Google slides had already updated its page layout & coordinates based on new visual viewport with
522         the software keyboard's boudning rect taken into account.
523
524         Delay bringing up the software keyboard for a inputmode change until all touches are released.
525
526         In the future, we could consider also delaying the software keyboard to be brought in general until
527         touchend / pointerup events are dispatched but this is rather risky since that could affact random
528         other websites while Google suites is the only major site to make use of inputmode="none".
529
530         This patch also reverts r243044, which was added for Google slides, since it's no longer needed and
531         interferes with this patch by adding another way to bring up the software keyboard.
532
533         Note: Adjusting touchend / pointerup coordinates while the keyboard is being brought up doesn't work
534         because the page had already updated the layout by then based on new visual viewport size.
535
536         Test: fast/forms/ios/inputmode-change-update-keyboard-after-pointerup.html
537
538         * UIProcess/WebPageProxy.cpp:
539         (WebKit::WebPageProxy::handleTouchEventSynchronously): Call didReleaseAllTouchPoints when all
540         touches are released.
541         (WebKit::WebPageProxy::handleTouchEventAsynchronously): Ditto.
542         (WebKit::WebPageProxy::handleTouchEvent): Ditto.
543         * UIProcess/WebPageProxy.h:
544         (WebKit::WebPageProxy::didReleaseAllTouchPoints): Added for non-iOS platforms.
545         (WebKit::WebPageProxy::m_pendingInputModeChange): Added. Used when inputmode is changed while
546         there is an on-going touch interaction.
547         * UIProcess/ios/WebPageProxyIOS.mm:
548         (WebKit::WebPageProxy::elementDidFocus): Clear m_pendingInputModeChange when a new element is focused.
549         (WebKit::WebPageProxy::elementDidBlur): Ditto for bluring.
550         (WebKit::WebPageProxy::focusedElementDidChangeInputMode): Don't bring up the software keyboard now if
551         there are on-going touches by exiting early after setting m_pendingInputModeChange.
552         (WebKit::WebPageProxy::didReleaseAllTouchPoints): Bring up the software keyboard if inputmode
553         had changed from "none" to something else.
554         * WebProcess/WebPage/WebPage.cpp:
555         (WebKit::WebPage::dispatchTouchEvent): Removed the code added by r243044.
556
557 2019-08-06  Fujii Hironori  <Hironori.Fujii@sony.com>
558
559         ASSERTION FAILED: m_observers.isEmpty() if WKPageSetPageStateClient is used
560         https://bugs.webkit.org/show_bug.cgi?id=200465
561
562         Reviewed by Alex Christensen.
563
564         PageLoadState::Observer should be removed before destructing
565         WebPageProxy.
566
567         * UIProcess/WebPageProxy.cpp:
568         (WebKit::WebPageProxy::~WebPageProxy): Call
569         setPageLoadStateObserver with nullptr to remove
570         PageLoadState::Observer.
571
572 2019-08-06  Chris Dumez  <cdumez@apple.com>
573
574         Add release assertions to help catch a bug in our WebProcessCache implementation
575         https://bugs.webkit.org/show_bug.cgi?id=200483
576
577         Reviewed by Geoffrey Garen.
578
579         Add release assertions to help catch a bug in our WebProcessCache implementation. We
580         have evidence (rdar://problem/53962494) that we have processes with a page which
581         starts a provisional load while the process is in the WebProcessCache. This should
582         not be possible.
583
584         * UIProcess/WebProcessProxy.cpp:
585         (WebKit::WebProcessProxy::setIsInProcessCache):
586         (WebKit::WebProcessProxy::addExistingWebPage):
587
588 2019-08-06  Dean Jackson  <dino@apple.com>
589
590         Context menu on a universal link produces a blank preview
591         https://bugs.webkit.org/show_bug.cgi?id=200485
592         <rdar://problem/53699620>
593
594         Reviewed by Dean Jackson.
595
596         If the context menu is activated on an iTunesStore URL, pass it
597         on to DataDetectors, who should know how to handle it.
598
599         Two drive-by fixes:
600         - make it clear that early returns do not produce a value. Instead call the
601           completion handler first, then return.
602         - The new API DataDetectors case doesn't need to worry about hiding link previews
603           as DataDetectors itself will handle that.
604
605         * UIProcess/ios/WKContentViewInteraction.mm: If the URL is an iTunesStoreURL
606         (as defined by CoreServices), let DataDetectors handle it.
607         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
608         (-[WKContentView continueContextMenuInteraction:]):
609         (-[WKContentView continueContextMenuInteractionWithDataDetectors:]): New method to
610         use DataDetectors if possible.
611
612 2019-08-06  Chris Dumez  <cdumez@apple.com>
613
614         Avoid unnecessary ResourceRequest copy under NetworkResourceLoader::isCrossOriginPrefetch()
615         https://bugs.webkit.org/show_bug.cgi?id=200478
616
617         Reviewed by Youenn Fablet.
618
619         * NetworkProcess/NetworkResourceLoader.cpp:
620         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const):
621
622 2019-08-06  Jiewen Tan  <jiewen_tan@apple.com>
623
624         Unreviewed, a build fix after r248319
625
626         Use HAVE(DATA_PROTECTION_KEYCHAIN) instead of HAVE_DATA_PROTECTION_KEYCHAIN.
627
628         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
629         (WebKit::LocalAuthenticator::makeCredential):
630         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented):
631         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
632         (WebKit::LocalAuthenticator::getAssertion):
633         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
634
635 2019-08-06  Jiewen Tan  <jiewen_tan@apple.com>
636
637         Unreviewed, a build fix after r248308
638
639         Use kSecUseDataProtectionKeychain for iOS 13 and macOS Catalina or newer.
640
641         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
642         (WebKit::LocalAuthenticator::makeCredential):
643         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented):
644         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
645         (WebKit::LocalAuthenticator::getAssertion):
646         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
647
648 2019-08-06  Chris Dumez  <cdumez@apple.com>
649
650         Unreviewed, fix internal iOS build after r248308.
651
652         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
653         (WebKit::LocalAuthenticator::makeCredential):
654
655 2019-08-06  Jiewen Tan  <jiewen_tan@apple.com>
656
657         [WebAuthN] Enable LocalAuthenticator for macOS
658         https://bugs.webkit.org/show_bug.cgi?id=182772
659         <rdar://problem/43347920>
660
661         Reviewed by Brent Fulgham.
662
663         This patch enables LocalAuthenticator for macOS. The majority
664         of this patch is to tweak macOS keychain to use the modern one.
665
666         * Configurations/WebKit.xcconfig:
667         * Platform/spi/Cocoa/DeviceIdentitySPI.h:
668         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
669         (WebKit::LocalAuthenticatorInternal::toVector):
670         (WebKit::LocalAuthenticator::makeCredential):
671         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented):
672         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
673         (WebKit::LocalAuthenticator::getAssertion):
674         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
675         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
676         (WebKit::LocalConnection::getUserConsent const):
677         (WebKit::LocalConnection::getAttestation const):
678         * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
679         (WebKit::LocalService::isAvailable):
680         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
681         (WebKit::MockLocalConnection::getAttestation const):
682         * config.h:
683
684 2019-08-06  Jer Noble  <jer.noble@apple.com>
685
686         Add test for behavior introduced in r248174
687         https://bugs.webkit.org/show_bug.cgi?id=200446
688
689         Reviewed by Eric Carlson.
690
691         Add a new helper struct, FullscreenTouchSecheuristicParameters, and static getter,
692         iosParameters(), to allow the settings used by WKFullScreenViewController to be tested
693         in TestWebKitAPI. Make both of the Secheuristic classes privately exported as well.
694
695         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.cpp:
696         (WebKit::FullscreenTouchSecheuristic::scoreOfNextTouch):
697         (WebKit::FullscreenTouchSecheuristic::reset):
698         (WebKit::FullscreenTouchSecheuristic::distanceScore):
699         (WebKit::FullscreenTouchSecheuristic::attenuationFactor):
700         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.h:
701         (WebKit::FullscreenTouchSecheuristic::setParameters):
702         (WebKit::FullscreenTouchSecheuristic::requiredScore const):
703         (WebKit::FullscreenTouchSecheuristic::setRampUpSpeed):
704         (WebKit::FullscreenTouchSecheuristic::setRampDownSpeed):
705         (WebKit::FullscreenTouchSecheuristic::setXWeight):
706         (WebKit::FullscreenTouchSecheuristic::setYWeight):
707         (WebKit::FullscreenTouchSecheuristic::setGamma):
708         (WebKit::FullscreenTouchSecheuristic::setGammaCutoff):
709         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristicParameters.cpp: Copied from Source/WebKit/UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.h.
710         (WebKit::FullscreenTouchSecheuristicParameters::iosParameters):
711         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristicParameters.h: Copied from Source/WebKit/UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.h.
712         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
713         (-[WKFullScreenViewController initWithWebView:]):
714         (-[WKFullScreenViewController _touchDetected:]):
715         * WebKit.xcodeproj/project.pbxproj:
716
717 2019-08-06  Claudio Saavedra  <csaavedra@igalia.com>
718
719         [GLIB] Fix documentation typo
720
721         Unreviewed.
722
723         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
724
725 2019-08-05  Fujii Hironori  <Hironori.Fujii@sony.com>
726
727         [Win][MiniBrowser][WK2] Unhandled key events should be bubbled up to the parent window
728         https://bugs.webkit.org/show_bug.cgi?id=200464
729
730         Reviewed by Ross Kirsling.
731
732         * UIProcess/API/C/WKNativeEvent.h: Define WKNativeEventPtr for WIN32.
733
734 2019-08-05  Youenn Fablet  <youenn@apple.com>
735
736         Support RTCRtpSender.dtmf
737         https://bugs.webkit.org/show_bug.cgi?id=200431
738
739         Reviewed by Eric Carlson.
740
741         * Shared/WebPreferences.yaml:
742
743 2019-08-05  Simon Fraser  <simon.fraser@apple.com>
744
745         iOS 13: Overflow:hidden on body prevents PDF scroll
746         https://bugs.webkit.org/show_bug.cgi?id=200435
747         rdar://problem/53942888
748
749         Reviewed by Tim Horton.
750
751         When we navigate from an overflow:hidden HTML page to a custom view (like PDF), we need
752         to make sure that the scroll view is scrollable.
753
754         * UIProcess/API/Cocoa/WKWebView.mm:
755         (-[WKWebView _setHasCustomContentView:loadedMIMEType:]):
756
757 2019-08-05  John Wilander  <wilander@apple.com>
758
759         Resource Load Statistics: Re-introduce latch mode for subresource cookie blocking
760         https://bugs.webkit.org/show_bug.cgi?id=200395
761         <rdar://problem/53869611>
762
763         Reviewed by Darin Adler.
764
765         Back when we had a relaxation of cookie blocking 24 hours after first-party user
766         interaction, we made sure cookie blocking could be turned on and off in subresource
767         redirect chains. The 24 hour window is now long gone. This patch simplifies the
768         cookie blocking so that once a subresource request is denied cookies, any
769         subsequent redirect of that request will also be denied cookies, regardless of the
770         classification status of the domains involved. I call it latch mode.
771
772         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
773         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
774         (WebKit::NetworkDataTaskCocoa::blockCookies):
775         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
776         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
777         (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy): Deleted.
778
779 2019-08-05  Youenn Fablet  <youenn@apple.com>
780
781         Disable speculative loading if cache is not to be used for the load
782         https://bugs.webkit.org/show_bug.cgi?id=199644
783
784         Reviewed by Alex Christensen.
785
786         When the page is reloaded, loads are instructed to not use the cache.
787         It is therefore unneeded to do speculative revalidation.
788         Allow speculative revalidation if the cache policy is either the default HTTP policy or
789         if policy is to refresh all cache data.
790         Covered by added test.
791
792         * NetworkProcess/cache/NetworkCache.cpp:
793         (WebKit::NetworkCache::cachePolicyValidForSpeculativeRevalidation):
794         (WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):
795
796 2019-08-04  Konstantin Tokarev  <annulen@yandex.ru>
797
798         Remove unused lambda capture in MemoryPressureMonitor
799         https://bugs.webkit.org/show_bug.cgi?id=200420
800
801         Reviewed by Darin Adler.
802
803         * UIProcess/linux/MemoryPressureMonitor.cpp:
804         (WebKit::MemoryPressureMonitor::start):
805
806 2019-08-03  Konstantin Tokarev  <annulen@yandex.ru>
807
808         Fix compilation with disabled WebGL
809         https://bugs.webkit.org/show_bug.cgi?id=200421
810
811         Reviewed by Wenson Hsieh.
812
813         After r247452 webGLStateTracker is guarded with #if ENABLE(WEBGL)
814
815         * WebProcess/WebPage/WebPage.cpp:
816         (WebKit::m_textAutoSizingAdjustmentTimer):
817
818 2019-08-02  Keith Rollin  <krollin@apple.com>
819
820         Consistently use Obj-C boolean literals
821         https://bugs.webkit.org/show_bug.cgi?id=200405
822         <rdar://problem/53880043>
823
824         Reviewed by Simon Fraser, Joseph Pecoraro.
825
826         There are places where we use equivalent but different expressions for
827         Obj-C boolean objects. For example, we use both [NSNumber
828         numberWithBool:YES] and @YES. There are places where both are used in
829         the same function, such as -[WebPreferences initialize]. The boolean
830         literal is in greater use and is more succinct, so standardize on
831         that. Also, change @(YES/NO) to @YES/NO.
832
833         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
834         (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
835         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
836         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
837         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
838         (WebKit::LocalConnection::getAttestation const):
839
840 2019-08-02  Sihui Liu  <sihui_liu@apple.com>
841
842         API tests using permanent credentials should clear credentials left by previous tests
843         https://bugs.webkit.org/show_bug.cgi?id=199729
844
845         Reviewed by Alex Christensen.
846
847         Permanent password credentials currently are shared across processes, so we don't need to clear them from 
848         network process.
849
850         * NetworkProcess/NetworkProcess.cpp:
851         (WebKit::NetworkProcess::clearPermanentCredentialsForProtectionSpace): Deleted.
852         * NetworkProcess/NetworkProcess.h:
853         * NetworkProcess/NetworkProcess.messages.in:
854         * UIProcess/API/Cocoa/WKProcessPool.mm:
855         (-[WKProcessPool _clearPermanentCredentialsForProtectionSpace:]):
856         (-[WKProcessPool _clearPermanentCredentialsForProtectionSpace:completionHandler:]): Deleted.
857         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
858         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
859         (WebKit::WebProcessPool::clearPermanentCredentialsForProtectionSpace):
860         * UIProcess/WebProcessPool.cpp:
861         (WebKit::WebProcessPool::clearPermanentCredentialsForProtectionSpace): Deleted.
862         * UIProcess/WebProcessPool.h:
863
864 2019-08-02  Devin Rousso  <drousso@apple.com>
865
866         Web Inspector: Timelines: Develop > Start Timeline Recording doesn't work when focused on a detached inspector window
867         https://bugs.webkit.org/show_bug.cgi?id=200125
868         <rdar://problem/53543008>
869
870         Reviewed by Brian Burg.
871
872         Always show the Timelines tab in Web Inspector whenever timeline recording starts/stops.
873         Notify the UIProcess whenever the timeline recording state changes.
874
875         * WebProcess/WebPage/WebInspector.messages.in:
876         * WebProcess/WebPage/WebInspector.h:
877         * WebProcess/WebPage/WebInspector.cpp:
878         (WebKit::WebInspector::startPageProfiling):
879         (WebKit::WebInspector::stopPageProfiling):
880         (WebKit::WebInspector::timelineRecordingChanged): Added.
881         (WebKit::WebInspector::showTimelines): Deleted.
882
883         * WebProcess/WebPage/WebInspectorUI.messages.in:
884         * WebProcess/WebPage/WebInspectorUI.h:
885         * WebProcess/WebPage/WebInspectorUI.cpp:
886         (WebKit::WebInspectorUI::showTimelines): Deleted.
887
888         * WebProcess/WebCoreSupport/WebInspectorClient.h:
889         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
890         (WebKit::WebInspectorClient::timelineRecordingChanged): Added.
891
892         * UIProcess/WebInspectorProxy.messages.in:
893         * UIProcess/WebInspectorProxy.h:
894         * UIProcess/WebInspectorProxy.cpp:
895         (WebKit::WebInspectorProxy::togglePageProfiling):
896         (WebKit::WebInspectorProxy::timelineRecordingChanged): Added.
897         (WebKit::WebInspectorProxy::showTimelines): Deleted.
898
899         * UIProcess/API/C/WKInspector.cpp:
900         (WKInspectorTogglePageProfiling):
901
902         * UIProcess/API/Cocoa/_WKInspector.h:
903         * UIProcess/API/Cocoa/_WKInspector.mm:
904         (-[_WKInspector showTimelines]): Deleted.
905
906         * WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp:
907         (WKBundleInspectorSetPageProfilingEnabled):
908
909 2019-08-02  Jer Noble  <jer.noble@apple.com>
910
911         [iPadOS] slides.google.com: Full Screen API warning is presented when swiping through slides
912         https://bugs.webkit.org/show_bug.cgi?id=200313
913         <rdar://problem/53777001>
914
915         Reviewed by Eric Carlson.
916
917         Only run the secheuristic scoring during UIGestureRecognizerStateEnded, rather than both
918         UIGestureRecognizerStateEnded and UIGestureRecognizerStateBegan. The goal of the heuristic is
919         to detect fake on-screen keyboards by detecting gestures that look like "typing". Using only
920         UIGestureRecognizerStateEnded still allows us to do this (as typing will usually have identical
921         geometries for both Ended and Began) without generating false-positives during swipe gestures.
922
923         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
924         (-[WKFullScreenViewController _touchDetected:]):
925
926 2019-08-02  Wenson Hsieh  <wenson_hsieh@apple.com>
927
928         [macOS 10.15] Image dragged from Safari does not appear in Notes
929         https://bugs.webkit.org/show_bug.cgi?id=188490
930         <rdar://problem/39462717>
931
932         Reviewed by Andy Estes.
933
934         Removes some logic that clears out the cached promised drag image in the UI process when WebKit is asked to
935         provide TIFF image data. This prevents the drop destination from asking for promised image data, if anything
936         else (e.g. the system) also asks the web view to provide the same data. Additionally, this logic didn't
937         previously guarantee that the promised image would be cleared anyways, since it is dependent on the drop target
938         actually requesting the promised image in order to perform the cleanup.
939
940         In lieu of clearing the promised drag image when it's requested, we instead clear it out upon mainframe
941         navigation, in PageClientImpl::didCommitLoadForMainFrame.
942
943         Test: DragAndDropTests.MultiplePromisedImageDataRequests
944
945         * UIProcess/Cocoa/WebViewImpl.h:
946         * UIProcess/Cocoa/WebViewImpl.mm:
947         (WebKit::WebViewImpl::clearPromisedDragImage):
948         (WebKit::WebViewImpl::pasteboardChangedOwner):
949         (WebKit::WebViewImpl::provideDataForPasteboard):
950
951         Fix the bug by not immediately clearing out the promised drag image.
952
953         * UIProcess/mac/PageClientImplMac.mm:
954         (WebKit::PageClientImpl::didCommitLoadForMainFrame):
955
956 2019-08-02  Keith Rollin  <krollin@apple.com>
957
958         macCatalyst build fails the first attempt, requires a second build
959         https://bugs.webkit.org/show_bug.cgi?id=200242
960         <rdar://problem/53678481>
961
962         macCatalyst builds fail the first time with an error like:
963
964             Code Signing Error: The file
965             "/Users/tim_cook/Build/Debug-maccatalyst/DerivedSources/WebKit2/WebContent-macCatalyst-no-sandbox.entitlements"
966             could not be opened. Verify the value of the
967             CODE_SIGN_ENTITLEMENTS build setting for target "WebContent" is
968             correct and that the file exists on disk.
969
970         This problem is caused by the file referenced by
971         CODE_SIGN_ENTITLEMENTS changing during the build process. For
972         macCatalyst builds, we start with the iOS entitlements files and then
973         tweak them for macCatalyst. When this occurs during a clean build,
974         Xcode sees the entitlements file being generated and complains about
975         it. Restarting the build does so with the file already existing, and
976         so Xcode does not complain about it.
977
978         The approach of generating or tweaking entitlement files may have
979         worked in the past, but the fact is that Xcode doesn't support it.
980
981         We had a similar problem with macOS builds. The entitlements files
982         used to be generated on the fly with scripts like
983         WebKit/Scripts/process-network-sandbox-entitlements.sh. That process
984         was reworked to avoid the issue with Xcode not allowing the files to
985         be generated (see r241135). In short:
986
987         o The various process-*-entitlements.sh scripts were consolidated into
988           a single process-entitlements file
989         o CODE_SIGN_ENTITLEMENTS, which contains the name of the entitlements
990           file to use, was de-initialized so that Xcode would not try to
991           access our generated entitlements file
992         o CODE_SIGN_INJECT_BASE_ENTITLEMENTS (which injects some base
993           entitlements) was set to NO. If it were left set to YES, Xcode would
994           create its own entitlements file and use it as if it were specified
995           in CODE_SIGN_ENTITLEMENTS
996         o WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS was updated with an
997           "--entitlements <generated_file>" option.
998           WK_LIBRARY_VALIDATION_CODE_SIGN_FLAGS was then used to initialize
999           OTHER_CODE_SIGN_FLAGS. By specifying the entitlements file this way,
1000           we avoid Xcode complaining about it.
1001
1002         This approach works well for macOS, and so we now also use it to
1003         address the issue with macCatalyst. While we're at it, convert the
1004         rest of the platforms to use the same approach and also generate their
1005         entitlements from the process-entitlements script.
1006
1007         The new process was validated by performing a build with the old
1008         process and the new process, and then comparing the entitlements of
1009         the resulting XPC services to make sure they were the same. Builds
1010         were performed for all platforms, and for Engineering and Production
1011         builds.
1012
1013         Reviewed by Brent Fulgham.
1014
1015         * Configurations/BaseXPCService.xcconfig:
1016         * Configurations/Network-iOS.entitlements: Removed.
1017         * Configurations/Network-macCatalyst.entitlements: Removed.
1018         * Configurations/NetworkService.xcconfig:
1019         * Configurations/PluginService.64.xcconfig:
1020         * Configurations/PluginService.entitlements: Removed.
1021         * Configurations/WebContent-iOS.entitlements: Removed.
1022         * Configurations/WebContent-macCatalyst.entitlements: Removed.
1023         * Configurations/WebContentService.Development.xcconfig:
1024         * Configurations/WebContentService.xcconfig:
1025         * Scripts/copy-webcontent-resources-to-private-headers.sh:
1026         * Scripts/process-entitlements.sh:
1027         * WebKit.xcodeproj/project.pbxproj:
1028
1029 2019-08-02  Carlos Garcia Campos  <cgarcia@igalia.com>
1030
1031         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.25.4 release
1032
1033         * gtk/NEWS: Add release notes for 2.25.4.
1034
1035 2019-08-02  Carlos Garcia Campos  <cgarcia@igalia.com>
1036
1037         [SOUP] WebSockets: use SOUP_WEBSOCKET_CLOSE_NO_STATUS when closing with no status
1038         https://bugs.webkit.org/show_bug.cgi?id=200338
1039
1040         Reviewed by Alex Christensen.
1041
1042         * NetworkProcess/soup/WebSocketTaskSoup.cpp:
1043         (WebKit::WebSocketTask::close):
1044
1045 2019-08-01  Alex Christensen  <achristensen@webkit.org>
1046
1047         Do not send NetworkProcessProxy::LogTestingEvent message if we are not testing
1048         https://bugs.webkit.org/show_bug.cgi?id=200360
1049
1050         Reviewed by Tim Horton.
1051
1052         Sending this message causes instantiation of the default WebsiteDataStore in the UIProcess,
1053         which causes more memory to be used than is needed if we are browsing without the default WebsiteDataStore.
1054
1055         Covered by an API test.
1056
1057         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1058         (WebKit::WebResourceLoadStatisticsStore::logTestingEvent):
1059         * NetworkProcess/NetworkSession.cpp:
1060         (WebKit::NetworkSession::NetworkSession):
1061         * NetworkProcess/NetworkSession.h:
1062         (WebKit::NetworkSession::enableResourceLoadStatisticsLogTestingEvent const):
1063         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1064         (WebKit::NetworkSessionCreationParameters::encode const):
1065         (WebKit::NetworkSessionCreationParameters::decode):
1066         * NetworkProcess/NetworkSessionCreationParameters.h:
1067         * UIProcess/WebProcessPool.cpp:
1068         (WebKit::WebProcessPool::ensureNetworkProcess):
1069         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1070         (WebKit::WebsiteDataStore::parameters):
1071         * UIProcess/WebsiteData/WebsiteDataStore.h:
1072         (WebKit::WebsiteDataStore::hasStatisticsTestingCallback const):
1073
1074 2019-08-01  Alex Christensen  <achristensen@webkit.org>
1075
1076         Move FormData zip file generation to NetworkProcess and enable it for all WebKit clients for uploading directories
1077         https://bugs.webkit.org/show_bug.cgi?id=200102
1078         <rdar://problem/53275114>
1079
1080         Reviewed by Darin Adler.
1081
1082         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1083         (WebKit::NetworkResourceLoadParameters::encode const):
1084         * Platform/IPC/FormDataReference.h:
1085         (IPC::FormDataReference::encode const):
1086         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1087         * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
1088         (API::InjectedBundle::PageUIClient::shouldGenerateFileForUpload): Deleted.
1089         (API::InjectedBundle::PageUIClient::generateFileForUpload): Deleted.
1090         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
1091         (WebKit::InjectedBundlePageUIClient::shouldGenerateFileForUpload): Deleted.
1092         (WebKit::InjectedBundlePageUIClient::generateFileForUpload): Deleted.
1093         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
1094         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1095         (WebKit::WebChromeClient::shouldReplaceWithGeneratedFileForUpload): Deleted.
1096         (WebKit::WebChromeClient::generateReplacementFile): Deleted.
1097         * WebProcess/WebCoreSupport/WebChromeClient.h:
1098         * WebProcess/com.apple.WebProcess.sb.in:
1099
1100 2019-08-01  Tim Horton  <timothy_horton@apple.com>
1101
1102         REGRESSION: HSBC Personal Banking download/print dialog is usually positioned off screen on iPad
1103         https://bugs.webkit.org/show_bug.cgi?id=200356
1104         <rdar://problem/51885199>
1105
1106         Reviewed by Beth Dakin.
1107
1108         * UIProcess/ios/WebPageProxyIOS.mm:
1109         (WebKit::desktopClassBrowsingRecommendedForRequest):
1110         Add HSBC domains to the list of sites that recommend mobile mode by default.
1111
1112 2019-08-01  Chris Dumez  <cdumez@apple.com>
1113
1114         Crash under WebProcessProxy::didBecomeUnresponsive()
1115         https://bugs.webkit.org/show_bug.cgi?id=200346
1116         <rdar://problem/53795984>
1117
1118         Reviewed by Geoffrey Garen.
1119
1120         Make sure the BackgroundProcessResponsivenessTimer / ResponsivenessTimer ref their client
1121         while they call mayBecomeUnresponsive() / willChangeIsResponsive() / didChangeIsResponsive()
1122         / didBecomeUnresponsive() on their client, in case calling one of these ends up destroying
1123         the client.
1124
1125         * UIProcess/BackgroundProcessResponsivenessTimer.cpp:
1126         (WebKit::BackgroundProcessResponsivenessTimer::setResponsive):
1127         * UIProcess/ResponsivenessTimer.cpp:
1128         (WebKit::ResponsivenessTimer::timerFired):
1129         * UIProcess/ResponsivenessTimer.h:
1130         * UIProcess/WebProcessProxy.h:
1131
1132 2019-08-01  Youenn Fablet  <youenn@apple.com>
1133
1134         UserMediaPermissionRequestManagerProxy should not use audio+video denied requests to deny audio-only or video-only requests
1135         https://bugs.webkit.org/show_bug.cgi?id=200317
1136
1137         Reviewed by Eric Carlson.
1138
1139         Only match audio+video denied requests with new audio+video requests.
1140         That will ensure that audio can still be captured if user denied access to the camera through preferences
1141         and website started with a getUserMedia({audio: true, video: true}) call.
1142         Covered by added API test.
1143
1144         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1145         (WebKit::UserMediaPermissionRequestManagerProxy::wasRequestDenied):
1146
1147 2019-08-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1148
1149         [SOUP] WebSockets: add support for extensions when using web sockets libsoup API
1150         https://bugs.webkit.org/show_bug.cgi?id=199943
1151
1152         Reviewed by Alex Christensen.
1153
1154         * NetworkProcess/NetworkSocketChannel.cpp:
1155         (WebKit::NetworkSocketChannel::didConnect): Add extensions parameter and pass it to the IPC message.
1156         * NetworkProcess/NetworkSocketChannel.h:
1157         * NetworkProcess/cocoa/WebSocketTaskCocoa.mm:
1158         (WebKit::WebSocketTask::didConnect): Pass empty extensions string.
1159         * NetworkProcess/soup/WebSocketTaskSoup.cpp:
1160         (WebKit::WebSocketTask::acceptedExtensions const): Build the accepted extensions string.
1161         (WebKit::WebSocketTask::didConnect): Pass accepted extensions to NetworkSocketChannel::didConnect().
1162         * NetworkProcess/soup/WebSocketTaskSoup.h:
1163         * WebProcess/Network/WebSocketChannel.cpp:
1164         (WebKit::WebSocketChannel::extensions): Return the extensions string received from the network process.
1165         (WebKit::WebSocketChannel::didConnect): Save the extensions string.
1166         * WebProcess/Network/WebSocketChannel.h:
1167         * WebProcess/Network/WebSocketChannel.messages.in:
1168
1169 2019-08-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1170
1171         [SOUP] Switch to use libsoup WebSockets API
1172         https://bugs.webkit.org/show_bug.cgi?id=200162
1173
1174         Reviewed by Michael Catanzaro.
1175
1176         Remove temporary method added for old WebSockets implementation.
1177
1178         * NetworkProcess/NetworkStorageSessionProvider.h:
1179
1180 2019-07-31  Dean Jackson  <dino@apple.com>
1181
1182         WKImagePreviewViewController not being autoreleased
1183         https://bugs.webkit.org/show_bug.cgi?id=200325
1184         <rdar://problem/53788214>
1185
1186         Reviewed by Wenson Hsieh.
1187
1188         Wenson noticed I wasn't autoreleasing the WKImagePreviewViewController.
1189
1190         * UIProcess/ios/WKContentViewInteraction.mm:
1191         (-[WKContentView continueContextMenuInteraction:]):
1192
1193 2019-07-31  Chris Dumez  <cdumez@apple.com>
1194
1195         REGRESSION (r247486?): Flaky API Test TestWebKitAPI.WKWebView.LocalStorageProcessSuspends
1196         https://bugs.webkit.org/show_bug.cgi?id=200086
1197         <rdar://problem/53501721>
1198
1199         Reviewed by Alex Christensen.
1200
1201         The test would first send a ProcessWillSuspendImminently IPC to the NetworkProcess and then
1202         run JS in the WebContent process, which would in turn send IPC to the NetworkProcess. The
1203         test was flaky because it expected the network process to receive the IPC from the UIProcess
1204         *before* the one from the WebContent process. However, there is no guarantee about ordering
1205         from IPC messages coming from different connections.
1206
1207         To address the flakiness, this patch introduces a new ProcessWillSuspendImminentlyForTesting
1208         synchronous IPC and uses this instead. As a result, it is now guaranteed that the network
1209         process processes this IPC *before* receiving any IPC from the WebContent process that is
1210         the result of IPC from the UIProcess.
1211
1212         * NetworkProcess/NetworkProcess.cpp:
1213         (WebKit::NetworkProcess::processWillSuspendImminentlyForTestingSync):
1214         * NetworkProcess/NetworkProcess.h:
1215         * NetworkProcess/NetworkProcess.messages.in:
1216         * UIProcess/API/Cocoa/WKProcessPool.mm:
1217         (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):
1218         * UIProcess/Network/NetworkProcessProxy.cpp:
1219         (WebKit::NetworkProcessProxy::sendProcessWillSuspendImminentlyForTesting):
1220         * UIProcess/Network/NetworkProcessProxy.h:
1221         * UIProcess/WebProcessPool.cpp:
1222         (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminentlyForTesting):
1223         (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently): Deleted.
1224         * UIProcess/WebProcessPool.h:
1225
1226 2019-07-31  Wenson Hsieh  <wenson_hsieh@apple.com>
1227
1228         [iOS 13] Safari crashes when closing a tab with a focused element if the unified field has focus
1229         https://bugs.webkit.org/show_bug.cgi?id=200291
1230         <rdar://problem/53717946>
1231
1232         Reviewed by Megan Gardner.
1233
1234         Makes -requestAutocorrectionContextWithCompletionHandler: robust in the case where the web page has been closed,
1235         and there is no Connection object to use when waiting for a sync IPC response.
1236
1237         Test: AutocorrectionTests.RequestAutocorrectionContextAfterClosingPage
1238
1239         * UIProcess/ios/WKContentViewInteraction.mm:
1240         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
1241
1242 2019-07-31  Chris Fleizach  <cfleizach@apple.com>
1243
1244         AX: com.apple.WebKit.WebContent at com.apple.WebKit: -[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]
1245         https://bugs.webkit.org/show_bug.cgi?id=200277
1246         <rdar://problem/49475009>
1247
1248         Reviewed by Per Arne Vollan.
1249
1250         Verify Page is available before calling into it.
1251
1252         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1253         (-[WKAccessibilityWebPageObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
1254
1255 2019-07-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1256
1257         [GTK] Datalist element support for TextFieldInputType
1258         https://bugs.webkit.org/show_bug.cgi?id=98934
1259
1260         Reviewed by Michael Catanzaro.
1261
1262         Add a WebDataListSuggestionsDropdown implementation for the GTK port using a popup window with a tree view list.
1263
1264         * Sources.txt:
1265         * SourcesGTK.txt:
1266         * UIProcess/API/gtk/PageClientImpl.cpp:
1267         (WebKit::PageClientImpl::createDataListSuggestionsDropdown):
1268         * UIProcess/API/gtk/PageClientImpl.h:
1269         * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp: Added.
1270         (WebKit::firstTimeItemSelectedCallback):
1271         (WebKit::WebDataListSuggestionsDropdownGtk::WebDataListSuggestionsDropdownGtk):
1272         (WebKit::WebDataListSuggestionsDropdownGtk::~WebDataListSuggestionsDropdownGtk):
1273         (WebKit::WebDataListSuggestionsDropdownGtk::treeViewRowActivatedCallback):
1274         (WebKit::WebDataListSuggestionsDropdownGtk::didSelectOption):
1275         (WebKit::WebDataListSuggestionsDropdownGtk::show):
1276         (WebKit::WebDataListSuggestionsDropdownGtk::handleKeydownWithIdentifier):
1277         (WebKit::WebDataListSuggestionsDropdownGtk::close):
1278         * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.h: Copied from Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.h.
1279
1280 2019-07-31  Tim Horton  <timothy_horton@apple.com>
1281
1282         Remove WebKit2 Makefile guards for pre-Snow Leopard macOS
1283         https://bugs.webkit.org/show_bug.cgi?id=200294
1284
1285         Reviewed by Dan Bernstein.
1286
1287         * Makefile:
1288         It seems ... unlikely ... that anyone is trying to build
1289         trunk WebKit for Leopard or prior.
1290
1291 2019-07-30  Fujii Hironori  <Hironori.Fujii@sony.com>
1292
1293         [WebKit] Add PageLoadState::Observer C API
1294         https://bugs.webkit.org/show_bug.cgi?id=199848
1295
1296         Reviewed by Alex Christensen.
1297
1298         There is no WebKit C API to get the timing of title changed since
1299         WKPageLoaderClientV0::didReceiveTitleForFrame has been removed in
1300         r235398. Cocoa and glib WebKit API exist.
1301
1302         * PlatformWin.cmake:
1303         * UIProcess/API/C/WKPage.cpp:
1304         (WKPageSetPageStateClient):
1305         * UIProcess/API/C/WKPage.h: Added WKPageSetPageStateClient.
1306         * UIProcess/API/C/WKPageStateClient.h: Added.
1307         * UIProcess/WebPageProxy.cpp:
1308         (WebKit::WebPageProxy::setPageLoadStateObserver):
1309         * UIProcess/WebPageProxy.h:
1310         * WebKit.xcodeproj/project.pbxproj:
1311
1312 2019-07-30  Chris Dumez  <cdumez@apple.com>
1313
1314         Fix non-thread safe use of WeakPtr under sendSecItemRequest()
1315         https://bugs.webkit.org/show_bug.cgi?id=200249
1316
1317         Reviewed by Alex Christensen.
1318
1319         The function was calling globalNetworkProcess() from a background thread. This is not safe because
1320         globalNetworkProcess() deferences a WeakPtr<NetworkProcess> internally and the NetworkProcess object
1321         gets destroyed on the main thread.
1322
1323         * Shared/mac/SecItemShim.cpp:
1324         (WebKit::sendSecItemRequest):
1325
1326 2019-07-24  Carlos Garcia Campos  <cgarcia@igalia.com>
1327
1328         [SOUP] Move SoupNetworkSession ownership from NetworkStorageSession to NetworkSession
1329         https://bugs.webkit.org/show_bug.cgi?id=200076
1330
1331         Reviewed by Michael Catanzaro.
1332
1333         NetworkStorageSession should only own the cookie jar, since it's the only thing it handles from the session.
1334
1335         * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp:
1336         (WebKit::WebCookieManager::setCookiePersistentStorage): Use the network session instead of the storage session
1337         to set the peristent cookie storage.
1338         * NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp:
1339         (WebKit::LegacyCustomProtocolManager::registerScheme): Iterate network sessions instead of storage sessions to
1340         access the SoupNetworkSession.
1341         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1342         (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated): Use
1343         NetworkProcess::forEachNetworkSession() to iterate network sessions.
1344         * NetworkProcess/NetworkProcess.cpp:
1345         (WebKit::NetworkProcess::lowMemoryHandler): Ditto.
1346         (WebKit::NetworkProcess::forEachNetworkSession): Added to iterate network sessions intead of exposing the map
1347         that is always used to iterate the sessions.
1348         (WebKit::NetworkProcess::switchToNewTestingSession): Use the new NetworkStorageSession constructor API.
1349         (WebKit::NetworkProcess::ensureSession): Ditto.
1350         (WebKit::NetworkProcess::destroySession): Allow to destroy the default session for soup based ports. This is
1351         only called right before process exit to ensure we don't leak network resources like the cookies database.
1352         (WebKit::NetworkProcess::setResourceLoadStatisticsEnabled): Use NetworkProcess::forEachNetworkSession() to
1353         iterate network sessions.
1354         (WebKit::NetworkProcess::fetchWebsiteData): Ditto.
1355         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): Ditto.
1356         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains): Ditto.
1357         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData): Ditto.
1358         (WebKit::NetworkProcess::setCacheModel): Ditto.
1359         (WebKit::NetworkProcess::actualPrepareToSuspend): Ditto.
1360         (WebKit::NetworkProcess::resume): Ditto.
1361         * NetworkProcess/NetworkProcess.h:
1362         * NetworkProcess/NetworkStorageSessionProvider.h:
1363         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1364         (WebKit::NetworkProcess::clearDiskCache): Ditto.
1365         * NetworkProcess/ios/NetworkProcessIOS.mm:
1366         (WebKit::NetworkProcess::clearCacheForAllOrigins): Ditto.
1367         * NetworkProcess/soup/NetworkProcessMainSoup.cpp: Destroy the default session before process exists.
1368         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1369         (WebKit::NetworkProcess::userPreferredLanguagesChanged): Iterate network sessions instead of storage sessions to
1370         access the SoupNetworkSession.
1371         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const): Use the new NetworkStorageSession constructor API.
1372         (WebKit::NetworkProcess::clearDiskCache): Use NetworkProcess::forEachNetworkSession() to iterate network sessions.
1373         (WebKit::NetworkProcess::setNetworkProxySettings): Iterate network sessions instead of storage sessions to
1374         access the SoupNetworkSession.
1375         * NetworkProcess/soup/NetworkSessionSoup.cpp:
1376         (WebKit::NetworkSessionSoup::NetworkSessionSoup): Create the SoupNetworkSession and setup cookies.
1377         (WebKit::NetworkSessionSoup::soupSession const): Return the SoupSession of SoupNetworkSession.
1378         (WebKit::NetworkSessionSoup::setCookiePersistentStorage): Setup a new cookie jar.
1379         * NetworkProcess/soup/NetworkSessionSoup.h:
1380
1381 2019-07-30  Truitt Savell  <tsavell@apple.com>
1382
1383         Unreviewed, rolling out r247932.
1384
1385         Broke 8 API tests across all platforms.
1386
1387         Reverted changeset:
1388
1389         "Fix non-thread safe use of WeakPtr under
1390         sendSecItemRequest()"
1391         https://bugs.webkit.org/show_bug.cgi?id=200249
1392         https://trac.webkit.org/changeset/247932
1393
1394 2019-07-29  Wenson Hsieh  <wenson_hsieh@apple.com>
1395
1396         YouTube search field shows RTL text outside its border on iPadOS
1397         https://bugs.webkit.org/show_bug.cgi?id=200253
1398         <rdar://problem/53680603>
1399
1400         Reviewed by Beth Dakin.
1401
1402         Limits code added in r238939 to respect the current keyboard's writing mode to only editable web views. This
1403         behavior was only intended for Mail, and isn't generally compatible with web content.
1404
1405         While the call to -setInitialDirection is correctly gated on an web view editability check, it appears that
1406         other changes in iOS 13 now cause -setBaseWritingDirection:forRange: to be invoked directly from keyboards code.
1407         This means that -setBaseWritingDirection:forRange: should additionally be guarded with the same check.
1408
1409         * UIProcess/ios/WKContentViewInteraction.mm:
1410         (-[WKContentView setBaseWritingDirection:forRange:]):
1411
1412 2019-07-29  Sihui Liu  <sihui_liu@apple.com>
1413
1414         Try fixing crash at com.apple.WebKit.Networking: NetworkProcess::setSharedHTTPCookieStorage
1415         https://bugs.webkit.org/show_bug.cgi?id=200189
1416         <rdar://problem/41325767>
1417
1418         Reviewed by Chris Dumez.
1419
1420         The crash indicates that sharedCookieStorage is accessed before being set in network process. 
1421         sharedCookieStorage is set during the processing of InitializeNetworkProcess message, and access to 
1422         sharedCookieStorage is supposed to happen after that. Therefore, it is likely some message is received and 
1423         handled before InitializeNetworkProcess. 
1424  
1425         One possible explanation is WebKit APIs get called on different threads. Because of the race in checking and 
1426         setting m_networkProcess, some message is sent between network process gets launched (m_networkProcess is set) 
1427         and InitializeNetworkProcess message is sent. To mitigate this issue, we make sure m_networkProcess is set only
1428         in the main runloop and only after InitializeNetworkProcess is sent. 
1429
1430         * UIProcess/WebProcessPool.cpp:
1431         (WebKit::WebProcessPool::ensureNetworkProcess):
1432
1433 2019-07-29  Chris Dumez  <cdumez@apple.com>
1434
1435         Fix non-thread safe use of WeakPtr under sendSecItemRequest()
1436         https://bugs.webkit.org/show_bug.cgi?id=200249
1437
1438         Reviewed by Alex Christensen.
1439
1440         The function was calling globalNetworkProcess() from a background thread. This is not safe because
1441         globalNetworkProcess() deferences a WeakPtr<NetworkProcess> internally and the NetworkProcess object
1442         gets destroyed on the main thread.
1443
1444         * Shared/mac/SecItemShim.cpp:
1445         (WebKit::sendSecItemRequest):
1446
1447 2019-07-29  Zalan Bujtas  <zalan@apple.com>
1448
1449         [ContentChangeObserver] didFinishContentChangeObserving should include the type of content change.
1450         https://bugs.webkit.org/show_bug.cgi?id=200247
1451         <rdar://problem/53681149>
1452
1453         Reviewed by Simon Fraser.
1454
1455         * WebProcess/WebCoreSupport/WebChromeClient.h:
1456         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
1457         (WebKit::WebChromeClient::didFinishContentChangeObserving):
1458         * WebProcess/WebPage/WebPage.h:
1459         * WebProcess/WebPage/ios/WebPageIOS.mm:
1460         (WebKit::WebPage::didFinishContentChangeObserving):
1461
1462 2019-07-29  Youenn Fablet  <youenn@apple.com>
1463
1464         REGRESSION: WebSockets no longer work in Service Workers
1465         https://bugs.webkit.org/show_bug.cgi?id=199906
1466         <rdar://problem/53516732>
1467
1468         Reviewed by Geoffrey Garen.
1469
1470         Use WebSocketProvider so that network calls are done in the network process.
1471
1472         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1473         (WebKit::WebSWContextManagerConnection::installServiceWorker):
1474
1475 2019-07-29  Zalan Bujtas  <zalan@apple.com>
1476
1477         [ContentChangeObserver] ChromeClient::observedContentChange() name is misleading
1478         https://bugs.webkit.org/show_bug.cgi?id=200238
1479         <rdar://problem/53677038>
1480
1481         Reviewed by Simon Fraser.
1482
1483         * WebProcess/WebCoreSupport/WebChromeClient.h:
1484         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
1485         (WebKit::WebChromeClient::didFinishContentChangeObserving):
1486         (WebKit::WebChromeClient::observedContentChange): Deleted.
1487         * WebProcess/WebPage/WebPage.h:
1488         * WebProcess/WebPage/ios/WebPageIOS.mm:
1489         (WebKit::WebPage::didFinishContentChangeObserving):
1490         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver): Deleted.
1491
1492 2019-07-26  Ryosuke Niwa  <rniwa@webkit.org>
1493
1494         ShareableBitmap::createGraphicsContext() should return nullptr when CGBitmapContextCreateWithData returns nil
1495         https://bugs.webkit.org/show_bug.cgi?id=200185
1496
1497         Reviewed by Simon Fraser.
1498
1499         We should not be creating GraphicsContext with nil CGContextRef in ShareableBitmap::createGraphicsContext()
1500         as such a GraphicsContext is only used for specific purposes.
1501
1502         This patch adds an early return to ShareableBitmap::createGraphicsContext() when CGBitmapContextCreateWithData
1503         returns nil CGContextRef.
1504
1505         * PluginProcess/PluginControllerProxy.cpp:
1506         (WebKit::PluginControllerProxy::paint):
1507         * Shared/API/c/cg/WKImageCG.cpp:
1508         (WKImageCreateFromCGImage):
1509         * Shared/ContextMenuContextData.cpp:
1510         (WebKit::ContextMenuContextData::ContextMenuContextData):
1511         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
1512         (WebKit::RemoteLayerBackingStore::display):
1513         * Shared/WebCoreArgumentCoders.cpp:
1514         (IPC::encodeImage):
1515         * Shared/cg/ShareableBitmapCG.cpp:
1516         (WebKit::ShareableBitmap::createGraphicsContext):
1517         (WebKit::ShareableBitmap::makeCGImageCopy):
1518         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
1519         (WebKit::imageForRect):
1520         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
1521         (WebKit::InjectedBundleRangeHandle::renderedImage):
1522         * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp:
1523         (WebKit::InjectedBundleHitTestResult::image const):
1524         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
1525         (WebKit::NetscapePlugin::snapshot):
1526         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1527         (WebKit::PDFPlugin::snapshot):
1528         * WebProcess/Plugins/PluginProxy.cpp:
1529         (WebKit::PluginProxy::paint):
1530         (WebKit::PluginProxy::update):
1531         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1532         (WebKit::convertCGImageToBitmap):
1533         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
1534         (WebKit::DrawingAreaCoordinatedGraphics::display):
1535         * WebProcess/WebPage/WebFrame.cpp:
1536         (WebKit::WebFrame::createSelectionSnapshot const):
1537         * WebProcess/WebPage/WebPage.cpp:
1538         (WebKit::WebPage::snapshotAtSize):
1539         (WebKit::WebPage::snapshotNode):
1540         (WebKit::WebPage::drawRectToImage):
1541
1542 2019-07-29  Dean Jackson  <dino@apple.com>
1543
1544         Contextual menu does not present when holding an embedded photo but works with link and attachments
1545         https://bugs.webkit.org/show_bug.cgi?id=200239
1546         <rdar://problem/53318733>
1547
1548         Reviewed by Tim Horton.
1549
1550         If the user long-pressed on an image, and the client implemented the new API but did
1551         not provide a configuration, we were not falling back to the default behaviour of
1552         giving a menu allowing the user to copy/share/save the image.
1553
1554         * UIProcess/ios/WKContentViewInteraction.mm:
1555         (-[WKContentView continueContextMenuInteraction:]): If we get through the delegates,
1556         and the element is an image, return the default configuration.
1557
1558 2019-07-29  Chris Dumez  <cdumez@apple.com>
1559
1560         Remove unnecessary null check under WebResourceLoadStatisticsStore::hasStorageAccess()
1561         https://bugs.webkit.org/show_bug.cgi?id=200229
1562
1563         Reviewed by Alex Christensen.
1564
1565         Remove unnecessary null check under WebResourceLoadStatisticsStore::hasStorageAccess().
1566         There is already a null check with an early return a few lines above.
1567
1568         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1569         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
1570
1571 2019-07-29  Wenson Hsieh  <wenson_hsieh@apple.com>
1572
1573         UI process occasionally hangs in -[UIKeyboardTaskQueue lockWhenReadyForMainThread]
1574         https://bugs.webkit.org/show_bug.cgi?id=200215
1575         <rdar://problem/52976965>
1576
1577         Reviewed by Tim Horton.
1578
1579         To implement autocorrection on iOS, UIKit sometimes needs to request contextual information from WebKit. This is
1580         handled as a sync IPC message in WebKit, since UIKit would otherwise proceed to block the main thread after
1581         sending the request, preventing WebKit from handling any IPC responses in the UI process (potentially resulting
1582         in deadlock if any other sync IPC messages were to arrive in the UI process during this time).
1583
1584         The synchronous nature of this autocorrection request means that if any sync IPC message were to be
1585         simultaneously dispatched in the opposite direction (i.e. web to UI process), we need to immediately handle the
1586         incoming sync message in the UI process (otherwise, we'd end up deadlocking for 1 second until the
1587         autocorrection context request hits a 1-second IPC timeout).
1588
1589         One such synchronous message from the web process to the UI process is WebPageProxy::CreateNewPage, triggered as
1590         a result of synchronously opening a new window. Due to Safari changes in iOS 13 (<rdar://problem/51755088>),
1591         this message now calls into code which then causes UIKit to call *back into* -[WKContentView
1592         requestAutocorrectionContextWithCompletionHandler:] for the newly opened web view, under the scope of the call
1593         to -requestAutocorrectionContextWithCompletionHandler: in the original web view.
1594
1595         This caused a crash, which was tracked in <rdar://problem/52590170>. There was an attempt to fix this in r247345
1596         by invoking the existing handler well before storing the new one; while this avoided the crash, it didn't solve
1597         the root problem, which was that keyboard task queues would get into a bad state after this scenario; this would
1598         manifest in a UI process hang under -[UIKeyboardTaskQueue lockWhenReadyForMainThread] during the next user
1599         gesture, which is tracked by this bug (<rdar://problem/52976965>).
1600
1601         As it turns out, the keyboard task queue gets into a bad state because it is architected in such a way that
1602         tasks added to the queue under the scope of parent task must be finished executing before their parents;
1603         otherwise, the call to -[UIKeyboardTaskExecutionContext returnExecutionToParentWithInfo:] never happens when
1604         handling the child task. This has the effect of causing the keyboard task queue to end up with a
1605         UIKeyboardTaskExecutionContext that can never return execution to its parent context, such that if the task
1606         queue is then told to wait until any future task is finished executing, it will hang forever, waiting for these
1607         stuck tasks to finish executing (which never happens, because they're all waiting to return execution to their
1608         parents which are already done executing!)
1609
1610         To fix this hang and avoid ever getting into this bad state, we need to invoke the autocorrection request
1611         handlers in this order:
1612
1613         (1) Receive outer autocorrection context request.
1614         (2) Receive inner autocorrection context request.
1615         (3) Invoke inner autocorrection context request completion handler.
1616         (4) Invoke outer autocorrection context request completion handler.
1617
1618         ...instead of swapping (3) and (4), like we do currently.
1619
1620         * UIProcess/ios/WKContentViewInteraction.mm:
1621         (-[WKContentView resignFirstResponderForWebView]):
1622
1623         Remove the hack added in r247345 to try and avoid reentrant autocorrection context requests; we don't need this
1624         anymore, since we should now be able to handle these reentrant requests in the way UIKit expects.
1625
1626         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
1627
1628         Add an early return in the case where the request is synchronous and there's already a pending autocorrection
1629         context to ensure that the completion handler for the nested request is invoked before the outer request is
1630         finished.
1631
1632 2019-07-29  Simon Fraser  <simon.fraser@apple.com>
1633
1634         Can't scroll on yummly.co.uk recipe (scale(0) div covers the content and hit-tests)
1635         https://bugs.webkit.org/show_bug.cgi?id=200263
1636         rdar://problem/53679408
1637
1638         Reviewed by Antti Koivisto.
1639
1640         The content on this page had a scale(0) div overlaying an overflow:scroll element,
1641         and our UI-side hit-testing code would find this scale(0) element, because apparently
1642         -[UIView convertPoint:fromView:] will happily work with non-invertible matrices, and 
1643         -[UIView pointInside:withEvent:] just compares the point with the view bounds.
1644
1645         Since the view frame takes the transform into account, we can look for an empty frame
1646         to detect these non-invertible transforms.
1647
1648         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1649         (WebKit::collectDescendantViewsAtPoint):
1650
1651 2019-07-29  Youenn Fablet  <youenn@apple.com>
1652
1653         NetworkProcess clear and fetch of cache entries might move the callback aggregator more than once
1654         https://bugs.webkit.org/show_bug.cgi?id=200228
1655
1656         Reviewed by Alex Christensen.
1657
1658         copyRef the callback aggregator instead of moving it.
1659
1660         * NetworkProcess/NetworkProcess.cpp:
1661         (WebKit::NetworkProcess::fetchWebsiteData):
1662         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1663
1664 2019-07-29  Chris Dumez  <cdumez@apple.com>
1665
1666         Possible use-after-move under NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated()
1667         https://bugs.webkit.org/show_bug.cgi?id=200225
1668
1669         Reviewed by Brent Fulgham.
1670
1671         The code was WTFMove()-ing the method parameter inside of a loop, which means that it could
1672         move it several times. Instead of copying the parameters, I opted into sending the statistics
1673         only to the network session that matches this WebProcess connection.
1674
1675         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1676         (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
1677
1678 2019-07-27  Chris Dumez  <cdumez@apple.com>
1679
1680         Allow more syscalls in the WebContent process' sandbox profile
1681         https://bugs.webkit.org/show_bug.cgi?id=200182
1682         <rdar://problem/53594973>
1683
1684         Reviewed by Geoffrey Garen.
1685
1686         I reviewed all crash traces attached to the radar and found the following
1687         syscalls that we not yet allowed by the WebContent process's sandbox
1688         profile.
1689
1690         * WebProcess/com.apple.WebProcess.sb.in:
1691
1692 2019-07-26  Jiewen Tan  <jiewen_tan@apple.com>
1693
1694         NavigationSOAuthorizationSession should check the active URL of the responding page after waking up from waiting
1695         https://bugs.webkit.org/show_bug.cgi?id=200150
1696         <rdar://problem/53280170>
1697
1698         Reviewed by Brent Fulgham.
1699
1700         NavigationSOAuthorizationSession should check the active URL of the responding page after waking up from waiting
1701         as the page might have already changed the location.
1702
1703         * UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.h:
1704         * UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm:
1705         (WebKit::NavigationSOAuthorizationSession::shouldStartInternal):
1706         (WebKit::NavigationSOAuthorizationSession::webViewDidMoveToWindow):
1707         (WebKit::NavigationSOAuthorizationSession::pageActiveURLDidChangeDuringWaiting const):
1708         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.mm:
1709         (WebKit::SubFrameSOAuthorizationSession::abortInternal):
1710
1711 2019-07-26  Chris Dumez  <cdumez@apple.com>
1712
1713         Crashes under XPCServiceMain() / mach_msg_trap() due to sandboxing
1714         https://bugs.webkit.org/show_bug.cgi?id=200173
1715         <rdar://problem/53594973>
1716
1717         Reviewed by Per Arne Vollan.
1718
1719         Allow a few more syscalls as they appear to be needed by mach_msg_trap().
1720
1721         * WebProcess/com.apple.WebProcess.sb.in:
1722
1723 2019-07-26  Daniel Bates  <dabates@apple.com>
1724
1725         [iOS] REGRESSION: Keyboard dismisses and reappears when typing 2FA pin on appleid.apple.com
1726         https://bugs.webkit.org/show_bug.cgi?id=200171
1727         <rdar://problem/50245251>
1728
1729         Reviewed by Wenson Hsieh.
1730
1731         Take out an InputViewUpdateDeferrer token (if we don't already have one) to temporarily defer
1732         tearing down the input view (keyboard) before bluring the previously focused element as part
1733         of switching between focused elements. This avoid a noticeable flash caused by UIKit animating
1734         out and animating in the keyboard should the newly focused element require the keyboard. We
1735         only take out the InputViewUpdateDeferrer until we fall off the end of _elementDidFocus: (or
1736         bail early). Once we fall of the end UIKit will update input view UI.
1737
1738         * UIProcess/ios/WKContentViewInteraction.mm:
1739         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
1740
1741 2019-07-26  Chris Dumez  <cdumez@apple.com>
1742
1743         Avoid WebContent process SIGKILL when using kevent()
1744         https://bugs.webkit.org/show_bug.cgi?id=200170
1745         <rdar://problem/51559921>
1746
1747         Reviewed by Per Arne Vollan.
1748
1749         Avoid WebContent process SIGKILL when using kevent() by updated its sandboxing profile.
1750
1751         * WebProcess/com.apple.WebProcess.sb.in:
1752
1753 2019-07-26  Chris Dumez  <cdumez@apple.com>
1754
1755         [iOS] WebPage::TouchEventSync() & WebPage::GetPositionInformation() sync IPC causes UIProcess hangs
1756         https://bugs.webkit.org/show_bug.cgi?id=200138
1757         <rdar://problem/52698157>
1758
1759         Reviewed by Geoffrey Garen.
1760
1761         Revert most of r247822 and use an alternative approach to address hangs. In this patch, the proposal
1762         is to add a SendSyncOption::ForceDispatchWhenDestinationIsWaitingForUnboundedSyncReply flag on the
1763         WebPage::TouchEventSync() & WebPage::GetPositionInformation() sendSync() calls in the UIProcess.
1764         Those will cause this IPCs to get dispatched right away in the WebContent process, even if the
1765         WebContent process is itself currently stuck on unbounded (i.e. potentially slow) synchronous IPC
1766         (JS alerts / prompts & sync XHR). Because re-entering WebCore on sync IPC is generally unsafe, this
1767         patch also updates the WebPage::getPositionInformation() & WebPage::touchEventSync() to return early
1768         (i.e. cancelled) if they get called while the WebContent process is stuck on a slow sendSync.
1769
1770         This approach should address the UIProcess hangs caused by the WebPage::TouchEventSync() and
1771         WebPage::GetPositionInformation() sync IPC messages when the WebContent process is busy on a slow XHR
1772         or a JS prompt / alert. It should be safe because we do not re-enter WebCore. The only drawback is that
1773         those IPCs will be cancelled (early return with default value) when the WebContent process is busy.
1774         However, I am being told that this is likely acceptable in practice.        
1775
1776         * Platform/IPC/Connection.cpp:
1777         (IPC::Connection::SyncMessageState::processIncomingMessage):
1778         (IPC::Connection::sendMessage):
1779         (IPC::Connection::sendSyncMessage):
1780         (IPC::Connection::dispatchMessage):
1781         * Platform/IPC/Connection.h:
1782         (IPC::UnboundedSynchronousIPCScope::UnboundedSynchronousIPCScope):
1783         (IPC::UnboundedSynchronousIPCScope::~UnboundedSynchronousIPCScope):
1784         (IPC::UnboundedSynchronousIPCScope::hasOngoingUnboundedSyncIPC):
1785         * Platform/IPC/Decoder.cpp:
1786         (IPC::Decoder::shouldDispatchMessageWhenWaitingForSyncReply const):
1787         * Platform/IPC/Decoder.h:
1788         * Platform/IPC/Encoder.cpp:
1789         (IPC::Encoder::shouldDispatchMessageWhenWaitingForSyncReply const):
1790         (IPC::Encoder::setShouldDispatchMessageWhenWaitingForSyncReply):
1791         (IPC::Encoder::wrapForTesting):
1792         * Platform/IPC/Encoder.h:
1793         * Platform/IPC/MessageFlags.h:
1794         * UIProcess/Network/NetworkProcessProxy.cpp:
1795         (WebKit::NetworkProcessProxy::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
1796         * UIProcess/WebPageProxy.cpp:
1797         (WebKit::WebPageProxy::handleTouchEventSynchronously):
1798         * UIProcess/ios/WKContentViewInteraction.mm:
1799         (-[WKContentView ensurePositionInformationIsUpToDate:]):
1800         * WebProcess/Network/WebLoaderStrategy.cpp:
1801         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1802         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1803         (WebKit::WebChromeClient::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
1804         (WebKit::WebChromeClient::runJavaScriptAlert):
1805         (WebKit::WebChromeClient::runJavaScriptConfirm):
1806         (WebKit::WebChromeClient::runJavaScriptPrompt):
1807         * WebProcess/WebPage/WebPage.cpp:
1808         (WebKit::WebPage::layerVolatilityTimerFired):
1809         (WebKit::WebPage::markLayersVolatile):
1810         (WebKit::WebPage::cancelMarkLayersVolatile):
1811         (WebKit::WebPage::touchEventSync):
1812         (WebKit::WebPage::didCompletePageTransition):
1813         (WebKit::WebPage::updatePreferences):
1814         (WebKit::WebPage::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
1815         * WebProcess/WebPage/WebPage.h:
1816         (WebKit::WebPage::sendSyncWithDelayedReply):
1817         * WebProcess/WebPage/ios/WebPageIOS.mm:
1818         (WebKit::WebPage::getPositionInformation):
1819
1820 2019-07-26  Zalan Bujtas  <zalan@apple.com>
1821
1822         Unable to tap/double tap to open files/folders in Google Drive in Safari
1823         https://bugs.webkit.org/show_bug.cgi?id=200096
1824         <rdar://problem/52748552>
1825
1826         Reviewed by Wenson Hsieh.
1827
1828         This patch reverts to the original double-tap-for-double-click implementation (see r244775 and r246347 for more information).
1829
1830         * Shared/WebPageCreationParameters.cpp:
1831         (WebKit::WebPageCreationParameters::encode const):
1832         (WebKit::WebPageCreationParameters::decode):
1833         * Shared/WebPageCreationParameters.h:
1834         * UIProcess/PageClient.h:
1835         * UIProcess/WebPageProxy.cpp:
1836         (WebKit::WebPageProxy::creationParameters):
1837         * UIProcess/WebPageProxy.h:
1838         * UIProcess/ios/PageClientImplIOS.h:
1839         * UIProcess/ios/PageClientImplIOS.mm:
1840         (WebKit::PageClientImpl::doubleTapForDoubleClickDelay): Deleted.
1841         (WebKit::PageClientImpl::doubleTapForDoubleClickRadius): Deleted.
1842         * UIProcess/ios/WKContentViewInteraction.h:
1843         * UIProcess/ios/WKContentViewInteraction.mm:
1844         (-[WKContentView setupInteraction]):
1845         (-[WKContentView cleanupInteraction]):
1846         (-[WKContentView _removeDefaultGestureRecognizers]):
1847         (-[WKContentView _addDefaultGestureRecognizers]):
1848         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): Do not recognize the single and double gestures the same time.
1849         (-[WKContentView gestureRecognizerShouldBegin:]):
1850         (-[WKContentView _doubleTapRecognizedForDoubleClick:]):
1851         (-[WKContentView _didStartProvisionalLoadForMainFrame]):
1852         (-[WKContentView _ensureNonBlockingDoubleTapGestureRecognizer]): Deleted.
1853         (-[WKContentView _doubleTapForDoubleClickDelay]): Deleted.
1854         (-[WKContentView _doubleTapForDoubleClickRadius]): Deleted.
1855         * UIProcess/ios/WebPageProxyIOS.mm:
1856         (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
1857         * WebProcess/WebPage/WebPage.cpp:
1858         * WebProcess/WebPage/WebPage.h:
1859         * WebProcess/WebPage/WebPage.messages.in:
1860         * WebProcess/WebPage/ios/WebPageIOS.mm:
1861         (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
1862         (WebKit::WebPage::commitPotentialTap):
1863         (WebKit::WebPage::handlePotentialDoubleTapForDoubleClickAtPoint): Deleted.
1864
1865 2019-07-26  Eric Liang  <ericliang@apple.com>
1866
1867         AX: web process should load correct bundle path for MACCATALYST
1868         https://bugs.webkit.org/show_bug.cgi?id=200122
1869
1870         Reviewed by Brent Fulgham.
1871
1872         Added the path to accessibility bundle for Mac Catalyst.
1873         Added sandbox profile to read accessibility settings.
1874
1875         * WebProcess/cocoa/WebProcessCocoa.mm:
1876         (WebKit::registerWithAccessibility):
1877         * WebProcess/com.apple.WebProcess.sb.in:
1878
1879 2019-07-26  Alexander Mikhaylenko  <exalm7659@gmail.com>
1880
1881         REGRESSION(r246496): [GTK] Tapping the web view scrolls up a bit
1882         https://bugs.webkit.org/show_bug.cgi?id=200084
1883
1884         Reviewed by Carlos Garcia Campos.
1885
1886         gdk_event_get_scroll_direction() returns false, but also sets direction to GDK_SCROLL_UP if
1887         the direction was GDK_SCROLL_SMOOTH. Relying on zero deltas in this case is not correct, because
1888         they can also be zero with GDK_SCROLL_SMOOTH. In this case, set the direction manually to avoid
1889         that.
1890
1891         See https://gitlab.gnome.org/GNOME/gtk/issues/2048
1892
1893         * Shared/gtk/WebEventFactory.cpp:
1894         (WebKit::WebEventFactory::createWebWheelEvent):
1895
1896 2019-07-26  Loïc Yhuel  <loic.yhuel@softathome.com>
1897
1898         [WPE] Support disk cache dumping like GTK
1899         https://bugs.webkit.org/show_bug.cgi?id=200157
1900
1901         Reviewed by Carlos Garcia Campos.
1902
1903         Creating or touching "dump" would create the dump.json.
1904
1905         * NetworkProcess/cache/NetworkCache.cpp:
1906         (WebKit::NetworkCache::Cache::Cache):
1907
1908 2019-07-26  Rob Buis  <rbuis@igalia.com>
1909
1910         Make storing cross-origin top-level prefetches in HTTP cache optional
1911         https://bugs.webkit.org/show_bug.cgi?id=199499
1912
1913         Reviewed by Youenn Fablet.
1914
1915         Currently when we navigate we check if there is a cross-origin top-level
1916         prefetch we can use for the navigation. The current solution uses the
1917         HTTP cache as a way to store the prefetch and to immediately use it for
1918         the navigation load. However this solution fails in case the prefetch is
1919         not cacheable.
1920
1921         Instead of this, simulate a HTTP Cache entry to process the load and
1922         afterwards try to store the navigation load into the HTTP cache, where
1923         normal store decisions will be applied.
1924
1925         Test: http/wpt/prefetch/link-prefetch-skip-disk-cache.html
1926
1927         * NetworkProcess/NetworkResourceLoader.cpp:
1928         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1929         (WebKit::NetworkResourceLoader::retrieveCacheEntryInternal):
1930         * NetworkProcess/NetworkResourceLoader.h:
1931
1932 2019-07-25  Zan Dobersek  <zdobersek@igalia.com>
1933
1934         Unreviewed build fix in NetworkDataTaskSoup.
1935
1936         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1937         (WebKit::NetworkDataTaskSoup::authenticateCallback):
1938         Fix incorrect use of the dereferencing operator introduced in r247831.
1939
1940 2019-07-25  Jiewen Tan  <jiewen_tan@apple.com>
1941
1942         Unreviewed, build fix after r247851
1943
1944         * UIProcess/WebPageProxy.cpp:
1945         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1946         Reverts an unnecessary change.
1947
1948 2019-07-25  Fujii Hironori  <fujii.hironori@gmail.com>
1949
1950         [GTK] Indistinguishable overloaded callback function inspectorViewDestroyed if RemoteWebInspectorProxyGtk.cpp and WebInspectorProxyGtk.cpp are in a unified build bundle
1951         https://bugs.webkit.org/show_bug.cgi?id=200123
1952
1953         Reviewed by Carlos Garcia Campos.
1954
1955         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
1956         (WebKit::remoteInspectorViewDestroyed): Added.
1957         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
1958         (WebKit::inspectorViewDestroyed): Deleted.
1959         Renamed inspectorViewDestroyed to remoteInspectorViewDestroyed.
1960
1961 2019-07-25  Jiewen Tan  <jiewen_tan@apple.com>
1962
1963         WebPageProxy::receivedPolicyDecision should check navigation ID before clear pendingAPIRequest
1964         https://bugs.webkit.org/show_bug.cgi?id=200108
1965         <rdar://problem/53521238>
1966
1967         Reviewed by Chris Dumez.
1968
1969         Assuming there are two loads happening one after another. There is an issue when clients save
1970         the first decisionHandler and then call WKNavigationActionPolicyCancel for it right after the
1971         second decisionHandler received, -[WKWebView URL] could return a null string even though it is
1972         loading the second one.
1973
1974         To solve that, this patch pairs a navigationID with the pendingAPIRequestURL such that
1975         WebPageProxy::receivedPolicyDecision could clear the pendingAPIRequestURL only if
1976         the passed navigation ID matches the current one.
1977
1978         * UIProcess/PageLoadState.cpp:
1979         (WebKit::PageLoadState::reset):
1980         (WebKit::PageLoadState::activeURL):
1981         (WebKit::PageLoadState::estimatedProgress):
1982         (WebKit::PageLoadState::pendingAPIRequestURL const):
1983         (WebKit::PageLoadState::pendingAPIRequest const):
1984         (WebKit::PageLoadState::setPendingAPIRequest):
1985         (WebKit::PageLoadState::clearPendingAPIRequest):
1986         (WebKit::PageLoadState::isLoading):
1987         (WebKit::PageLoadState::setPendingAPIRequestURL): Deleted.
1988         (WebKit::PageLoadState::clearPendingAPIRequestURL): Deleted.
1989         * UIProcess/PageLoadState.h:
1990         (WebKit::PageLoadState::setPendingAPIRequest):
1991         (WebKit::PageLoadState::setPendingAPIRequestURL): Deleted.
1992         * UIProcess/WebPageProxy.cpp:
1993         (WebKit::WebPageProxy::launchProcessForReload):
1994         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
1995         (WebKit::WebPageProxy::loadFile):
1996         (WebKit::WebPageProxy::loadDataWithNavigationShared):
1997         (WebKit::WebPageProxy::loadAlternateHTML):
1998         (WebKit::WebPageProxy::loadWebArchiveData):
1999         (WebKit::WebPageProxy::reload):
2000         (WebKit::WebPageProxy::goToBackForwardItem):
2001         (WebKit::WebPageProxy::receivedPolicyDecision):
2002         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2003         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
2004         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
2005         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2006
2007 2019-07-25  Commit Queue  <commit-queue@webkit.org>
2008
2009         Unreviewed, rolling out r247806.
2010         https://bugs.webkit.org/show_bug.cgi?id=200141
2011
2012         It is regressing PLT (Requested by youenn on #webkit).
2013
2014         Reverted changeset:
2015
2016         "Disable speculative loading if cache is not to be used for
2017         the load"
2018         https://bugs.webkit.org/show_bug.cgi?id=199644
2019         https://trac.webkit.org/changeset/247806
2020
2021 2019-07-25  Dean Jackson  <dino@apple.com>
2022
2023         WebKit/UIProcess/ios/WKContentViewInteraction.mm: error: implementing deprecated method contextMenuInteractionWillPresent
2024         https://bugs.webkit.org/show_bug.cgi?id=200136
2025         <rdar://problem/53547698>
2026
2027         Reviewed by Wenson Hsieh.
2028
2029         Ignore deprecation warnings for these UIContextMenuInteraction delegates.
2030
2031         * UIProcess/ios/WKContentViewInteraction.mm:
2032         (-[WKContentView contextMenuInteractionWillPresent:]):
2033         (-[WKContentView contextMenuInteraction:willCommitWithAnimator:]):
2034         (-[WKContentView contextMenuInteractionDidEnd:]):
2035
2036 2019-07-25  Dean Jackson  <dino@apple.com>
2037
2038         Add helper for ignoring deprecated implementation warnings
2039         https://bugs.webkit.org/show_bug.cgi?id=200135
2040
2041         Reviewed by Wenson Hsieh.
2042
2043         Add ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN/END macro which
2044         is IGNORE_WARNINGS_BEGIN("deprecated-implementations")
2045
2046         * UIProcess/API/Cocoa/LegacyBundleForClass.mm:
2047         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
2048         (IGNORE_WARNINGS_BEGIN): Deleted.
2049         * UIProcess/API/Cocoa/WKBrowsingContextGroup.mm:
2050         (IGNORE_WARNINGS_BEGIN): Deleted.
2051         * UIProcess/API/Cocoa/WKConnection.mm:
2052         (IGNORE_WARNINGS_BEGIN): Deleted.
2053         * UIProcess/API/Cocoa/WKPreviewElementInfo.mm:
2054         * UIProcess/API/Cocoa/WKProcessGroup.mm:
2055         (IGNORE_WARNINGS_BEGIN): Deleted.
2056         * UIProcess/API/Cocoa/WKTypeRefWrapper.mm:
2057         * UIProcess/API/Cocoa/WKWebView.mm:
2058         (-[WKWebView ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
2059         (-[WKWebView draggedImage:endedAt:operation:]):
2060         (-[WKWebView accessibilityAttributeValue:]):
2061         (-[WKWebView accessibilityAttributeValue:forParameter:]):
2062         (-[WKWebView namesOfPromisedFilesDroppedAtDestination:]):
2063         (-[WKWebView IGNORE_WARNINGS_END]): Deleted.
2064         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2065         (-[WKWebViewConfiguration ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
2066         (-[WKWebViewConfiguration _setWebsiteDataStore:]):
2067         (-[WKWebViewConfiguration IGNORE_WARNINGS_END]): Deleted.
2068         * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm:
2069         * UIProcess/API/mac/WKView.mm:
2070         (-[WKView ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
2071         (-[WKView draggedImage:endedAt:operation:]):
2072         (-[WKView accessibilityAttributeValue:]):
2073         (-[WKView accessibilityAttributeValue:forParameter:]):
2074         (-[WKView namesOfPromisedFilesDroppedAtDestination:]):
2075         (-[WKView IGNORE_WARNINGS_END]): Deleted.
2076         * UIProcess/WKImagePreviewViewController.mm:
2077         (-[WKImagePreviewViewController ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
2078         (-[WKImagePreviewViewController IGNORE_WARNINGS_END]): Deleted.
2079         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
2080         (-[WKAirPlayRoutePicker popoverControllerDidDismissPopover:]):
2081         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2082         (-[WKFileUploadPanel popoverControllerDidDismissPopover:]):
2083         * UIProcess/ios/forms/WKFormPopover.mm:
2084         (-[WKRotatingPopover popoverControllerDidDismissPopover:]):
2085         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2086         (-[WKPDFPluginAccessibilityObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
2087         (-[WKPDFPluginAccessibilityObject accessibilityAttributeValue:]):
2088         (-[WKPDFPluginAccessibilityObject accessibilityAttributeValue:forParameter:]):
2089         (-[WKPDFPluginAccessibilityObject accessibilityPerformAction:]):
2090         (-[WKPDFPluginAccessibilityObject accessibilityIsAttributeSettable:]):
2091         (-[WKPDFPluginAccessibilityObject accessibilitySetValue:forAttribute:]):
2092         (-[WKPDFPluginAccessibilityObject IGNORE_WARNINGS_END]): Deleted.
2093         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
2094         (-[WKAccessibilityWebPageObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
2095         (-[WKAccessibilityWebPageObject accessibilityIsAttributeSettable:]):
2096         (-[WKAccessibilityWebPageObject accessibilitySetValue:forAttribute:]):
2097         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
2098         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]):
2099         (-[WKAccessibilityWebPageObject IGNORE_WARNINGS_END]): Deleted.
2100
2101 2019-07-25  Youenn Fablet  <youenn@apple.com>
2102
2103         Make NetworkSession no longer RefCounted
2104         https://bugs.webkit.org/show_bug.cgi?id=200020
2105
2106         This allows to have a simpler memory management model where
2107         NetworkSession cannot live once removed from the network process session map.
2108         This requires some additional null checks, especially in NetworkDataTask.
2109
2110         Reviewed by Carlos Garcia Campos.
2111
2112         * NetworkProcess/curl/NetworkSessionCurl.h:
2113         * NetworkProcess/soup/NetworkSessionSoup.h:
2114         * NetworkProcess/NetworkDataTask.cpp:
2115         (WebKit::NetworkDataTask::NetworkDataTask):
2116         * NetworkProcess/NetworkDataTask.h:
2117         * NetworkProcess/NetworkDataTaskBlob.cpp:
2118         (WebKit::NetworkDataTaskBlob::~NetworkDataTaskBlob):
2119         (WebKit::NetworkDataTaskBlob::download):
2120         * NetworkProcess/NetworkProcess.cpp:
2121         (WebKit::NetworkProcess::lowMemoryHandler):
2122         (WebKit::NetworkProcess::setSession):
2123         (WebKit::NetworkProcess::destroySession):
2124         (WebKit::NetworkProcess::setResourceLoadStatisticsEnabled):
2125         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
2126         * NetworkProcess/NetworkProcess.h:
2127         (WebKit::NetworkProcess::networkSessions):
2128         * NetworkProcess/NetworkSession.cpp:
2129         (WebKit::NetworkSession::create):
2130         * NetworkProcess/NetworkSession.h:
2131         * NetworkProcess/NetworkSocketChannel.cpp:
2132         (WebKit::NetworkSocketChannel::NetworkSocketChannel):
2133         (WebKit::NetworkSocketChannel::~NetworkSocketChannel):
2134         * NetworkProcess/NetworkSocketChannel.h:
2135         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2136         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2137         (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
2138         (WebKit::computeIsAlwaysOnLoggingAllowed):
2139         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2140         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
2141         (WebKit::NetworkDataTaskCocoa::resume):
2142         (WebKit::NetworkDataTaskCocoa::isAlwaysOnLoggingAllowed const):
2143         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
2144         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2145         (-[WKNetworkSessionDelegate initWithNetworkSession:withCredentials:]):
2146         (WebKit::NetworkSessionCocoa::create):
2147         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2148         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2149         (WebKit::NetworkDataTaskSoup::createRequest):
2150         (WebKit::NetworkDataTaskSoup::clearRequest):
2151         (WebKit::NetworkDataTaskSoup::cancel):
2152         (WebKit::NetworkDataTaskSoup::authenticateCallback):
2153         (WebKit::NetworkDataTaskSoup::authenticate):
2154         (WebKit::NetworkDataTaskSoup::continueAuthenticate):
2155
2156 2019-07-25  Chris Dumez  <cdumez@apple.com>
2157
2158         Avoid some unnecessary HashMap copies
2159         https://bugs.webkit.org/show_bug.cgi?id=200129
2160
2161         Reviewed by Youenn Fablet.
2162
2163         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2164         (WebKit::NetworkConnectionToWebProcess::didClose):
2165         * UIProcess/AuxiliaryProcessProxy.cpp:
2166         (WebKit::AuxiliaryProcessProxy::connect):
2167         * UIProcess/Launcher/ProcessLauncher.cpp:
2168         (WebKit::ProcessLauncher::ProcessLauncher):
2169         * UIProcess/Launcher/ProcessLauncher.h:
2170         (WebKit::ProcessLauncher::create):
2171         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
2172         (WebKit::WebPluginInfoProvider::setPluginLoadClientPolicy):
2173
2174 2019-07-25  Truitt Savell  <tsavell@apple.com>
2175
2176         Unreviewed, rolling out r247821.
2177
2178         Caused two crashing Layout Tests
2179
2180         Reverted changeset:
2181
2182         "Make storing cross-origin top-level prefetches in HTTP cache
2183         optional"
2184         https://bugs.webkit.org/show_bug.cgi?id=199499
2185         https://trac.webkit.org/changeset/247821
2186
2187 2019-07-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2188
2189         Unreviewed, fix -Wredundant-move warning spam after r247672
2190         https://bugs.webkit.org/show_bug.cgi?id=199967
2191         <rdar://problem/53351435>
2192
2193         * Platform/IPC/ArgumentCoders.cpp:
2194         (IPC::decodeStringText):
2195         * Platform/IPC/ArgumentCoders.h:
2196
2197 2019-07-25  Chris Dumez  <cdumez@apple.com>
2198
2199         Avoid UI Process hangs when the WebContent process is showing JS prompts / alerts
2200         https://bugs.webkit.org/show_bug.cgi?id=200107
2201         <rdar://problem/53034592>
2202
2203         Reviewed by Geoffrey Garen.
2204
2205         * Platform/IPC/Connection.cpp:
2206         (IPC::Connection::SyncMessageState::incrementProcessIncomingSyncMessagesWhenWaitingForSyncReplyCount):
2207         (IPC::Connection::SyncMessageState::decrementProcessIncomingSyncMessagesWhenWaitingForSyncReplyCount):
2208         (IPC::Connection::SyncMessageState::processIncomingMessage):
2209         (IPC::Connection::sendSyncMessage):
2210         * Platform/IPC/Connection.h:
2211         Add support for new SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply flag
2212         to allow processing incoming sync messages while sending a particular sync IPC. This is the
2213         default behavior in all processes except in the WebContent process, where we try to avoid
2214         re-entering to prevent bugs. This flag allows the WebContent process to change its default
2215         behavior for some specific IPCs, where we know it is safe to re-enter and where it benefits
2216         performance to re-renter.
2217
2218         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2219         (WebKit::NetworkConnectionToWebProcess::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
2220         * NetworkProcess/NetworkConnectionToWebProcess.h:
2221         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2222         * UIProcess/Network/NetworkProcessProxy.cpp:
2223         (WebKit::NetworkProcessProxy::didReceiveSyncMessage):
2224         (WebKit::NetworkProcessProxy::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
2225         * UIProcess/Network/NetworkProcessProxy.h:
2226         * UIProcess/Network/NetworkProcessProxy.messages.in:
2227         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2228         (WebKit::WebChromeClient::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
2229         * WebProcess/WebCoreSupport/WebChromeClient.h:
2230         * WebProcess/WebPage/WebPage.cpp:
2231         (WebKit::WebPage::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
2232         * WebProcess/WebPage/WebPage.h:
2233         (WebKit::WebPage::sendSyncWithDelayedReply):
2234         * WebProcess/WebPage/WebPage.messages.in:
2235         SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply
2236         Add testing infrastructure for SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply
2237         flag.
2238
2239         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2240         (WebKit::WebChromeClient::runJavaScriptAlert):
2241         (WebKit::WebChromeClient::runJavaScriptConfirm):
2242         (WebKit::WebChromeClient::runJavaScriptPrompt):
2243         Use new SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply flag when sending
2244         the synchronous IPC for JS alerts / prompt / confirm. This allows the WebProcess to process
2245         incoming synchronous IPC for other processes (in particular the UIProcess) while it is blocked
2246         on those synchronous IPCs. It is safe to re-enter the WebContent process on these sync IPCs
2247         since they are triggered by JS and we return to JS right after. This should avoid UIProcess
2248         hangs when the UIProcess is sending a sync IPC to the WebContent process, which is itself
2249         stuck on the sync IPC to show a JS alert.
2250
2251 2019-07-25  Rob Buis  <rbuis@igalia.com>
2252
2253         Make storing cross-origin top-level prefetches in HTTP cache optional
2254         https://bugs.webkit.org/show_bug.cgi?id=199499
2255
2256         Reviewed by Youenn Fablet.
2257
2258         Currently when we navigate we check if there is a cross-origin top-level
2259         prefetch we can use for the navigation. The current solution uses the
2260         HTTP cache as a way to store the prefetch and to immediately use it for
2261         the navigation load. However this solution fails in case the prefetch is
2262         not cacheable.
2263
2264         Instead of this, simulate a HTTP Cache entry to process the load and
2265         afterwards try to store the navigation load into the HTTP cache, where
2266         normal store decisions will be applied.
2267
2268         Test: http/wpt/prefetch/link-prefetch-skip-disk-cache.html
2269
2270         * NetworkProcess/NetworkResourceLoader.cpp:
2271         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2272         (WebKit::NetworkResourceLoader::retrieveCacheEntryInternal):
2273         * NetworkProcess/NetworkResourceLoader.h:
2274
2275 2019-07-25  Truitt Savell  <tsavell@apple.com>
2276
2277         Unreviewed, rolling out r247817.
2278
2279         Broke 14 http/tests/paymentrequest/ tests. on iOS
2280
2281         Reverted changeset:
2282
2283         "Unable to tap/double tap to open files/folders in Google
2284         Drive in Safari"
2285         https://bugs.webkit.org/show_bug.cgi?id=200096
2286         https://trac.webkit.org/changeset/247817
2287
2288 2019-07-24  Zalan Bujtas  <zalan@apple.com>
2289
2290         Unable to tap/double tap to open files/folders in Google Drive in Safari
2291         https://bugs.webkit.org/show_bug.cgi?id=200096
2292         <rdar://problem/52748552>
2293
2294         Reviewed by Wenson Hsieh.
2295
2296         This patch reverts to the original double-tap-for-double-click implementation (see r244775 and r246347 for more information).
2297
2298         * Shared/WebPageCreationParameters.cpp:
2299         (WebKit::WebPageCreationParameters::encode const):
2300         (WebKit::WebPageCreationParameters::decode):
2301         * Shared/WebPageCreationParameters.h:
2302         * UIProcess/PageClient.h:
2303         * UIProcess/WebPageProxy.cpp:
2304         (WebKit::WebPageProxy::creationParameters):
2305         * UIProcess/WebPageProxy.h:
2306         * UIProcess/ios/PageClientImplIOS.h:
2307         * UIProcess/ios/PageClientImplIOS.mm:
2308         (WebKit::PageClientImpl::doubleTapForDoubleClickDelay): Deleted.
2309         (WebKit::PageClientImpl::doubleTapForDoubleClickRadius): Deleted.
2310         * UIProcess/ios/WKContentViewInteraction.h:
2311         * UIProcess/ios/WKContentViewInteraction.mm:
2312         (-[WKContentView setupInteraction]):
2313         (-[WKContentView cleanupInteraction]):
2314         (-[WKContentView _removeDefaultGestureRecognizers]):
2315         (-[WKContentView _addDefaultGestureRecognizers]):
2316         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): Do not recognize the single and double gestures the same time.
2317         (-[WKContentView gestureRecognizerShouldBegin:]):
2318         (-[WKContentView _doubleTapRecognizedForDoubleClick:]):
2319         (-[WKContentView _didStartProvisionalLoadForMainFrame]):
2320         (-[WKContentView _ensureNonBlockingDoubleTapGestureRecognizer]): Deleted.
2321         (-[WKContentView _doubleTapForDoubleClickDelay]): Deleted.
2322         (-[WKContentView _doubleTapForDoubleClickRadius]): Deleted.
2323         * UIProcess/ios/WebPageProxyIOS.mm:
2324         (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
2325         * WebProcess/WebPage/WebPage.cpp:
2326         * WebProcess/WebPage/WebPage.h:
2327         * WebProcess/WebPage/WebPage.messages.in:
2328         * WebProcess/WebPage/ios/WebPageIOS.mm:
2329         (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
2330         (WebKit::WebPage::commitPotentialTap):
2331         (WebKit::WebPage::handlePotentialDoubleTapForDoubleClickAtPoint): Deleted.
2332
2333 2019-07-24  Yusuke Suzuki  <ysuzuki@apple.com>
2334
2335         [bmalloc] Add IsoHeap test to ensure that IsoHeap pages are not allocating too large VA
2336         https://bugs.webkit.org/show_bug.cgi?id=200103
2337
2338         Reviewed by Mark Lam.
2339
2340         Move MachVMSPI.h from PAL to WTF.
2341
2342         * Platform/cocoa/SharedMemoryCocoa.cpp:
2343
2344 2019-07-24  Youenn Fablet  <youenn@apple.com>
2345
2346         Disable speculative loading if cache is not to be used for the load
2347         https://bugs.webkit.org/show_bug.cgi?id=199644
2348
2349         Reviewed by Alex Christensen.
2350
2351         When the page is reloaded, loads are instructed to not use the cache.
2352         It is therefore unneeded to do speculative revalidation.
2353         Allow speculative revalidation if the cache policy is either the default HTTP policy or
2354         if policy is to refresh all cache data.
2355         Covered by added test.
2356
2357         * NetworkProcess/cache/NetworkCache.cpp:
2358         (WebKit::NetworkCache::cachePolicyValidForSpeculativeRevalidation):
2359         (WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):
2360
2361 2019-07-24  Priyanka Agarwal  <pagarwal999@apple.com>
2362
2363         Allow Clients to Add Fields to the AutoFillContext Dictionary
2364         https://bugs.webkit.org/show_bug.cgi?id=199326
2365         rdar://problem/42816957
2366
2367         Reviewed by Wenson Hsieh.
2368
2369         * UIProcess/API/Cocoa/_WKInputDelegate.h:
2370         Added function declaration for function which returns additional dictionary for autofillcontext
2371
2372         * UIProcess/ios/WKContentViewInteraction.h:
2373         Created dictionary for additional autofillcontext
2374
2375         * UIProcess/ios/WKContentViewInteraction.mm:
2376         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
2377         Populating additional dictionary for autofillcontext
2378
2379         (-[WKContentView _autofillContext]):
2380         Adding new dictionary to the returned autofillcontext
2381
2382 2019-07-24  Chris Dumez  <cdumez@apple.com>
2383
2384         Regression(r247400): Unable to log into AIB Mobile Banking App
2385         https://bugs.webkit.org/show_bug.cgi?id=200094
2386         <rdar://problem/52519818>
2387
2388         Reviewed by Brent Fulgham.
2389
2390         In r247400, a change was made to only set the 'app has universal sandbox access' flag
2391         only when issueing the sandbox extension for / actually succeeded (it usually fails
2392         in practice). Previously, AIB Mobile Banking app was relying on this behavior to
2393         trigger a load for file:///login which is outside their container. However, now that
2394         the 'app has universal sandbox access' flag is no longer set, it trips our security
2395         checks and the load gets ignored.
2396
2397         To address the issue, apply only the 'app has universal sandbox access' flag fix with
2398         a linked-on-after check.
2399
2400         * UIProcess/Cocoa/VersionChecks.h:
2401         * UIProcess/WebPageProxy.cpp:
2402         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
2403
2404 2019-07-24  Tim Horton  <timothy_horton@apple.com>
2405
2406         Module-enabled users of WKWebProcessPlugInFrame.h fail to build; duplicate declaration
2407         https://bugs.webkit.org/show_bug.cgi?id=200095
2408         <rdar://problem/53512407>
2409
2410         Reviewed by Wenson Hsieh.
2411
2412         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
2413         Import <JavaScriptCore/JavaScriptCore.h> (the module header) instead of
2414         <JavaScriptCore/JSContext.h> directly, otherwise we can end up getting
2415         JSContext.h included twice, to the compiler's chagrin.
2416
2417 2019-07-24  Brady Eidson  <beidson@apple.com>
2418
2419         Crash in WebContent process with custom schemes.
2420         <rdar://problem/52968793> and https://bugs.webkit.org/show_bug.cgi?id=200062
2421
2422         Reviewed by Andy Estes.
2423
2424         Almost everywhere in WebURLSchemeTaskProxy where we call processNextPendingTask() we first protect the task with a ref.
2425         But not in didReceiveData.
2426         So lets do that.
2427
2428         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
2429         (WebKit::WebURLSchemeTaskProxy::didReceiveData): Protect this.
2430
2431 2019-07-24  Alex Christensen  <achristensen@webkit.org>
2432
2433         Null check CompletionHandler in WebPreviewLoaderClient::didReceivePassword
2434         https://bugs.webkit.org/show_bug.cgi?id=200080
2435         <rdar://problem/37275772>
2436
2437         Reviewed by Chris Dumez.
2438
2439         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp:
2440         (WebKit::WebPreviewLoaderClient::didReceivePassword):
2441
2442 2019-07-24  Chris Dumez  <cdumez@apple.com>
2443
2444         Crash under WebKit:WTF::Detail::CallableWrapper<WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking(WTF::CompletionHandler<void ()>&&)::$_32::operator()()::'lambda'(), void>::call
2445         https://bugs.webkit.org/show_bug.cgi?id=200071
2446         <rdar://problem/53335583>
2447
2448         Reviewed by Brent Fulgham and Youenn Fablet.
2449
2450         The WebResourceLoadStatisticsStore is a main thread object. In its destructor, it was dispatching
2451         to the background queue to destroy the m_statisticsStore / m_persistentStorage data members, which
2452         live on the background queue. It would then synchronously wait for the background queue to finish
2453         destroying them. The idea was to guarantee that the ResourceLoadStatisticsMemoryStore and the
2454         ResourceLoadStatisticsPersistentStorage would never outlive the WebResourceLoadStatisticsStore,
2455         given that they keep a raw pointer back to the WebResourceLoadStatisticsStore (via m_store data
2456         member).
2457
2458         The issue is that *while* the WebResourceLoadStatisticsStore destructor is running on the main
2459         thread, the background queue may be running code in ResourceLoadStatisticsMemoryStore or
2460         ResourceLoadStatisticsPersistentStorage which refs the WebResourceLoadStatisticsStore, even
2461         though its ref count has already reached 0. It is actually a common pattern in
2462         ResourceLoadStatisticsMemoryStore to call RunLoop::main().dispatch() and ref their m_store in
2463         the lambda, so that they can interact with the WebResourceLoadStatisticsStore.
2464
2465         To address the issue, we now destroy m_statisticsStore / m_persistentStorage *before* the
2466         WebResourceLoadStatisticsStore destructor runs. The NetworkSession destructor now calls
2467         WebResourceLoadStatisticsStore::didDestroyNetworkSession() which takes care of destroying
2468         m_statisticsStore / m_persistentStorage on the background queue, synchronously. The
2469         WebResourceLoadStatisticsStore destructor will only run later, once all remaining references
2470         to it are gone.
2471
2472         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2473         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
2474         (WebKit::WebResourceLoadStatisticsStore::didDestroyNetworkSession):
2475         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2476         * NetworkProcess/NetworkSession.cpp:
2477         (WebKit::NetworkSession::~NetworkSession):
2478
2479 2019-07-24  Youenn Fablet  <youenn@apple.com>
2480
2481         SYS___pthread_markcancel is sometimes used by libwebrtc
2482         https://bugs.webkit.org/show_bug.cgi?id=200087
2483         <rdar://problem/53408606>
2484
2485         Reviewed by Brent Fulgham.
2486
2487         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2488         Whitelist this unix-call within WebProcess as libwebrtc uses it.
2489
2490 2019-07-24  Zalan Bujtas  <zalan@apple.com>
2491
2492         ASSERTION FAILED: settings().textAutosizingEnabled() && settings().textAutosizingUsesIdempotentMode() in WebCore::Page::recomputeTextAutoSizingInAllFrames()
2493         https://bugs.webkit.org/show_bug.cgi?id=200079
2494         <rdar://problem/53474325>
2495
2496         Reviewed by Wenson Hsieh.
2497
2498         Do not reset idempotent values when the text autosizing is off.
2499
2500         * UIProcess/API/C/WKPreferences.cpp:
2501         (WKPreferencesSetTextAutosizingUsesIdempotentMode):
2502         (WKPreferencesGetTextAutosizingUsesIdempotentMode):
2503         * UIProcess/API/C/WKPreferencesRef.h:
2504         * WebProcess/WebPage/ios/WebPageIOS.mm:
2505         (WebKit::WebPage::resetIdempotentTextAutosizingIfNeeded):
2506
2507 2019-07-24  Chris Dumez  <cdumez@apple.com>
2508
2509         Unreviewed, rolling out r247766.
2510
2511         Caused an API test failure
2512
2513         Reverted changeset:
2514
2515         "Crash under
2516         WebKit:WTF::Detail::CallableWrapper<WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking(WTF::CompletionHandler<void
2517         ()>&&)::$_32::operator()()::'lambda'(), void>::call"
2518         https://bugs.webkit.org/show_bug.cgi?id=200071
2519         https://trac.webkit.org/changeset/247766
2520
2521 2019-07-23  Chris Dumez  <cdumez@apple.com>
2522
2523         Crash under WebKit:WTF::Detail::CallableWrapper<WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking(WTF::CompletionHandler<void ()>&&)::$_32::operator()()::'lambda'(), void>::call
2524         https://bugs.webkit.org/show_bug.cgi?id=200071
2525         <rdar://problem/53335583>
2526
2527         Reviewed by Brent Fulgham and Youenn Fablet.
2528
2529         The WebResourceLoadStatisticsStore is a main thread object. In its destructor, it was dispatching
2530         to the background queue to destroy the m_statisticsStore / m_persistentStorage data members, which
2531         live on the background queue. It would then synchronously wait for the background queue to finish
2532         destroying them. The idea was to guarantee that the ResourceLoadStatisticsMemoryStore and the
2533         ResourceLoadStatisticsPersistentStorage would never outlive the WebResourceLoadStatisticsStore,
2534         given that they keep a raw pointer back to the WebResourceLoadStatisticsStore (via m_store data
2535         member).
2536
2537         The issue is that *while* the WebResourceLoadStatisticsStore destructor is running on the main
2538         thread, the background queue may be running code in ResourceLoadStatisticsMemoryStore or
2539         ResourceLoadStatisticsPersistentStorage which refs the WebResourceLoadStatisticsStore, even
2540         though its ref count has already reached 0. It is actually a common pattern in
2541         ResourceLoadStatisticsMemoryStore to call RunLoop::main().dispatch() and ref their m_store in
2542         the lambda, so that they can interact with the WebResourceLoadStatisticsStore.
2543
2544         To address the issue, we now destroy m_statisticsStore / m_persistentStorage *before* the
2545         WebResourceLoadStatisticsStore destructor runs. The NetworkSession destructor now calls
2546         WebResourceLoadStatisticsStore::didDestroyNetworkSession() which takes care of destroying
2547         m_statisticsStore / m_persistentStorage on the background queue, synchronously. The
2548         WebResourceLoadStatisticsStore destructor will only run later, once all remaining references
2549         to it are gone.
2550
2551         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2552         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
2553         (WebKit::WebResourceLoadStatisticsStore::didDestroyNetworkSession):
2554         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2555         * NetworkProcess/NetworkSession.cpp:
2556         (WebKit::NetworkSession::~NetworkSession):
2557
2558 2019-07-23  Alex Christensen  <achristensen@webkit.org>
2559
2560         Move javaScriptConfigurationDirectory SPI from _WKProcessPoolConfiguration to WKProcessPoolPrivate to make it runtime switchable
2561         https://bugs.webkit.org/show_bug.cgi?id=200045
2562
2563         Reviewed by Mark Lam.
2564
2565         This allows me to maintain the status quo in Safari.
2566
2567         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2568         (API::ProcessPoolConfiguration::copy):
2569         * UIProcess/API/APIProcessPoolConfiguration.h:
2570         * UIProcess/API/Cocoa/WKProcessPool.mm:
2571         (-[WKProcessPool _javaScriptConfigurationDirectory]):
2572         (-[WKProcessPool _setJavaScriptConfigurationDirectory:]):
2573         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2574         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2575         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2576         (-[_WKProcessPoolConfiguration javaScriptConfigurationDirectory]): Deleted.
2577         (-[_WKProcessPoolConfiguration setJavaScriptConfigurationDirectory:]): Deleted.
2578         * UIProcess/WebProcessPool.cpp:
2579         (WebKit::legacyWebsiteDataStoreConfiguration):
2580         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
2581         * UIProcess/WebProcessPool.h:
2582
2583 2019-07-23  Russell Epstein  <repstein@apple.com>
2584
2585         Unreviewed, rolling out r247745.
2586
2587         This broke API test
2588         TestWebKitAPI.WKProcessPool.JavaScriptConfiguration as
2589         indicated by EWS
2590
2591         Reverted changeset:
2592
2593         "Move javaScriptConfigurationDirectory SPI from
2594         _WKProcessPoolConfiguration to WKProcessPoolPrivate to make it
2595         runtime switchable"
2596         https://bugs.webkit.org/show_bug.cgi?id=200045
2597         https://trac.webkit.org/changeset/247745
2598
2599 2019-07-23  Chris Fleizach  <cfleizach@apple.com>
2600
2601         AX: CrashTracer: com.apple.WebKit.WebContent at WebKit: WebKit::WebSpeechSynthesisClient::speak
2602         https://bugs.webkit.org/show_bug.cgi?id=199988
2603
2604         Reviewed by Per Arne Vollan.
2605
2606         Improvements to WebSpeechSynthesis to avoid crashing and improve correctness.
2607         - Reset and cancel speech jobs on page close or reload (otherwise the synthesizer keeps talking after your page is gone)
2608         - Have a separate speech finish callback mechanism, use the start speaking callback when the synthesizer tells us.
2609         - Move an assert on utterance state to only apply when we use the in process synthesizer.
2610
2611         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2612         (WebKit::WebPageProxy::didStartSpeaking):
2613         * UIProcess/WebPageProxy.cpp:
2614         (WebKit::WebPageProxy::reload):
2615         (WebKit::WebPageProxy::resetState):
2616         (WebKit::WebPageProxy::resetSpeechSynthesizer):
2617         (WebKit::WebPageProxy::speechSynthesisSetFinishedCallback):
2618         (WebKit::WebPageProxy::speechSynthesisSpeak):
2619         * UIProcess/WebPageProxy.h:
2620         * UIProcess/WebPageProxy.messages.in:
2621         * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp:
2622         (WebKit::WebSpeechSynthesisClient::speak):
2623
2624 2019-07-23  Chris Dumez  <cdumez@apple.com>
2625
2626         Get rid of unnecessary callback aggregators in WebResourceLoadStatisticsStore
2627         https://bugs.webkit.org/show_bug.cgi?id=200042
2628
2629         Reviewed by Brent Fulgham.
2630
2631         Only 1 asynchronous function is called so there is nothing to "aggregate".
2632
2633         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2634         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdate):
2635         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains):
2636         (WebKit::WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains):
2637
2638 2019-07-23  Zalan Bujtas  <zalan@apple.com>
2639
2640         [iOS] Tapping the search field on a search results page on zillow.com shows and immediately dismisses the keyboard
2641         https://bugs.webkit.org/show_bug.cgi?id=200044
2642         <rdar://problem/53103732>
2643
2644         Reviewed by Wenson Hsieh.
2645
2646         * Shared/FocusedElementInformation.cpp:
2647         (WebKit::FocusedElementInformation::encode const):
2648         (WebKit::FocusedElementInformation::decode):
2649         * Shared/FocusedElementInformation.h:
2650         * UIProcess/API/Cocoa/WKWebView.mm:
2651         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
2652         * UIProcess/ios/WKContentViewInteraction.h:
2653         * UIProcess/ios/WKContentViewInteraction.mm:
2654         (-[WKContentView _elementDidBlur]):
2655         (-[WKContentView _shouldAvoidScrollingWhenFocusedContentIsVisible]):
2656         * WebProcess/WebPage/ios/WebPageIOS.mm:
2657         (WebKit::WebPage::getFocusedElementInformation):
2658
2659 2019-07-23  Alex Christensen  <achristensen@webkit.org>
2660
2661         Move javaScriptConfigurationDirectory SPI from _WKProcessPoolConfiguration to WKProcessPoolPrivate to make it runtime switchable
2662         https://bugs.webkit.org/show_bug.cgi?id=200045
2663
2664         Reviewed by Mark Lam.
2665
2666         This allows me to maintain the status quo in Safari.
2667
2668         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2669         (API::ProcessPoolConfiguration::copy):
2670         * UIProcess/API/APIProcessPoolConfiguration.h:
2671         * UIProcess/API/Cocoa/WKProcessPool.mm:
2672         (-[WKProcessPool _javaScriptConfigurationDirectory]):
2673         (-[WKProcessPool _setJavaScriptConfigurationDirectory:]):
2674         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2675         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2676         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2677         (-[_WKProcessPoolConfiguration javaScriptConfigurationDirectory]): Deleted.
2678         (-[_WKProcessPoolConfiguration setJavaScriptConfigurationDirectory:]): Deleted.
2679         * UIProcess/WebProcessPool.cpp:
2680         (WebKit::legacyWebsiteDataStoreConfiguration):
2681         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
2682         * UIProcess/WebProcessPool.h:
2683
2684 2019-07-24  Simon Fraser  <simon.fraser@apple.com>
2685
2686         [iOS WK2] A top fixed bar can flicker when scrolling with the keyboard up
2687         https://bugs.webkit.org/show_bug.cgi?id=200105
2688         rdar://problem/52871975
2689
2690         Reviewed by Wenson Hsieh.
2691
2692         ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition() computes a visual viewport
2693         from the current scroll position and scrollableAreaSize(). This doesn't know anything about
2694         the impact of keyboards on the visual viewport, so it computes a too-large visual viewport
2695         when the keyboard is up, triggering incorrect manipulations of the layout viewport. This
2696         leads to the top bar flashing to position 0 when it should be hidden off the top.
2697
2698         Fix by feeding into the scrolling tree the height of the visual viewport which takes
2699         FrameView::visualViewportOverrideRect() into account. This is stored on ScrollingStateFrameScrollingNode/
2700         ScrollingTreeFrameScrollingNode.
2701
2702         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2703         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
2704         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
2705
2706 2019-07-23  Alex Christensen  <achristensen@webkit.org>
2707
2708         Add SPI for setting media cache and key location on _WKWebsiteDataStoreConfiguration
2709         https://bugs.webkit.org/show_bug.cgi?id=199972
2710
2711         Reviewed by Jer Noble.
2712
2713         This is a step towards removing WebsiteDataStore::legacyDefaultDataStoreConfiguration
2714         I added a unit test for the media cache location,
2715         but the media key location can't reasonably be unit tested in an open source project.
2716
2717         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2718         (-[WKWebsiteDataStore _initWithConfiguration:]):
2719         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2720         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
2721         (-[_WKWebsiteDataStoreConfiguration mediaCacheDirectory]):
2722         (-[_WKWebsiteDataStoreConfiguration setMediaCacheDirectory:]):
2723         (-[_WKWebsiteDataStoreConfiguration mediaKeysStorageDirectory]):
2724         (-[_WKWebsiteDataStoreConfiguration setMediaKeysStorageDirectory:]):
2725
2726 2019-07-23  Wenson Hsieh  <wenson_hsieh@apple.com>
2727
2728         [macOS 10.15] Web process crashes when attempting to show the font panel via Font > Show Fonts
2729         https://bugs.webkit.org/show_bug.cgi?id=200021
2730         <rdar://problem/53301325>
2731
2732         Reviewed by Ryosuke Niwa.
2733
2734         Always return false from canShowFontPanel in WebKit2.
2735
2736         * WebProcess/WebCoreSupport/WebEditorClient.h:
2737
2738 2019-07-23  Carlos Garcia Campos  <cgarcia@igalia.com>
2739
2740         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.25.3 release
2741
2742         * gtk/NEWS: Add release notes for 2.25.3.
2743
2744 2019-07-23  Carlos Garcia Campos  <cgarcia@igalia.com>
2745
2746         [GTK] Emoji chooser is misplaced after scrolling
2747         https://bugs.webkit.org/show_bug.cgi?id=199996
2748
2749         Reviewed by Michael Catanzaro.
2750
2751         Convert caret rectangle coordinates to root view.
2752
2753         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2754         (WebKit::WebPage::showEmojiPicker):
2755
2756 2019-07-22  Ross Kirsling  <ross.kirsling@sony.com>
2757
2758         Unreviewed non-unified build fix.
2759
2760         * NetworkProcess/NetworkCORSPreflightChecker.h:
2761         * NetworkProcess/NetworkLoadChecker.h:
2762         * UIProcess/API/C/WKContext.cpp:
2763         * UIProcess/API/C/WKPageConfigurationRef.cpp:
2764         * UIProcess/Downloads/DownloadProxy.cpp:
2765         * UIProcess/WebPageInjectedBundleClient.cpp:
2766         * UIProcess/WebPreferences.cpp:
2767         * WebProcess/Network/WebSocketChannel.cpp:
2768         (WebKit::PendingMessage::PendingMessage):
2769
2770 2019-07-22  Megan Gardner  <megan_gardner@apple.com>
2771
2772         Remove Staging for scrolling bug
2773         https://bugs.webkit.org/show_bug.cgi?id=199894
2774
2775         Reviewed by Wenson Hsieh.
2776
2777         * UIProcess/ios/WKContentViewInteraction.mm:
2778         (-[WKUIWKTextInteractionAssistant scrollSelectionToVisible]): Deleted.
2779
2780 2019-07-22  Brent Fulgham  <bfulgham@apple.com>
2781
2782         Correct web audio-related crash in seed reports
2783         https://bugs.webkit.org/show_bug.cgi?id=200009
2784         <rdar://problem/51565203>
2785
2786         Reviewed by Per Arne Vollan.
2787
2788         Revise the iOS sandbox to allow the WebContent process to communicate with
2789         the 'com.apple.coremedia.audioprocessingtap.xpc' service, which is needed by
2790         some types of WebAudio.
2791
2792         * WebProcess/com.apple.WebKit.WebContent.sb.in:
2793
2794 2019-07-22  Dean Jackson  <dino@apple.com>
2795
2796         WebKit SPI fix for [ClickyOrb] Audio continues playing after dismissing a video preview in Safari
2797         https://bugs.webkit.org/show_bug.cgi?id=200011
2798         <rdar://problem/53409457>
2799
2800         Reviewed by Tim Horton.
2801
2802         Don't check for the SPI @selector(_webView:contextMenuDidEndForElement:)
2803         on the WKUIDelegate so that clients that got caught implementing the
2804         SPI before moving to the real API can still clean-up state. In other words,
2805         don't force a client that only implements that method to move completely
2806         to the new API.
2807
2808         * UIProcess/ios/WKContentViewInteraction.mm:
2809         (needsDeprecatedPreviewAPI):
2810
2811 2019-07-22  Jer Noble  <jer.noble@apple.com>
2812
2813         REGRESSION(rUnknown): YouTube playback pauses when switching to a new tab
2814         https://bugs.webkit.org/show_bug.cgi?id=199971
2815         <rdar://problem/51951218>
2816
2817         Reviewed by Alex Christensen.
2818
2819         When we get a message notifying us that the view has been removed from the window, we unconditionally
2820         ask the fullscreen manager to exit fullscreen, which has the side effect (on iOS) of pausing the video
2821         unconditionally. Only ask the fullscreen manager to exit fullscreen if there is actually a video in
2822         fullscreen mode.
2823
2824         * UIProcess/WebPageProxy.cpp:
2825         (WebKit::WebPageProxy::viewDidLeaveWindow):
2826
2827 2019-07-22  Youenn Fablet  <youenn@apple.com>
2828
2829         Make sure to unref captured lambda variables given to _strictTrustEvaluate in the main thread
2830         https://bugs.webkit.org/show_bug.cgi?id=199948
2831
2832         Reviewed by Alex Christensen.
2833
2834         Use a weak pointer instead of a Ref for the NetworkSession.
2835         Add a null check in processServerTrustEvaluation for extra safety if we decide to remove the data task NetworkSession ref.
2836         Make sure to move the NetworkDataTask ref in the completion handler so that the unrefing is done in the main thread.
2837
2838         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2839         (processServerTrustEvaluation):
2840         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
2841
2842 2019-07-22  Alex Christensen  <achristensen@webkit.org>
2843
2844         Don't always look for a JSC configuration file after r247685
2845         https://bugs.webkit.org/show_bug.cgi?id=199917
2846
2847         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2848         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
2849         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
2850         ProcessPoolConfiguration's javaScriptConfigurationDirectory wasn't used before r247685,
2851         which made it always look for a file with 'JavaScriptCoreDebug' in its name.  I had assumed
2852         m_javaScriptConfigurationDirectory would default to a null string, but it was defaulting to
2853         defaultJavaScriptConfigurationDirectory.  Make it a null string instead.
2854
2855 2019-07-22  Simon Fraser  <simon.fraser@apple.com>
2856
2857         Make some constructors explicit
2858         https://bugs.webkit.org/show_bug.cgi?id=199981
2859
2860         Reviewed by Daniel Bates.
2861
2862         Make explicit public constructors of objects that take POD or String& arguments,
2863         to reduce the changes of the compiler doing implicit conversions.
2864
2865         * Platform/Module.h:
2866         * WebProcess/WebPage/WebInspector.cpp:
2867         (WebKit::WebInspector::openInNewTab):
2868
2869 2019-07-22  Daniel Bates  <dabates@apple.com>
2870
2871         [iOS] REGRESSION (r241734): Autocorrection highlight should hide when field becomes defocused
2872         https://bugs.webkit.org/show_bug.cgi?id=199807
2873         <rdar://problem/52760259>
2874
2875         Fix a bad merge of r247653. svn-apply was way too forgiving. The original patch touched
2876         the non-existent function, -_didCommitLoadForMainFrame in WKContentViewInteraction.mm. Because
2877         that didn't exist, svn-apply patched up -clearSelection.
2878
2879         * UIProcess/ios/WKContentView.h:
2880         * UIProcess/ios/WKContentView.mm:
2881         (-[WKContentView _didCommitLoadForMainFrame]): Deleted; moved to WKContentViewInteraction.mm
2882         * UIProcess/ios/WKContentViewInteraction.h:
2883         * UIProcess/ios/WKContentViewInteraction.mm:
2884         (-[WKContentView clearSelection]): Remove code that should be in -_didCommitLoadForMainFrame.
2885         (-[WKContentView _didCommitLoadForMainFrame]): Moved from WKContentView.mm
2886
2887 2019-07-22  Alex Christensen  <achristensen@webkit.org>
2888
2889         Add SPI to _WKWebsiteDataStoreConfiguration for configuring application cache storage location
2890         https://bugs.webkit.org/show_bug.cgi?id=199954
2891
2892         Reviewed by Geoff Garen.
2893
2894         This is a step towards removing WebsiteDataStore::legacyDefaultDataStoreConfiguration
2895         Covered by a new API test.
2896
2897         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2898         (-[WKWebsiteDataStore _initWithConfiguration:]):
2899         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2900         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
2901         (-[_WKWebsiteDataStoreConfiguration applicationCacheDirectory]):
2902         (-[_WKWebsiteDataStoreConfiguration setApplicationCacheDirectory:]):
2903         (-[_WKWebsiteDataStoreConfiguration applicationCacheFlatFileSubdirectoryName]):
2904         (-[_WKWebsiteDataStoreConfiguration setApplicationCacheFlatFileSubdirectoryName:]):
2905         * UIProcess/WebProcessPool.cpp:
2906         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
2907         * UIProcess/WebsiteData/WebsiteDataStore.h:
2908         (WebKit::WebsiteDataStore::applicationCacheFlatFileSubdirectoryName const):
2909
2910 2019-07-22  Alex Christensen  <achristensen@webkit.org>
2911
2912         Add SPI _WKProcessPoolConfiguration.javaScriptConfigurationDirectory
2913         https://bugs.webkit.org/show_bug.cgi?id=199917
2914
2915         Reviewed by Sam Weinig.
2916
2917         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2918         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2919         (-[_WKProcessPoolConfiguration javaScriptConfigurationDirectory]):
2920         (-[_WKProcessPoolConfiguration setJavaScriptConfigurationDirectory:]):
2921         * UIProcess/WebProcessPool.cpp:
2922         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
2923
2924 2019-07-22  Carlos Garcia Campos  <cgarcia@igalia.com>
2925
2926         [SOUP] WebSockets: use new api to send text messages
2927         https://bugs.webkit.org/show_bug.cgi?id=199936
2928
2929         Reviewed by Michael Catanzaro.
2930
2931         New API allows to include null character in text messages.
2932
2933         * NetworkProcess/soup/WebSocketTaskSoup.cpp:
2934         (WebKit::WebSocketTask::didReceiveMessageCallback): Pass data size to String::fromUTF8().
2935         (WebKit::WebSocketTask::sendString): Use soup_websocket_connection_send_message() instead of
2936         soup_websocket_connection_send_text() when available. Also use
2937         StrictConversionReplacingUnpairedSurrogatesWithFFFD options when converting to UTF-8.
2938
2939 2019-07-21  Wenson Hsieh  <wenson_hsieh@apple.com>
2940
2941         [iOS] [WebKit2] Add limited support for -isPosition:atBoundary:inDirection: in WKContentView
2942         https://bugs.webkit.org/show_bug.cgi?id=199993
2943         <rdar://problem/49523528>
2944
2945         Reviewed by Beth Dakin.
2946
2947         Add support for -isPosition:atBoundary:inDirection:, only in the cases where the given position is the start or
2948         and position and the given granularity is UITextGranularityParagraph.
2949
2950         Test: EditorStateTests.ParagraphBoundary
2951
2952         * Shared/EditorState.cpp:
2953         (WebKit::EditorState::PostLayoutData::encode const):
2954         (WebKit::EditorState::PostLayoutData::decode):
2955         * Shared/EditorState.h:
2956
2957         Add a couple of bits to indicate whether the selection start or end positions are at paragraph boundaries.
2958
2959         * UIProcess/ios/WKContentViewInteraction.mm:
2960         (-[WKContentView isPosition:atBoundary:inDirection:]):
2961
2962         Implement this to return selectionStartIsAtParagraphBoundary or selectionEndIsAtParagraphBoundary.
2963
2964         * WebProcess/WebPage/ios/WebPageIOS.mm:
2965         (WebKit::WebPage::platformEditorState const):
2966
2967 2019-07-20  Chris Dumez  <cdumez@apple.com>
2968
2969         Speed up HashTable decoding by reserving capacity and avoiding rehashing
2970         https://bugs.webkit.org/show_bug.cgi?id=199982
2971
2972         Reviewed by Saam Barati.
2973
2974         Use HashMap::reserveInitialCapacity() in the HashMap IPC decoder for
2975         performance. I measured a ~35% improvement when decoding a very large
2976         HashMap of Strings (~160k entries) in the context of the
2977         StorageManager::GetValues IPC.
2978
2979         * Platform/IPC/ArgumentCoders.h:
2980         * Shared/API/c/WKDictionary.cpp:
2981         (WKDictionaryCreate):
2982
2983 2019-07-20  Chris Dumez  <cdumez@apple.com>
2984
2985         Micro-optimize HashMap & String IPC decoding
2986         https://bugs.webkit.org/show_bug.cgi?id=199967
2987
2988         Reviewed by Geoffrey Garen.
2989
2990         The legacy HashMap decoder (returning a boolean) was failing to WTFMove()
2991         the key & value when calling HashMap::add(). The modern decoder (returning
2992         an Optional) was properly using WTFMove(). Rewrite the legacy HashMap decoder
2993         to call the modern one to reduce code duplication and to get this optimization.
2994
2995         Also, encode HashMap::size() as a uint32_t instead of a uint64_t since
2996         HashMap::size() returns an 'unsigned int' type. Finally, update the modern
2997         decoder to WTFMove(hashMap) when returning. Because the function returns an
2998         Optional<HashMap> and not a HashMap, I do not believe we get return value
2999         optimization (RVO).
3000
3001         Do similar changes to String IPC coders.
3002
3003         * Platform/IPC/ArgumentCoders.cpp:
3004         (IPC::decodeStringText):
3005         (IPC::ArgumentCoder<String>::decode):
3006         * Platform/IPC/ArgumentCoders.h:
3007
3008 2019-07-20  Alexander Mikhaylenko  <exalm7659@gmail.com>
3009
3010         REGRESSION(r246033/r246496): [GTK] Kinetic scrolling doesn't work
3011         https://bugs.webkit.org/show_bug.cgi?id=199322
3012
3013         Reviewed by Michael Catanzaro.
3014
3015         Check ENABLE(KINETIC_SCROLLING) instead of ENABLE(ASYNC_SCROLLING) when setting wheel event phase and momentum phase.
3016
3017         * Shared/WebEventConversion.cpp:
3018         (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
3019
3020 2019-07-20  Zalan Bujtas  <zalan@apple.com>
3021
3022         [Text autosizing] Do not nuke the style on dynamicViewportSizeUpdate
3023         https://bugs.webkit.org/show_bug.cgi?id=199718
3024         <rdar://problem/53344961>
3025
3026         Reviewed by Simon Fraser.
3027
3028         * WebProcess/WebPage/WebPage.cpp:
3029         (WebKit::m_textAutoSizingAdjustmentTimer):
3030         (WebKit::WebPage::close):
3031         (WebKit::WebPage::didCommitLoad):
3032         (WebKit::WebPage::textAutoSizingAdjustmentTimerFired):
3033         (WebKit::m_shrinkToFitContentTimer): Deleted.
3034         * WebProcess/WebPage/WebPage.h:
3035         * WebProcess/WebPage/ios/WebPageIOS.mm:
3036         (WebKit::WebPage::dynamicViewportSizeUpdate):
3037         (WebKit::WebPage::resetIdempotentTextAutosizingIfNeeded):
3038         (WebKit::WebPage::resetTextAutosizing):
3039         (WebKit::WebPage::viewportConfigurationChanged):
3040
3041 2019-07-19  Youenn Fablet  <youenn@apple.com>
3042
3043         Remote WebInspector should enable mock capture devices in UIProcess if doing it in WebProcess
3044         https://bugs.webkit.org/show_bug.cgi?id=199924
3045         <rdar://problem/50552067>
3046
3047         Reviewed by Devin Rousso.
3048
3049         Add IPC plumbery to pass inspector override value for mock capture devices.
3050         Add an override in UserMediaPermissionRequestManagerProxy so that the value stays in sync with web inspector.
3051         The override will be removed when web inspector goes away.
3052
3053         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3054         (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs const):
3055         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
3056         (WebKit::UserMediaPermissionRequestManagerProxy::setMockCaptureDevicesEnabledOverride):
3057         * UIProcess/WebInspectorProxy.cpp:
3058         (WebKit::WebInspectorProxy::setMockCaptureDevicesEnabled):
3059         * UIProcess/WebInspectorProxy.h:
3060         * UIProcess/WebInspectorProxy.messages.in:
3061         * UIProcess/WebPageProxy.cpp:
3062         (WebKit::WebPageProxy::setMockCaptureDevicesEnabledOverride):
3063         * UIProcess/WebPageProxy.h:
3064         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
3065         (WebKit::WebInspectorClient::setMockCaptureDevicesEnabled):
3066         * WebProcess/WebCoreSupport/WebInspectorClient.h:
3067         * WebProcess/WebPage/WebInspector.cpp:
3068         (WebKit::WebInspector::setMockCaptureDevicesEnabled):
3069         * WebProcess/WebPage/WebInspector.h:
3070
3071 2019-07-19  Tim Horton  <timothy_horton@apple.com>
3072
3073         Web Content process gets stuck suspended after navigating away from a system preview
3074         https://bugs.webkit.org/show_bug.cgi?id=199965
3075         <rdar://problem/53109004>
3076
3077         Reviewed by Dean Jackson.
3078
3079         * UIProcess/API/Cocoa/WKWebView.mm:
3080         (-[WKWebView _isBackground]):
3081         * UIProcess/ios/WKSystemPreviewView.h:
3082         * UIProcess/ios/WKSystemPreviewView.mm:
3083         (-[WKSystemPreviewView web_initWithFrame:webView:mimeType:]):
3084         (-[WKSystemPreviewView web_isBackground]):
3085         Apply the fix from r193481 to WKSystemPreviewView as well, having it
3086         become a WKApplicationStateTrackingView and plumbing that through
3087         to our is-background machinery.
3088
3089         We really, really should instead have WKWebView itself be the application
3090         state tracking view, but that is a bigger change (and has some implications
3091         for full-screen video and whatnot).
3092
3093 2019-07-19  Dean Jackson  <dino@apple.com>
3094
3095         Provide correct names for UIContextMenuInteraction API replacements
3096         https://bugs.webkit.org/show_bug.cgi?id=199966
3097
3098         Reviewed by Tim Horton.
3099
3100         We had some old incorrect names for replacements to SPI. While
3101         here, I reordered and expanded the documentation for the new API.
3102
3103         * UIProcess/API/Cocoa/WKUIDelegate.h:
3104         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3105
3106 2019-07-19  Daniel Bates  <dabates@apple.com>
3107
3108         [iOS] REGRESSION (r241734): Autocorrection highlight should hide when field becomes defocused
3109         https://bugs.webkit.org/show_bug.cgi?id=199807
3110         <rdar://problem/52760259>
3111
3112         Reviewed by Wenson Hsieh.
3113
3114         Sometimes the correction highlight may not hide when defocusing an editable field.
3115         This occurs only when a person pressed a key in a non-editable element beforehand.
3116         We need to reset some state to force a re-computation of whether a keyboard is still
3117         needed whenever an element is defocused (blurred in web paralance).
3118
3119         Following r241734 both editable and non-editable key events are handled using the same
3120         code path. This is accomplished by having WKContentView's -_requiresKeyboardWhenFirstResponder
3121         return YES to tell UIKit it needs a keyboard even when there is no editable element focused.
3122         As a result UIKit retains all the keyboard state, including keeping the correction highlight
3123         visible. Prior to r241734 WKContentView's -_requiresKeyboardWhenFirstResponder would not return
3124         YES when a non-editable element was focused and hence UIKit would tear down the keyboard
3125         and its state, including the correction highlight. In r245154, we made keyboard instantiate
3126         for a focused non-editable element lazy as a performance optimization. Although r245154
3127         kept the r241734 behavior (just made it lazy) it re-wrote the code in such a way that we
3128         can utilize it as a hook to fix this bug. In particular, we now clear the bit about a
3129         seen keydown in a non-editable element whenever we are defocusing an editable element
3130         before we reload the input views, as part of hiding the keyboard. On the reload, UIKit
3131         will call -_requiresKeyboardWhenFirstResponder, WebKit will respond with NO now that
3132         a non-editable element is focused and hence UIKit will do what it did pre r241734: tear
3133         down the keyboard.
3134
3135         * UIProcess/ios/WKContentViewInteraction.mm:
3136         (-[WKContentView _didCommitLoadForMainFrame]): Clear the bit about a seen keydown here
3137         so that we don't keep the keyboard around on a new page commit. This includes the case
3138         when the same page is reloaded. There is not much advantage to keeping the keyboard
3139         around across reloads and not doing so will reduce our memory footprint. 
3140         (-[WKContentView _elementDidBlur]): Clear the same bit as well when defocusing an
3141         editable element. This will cause UIKit to tear down the keyboard on reload removing
3142         the correction highlight.
3143
3144 2019-07-19  Dean Jackson  <dino@apple.com>
3145
3146         Add a menu item to toggle between showing and hiding link previews
3147         https://bugs.webkit.org/show_bug.cgi?id=199940
3148         <rdar://problem/53032288>
3149
3150         Reviewed by Beth Dakin.
3151
3152         Add a new _WKElementAction that toggles the display of link previews
3153         in context menus, and add it to the default set of actions we provide
3154         for links.
3155
3156         When a UIAction is created from this new _WKElementAction type,
3157         it can be identified by WKElementActionTypeToggleShowLinkPreviewsIdentifier.
3158         This allows us to check a UIMenu provided by a delegate to make sure
3159         that they have provided the toggle menu item. If they haven't, we add it
3160         back.
3161
3162         The preference for showing links is moved from kCFPreferencesAnyApplication
3163         to standard user defaults, so that it can be set no matter what the
3164         hosting application is.
3165
3166         * UIProcess/API/Cocoa/_WKElementAction.h: New action type.
3167         * UIProcess/API/Cocoa/_WKElementAction.mm: 
3168         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
3169         (+[_WKElementAction imageForElementActionType:]): Use eye.fill for now.
3170         I'll need to check with HI to see if there is a more appropriate glyph.
3171         (elementActionTypeToUIActionIdentifier):
3172         (uiActionIdentifierToElementActionType):
3173
3174         * UIProcess/ios/WKActionSheetAssistant.mm: Add the toggle action to
3175         the default set.
3176         (-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
3177
3178         * UIProcess/ios/WKContentViewInteraction.mm:
3179         (-[WKContentView _registerPreview]): No need to listen for CFPreferences
3180         notifications any more.
3181         (-[WKContentView _unregisterPreview]):
3182         (menuWithShowLinkPreviewAction): New method that adds the UIAction
3183         for toggling previews to a UIMenu if necessary.
3184         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
3185         (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]):
3186         (-[WKContentView _showLinkPreviewsPreferenceChanged:]): Deleted.
3187         (titleForMenu): Deleted. URL text previews will be provided separately.
3188
3189 2019-07-19  Wenson Hsieh  <wenson_hsieh@apple.com>
3190
3191         [iOS] Entering 2FA code on idmsa.apple.com causes unexpected scrolling
3192         https://bugs.webkit.org/show_bug.cgi?id=199949
3193         <rdar://problem/49944428>
3194
3195         Reviewed by Tim Horton and Megan Gardner.
3196
3197         Since at least iOS 11, -[UIScrollView _adjustForAutomaticKeyboardInfo:animated:lastAdjustment:] adjusts the
3198         scroll view's content offset to account for updated keyboard bottom insets. In WebKit, we call this method
3199         whenever keyboard geometry changes (based on system notifications, such as UIKeyboardWillHideNotification).
3200
3201         When switching between focused form fields, we hide the keyboard for the previous focused element prior to
3202         showing the keyboard for the newly focused element. This means that we will actually dismiss the keyboard in the
3203         process of changing the focused element, which posts keyboard geometry notifications, which causes us to scroll
3204         WKScrollView.
3205
3206         On iOS 12, this would be immediately followed by re-presenting the keyboard for the new focused element, which
3207         causes us to adjust the scroll view back to its original position right away; this means that the scrolling that
3208         happens as a result of adjusting for the keyboard insets after dismissal doesn't result in any visible change.
3209
3210         However, on iOS 13, after r239441 and r244546, we now defer scrolling and zooming to reveal the focused element
3211         until later; this means the scrolling that happens as a result of initially dismissing the keyboard now causes a
3212         consistent jump in the scroll view's scroll position (whereas on iOS 12, this only happens rarely, and the jump
3213         is also less noticeable).
3214
3215         To mitigate this, we detect the case where we're moving focus from one element to another; if we're about to
3216         show a keyboard for the newly focused element, then we should avoid scrolling as a result of the impending
3217         "keyboard will hide" notification.
3218
3219         Test: fast/forms/ios/no-scrolling-when-moving-focus-between-adjacent-fields.html
3220
3221         * UIProcess/API/Cocoa/WKWebView.mm:
3222         (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
3223         (-[WKWebView _keyboardWillHide:]):
3224         * UIProcess/ios/WKContentViewInteraction.h:
3225         * UIProcess/ios/WKContentViewInteraction.mm:
3226         (shouldShowKeyboardForElement):
3227
3228         Add a helper to determine whether we're focusing an element which presents a "keyboard" (i.e. a UIKit input
3229         view, as opposed to modal select pickers, modal date pickers, or fields with inputmode="none", for which we
3230         don't show an input view).
3231
3232         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
3233         (-[WKContentView shouldIgnoreKeyboardWillHideNotification]):
3234
3235 2019-07-18  Alex Christensen  <achristensen@webkit.org>
3236
3237         Fix warning when importing WebKit in Swift
3238         https://bugs.webkit.org/show_bug.cgi?id=199914
3239         <rdar://problem/52854930>
3240
3241         Reviewed by Wenson Hsieh.
3242
3243         * UIProcess/API/Cocoa/NSAttributedString.h:
3244         Declare NSAttributedString and update a swift name.
3245         This fix was proposed by Argyrios Kyrtzidis.
3246
3247 2019-07-18  Alex Christensen  <achristensen@webkit.org>
3248
3249         Add and test _WKWebsiteDataStoreConfiguration.deviceIdHashSaltsStorageDirectory SPI
3250         https://bugs.webkit.org/show_bug.cgi?id=199923
3251
3252         Reviewed by Youenn Fablet.
3253
3254         This is a step towards us getting rid of WebsiteDataStore::legacyDefaultDataStoreConfiguration
3255
3256         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3257         (-[WKWebsiteDataStore _initWithConfiguration:]):
3258         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
3259         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
3260         (-[_WKWebsiteDataStoreConfiguration deviceIdHashSaltsStorageDirectory]):
3261         (-[_WKWebsiteDataStoreConfiguration setDeviceIdHashSaltsStorageDirectory:]):
3262
3263 2019-07-18  Alex Christensen  <achristensen@webkit.org>
3264
3265         Move NetworkCache ownership from NetworkProcess to NetworkSession
3266         https://bugs.webkit.org/show_bug.cgi?id=199817
3267
3268         Reviewed by Geoff Garen.
3269
3270         I also added SPI to set the path of the NetworkCache with an API test.
3271         If this new SPI is not used, it falls back to getting the cache location from the NetworkProcess to maintain compatibility.
3272         We still get options, cache size, and cache model from the NetworkProcess.  Those should be migrated with new SPI later.
3273         Clearing the cache and other operations now iterate the NetworkSessions instead of assuming there is only one cache.
3274
3275         * NetworkProcess/NetworkProcess.cpp:
3276         (WebKit::NetworkProcess::fetchWebsiteData):
3277         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
3278         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
3279         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
3280         (WebKit::NetworkProcess::setCacheModel):
3281         * NetworkProcess/NetworkProcess.h:
3282         (WebKit::NetworkProcess::diskCacheDirectory const):
3283         (WebKit::NetworkProcess::cacheOptions const):
3284         (WebKit::NetworkProcess::cache): Deleted.
3285         * NetworkProcess/NetworkResourceLoader.cpp:
3286         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
3287         * NetworkProcess/NetworkSession.cpp:
3288         (WebKit::NetworkSession::NetworkSession):
3289         * NetworkProcess/NetworkSession.h:
3290         (WebKit::NetworkSession::cache):
3291         * NetworkProcess/NetworkSessionCreationParameters.cpp:
3292         (WebKit::NetworkSessionCreationParameters::encode const):
3293         (WebKit::NetworkSessionCreationParameters::decode):
3294         * NetworkProcess/NetworkSessionCreationParameters.h:
3295         * NetworkProcess/cache/NetworkCache.cpp:
3296         (WebKit::NetworkCache::Cache::open):
3297         (WebKit::NetworkCache::Cache::Cache):
3298         * NetworkProcess/cache/NetworkCache.h:
3299         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3300         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
3301         (WebKit::NetworkProcess::clearDiskCache):
3302         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3303         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3304         * NetworkProcess/curl/NetworkSessionCurl.cpp:
3305         (WebKit::NetworkSessionCurl::NetworkSessionCurl):
3306         * NetworkProcess/soup/NetworkSessionSoup.cpp:
3307         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
3308         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3309         (-[WKWebsiteDataStore _initWithConfiguration:]):
3310         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
3311         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
3312         (-[_WKWebsiteDataStoreConfiguration networkCacheDirectory]):
3313         (-[_WKWebsiteDataStoreConfiguration setNetworkCacheDirectory:]):
3314         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3315         (WebKit::WebsiteDataStore::parameters):
3316         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3317         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
3318         * UIProcess/WebsiteData/WebsiteDataStore.h:
3319         (WebKit::WebsiteDataStore::resolvedNetworkCacheDirectory const):
3320
3321 2019-07-18  Chris Dumez  <cdumez@apple.com>
3322
3323         Regression(r247486) Multiple Layout Tests in http/tests/cache/* are crashing on iOS Debug WK2
3324         https://bugs.webkit.org/show_bug.cgi?id=199892
3325         <rdar://problem/53230217>
3326
3327         Reviewed by Geoffrey Garen.
3328
3329         The StorageManager was unregistering itself as a WorkQueueMessageReceiver on a given IPC
3330         connection too early. As a result, we would sometimes receive a 'StorageManager:DestroyStorageMap'
3331         IPC in NetworkConnectionToWebProcess::didReceiveMessage() with nobody to process it, which would
3332         trigger an assertion. To address the issue, we stop unregistering the StorageManager as a
3333         WorkQueueMessageReceiver inside removeAllowedSessionStorageNamespaceConnection(). Instead, we
3334         let the logic inside processDidCloseConnection() take care of it once the connection closes.
3335
3336         * NetworkProcess/WebStorage/StorageManager.cpp:
3337         (WebKit::StorageManager::removeAllowedSessionStorageNamespaceConnection):
3338         (WebKit::StorageManager::processDidCloseConnection):
3339         * NetworkProcess/WebStorage/StorageManager.h:
3340
3341 2019-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
3342
3343         [GTK] Crash in webkitWebViewBaseRenderHostFileDescriptor
3344         https://bugs.webkit.org/show_bug.cgi?id=199402
3345
3346         Reviewed by Michael Catanzaro.
3347
3348         There are two problems here:
3349
3350          - We need to ensure that the checks we do in HardwareAccelerationManager to disable AC mode are the same
3351            as the ones done in AcceleratedBackingStore create() methods. This is not the case for WPE renderer.
3352          - Some of the places where accelerateBackingStore is used, can be called even if AC mode is disabled, so we
3353            need to null-check there before using the backing store.
3354
3355         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3356         (webkitWebViewBaseDraw): Add an assert to ensure accelerateBackingStore is not nullptr here.
3357         (webkitWebViewBaseEnterAcceleratedCompositingMode): Ditto.
3358         (webkitWebViewBaseUpdateAcceleratedCompositingMode): Ditto.
3359         (webkitWebViewBaseExitAcceleratedCompositingMode): Ditto.
3360         (webkitWebViewBaseMakeGLContextCurrent): Ditto.
3361         (webkitWebViewBaseDidRelaunchWebProcess): Null-check accelerateBackingStore before using it.
3362         (webkitWebViewBasePageClosed): Ditto.
3363         (webkitWebViewBaseRenderHostFileDescriptor): Ditto.
3364         * UIProcess/gtk/AcceleratedBackingStore.cpp:
3365         (WebKit::AcceleratedBackingStore::checkRequirements): Call AcceleratedBackingStoreWayland::checkRequirements()
3366         or AcceleratedBackingStoreX11::checkRequirements() depending on the current display.
3367         (WebKit::AcceleratedBackingStore::create): Return early if AC mode is disabled in HardwareAccelerationManager.
3368         * UIProcess/gtk/AcceleratedBackingStore.h:
3369         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
3370         (WebKit::AcceleratedBackingStoreWayland::checkRequirements): Check requirements for hardware acceleration in Wayland.
3371         (WebKit::AcceleratedBackingStoreWayland::create): Assert that requirements are present.
3372         * UIProcess/gtk/AcceleratedBackingStoreWayland.h:
3373         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
3374         (WebKit::AcceleratedBackingStoreX11::checkRequirements): Check requirements for hardware acceleration in X11.
3375         (WebKit::AcceleratedBackingStoreX11::create): Assert that requirements are present.
3376         * UIProcess/gtk/AcceleratedBackingStoreX11.h:
3377         * UIProcess/gtk/HardwareAccelerationManager.cpp:
3378         (WebKit::HardwareAccelerationManager::HardwareAccelerationManager): Use
3379         AcceleratedBackingStore::checkRequirements() to decide whether to disable AC mode.
3380
3381 2019-07-17  Megan Gardner  <megan_gardner@apple.com>
3382
3383         Early Out of positionInfomation check if possible
3384         https://bugs.webkit.org/show_bug.cgi?id=199885
3385         <rdar://problem/53229413>
3386
3387         This is an early-out check that happens after most of the work is done.
3388         Move it to happen before we make all these calls, if in the end, we will not use the information.
3389
3390         Reviewed by Tim Horton.
3391
3392         * UIProcess/ios/WKContentViewInteraction.mm:
3393         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
3394
3395 2019-07-17  Chris Dumez  <cdumez@apple.com>
3396
3397         Unreviewed, add debug logging to help diagnose flaky crashes on the bots.
3398
3399         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3400         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):