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