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