AX: web process should load correct bundle path for MACCATALYST
[WebKit.git] / Source / WebKit / ChangeLog
1 2019-07-26  Eric Liang  <ericliang@apple.com>
2
3         AX: web process should load correct bundle path for MACCATALYST
4         https://bugs.webkit.org/show_bug.cgi?id=200122
5
6         Reviewed by Brent Fulgham.
7
8         Added the path to accessibility bundle for Mac Catalyst.
9         Added sandbox profile to read accessibility settings.
10
11         * WebProcess/cocoa/WebProcessCocoa.mm:
12         (WebKit::registerWithAccessibility):
13         * WebProcess/com.apple.WebProcess.sb.in:
14
15 2019-07-26  Alexander Mikhaylenko  <exalm7659@gmail.com>
16
17         REGRESSION(r246496): [GTK] Tapping the web view scrolls up a bit
18         https://bugs.webkit.org/show_bug.cgi?id=200084
19
20         Reviewed by Carlos Garcia Campos.
21
22         gdk_event_get_scroll_direction() returns false, but also sets direction to GDK_SCROLL_UP if
23         the direction was GDK_SCROLL_SMOOTH. Relying on zero deltas in this case is not correct, because
24         they can also be zero with GDK_SCROLL_SMOOTH. In this case, set the direction manually to avoid
25         that.
26
27         See https://gitlab.gnome.org/GNOME/gtk/issues/2048
28
29         * Shared/gtk/WebEventFactory.cpp:
30         (WebKit::WebEventFactory::createWebWheelEvent):
31
32 2019-07-26  Loïc Yhuel  <loic.yhuel@softathome.com>
33
34         [WPE] Support disk cache dumping like GTK
35         https://bugs.webkit.org/show_bug.cgi?id=200157
36
37         Reviewed by Carlos Garcia Campos.
38
39         Creating or touching "dump" would create the dump.json.
40
41         * NetworkProcess/cache/NetworkCache.cpp:
42         (WebKit::NetworkCache::Cache::Cache):
43
44 2019-07-26  Rob Buis  <rbuis@igalia.com>
45
46         Make storing cross-origin top-level prefetches in HTTP cache optional
47         https://bugs.webkit.org/show_bug.cgi?id=199499
48
49         Reviewed by Youenn Fablet.
50
51         Currently when we navigate we check if there is a cross-origin top-level
52         prefetch we can use for the navigation. The current solution uses the
53         HTTP cache as a way to store the prefetch and to immediately use it for
54         the navigation load. However this solution fails in case the prefetch is
55         not cacheable.
56
57         Instead of this, simulate a HTTP Cache entry to process the load and
58         afterwards try to store the navigation load into the HTTP cache, where
59         normal store decisions will be applied.
60
61         Test: http/wpt/prefetch/link-prefetch-skip-disk-cache.html
62
63         * NetworkProcess/NetworkResourceLoader.cpp:
64         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
65         (WebKit::NetworkResourceLoader::retrieveCacheEntryInternal):
66         * NetworkProcess/NetworkResourceLoader.h:
67
68 2019-07-25  Zan Dobersek  <zdobersek@igalia.com>
69
70         Unreviewed build fix in NetworkDataTaskSoup.
71
72         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
73         (WebKit::NetworkDataTaskSoup::authenticateCallback):
74         Fix incorrect use of the dereferencing operator introduced in r247831.
75
76 2019-07-25  Jiewen Tan  <jiewen_tan@apple.com>
77
78         Unreviewed, build fix after r247851
79
80         * UIProcess/WebPageProxy.cpp:
81         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
82         Reverts an unnecessary change.
83
84 2019-07-25  Fujii Hironori  <fujii.hironori@gmail.com>
85
86         [GTK] Indistinguishable overloaded callback function inspectorViewDestroyed if RemoteWebInspectorProxyGtk.cpp and WebInspectorProxyGtk.cpp are in a unified build bundle
87         https://bugs.webkit.org/show_bug.cgi?id=200123
88
89         Reviewed by Carlos Garcia Campos.
90
91         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
92         (WebKit::remoteInspectorViewDestroyed): Added.
93         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
94         (WebKit::inspectorViewDestroyed): Deleted.
95         Renamed inspectorViewDestroyed to remoteInspectorViewDestroyed.
96
97 2019-07-25  Jiewen Tan  <jiewen_tan@apple.com>
98
99         WebPageProxy::receivedPolicyDecision should check navigation ID before clear pendingAPIRequest
100         https://bugs.webkit.org/show_bug.cgi?id=200108
101         <rdar://problem/53521238>
102
103         Reviewed by Chris Dumez.
104
105         Assuming there are two loads happening one after another. There is an issue when clients save
106         the first decisionHandler and then call WKNavigationActionPolicyCancel for it right after the
107         second decisionHandler received, -[WKWebView URL] could return a null string even though it is
108         loading the second one.
109
110         To solve that, this patch pairs a navigationID with the pendingAPIRequestURL such that
111         WebPageProxy::receivedPolicyDecision could clear the pendingAPIRequestURL only if
112         the passed navigation ID matches the current one.
113
114         * UIProcess/PageLoadState.cpp:
115         (WebKit::PageLoadState::reset):
116         (WebKit::PageLoadState::activeURL):
117         (WebKit::PageLoadState::estimatedProgress):
118         (WebKit::PageLoadState::pendingAPIRequestURL const):
119         (WebKit::PageLoadState::pendingAPIRequest const):
120         (WebKit::PageLoadState::setPendingAPIRequest):
121         (WebKit::PageLoadState::clearPendingAPIRequest):
122         (WebKit::PageLoadState::isLoading):
123         (WebKit::PageLoadState::setPendingAPIRequestURL): Deleted.
124         (WebKit::PageLoadState::clearPendingAPIRequestURL): Deleted.
125         * UIProcess/PageLoadState.h:
126         (WebKit::PageLoadState::setPendingAPIRequest):
127         (WebKit::PageLoadState::setPendingAPIRequestURL): Deleted.
128         * UIProcess/WebPageProxy.cpp:
129         (WebKit::WebPageProxy::launchProcessForReload):
130         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
131         (WebKit::WebPageProxy::loadFile):
132         (WebKit::WebPageProxy::loadDataWithNavigationShared):
133         (WebKit::WebPageProxy::loadAlternateHTML):
134         (WebKit::WebPageProxy::loadWebArchiveData):
135         (WebKit::WebPageProxy::reload):
136         (WebKit::WebPageProxy::goToBackForwardItem):
137         (WebKit::WebPageProxy::receivedPolicyDecision):
138         (WebKit::WebPageProxy::continueNavigationInNewProcess):
139         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
140         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
141         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
142
143 2019-07-25  Commit Queue  <commit-queue@webkit.org>
144
145         Unreviewed, rolling out r247806.
146         https://bugs.webkit.org/show_bug.cgi?id=200141
147
148         It is regressing PLT (Requested by youenn on #webkit).
149
150         Reverted changeset:
151
152         "Disable speculative loading if cache is not to be used for
153         the load"
154         https://bugs.webkit.org/show_bug.cgi?id=199644
155         https://trac.webkit.org/changeset/247806
156
157 2019-07-25  Dean Jackson  <dino@apple.com>
158
159         WebKit/UIProcess/ios/WKContentViewInteraction.mm: error: implementing deprecated method contextMenuInteractionWillPresent
160         https://bugs.webkit.org/show_bug.cgi?id=200136
161         <rdar://problem/53547698>
162
163         Reviewed by Wenson Hsieh.
164
165         Ignore deprecation warnings for these UIContextMenuInteraction delegates.
166
167         * UIProcess/ios/WKContentViewInteraction.mm:
168         (-[WKContentView contextMenuInteractionWillPresent:]):
169         (-[WKContentView contextMenuInteraction:willCommitWithAnimator:]):
170         (-[WKContentView contextMenuInteractionDidEnd:]):
171
172 2019-07-25  Dean Jackson  <dino@apple.com>
173
174         Add helper for ignoring deprecated implementation warnings
175         https://bugs.webkit.org/show_bug.cgi?id=200135
176
177         Reviewed by Wenson Hsieh.
178
179         Add ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN/END macro which
180         is IGNORE_WARNINGS_BEGIN("deprecated-implementations")
181
182         * UIProcess/API/Cocoa/LegacyBundleForClass.mm:
183         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
184         (IGNORE_WARNINGS_BEGIN): Deleted.
185         * UIProcess/API/Cocoa/WKBrowsingContextGroup.mm:
186         (IGNORE_WARNINGS_BEGIN): Deleted.
187         * UIProcess/API/Cocoa/WKConnection.mm:
188         (IGNORE_WARNINGS_BEGIN): Deleted.
189         * UIProcess/API/Cocoa/WKPreviewElementInfo.mm:
190         * UIProcess/API/Cocoa/WKProcessGroup.mm:
191         (IGNORE_WARNINGS_BEGIN): Deleted.
192         * UIProcess/API/Cocoa/WKTypeRefWrapper.mm:
193         * UIProcess/API/Cocoa/WKWebView.mm:
194         (-[WKWebView ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
195         (-[WKWebView draggedImage:endedAt:operation:]):
196         (-[WKWebView accessibilityAttributeValue:]):
197         (-[WKWebView accessibilityAttributeValue:forParameter:]):
198         (-[WKWebView namesOfPromisedFilesDroppedAtDestination:]):
199         (-[WKWebView IGNORE_WARNINGS_END]): Deleted.
200         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
201         (-[WKWebViewConfiguration ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
202         (-[WKWebViewConfiguration _setWebsiteDataStore:]):
203         (-[WKWebViewConfiguration IGNORE_WARNINGS_END]): Deleted.
204         * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm:
205         * UIProcess/API/mac/WKView.mm:
206         (-[WKView ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
207         (-[WKView draggedImage:endedAt:operation:]):
208         (-[WKView accessibilityAttributeValue:]):
209         (-[WKView accessibilityAttributeValue:forParameter:]):
210         (-[WKView namesOfPromisedFilesDroppedAtDestination:]):
211         (-[WKView IGNORE_WARNINGS_END]): Deleted.
212         * UIProcess/WKImagePreviewViewController.mm:
213         (-[WKImagePreviewViewController ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
214         (-[WKImagePreviewViewController IGNORE_WARNINGS_END]): Deleted.
215         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
216         (-[WKAirPlayRoutePicker popoverControllerDidDismissPopover:]):
217         * UIProcess/ios/forms/WKFileUploadPanel.mm:
218         (-[WKFileUploadPanel popoverControllerDidDismissPopover:]):
219         * UIProcess/ios/forms/WKFormPopover.mm:
220         (-[WKRotatingPopover popoverControllerDidDismissPopover:]):
221         * WebProcess/Plugins/PDF/PDFPlugin.mm:
222         (-[WKPDFPluginAccessibilityObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
223         (-[WKPDFPluginAccessibilityObject accessibilityAttributeValue:]):
224         (-[WKPDFPluginAccessibilityObject accessibilityAttributeValue:forParameter:]):
225         (-[WKPDFPluginAccessibilityObject accessibilityPerformAction:]):
226         (-[WKPDFPluginAccessibilityObject accessibilityIsAttributeSettable:]):
227         (-[WKPDFPluginAccessibilityObject accessibilitySetValue:forAttribute:]):
228         (-[WKPDFPluginAccessibilityObject IGNORE_WARNINGS_END]): Deleted.
229         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
230         (-[WKAccessibilityWebPageObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
231         (-[WKAccessibilityWebPageObject accessibilityIsAttributeSettable:]):
232         (-[WKAccessibilityWebPageObject accessibilitySetValue:forAttribute:]):
233         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
234         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]):
235         (-[WKAccessibilityWebPageObject IGNORE_WARNINGS_END]): Deleted.
236
237 2019-07-25  Youenn Fablet  <youenn@apple.com>
238
239         Make NetworkSession no longer RefCounted
240         https://bugs.webkit.org/show_bug.cgi?id=200020
241
242         This allows to have a simpler memory management model where
243         NetworkSession cannot live once removed from the network process session map.
244         This requires some additional null checks, especially in NetworkDataTask.
245
246         Reviewed by Carlos Garcia Campos.
247
248         * NetworkProcess/curl/NetworkSessionCurl.h:
249         * NetworkProcess/soup/NetworkSessionSoup.h:
250         * NetworkProcess/NetworkDataTask.cpp:
251         (WebKit::NetworkDataTask::NetworkDataTask):
252         * NetworkProcess/NetworkDataTask.h:
253         * NetworkProcess/NetworkDataTaskBlob.cpp:
254         (WebKit::NetworkDataTaskBlob::~NetworkDataTaskBlob):
255         (WebKit::NetworkDataTaskBlob::download):
256         * NetworkProcess/NetworkProcess.cpp:
257         (WebKit::NetworkProcess::lowMemoryHandler):
258         (WebKit::NetworkProcess::setSession):
259         (WebKit::NetworkProcess::destroySession):
260         (WebKit::NetworkProcess::setResourceLoadStatisticsEnabled):
261         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
262         * NetworkProcess/NetworkProcess.h:
263         (WebKit::NetworkProcess::networkSessions):
264         * NetworkProcess/NetworkSession.cpp:
265         (WebKit::NetworkSession::create):
266         * NetworkProcess/NetworkSession.h:
267         * NetworkProcess/NetworkSocketChannel.cpp:
268         (WebKit::NetworkSocketChannel::NetworkSocketChannel):
269         (WebKit::NetworkSocketChannel::~NetworkSocketChannel):
270         * NetworkProcess/NetworkSocketChannel.h:
271         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
272         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
273         (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
274         (WebKit::computeIsAlwaysOnLoggingAllowed):
275         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
276         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
277         (WebKit::NetworkDataTaskCocoa::resume):
278         (WebKit::NetworkDataTaskCocoa::isAlwaysOnLoggingAllowed const):
279         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
280         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
281         (-[WKNetworkSessionDelegate initWithNetworkSession:withCredentials:]):
282         (WebKit::NetworkSessionCocoa::create):
283         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
284         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
285         (WebKit::NetworkDataTaskSoup::createRequest):
286         (WebKit::NetworkDataTaskSoup::clearRequest):
287         (WebKit::NetworkDataTaskSoup::cancel):
288         (WebKit::NetworkDataTaskSoup::authenticateCallback):
289         (WebKit::NetworkDataTaskSoup::authenticate):
290         (WebKit::NetworkDataTaskSoup::continueAuthenticate):
291
292 2019-07-25  Chris Dumez  <cdumez@apple.com>
293
294         Avoid some unnecessary HashMap copies
295         https://bugs.webkit.org/show_bug.cgi?id=200129
296
297         Reviewed by Youenn Fablet.
298
299         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
300         (WebKit::NetworkConnectionToWebProcess::didClose):
301         * UIProcess/AuxiliaryProcessProxy.cpp:
302         (WebKit::AuxiliaryProcessProxy::connect):
303         * UIProcess/Launcher/ProcessLauncher.cpp:
304         (WebKit::ProcessLauncher::ProcessLauncher):
305         * UIProcess/Launcher/ProcessLauncher.h:
306         (WebKit::ProcessLauncher::create):
307         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
308         (WebKit::WebPluginInfoProvider::setPluginLoadClientPolicy):
309
310 2019-07-25  Truitt Savell  <tsavell@apple.com>
311
312         Unreviewed, rolling out r247821.
313
314         Caused two crashing Layout Tests
315
316         Reverted changeset:
317
318         "Make storing cross-origin top-level prefetches in HTTP cache
319         optional"
320         https://bugs.webkit.org/show_bug.cgi?id=199499
321         https://trac.webkit.org/changeset/247821
322
323 2019-07-25  Michael Catanzaro  <mcatanzaro@igalia.com>
324
325         Unreviewed, fix -Wredundant-move warning spam after r247672
326         https://bugs.webkit.org/show_bug.cgi?id=199967
327         <rdar://problem/53351435>
328
329         * Platform/IPC/ArgumentCoders.cpp:
330         (IPC::decodeStringText):
331         * Platform/IPC/ArgumentCoders.h:
332
333 2019-07-25  Chris Dumez  <cdumez@apple.com>
334
335         Avoid UI Process hangs when the WebContent process is showing JS prompts / alerts
336         https://bugs.webkit.org/show_bug.cgi?id=200107
337         <rdar://problem/53034592>
338
339         Reviewed by Geoffrey Garen.
340
341         * Platform/IPC/Connection.cpp:
342         (IPC::Connection::SyncMessageState::incrementProcessIncomingSyncMessagesWhenWaitingForSyncReplyCount):
343         (IPC::Connection::SyncMessageState::decrementProcessIncomingSyncMessagesWhenWaitingForSyncReplyCount):
344         (IPC::Connection::SyncMessageState::processIncomingMessage):
345         (IPC::Connection::sendSyncMessage):
346         * Platform/IPC/Connection.h:
347         Add support for new SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply flag
348         to allow processing incoming sync messages while sending a particular sync IPC. This is the
349         default behavior in all processes except in the WebContent process, where we try to avoid
350         re-entering to prevent bugs. This flag allows the WebContent process to change its default
351         behavior for some specific IPCs, where we know it is safe to re-enter and where it benefits
352         performance to re-renter.
353
354         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
355         (WebKit::NetworkConnectionToWebProcess::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
356         * NetworkProcess/NetworkConnectionToWebProcess.h:
357         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
358         * UIProcess/Network/NetworkProcessProxy.cpp:
359         (WebKit::NetworkProcessProxy::didReceiveSyncMessage):
360         (WebKit::NetworkProcessProxy::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
361         * UIProcess/Network/NetworkProcessProxy.h:
362         * UIProcess/Network/NetworkProcessProxy.messages.in:
363         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
364         (WebKit::WebChromeClient::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
365         * WebProcess/WebCoreSupport/WebChromeClient.h:
366         * WebProcess/WebPage/WebPage.cpp:
367         (WebKit::WebPage::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
368         * WebProcess/WebPage/WebPage.h:
369         (WebKit::WebPage::sendSyncWithDelayedReply):
370         * WebProcess/WebPage/WebPage.messages.in:
371         SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply
372         Add testing infrastructure for SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply
373         flag.
374
375         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
376         (WebKit::WebChromeClient::runJavaScriptAlert):
377         (WebKit::WebChromeClient::runJavaScriptConfirm):
378         (WebKit::WebChromeClient::runJavaScriptPrompt):
379         Use new SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply flag when sending
380         the synchronous IPC for JS alerts / prompt / confirm. This allows the WebProcess to process
381         incoming synchronous IPC for other processes (in particular the UIProcess) while it is blocked
382         on those synchronous IPCs. It is safe to re-enter the WebContent process on these sync IPCs
383         since they are triggered by JS and we return to JS right after. This should avoid UIProcess
384         hangs when the UIProcess is sending a sync IPC to the WebContent process, which is itself
385         stuck on the sync IPC to show a JS alert.
386
387 2019-07-25  Rob Buis  <rbuis@igalia.com>
388
389         Make storing cross-origin top-level prefetches in HTTP cache optional
390         https://bugs.webkit.org/show_bug.cgi?id=199499
391
392         Reviewed by Youenn Fablet.
393
394         Currently when we navigate we check if there is a cross-origin top-level
395         prefetch we can use for the navigation. The current solution uses the
396         HTTP cache as a way to store the prefetch and to immediately use it for
397         the navigation load. However this solution fails in case the prefetch is
398         not cacheable.
399
400         Instead of this, simulate a HTTP Cache entry to process the load and
401         afterwards try to store the navigation load into the HTTP cache, where
402         normal store decisions will be applied.
403
404         Test: http/wpt/prefetch/link-prefetch-skip-disk-cache.html
405
406         * NetworkProcess/NetworkResourceLoader.cpp:
407         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
408         (WebKit::NetworkResourceLoader::retrieveCacheEntryInternal):
409         * NetworkProcess/NetworkResourceLoader.h:
410
411 2019-07-25  Truitt Savell  <tsavell@apple.com>
412
413         Unreviewed, rolling out r247817.
414
415         Broke 14 http/tests/paymentrequest/ tests. on iOS
416
417         Reverted changeset:
418
419         "Unable to tap/double tap to open files/folders in Google
420         Drive in Safari"
421         https://bugs.webkit.org/show_bug.cgi?id=200096
422         https://trac.webkit.org/changeset/247817
423
424 2019-07-24  Zalan Bujtas  <zalan@apple.com>
425
426         Unable to tap/double tap to open files/folders in Google Drive in Safari
427         https://bugs.webkit.org/show_bug.cgi?id=200096
428         <rdar://problem/52748552>
429
430         Reviewed by Wenson Hsieh.
431
432         This patch reverts to the original double-tap-for-double-click implementation (see r244775 and r246347 for more information).
433
434         * Shared/WebPageCreationParameters.cpp:
435         (WebKit::WebPageCreationParameters::encode const):
436         (WebKit::WebPageCreationParameters::decode):
437         * Shared/WebPageCreationParameters.h:
438         * UIProcess/PageClient.h:
439         * UIProcess/WebPageProxy.cpp:
440         (WebKit::WebPageProxy::creationParameters):
441         * UIProcess/WebPageProxy.h:
442         * UIProcess/ios/PageClientImplIOS.h:
443         * UIProcess/ios/PageClientImplIOS.mm:
444         (WebKit::PageClientImpl::doubleTapForDoubleClickDelay): Deleted.
445         (WebKit::PageClientImpl::doubleTapForDoubleClickRadius): Deleted.
446         * UIProcess/ios/WKContentViewInteraction.h:
447         * UIProcess/ios/WKContentViewInteraction.mm:
448         (-[WKContentView setupInteraction]):
449         (-[WKContentView cleanupInteraction]):
450         (-[WKContentView _removeDefaultGestureRecognizers]):
451         (-[WKContentView _addDefaultGestureRecognizers]):
452         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]): Do not recognize the single and double gestures the same time.
453         (-[WKContentView gestureRecognizerShouldBegin:]):
454         (-[WKContentView _doubleTapRecognizedForDoubleClick:]):
455         (-[WKContentView _didStartProvisionalLoadForMainFrame]):
456         (-[WKContentView _ensureNonBlockingDoubleTapGestureRecognizer]): Deleted.
457         (-[WKContentView _doubleTapForDoubleClickDelay]): Deleted.
458         (-[WKContentView _doubleTapForDoubleClickRadius]): Deleted.
459         * UIProcess/ios/WebPageProxyIOS.mm:
460         (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
461         * WebProcess/WebPage/WebPage.cpp:
462         * WebProcess/WebPage/WebPage.h:
463         * WebProcess/WebPage/WebPage.messages.in:
464         * WebProcess/WebPage/ios/WebPageIOS.mm:
465         (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
466         (WebKit::WebPage::commitPotentialTap):
467         (WebKit::WebPage::handlePotentialDoubleTapForDoubleClickAtPoint): Deleted.
468
469 2019-07-24  Yusuke Suzuki  <ysuzuki@apple.com>
470
471         [bmalloc] Add IsoHeap test to ensure that IsoHeap pages are not allocating too large VA
472         https://bugs.webkit.org/show_bug.cgi?id=200103
473
474         Reviewed by Mark Lam.
475
476         Move MachVMSPI.h from PAL to WTF.
477
478         * Platform/cocoa/SharedMemoryCocoa.cpp:
479
480 2019-07-24  Youenn Fablet  <youenn@apple.com>
481
482         Disable speculative loading if cache is not to be used for the load
483         https://bugs.webkit.org/show_bug.cgi?id=199644
484
485         Reviewed by Alex Christensen.
486
487         When the page is reloaded, loads are instructed to not use the cache.
488         It is therefore unneeded to do speculative revalidation.
489         Allow speculative revalidation if the cache policy is either the default HTTP policy or
490         if policy is to refresh all cache data.
491         Covered by added test.
492
493         * NetworkProcess/cache/NetworkCache.cpp:
494         (WebKit::NetworkCache::cachePolicyValidForSpeculativeRevalidation):
495         (WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):
496
497 2019-07-24  Priyanka Agarwal  <pagarwal999@apple.com>
498
499         Allow Clients to Add Fields to the AutoFillContext Dictionary
500         https://bugs.webkit.org/show_bug.cgi?id=199326
501         rdar://problem/42816957
502
503         Reviewed by Wenson Hsieh.
504
505         * UIProcess/API/Cocoa/_WKInputDelegate.h:
506         Added function declaration for function which returns additional dictionary for autofillcontext
507
508         * UIProcess/ios/WKContentViewInteraction.h:
509         Created dictionary for additional autofillcontext
510
511         * UIProcess/ios/WKContentViewInteraction.mm:
512         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
513         Populating additional dictionary for autofillcontext
514
515         (-[WKContentView _autofillContext]):
516         Adding new dictionary to the returned autofillcontext
517
518 2019-07-24  Chris Dumez  <cdumez@apple.com>
519
520         Regression(r247400): Unable to log into AIB Mobile Banking App
521         https://bugs.webkit.org/show_bug.cgi?id=200094
522         <rdar://problem/52519818>
523
524         Reviewed by Brent Fulgham.
525
526         In r247400, a change was made to only set the 'app has universal sandbox access' flag
527         only when issueing the sandbox extension for / actually succeeded (it usually fails
528         in practice). Previously, AIB Mobile Banking app was relying on this behavior to
529         trigger a load for file:///login which is outside their container. However, now that
530         the 'app has universal sandbox access' flag is no longer set, it trips our security
531         checks and the load gets ignored.
532
533         To address the issue, apply only the 'app has universal sandbox access' flag fix with
534         a linked-on-after check.
535
536         * UIProcess/Cocoa/VersionChecks.h:
537         * UIProcess/WebPageProxy.cpp:
538         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
539
540 2019-07-24  Tim Horton  <timothy_horton@apple.com>
541
542         Module-enabled users of WKWebProcessPlugInFrame.h fail to build; duplicate declaration
543         https://bugs.webkit.org/show_bug.cgi?id=200095
544         <rdar://problem/53512407>
545
546         Reviewed by Wenson Hsieh.
547
548         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
549         Import <JavaScriptCore/JavaScriptCore.h> (the module header) instead of
550         <JavaScriptCore/JSContext.h> directly, otherwise we can end up getting
551         JSContext.h included twice, to the compiler's chagrin.
552
553 2019-07-24  Brady Eidson  <beidson@apple.com>
554
555         Crash in WebContent process with custom schemes.
556         <rdar://problem/52968793> and https://bugs.webkit.org/show_bug.cgi?id=200062
557
558         Reviewed by Andy Estes.
559
560         Almost everywhere in WebURLSchemeTaskProxy where we call processNextPendingTask() we first protect the task with a ref.
561         But not in didReceiveData.
562         So lets do that.
563
564         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
565         (WebKit::WebURLSchemeTaskProxy::didReceiveData): Protect this.
566
567 2019-07-24  Alex Christensen  <achristensen@webkit.org>
568
569         Null check CompletionHandler in WebPreviewLoaderClient::didReceivePassword
570         https://bugs.webkit.org/show_bug.cgi?id=200080
571         <rdar://problem/37275772>
572
573         Reviewed by Chris Dumez.
574
575         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp:
576         (WebKit::WebPreviewLoaderClient::didReceivePassword):
577
578 2019-07-24  Chris Dumez  <cdumez@apple.com>
579
580         Crash under WebKit:WTF::Detail::CallableWrapper<WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking(WTF::CompletionHandler<void ()>&&)::$_32::operator()()::'lambda'(), void>::call
581         https://bugs.webkit.org/show_bug.cgi?id=200071
582         <rdar://problem/53335583>
583
584         Reviewed by Brent Fulgham and Youenn Fablet.
585
586         The WebResourceLoadStatisticsStore is a main thread object. In its destructor, it was dispatching
587         to the background queue to destroy the m_statisticsStore / m_persistentStorage data members, which
588         live on the background queue. It would then synchronously wait for the background queue to finish
589         destroying them. The idea was to guarantee that the ResourceLoadStatisticsMemoryStore and the
590         ResourceLoadStatisticsPersistentStorage would never outlive the WebResourceLoadStatisticsStore,
591         given that they keep a raw pointer back to the WebResourceLoadStatisticsStore (via m_store data
592         member).
593
594         The issue is that *while* the WebResourceLoadStatisticsStore destructor is running on the main
595         thread, the background queue may be running code in ResourceLoadStatisticsMemoryStore or
596         ResourceLoadStatisticsPersistentStorage which refs the WebResourceLoadStatisticsStore, even
597         though its ref count has already reached 0. It is actually a common pattern in
598         ResourceLoadStatisticsMemoryStore to call RunLoop::main().dispatch() and ref their m_store in
599         the lambda, so that they can interact with the WebResourceLoadStatisticsStore.
600
601         To address the issue, we now destroy m_statisticsStore / m_persistentStorage *before* the
602         WebResourceLoadStatisticsStore destructor runs. The NetworkSession destructor now calls
603         WebResourceLoadStatisticsStore::didDestroyNetworkSession() which takes care of destroying
604         m_statisticsStore / m_persistentStorage on the background queue, synchronously. The
605         WebResourceLoadStatisticsStore destructor will only run later, once all remaining references
606         to it are gone.
607
608         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
609         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
610         (WebKit::WebResourceLoadStatisticsStore::didDestroyNetworkSession):
611         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
612         * NetworkProcess/NetworkSession.cpp:
613         (WebKit::NetworkSession::~NetworkSession):
614
615 2019-07-24  Youenn Fablet  <youenn@apple.com>
616
617         SYS___pthread_markcancel is sometimes used by libwebrtc
618         https://bugs.webkit.org/show_bug.cgi?id=200087
619         <rdar://problem/53408606>
620
621         Reviewed by Brent Fulgham.
622
623         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
624         Whitelist this unix-call within WebProcess as libwebrtc uses it.
625
626 2019-07-24  Zalan Bujtas  <zalan@apple.com>
627
628         ASSERTION FAILED: settings().textAutosizingEnabled() && settings().textAutosizingUsesIdempotentMode() in WebCore::Page::recomputeTextAutoSizingInAllFrames()
629         https://bugs.webkit.org/show_bug.cgi?id=200079
630         <rdar://problem/53474325>
631
632         Reviewed by Wenson Hsieh.
633
634         Do not reset idempotent values when the text autosizing is off.
635
636         * UIProcess/API/C/WKPreferences.cpp:
637         (WKPreferencesSetTextAutosizingUsesIdempotentMode):
638         (WKPreferencesGetTextAutosizingUsesIdempotentMode):
639         * UIProcess/API/C/WKPreferencesRef.h:
640         * WebProcess/WebPage/ios/WebPageIOS.mm:
641         (WebKit::WebPage::resetIdempotentTextAutosizingIfNeeded):
642
643 2019-07-24  Chris Dumez  <cdumez@apple.com>
644
645         Unreviewed, rolling out r247766.
646
647         Caused an API test failure
648
649         Reverted changeset:
650
651         "Crash under
652         WebKit:WTF::Detail::CallableWrapper<WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking(WTF::CompletionHandler<void
653         ()>&&)::$_32::operator()()::'lambda'(), void>::call"
654         https://bugs.webkit.org/show_bug.cgi?id=200071
655         https://trac.webkit.org/changeset/247766
656
657 2019-07-23  Chris Dumez  <cdumez@apple.com>
658
659         Crash under WebKit:WTF::Detail::CallableWrapper<WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking(WTF::CompletionHandler<void ()>&&)::$_32::operator()()::'lambda'(), void>::call
660         https://bugs.webkit.org/show_bug.cgi?id=200071
661         <rdar://problem/53335583>
662
663         Reviewed by Brent Fulgham and Youenn Fablet.
664
665         The WebResourceLoadStatisticsStore is a main thread object. In its destructor, it was dispatching
666         to the background queue to destroy the m_statisticsStore / m_persistentStorage data members, which
667         live on the background queue. It would then synchronously wait for the background queue to finish
668         destroying them. The idea was to guarantee that the ResourceLoadStatisticsMemoryStore and the
669         ResourceLoadStatisticsPersistentStorage would never outlive the WebResourceLoadStatisticsStore,
670         given that they keep a raw pointer back to the WebResourceLoadStatisticsStore (via m_store data
671         member).
672
673         The issue is that *while* the WebResourceLoadStatisticsStore destructor is running on the main
674         thread, the background queue may be running code in ResourceLoadStatisticsMemoryStore or
675         ResourceLoadStatisticsPersistentStorage which refs the WebResourceLoadStatisticsStore, even
676         though its ref count has already reached 0. It is actually a common pattern in
677         ResourceLoadStatisticsMemoryStore to call RunLoop::main().dispatch() and ref their m_store in
678         the lambda, so that they can interact with the WebResourceLoadStatisticsStore.
679
680         To address the issue, we now destroy m_statisticsStore / m_persistentStorage *before* the
681         WebResourceLoadStatisticsStore destructor runs. The NetworkSession destructor now calls
682         WebResourceLoadStatisticsStore::didDestroyNetworkSession() which takes care of destroying
683         m_statisticsStore / m_persistentStorage on the background queue, synchronously. The
684         WebResourceLoadStatisticsStore destructor will only run later, once all remaining references
685         to it are gone.
686
687         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
688         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
689         (WebKit::WebResourceLoadStatisticsStore::didDestroyNetworkSession):
690         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
691         * NetworkProcess/NetworkSession.cpp:
692         (WebKit::NetworkSession::~NetworkSession):
693
694 2019-07-23  Alex Christensen  <achristensen@webkit.org>
695
696         Move javaScriptConfigurationDirectory SPI from _WKProcessPoolConfiguration to WKProcessPoolPrivate to make it runtime switchable
697         https://bugs.webkit.org/show_bug.cgi?id=200045
698
699         Reviewed by Mark Lam.
700
701         This allows me to maintain the status quo in Safari.
702
703         * UIProcess/API/APIProcessPoolConfiguration.cpp:
704         (API::ProcessPoolConfiguration::copy):
705         * UIProcess/API/APIProcessPoolConfiguration.h:
706         * UIProcess/API/Cocoa/WKProcessPool.mm:
707         (-[WKProcessPool _javaScriptConfigurationDirectory]):
708         (-[WKProcessPool _setJavaScriptConfigurationDirectory:]):
709         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
710         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
711         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
712         (-[_WKProcessPoolConfiguration javaScriptConfigurationDirectory]): Deleted.
713         (-[_WKProcessPoolConfiguration setJavaScriptConfigurationDirectory:]): Deleted.
714         * UIProcess/WebProcessPool.cpp:
715         (WebKit::legacyWebsiteDataStoreConfiguration):
716         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
717         * UIProcess/WebProcessPool.h:
718
719 2019-07-23  Russell Epstein  <repstein@apple.com>
720
721         Unreviewed, rolling out r247745.
722
723         This broke API test
724         TestWebKitAPI.WKProcessPool.JavaScriptConfiguration as
725         indicated by EWS
726
727         Reverted changeset:
728
729         "Move javaScriptConfigurationDirectory SPI from
730         _WKProcessPoolConfiguration to WKProcessPoolPrivate to make it
731         runtime switchable"
732         https://bugs.webkit.org/show_bug.cgi?id=200045
733         https://trac.webkit.org/changeset/247745
734
735 2019-07-23  Chris Fleizach  <cfleizach@apple.com>
736
737         AX: CrashTracer: com.apple.WebKit.WebContent at WebKit: WebKit::WebSpeechSynthesisClient::speak
738         https://bugs.webkit.org/show_bug.cgi?id=199988
739
740         Reviewed by Per Arne Vollan.
741
742         Improvements to WebSpeechSynthesis to avoid crashing and improve correctness.
743         - Reset and cancel speech jobs on page close or reload (otherwise the synthesizer keeps talking after your page is gone)
744         - Have a separate speech finish callback mechanism, use the start speaking callback when the synthesizer tells us.
745         - Move an assert on utterance state to only apply when we use the in process synthesizer.
746
747         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
748         (WebKit::WebPageProxy::didStartSpeaking):
749         * UIProcess/WebPageProxy.cpp:
750         (WebKit::WebPageProxy::reload):
751         (WebKit::WebPageProxy::resetState):
752         (WebKit::WebPageProxy::resetSpeechSynthesizer):
753         (WebKit::WebPageProxy::speechSynthesisSetFinishedCallback):
754         (WebKit::WebPageProxy::speechSynthesisSpeak):
755         * UIProcess/WebPageProxy.h:
756         * UIProcess/WebPageProxy.messages.in:
757         * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp:
758         (WebKit::WebSpeechSynthesisClient::speak):
759
760 2019-07-23  Chris Dumez  <cdumez@apple.com>
761
762         Get rid of unnecessary callback aggregators in WebResourceLoadStatisticsStore
763         https://bugs.webkit.org/show_bug.cgi?id=200042
764
765         Reviewed by Brent Fulgham.
766
767         Only 1 asynchronous function is called so there is nothing to "aggregate".
768
769         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
770         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdate):
771         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains):
772         (WebKit::WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains):
773
774 2019-07-23  Zalan Bujtas  <zalan@apple.com>
775
776         [iOS] Tapping the search field on a search results page on zillow.com shows and immediately dismisses the keyboard
777         https://bugs.webkit.org/show_bug.cgi?id=200044
778         <rdar://problem/53103732>
779
780         Reviewed by Wenson Hsieh.
781
782         * Shared/FocusedElementInformation.cpp:
783         (WebKit::FocusedElementInformation::encode const):
784         (WebKit::FocusedElementInformation::decode):
785         * Shared/FocusedElementInformation.h:
786         * UIProcess/API/Cocoa/WKWebView.mm:
787         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
788         * UIProcess/ios/WKContentViewInteraction.h:
789         * UIProcess/ios/WKContentViewInteraction.mm:
790         (-[WKContentView _elementDidBlur]):
791         (-[WKContentView _shouldAvoidScrollingWhenFocusedContentIsVisible]):
792         * WebProcess/WebPage/ios/WebPageIOS.mm:
793         (WebKit::WebPage::getFocusedElementInformation):
794
795 2019-07-23  Alex Christensen  <achristensen@webkit.org>
796
797         Move javaScriptConfigurationDirectory SPI from _WKProcessPoolConfiguration to WKProcessPoolPrivate to make it runtime switchable
798         https://bugs.webkit.org/show_bug.cgi?id=200045
799
800         Reviewed by Mark Lam.
801
802         This allows me to maintain the status quo in Safari.
803
804         * UIProcess/API/APIProcessPoolConfiguration.cpp:
805         (API::ProcessPoolConfiguration::copy):
806         * UIProcess/API/APIProcessPoolConfiguration.h:
807         * UIProcess/API/Cocoa/WKProcessPool.mm:
808         (-[WKProcessPool _javaScriptConfigurationDirectory]):
809         (-[WKProcessPool _setJavaScriptConfigurationDirectory:]):
810         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
811         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
812         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
813         (-[_WKProcessPoolConfiguration javaScriptConfigurationDirectory]): Deleted.
814         (-[_WKProcessPoolConfiguration setJavaScriptConfigurationDirectory:]): Deleted.
815         * UIProcess/WebProcessPool.cpp:
816         (WebKit::legacyWebsiteDataStoreConfiguration):
817         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
818         * UIProcess/WebProcessPool.h:
819
820 2019-07-24  Simon Fraser  <simon.fraser@apple.com>
821
822         [iOS WK2] A top fixed bar can flicker when scrolling with the keyboard up
823         https://bugs.webkit.org/show_bug.cgi?id=200105
824         rdar://problem/52871975
825
826         Reviewed by Wenson Hsieh.
827
828         ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition() computes a visual viewport
829         from the current scroll position and scrollableAreaSize(). This doesn't know anything about
830         the impact of keyboards on the visual viewport, so it computes a too-large visual viewport
831         when the keyboard is up, triggering incorrect manipulations of the layout viewport. This
832         leads to the top bar flashing to position 0 when it should be hidden off the top.
833
834         Fix by feeding into the scrolling tree the height of the visual viewport which takes
835         FrameView::visualViewportOverrideRect() into account. This is stored on ScrollingStateFrameScrollingNode/
836         ScrollingTreeFrameScrollingNode.
837
838         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
839         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
840         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
841
842 2019-07-23  Alex Christensen  <achristensen@webkit.org>
843
844         Add SPI for setting media cache and key location on _WKWebsiteDataStoreConfiguration
845         https://bugs.webkit.org/show_bug.cgi?id=199972
846
847         Reviewed by Jer Noble.
848
849         This is a step towards removing WebsiteDataStore::legacyDefaultDataStoreConfiguration
850         I added a unit test for the media cache location,
851         but the media key location can't reasonably be unit tested in an open source project.
852
853         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
854         (-[WKWebsiteDataStore _initWithConfiguration:]):
855         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
856         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
857         (-[_WKWebsiteDataStoreConfiguration mediaCacheDirectory]):
858         (-[_WKWebsiteDataStoreConfiguration setMediaCacheDirectory:]):
859         (-[_WKWebsiteDataStoreConfiguration mediaKeysStorageDirectory]):
860         (-[_WKWebsiteDataStoreConfiguration setMediaKeysStorageDirectory:]):
861
862 2019-07-23  Wenson Hsieh  <wenson_hsieh@apple.com>
863
864         [macOS 10.15] Web process crashes when attempting to show the font panel via Font > Show Fonts
865         https://bugs.webkit.org/show_bug.cgi?id=200021
866         <rdar://problem/53301325>
867
868         Reviewed by Ryosuke Niwa.
869
870         Always return false from canShowFontPanel in WebKit2.
871
872         * WebProcess/WebCoreSupport/WebEditorClient.h:
873
874 2019-07-23  Carlos Garcia Campos  <cgarcia@igalia.com>
875
876         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.25.3 release
877
878         * gtk/NEWS: Add release notes for 2.25.3.
879
880 2019-07-23  Carlos Garcia Campos  <cgarcia@igalia.com>
881
882         [GTK] Emoji chooser is misplaced after scrolling
883         https://bugs.webkit.org/show_bug.cgi?id=199996
884
885         Reviewed by Michael Catanzaro.
886
887         Convert caret rectangle coordinates to root view.
888
889         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
890         (WebKit::WebPage::showEmojiPicker):
891
892 2019-07-22  Ross Kirsling  <ross.kirsling@sony.com>
893
894         Unreviewed non-unified build fix.
895
896         * NetworkProcess/NetworkCORSPreflightChecker.h:
897         * NetworkProcess/NetworkLoadChecker.h:
898         * UIProcess/API/C/WKContext.cpp:
899         * UIProcess/API/C/WKPageConfigurationRef.cpp:
900         * UIProcess/Downloads/DownloadProxy.cpp:
901         * UIProcess/WebPageInjectedBundleClient.cpp:
902         * UIProcess/WebPreferences.cpp:
903         * WebProcess/Network/WebSocketChannel.cpp:
904         (WebKit::PendingMessage::PendingMessage):
905
906 2019-07-22  Megan Gardner  <megan_gardner@apple.com>
907
908         Remove Staging for scrolling bug
909         https://bugs.webkit.org/show_bug.cgi?id=199894
910
911         Reviewed by Wenson Hsieh.
912
913         * UIProcess/ios/WKContentViewInteraction.mm:
914         (-[WKUIWKTextInteractionAssistant scrollSelectionToVisible]): Deleted.
915
916 2019-07-22  Brent Fulgham  <bfulgham@apple.com>
917
918         Correct web audio-related crash in seed reports
919         https://bugs.webkit.org/show_bug.cgi?id=200009
920         <rdar://problem/51565203>
921
922         Reviewed by Per Arne Vollan.
923
924         Revise the iOS sandbox to allow the WebContent process to communicate with
925         the 'com.apple.coremedia.audioprocessingtap.xpc' service, which is needed by
926         some types of WebAudio.
927
928         * WebProcess/com.apple.WebKit.WebContent.sb.in:
929
930 2019-07-22  Dean Jackson  <dino@apple.com>
931
932         WebKit SPI fix for [ClickyOrb] Audio continues playing after dismissing a video preview in Safari
933         https://bugs.webkit.org/show_bug.cgi?id=200011
934         <rdar://problem/53409457>
935
936         Reviewed by Tim Horton.
937
938         Don't check for the SPI @selector(_webView:contextMenuDidEndForElement:)
939         on the WKUIDelegate so that clients that got caught implementing the
940         SPI before moving to the real API can still clean-up state. In other words,
941         don't force a client that only implements that method to move completely
942         to the new API.
943
944         * UIProcess/ios/WKContentViewInteraction.mm:
945         (needsDeprecatedPreviewAPI):
946
947 2019-07-22  Jer Noble  <jer.noble@apple.com>
948
949         REGRESSION(rUnknown): YouTube playback pauses when switching to a new tab
950         https://bugs.webkit.org/show_bug.cgi?id=199971
951         <rdar://problem/51951218>
952
953         Reviewed by Alex Christensen.
954
955         When we get a message notifying us that the view has been removed from the window, we unconditionally
956         ask the fullscreen manager to exit fullscreen, which has the side effect (on iOS) of pausing the video
957         unconditionally. Only ask the fullscreen manager to exit fullscreen if there is actually a video in
958         fullscreen mode.
959
960         * UIProcess/WebPageProxy.cpp:
961         (WebKit::WebPageProxy::viewDidLeaveWindow):
962
963 2019-07-22  Youenn Fablet  <youenn@apple.com>
964
965         Make sure to unref captured lambda variables given to _strictTrustEvaluate in the main thread
966         https://bugs.webkit.org/show_bug.cgi?id=199948
967
968         Reviewed by Alex Christensen.
969
970         Use a weak pointer instead of a Ref for the NetworkSession.
971         Add a null check in processServerTrustEvaluation for extra safety if we decide to remove the data task NetworkSession ref.
972         Make sure to move the NetworkDataTask ref in the completion handler so that the unrefing is done in the main thread.
973
974         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
975         (processServerTrustEvaluation):
976         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
977
978 2019-07-22  Alex Christensen  <achristensen@webkit.org>
979
980         Don't always look for a JSC configuration file after r247685
981         https://bugs.webkit.org/show_bug.cgi?id=199917
982
983         * UIProcess/API/APIProcessPoolConfiguration.cpp:
984         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
985         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
986         ProcessPoolConfiguration's javaScriptConfigurationDirectory wasn't used before r247685,
987         which made it always look for a file with 'JavaScriptCoreDebug' in its name.  I had assumed
988         m_javaScriptConfigurationDirectory would default to a null string, but it was defaulting to
989         defaultJavaScriptConfigurationDirectory.  Make it a null string instead.
990
991 2019-07-22  Simon Fraser  <simon.fraser@apple.com>
992
993         Make some constructors explicit
994         https://bugs.webkit.org/show_bug.cgi?id=199981
995
996         Reviewed by Daniel Bates.
997
998         Make explicit public constructors of objects that take POD or String& arguments,
999         to reduce the changes of the compiler doing implicit conversions.
1000
1001         * Platform/Module.h:
1002         * WebProcess/WebPage/WebInspector.cpp:
1003         (WebKit::WebInspector::openInNewTab):
1004
1005 2019-07-22  Daniel Bates  <dabates@apple.com>
1006
1007         [iOS] REGRESSION (r241734): Autocorrection highlight should hide when field becomes defocused
1008         https://bugs.webkit.org/show_bug.cgi?id=199807
1009         <rdar://problem/52760259>
1010
1011         Fix a bad merge of r247653. svn-apply was way too forgiving. The original patch touched
1012         the non-existent function, -_didCommitLoadForMainFrame in WKContentViewInteraction.mm. Because
1013         that didn't exist, svn-apply patched up -clearSelection.
1014
1015         * UIProcess/ios/WKContentView.h:
1016         * UIProcess/ios/WKContentView.mm:
1017         (-[WKContentView _didCommitLoadForMainFrame]): Deleted; moved to WKContentViewInteraction.mm
1018         * UIProcess/ios/WKContentViewInteraction.h:
1019         * UIProcess/ios/WKContentViewInteraction.mm:
1020         (-[WKContentView clearSelection]): Remove code that should be in -_didCommitLoadForMainFrame.
1021         (-[WKContentView _didCommitLoadForMainFrame]): Moved from WKContentView.mm
1022
1023 2019-07-22  Alex Christensen  <achristensen@webkit.org>
1024
1025         Add SPI to _WKWebsiteDataStoreConfiguration for configuring application cache storage location
1026         https://bugs.webkit.org/show_bug.cgi?id=199954
1027
1028         Reviewed by Geoff Garen.
1029
1030         This is a step towards removing WebsiteDataStore::legacyDefaultDataStoreConfiguration
1031         Covered by a new API test.
1032
1033         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1034         (-[WKWebsiteDataStore _initWithConfiguration:]):
1035         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
1036         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
1037         (-[_WKWebsiteDataStoreConfiguration applicationCacheDirectory]):
1038         (-[_WKWebsiteDataStoreConfiguration setApplicationCacheDirectory:]):
1039         (-[_WKWebsiteDataStoreConfiguration applicationCacheFlatFileSubdirectoryName]):
1040         (-[_WKWebsiteDataStoreConfiguration setApplicationCacheFlatFileSubdirectoryName:]):
1041         * UIProcess/WebProcessPool.cpp:
1042         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
1043         * UIProcess/WebsiteData/WebsiteDataStore.h:
1044         (WebKit::WebsiteDataStore::applicationCacheFlatFileSubdirectoryName const):
1045
1046 2019-07-22  Alex Christensen  <achristensen@webkit.org>
1047
1048         Add SPI _WKProcessPoolConfiguration.javaScriptConfigurationDirectory
1049         https://bugs.webkit.org/show_bug.cgi?id=199917
1050
1051         Reviewed by Sam Weinig.
1052
1053         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1054         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1055         (-[_WKProcessPoolConfiguration javaScriptConfigurationDirectory]):
1056         (-[_WKProcessPoolConfiguration setJavaScriptConfigurationDirectory:]):
1057         * UIProcess/WebProcessPool.cpp:
1058         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
1059
1060 2019-07-22  Carlos Garcia Campos  <cgarcia@igalia.com>
1061
1062         [SOUP] WebSockets: use new api to send text messages
1063         https://bugs.webkit.org/show_bug.cgi?id=199936
1064
1065         Reviewed by Michael Catanzaro.
1066
1067         New API allows to include null character in text messages.
1068
1069         * NetworkProcess/soup/WebSocketTaskSoup.cpp:
1070         (WebKit::WebSocketTask::didReceiveMessageCallback): Pass data size to String::fromUTF8().
1071         (WebKit::WebSocketTask::sendString): Use soup_websocket_connection_send_message() instead of
1072         soup_websocket_connection_send_text() when available. Also use
1073         StrictConversionReplacingUnpairedSurrogatesWithFFFD options when converting to UTF-8.
1074
1075 2019-07-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1076
1077         [iOS] [WebKit2] Add limited support for -isPosition:atBoundary:inDirection: in WKContentView
1078         https://bugs.webkit.org/show_bug.cgi?id=199993
1079         <rdar://problem/49523528>
1080
1081         Reviewed by Beth Dakin.
1082
1083         Add support for -isPosition:atBoundary:inDirection:, only in the cases where the given position is the start or
1084         and position and the given granularity is UITextGranularityParagraph.
1085
1086         Test: EditorStateTests.ParagraphBoundary
1087
1088         * Shared/EditorState.cpp:
1089         (WebKit::EditorState::PostLayoutData::encode const):
1090         (WebKit::EditorState::PostLayoutData::decode):
1091         * Shared/EditorState.h:
1092
1093         Add a couple of bits to indicate whether the selection start or end positions are at paragraph boundaries.
1094
1095         * UIProcess/ios/WKContentViewInteraction.mm:
1096         (-[WKContentView isPosition:atBoundary:inDirection:]):
1097
1098         Implement this to return selectionStartIsAtParagraphBoundary or selectionEndIsAtParagraphBoundary.
1099
1100         * WebProcess/WebPage/ios/WebPageIOS.mm:
1101         (WebKit::WebPage::platformEditorState const):
1102
1103 2019-07-20  Chris Dumez  <cdumez@apple.com>
1104
1105         Speed up HashTable decoding by reserving capacity and avoiding rehashing
1106         https://bugs.webkit.org/show_bug.cgi?id=199982
1107
1108         Reviewed by Saam Barati.
1109
1110         Use HashMap::reserveInitialCapacity() in the HashMap IPC decoder for
1111         performance. I measured a ~35% improvement when decoding a very large
1112         HashMap of Strings (~160k entries) in the context of the
1113         StorageManager::GetValues IPC.
1114
1115         * Platform/IPC/ArgumentCoders.h:
1116         * Shared/API/c/WKDictionary.cpp:
1117         (WKDictionaryCreate):
1118
1119 2019-07-20  Chris Dumez  <cdumez@apple.com>
1120
1121         Micro-optimize HashMap & String IPC decoding
1122         https://bugs.webkit.org/show_bug.cgi?id=199967
1123
1124         Reviewed by Geoffrey Garen.
1125
1126         The legacy HashMap decoder (returning a boolean) was failing to WTFMove()
1127         the key & value when calling HashMap::add(). The modern decoder (returning
1128         an Optional) was properly using WTFMove(). Rewrite the legacy HashMap decoder
1129         to call the modern one to reduce code duplication and to get this optimization.
1130
1131         Also, encode HashMap::size() as a uint32_t instead of a uint64_t since
1132         HashMap::size() returns an 'unsigned int' type. Finally, update the modern
1133         decoder to WTFMove(hashMap) when returning. Because the function returns an
1134         Optional<HashMap> and not a HashMap, I do not believe we get return value
1135         optimization (RVO).
1136
1137         Do similar changes to String IPC coders.
1138
1139         * Platform/IPC/ArgumentCoders.cpp:
1140         (IPC::decodeStringText):
1141         (IPC::ArgumentCoder<String>::decode):
1142         * Platform/IPC/ArgumentCoders.h:
1143
1144 2019-07-20  Alexander Mikhaylenko  <exalm7659@gmail.com>
1145
1146         REGRESSION(r246033/r246496): [GTK] Kinetic scrolling doesn't work
1147         https://bugs.webkit.org/show_bug.cgi?id=199322
1148
1149         Reviewed by Michael Catanzaro.
1150
1151         Check ENABLE(KINETIC_SCROLLING) instead of ENABLE(ASYNC_SCROLLING) when setting wheel event phase and momentum phase.
1152
1153         * Shared/WebEventConversion.cpp:
1154         (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
1155
1156 2019-07-20  Zalan Bujtas  <zalan@apple.com>
1157
1158         [Text autosizing] Do not nuke the style on dynamicViewportSizeUpdate
1159         https://bugs.webkit.org/show_bug.cgi?id=199718
1160         <rdar://problem/53344961>
1161
1162         Reviewed by Simon Fraser.
1163
1164         * WebProcess/WebPage/WebPage.cpp:
1165         (WebKit::m_textAutoSizingAdjustmentTimer):
1166         (WebKit::WebPage::close):
1167         (WebKit::WebPage::didCommitLoad):
1168         (WebKit::WebPage::textAutoSizingAdjustmentTimerFired):
1169         (WebKit::m_shrinkToFitContentTimer): Deleted.
1170         * WebProcess/WebPage/WebPage.h:
1171         * WebProcess/WebPage/ios/WebPageIOS.mm:
1172         (WebKit::WebPage::dynamicViewportSizeUpdate):
1173         (WebKit::WebPage::resetIdempotentTextAutosizingIfNeeded):
1174         (WebKit::WebPage::resetTextAutosizing):
1175         (WebKit::WebPage::viewportConfigurationChanged):
1176
1177 2019-07-19  Youenn Fablet  <youenn@apple.com>
1178
1179         Remote WebInspector should enable mock capture devices in UIProcess if doing it in WebProcess
1180         https://bugs.webkit.org/show_bug.cgi?id=199924
1181         <rdar://problem/50552067>
1182
1183         Reviewed by Devin Rousso.
1184
1185         Add IPC plumbery to pass inspector override value for mock capture devices.
1186         Add an override in UserMediaPermissionRequestManagerProxy so that the value stays in sync with web inspector.
1187         The override will be removed when web inspector goes away.
1188
1189         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1190         (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs const):
1191         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1192         (WebKit::UserMediaPermissionRequestManagerProxy::setMockCaptureDevicesEnabledOverride):
1193         * UIProcess/WebInspectorProxy.cpp:
1194         (WebKit::WebInspectorProxy::setMockCaptureDevicesEnabled):
1195         * UIProcess/WebInspectorProxy.h:
1196         * UIProcess/WebInspectorProxy.messages.in:
1197         * UIProcess/WebPageProxy.cpp:
1198         (WebKit::WebPageProxy::setMockCaptureDevicesEnabledOverride):
1199         * UIProcess/WebPageProxy.h:
1200         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
1201         (WebKit::WebInspectorClient::setMockCaptureDevicesEnabled):
1202         * WebProcess/WebCoreSupport/WebInspectorClient.h:
1203         * WebProcess/WebPage/WebInspector.cpp:
1204         (WebKit::WebInspector::setMockCaptureDevicesEnabled):
1205         * WebProcess/WebPage/WebInspector.h:
1206
1207 2019-07-19  Tim Horton  <timothy_horton@apple.com>
1208
1209         Web Content process gets stuck suspended after navigating away from a system preview
1210         https://bugs.webkit.org/show_bug.cgi?id=199965
1211         <rdar://problem/53109004>
1212
1213         Reviewed by Dean Jackson.
1214
1215         * UIProcess/API/Cocoa/WKWebView.mm:
1216         (-[WKWebView _isBackground]):
1217         * UIProcess/ios/WKSystemPreviewView.h:
1218         * UIProcess/ios/WKSystemPreviewView.mm:
1219         (-[WKSystemPreviewView web_initWithFrame:webView:mimeType:]):
1220         (-[WKSystemPreviewView web_isBackground]):
1221         Apply the fix from r193481 to WKSystemPreviewView as well, having it
1222         become a WKApplicationStateTrackingView and plumbing that through
1223         to our is-background machinery.
1224
1225         We really, really should instead have WKWebView itself be the application
1226         state tracking view, but that is a bigger change (and has some implications
1227         for full-screen video and whatnot).
1228
1229 2019-07-19  Dean Jackson  <dino@apple.com>
1230
1231         Provide correct names for UIContextMenuInteraction API replacements
1232         https://bugs.webkit.org/show_bug.cgi?id=199966
1233
1234         Reviewed by Tim Horton.
1235
1236         We had some old incorrect names for replacements to SPI. While
1237         here, I reordered and expanded the documentation for the new API.
1238
1239         * UIProcess/API/Cocoa/WKUIDelegate.h:
1240         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1241
1242 2019-07-19  Daniel Bates  <dabates@apple.com>
1243
1244         [iOS] REGRESSION (r241734): Autocorrection highlight should hide when field becomes defocused
1245         https://bugs.webkit.org/show_bug.cgi?id=199807
1246         <rdar://problem/52760259>
1247
1248         Reviewed by Wenson Hsieh.
1249
1250         Sometimes the correction highlight may not hide when defocusing an editable field.
1251         This occurs only when a person pressed a key in a non-editable element beforehand.
1252         We need to reset some state to force a re-computation of whether a keyboard is still
1253         needed whenever an element is defocused (blurred in web paralance).
1254
1255         Following r241734 both editable and non-editable key events are handled using the same
1256         code path. This is accomplished by having WKContentView's -_requiresKeyboardWhenFirstResponder
1257         return YES to tell UIKit it needs a keyboard even when there is no editable element focused.
1258         As a result UIKit retains all the keyboard state, including keeping the correction highlight
1259         visible. Prior to r241734 WKContentView's -_requiresKeyboardWhenFirstResponder would not return
1260         YES when a non-editable element was focused and hence UIKit would tear down the keyboard
1261         and its state, including the correction highlight. In r245154, we made keyboard instantiate
1262         for a focused non-editable element lazy as a performance optimization. Although r245154
1263         kept the r241734 behavior (just made it lazy) it re-wrote the code in such a way that we
1264         can utilize it as a hook to fix this bug. In particular, we now clear the bit about a
1265         seen keydown in a non-editable element whenever we are defocusing an editable element
1266         before we reload the input views, as part of hiding the keyboard. On the reload, UIKit
1267         will call -_requiresKeyboardWhenFirstResponder, WebKit will respond with NO now that
1268         a non-editable element is focused and hence UIKit will do what it did pre r241734: tear
1269         down the keyboard.
1270
1271         * UIProcess/ios/WKContentViewInteraction.mm:
1272         (-[WKContentView _didCommitLoadForMainFrame]): Clear the bit about a seen keydown here
1273         so that we don't keep the keyboard around on a new page commit. This includes the case
1274         when the same page is reloaded. There is not much advantage to keeping the keyboard
1275         around across reloads and not doing so will reduce our memory footprint. 
1276         (-[WKContentView _elementDidBlur]): Clear the same bit as well when defocusing an
1277         editable element. This will cause UIKit to tear down the keyboard on reload removing
1278         the correction highlight.
1279
1280 2019-07-19  Dean Jackson  <dino@apple.com>
1281
1282         Add a menu item to toggle between showing and hiding link previews
1283         https://bugs.webkit.org/show_bug.cgi?id=199940
1284         <rdar://problem/53032288>
1285
1286         Reviewed by Beth Dakin.
1287
1288         Add a new _WKElementAction that toggles the display of link previews
1289         in context menus, and add it to the default set of actions we provide
1290         for links.
1291
1292         When a UIAction is created from this new _WKElementAction type,
1293         it can be identified by WKElementActionTypeToggleShowLinkPreviewsIdentifier.
1294         This allows us to check a UIMenu provided by a delegate to make sure
1295         that they have provided the toggle menu item. If they haven't, we add it
1296         back.
1297
1298         The preference for showing links is moved from kCFPreferencesAnyApplication
1299         to standard user defaults, so that it can be set no matter what the
1300         hosting application is.
1301
1302         * UIProcess/API/Cocoa/_WKElementAction.h: New action type.
1303         * UIProcess/API/Cocoa/_WKElementAction.mm: 
1304         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
1305         (+[_WKElementAction imageForElementActionType:]): Use eye.fill for now.
1306         I'll need to check with HI to see if there is a more appropriate glyph.
1307         (elementActionTypeToUIActionIdentifier):
1308         (uiActionIdentifierToElementActionType):
1309
1310         * UIProcess/ios/WKActionSheetAssistant.mm: Add the toggle action to
1311         the default set.
1312         (-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
1313
1314         * UIProcess/ios/WKContentViewInteraction.mm:
1315         (-[WKContentView _registerPreview]): No need to listen for CFPreferences
1316         notifications any more.
1317         (-[WKContentView _unregisterPreview]):
1318         (menuWithShowLinkPreviewAction): New method that adds the UIAction
1319         for toggling previews to a UIMenu if necessary.
1320         (-[WKContentView assignLegacyDataForContextMenuInteraction]):
1321         (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]):
1322         (-[WKContentView _showLinkPreviewsPreferenceChanged:]): Deleted.
1323         (titleForMenu): Deleted. URL text previews will be provided separately.
1324
1325 2019-07-19  Wenson Hsieh  <wenson_hsieh@apple.com>
1326
1327         [iOS] Entering 2FA code on idmsa.apple.com causes unexpected scrolling
1328         https://bugs.webkit.org/show_bug.cgi?id=199949
1329         <rdar://problem/49944428>
1330
1331         Reviewed by Tim Horton and Megan Gardner.
1332
1333         Since at least iOS 11, -[UIScrollView _adjustForAutomaticKeyboardInfo:animated:lastAdjustment:] adjusts the
1334         scroll view's content offset to account for updated keyboard bottom insets. In WebKit, we call this method
1335         whenever keyboard geometry changes (based on system notifications, such as UIKeyboardWillHideNotification).
1336
1337         When switching between focused form fields, we hide the keyboard for the previous focused element prior to
1338         showing the keyboard for the newly focused element. This means that we will actually dismiss the keyboard in the
1339         process of changing the focused element, which posts keyboard geometry notifications, which causes us to scroll
1340         WKScrollView.
1341
1342         On iOS 12, this would be immediately followed by re-presenting the keyboard for the new focused element, which
1343         causes us to adjust the scroll view back to its original position right away; this means that the scrolling that
1344         happens as a result of adjusting for the keyboard insets after dismissal doesn't result in any visible change.
1345
1346         However, on iOS 13, after r239441 and r244546, we now defer scrolling and zooming to reveal the focused element
1347         until later; this means the scrolling that happens as a result of initially dismissing the keyboard now causes a
1348         consistent jump in the scroll view's scroll position (whereas on iOS 12, this only happens rarely, and the jump
1349         is also less noticeable).
1350
1351         To mitigate this, we detect the case where we're moving focus from one element to another; if we're about to
1352         show a keyboard for the newly focused element, then we should avoid scrolling as a result of the impending
1353         "keyboard will hide" notification.
1354
1355         Test: fast/forms/ios/no-scrolling-when-moving-focus-between-adjacent-fields.html
1356
1357         * UIProcess/API/Cocoa/WKWebView.mm:
1358         (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
1359         (-[WKWebView _keyboardWillHide:]):
1360         * UIProcess/ios/WKContentViewInteraction.h:
1361         * UIProcess/ios/WKContentViewInteraction.mm:
1362         (shouldShowKeyboardForElement):
1363
1364         Add a helper to determine whether we're focusing an element which presents a "keyboard" (i.e. a UIKit input
1365         view, as opposed to modal select pickers, modal date pickers, or fields with inputmode="none", for which we
1366         don't show an input view).
1367
1368         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
1369         (-[WKContentView shouldIgnoreKeyboardWillHideNotification]):
1370
1371 2019-07-18  Alex Christensen  <achristensen@webkit.org>
1372
1373         Fix warning when importing WebKit in Swift
1374         https://bugs.webkit.org/show_bug.cgi?id=199914
1375         <rdar://problem/52854930>
1376
1377         Reviewed by Wenson Hsieh.
1378
1379         * UIProcess/API/Cocoa/NSAttributedString.h:
1380         Declare NSAttributedString and update a swift name.
1381         This fix was proposed by Argyrios Kyrtzidis.
1382
1383 2019-07-18  Alex Christensen  <achristensen@webkit.org>
1384
1385         Add and test _WKWebsiteDataStoreConfiguration.deviceIdHashSaltsStorageDirectory SPI
1386         https://bugs.webkit.org/show_bug.cgi?id=199923
1387
1388         Reviewed by Youenn Fablet.
1389
1390         This is a step towards us getting rid of WebsiteDataStore::legacyDefaultDataStoreConfiguration
1391
1392         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1393         (-[WKWebsiteDataStore _initWithConfiguration:]):
1394         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
1395         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
1396         (-[_WKWebsiteDataStoreConfiguration deviceIdHashSaltsStorageDirectory]):
1397         (-[_WKWebsiteDataStoreConfiguration setDeviceIdHashSaltsStorageDirectory:]):
1398
1399 2019-07-18  Alex Christensen  <achristensen@webkit.org>
1400
1401         Move NetworkCache ownership from NetworkProcess to NetworkSession
1402         https://bugs.webkit.org/show_bug.cgi?id=199817
1403
1404         Reviewed by Geoff Garen.
1405
1406         I also added SPI to set the path of the NetworkCache with an API test.
1407         If this new SPI is not used, it falls back to getting the cache location from the NetworkProcess to maintain compatibility.
1408         We still get options, cache size, and cache model from the NetworkProcess.  Those should be migrated with new SPI later.
1409         Clearing the cache and other operations now iterate the NetworkSessions instead of assuming there is only one cache.
1410
1411         * NetworkProcess/NetworkProcess.cpp:
1412         (WebKit::NetworkProcess::fetchWebsiteData):
1413         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1414         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
1415         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
1416         (WebKit::NetworkProcess::setCacheModel):
1417         * NetworkProcess/NetworkProcess.h:
1418         (WebKit::NetworkProcess::diskCacheDirectory const):
1419         (WebKit::NetworkProcess::cacheOptions const):
1420         (WebKit::NetworkProcess::cache): Deleted.
1421         * NetworkProcess/NetworkResourceLoader.cpp:
1422         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
1423         * NetworkProcess/NetworkSession.cpp:
1424         (WebKit::NetworkSession::NetworkSession):
1425         * NetworkProcess/NetworkSession.h:
1426         (WebKit::NetworkSession::cache):
1427         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1428         (WebKit::NetworkSessionCreationParameters::encode const):
1429         (WebKit::NetworkSessionCreationParameters::decode):
1430         * NetworkProcess/NetworkSessionCreationParameters.h:
1431         * NetworkProcess/cache/NetworkCache.cpp:
1432         (WebKit::NetworkCache::Cache::open):
1433         (WebKit::NetworkCache::Cache::Cache):
1434         * NetworkProcess/cache/NetworkCache.h:
1435         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1436         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1437         (WebKit::NetworkProcess::clearDiskCache):
1438         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1439         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1440         * NetworkProcess/curl/NetworkSessionCurl.cpp:
1441         (WebKit::NetworkSessionCurl::NetworkSessionCurl):
1442         * NetworkProcess/soup/NetworkSessionSoup.cpp:
1443         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
1444         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1445         (-[WKWebsiteDataStore _initWithConfiguration:]):
1446         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
1447         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
1448         (-[_WKWebsiteDataStoreConfiguration networkCacheDirectory]):
1449         (-[_WKWebsiteDataStoreConfiguration setNetworkCacheDirectory:]):
1450         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1451         (WebKit::WebsiteDataStore::parameters):
1452         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1453         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
1454         * UIProcess/WebsiteData/WebsiteDataStore.h:
1455         (WebKit::WebsiteDataStore::resolvedNetworkCacheDirectory const):
1456
1457 2019-07-18  Chris Dumez  <cdumez@apple.com>
1458
1459         Regression(r247486) Multiple Layout Tests in http/tests/cache/* are crashing on iOS Debug WK2
1460         https://bugs.webkit.org/show_bug.cgi?id=199892
1461         <rdar://problem/53230217>
1462
1463         Reviewed by Geoffrey Garen.
1464
1465         The StorageManager was unregistering itself as a WorkQueueMessageReceiver on a given IPC
1466         connection too early. As a result, we would sometimes receive a 'StorageManager:DestroyStorageMap'
1467         IPC in NetworkConnectionToWebProcess::didReceiveMessage() with nobody to process it, which would
1468         trigger an assertion. To address the issue, we stop unregistering the StorageManager as a
1469         WorkQueueMessageReceiver inside removeAllowedSessionStorageNamespaceConnection(). Instead, we
1470         let the logic inside processDidCloseConnection() take care of it once the connection closes.
1471
1472         * NetworkProcess/WebStorage/StorageManager.cpp:
1473         (WebKit::StorageManager::removeAllowedSessionStorageNamespaceConnection):
1474         (WebKit::StorageManager::processDidCloseConnection):
1475         * NetworkProcess/WebStorage/StorageManager.h:
1476
1477 2019-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1478
1479         [GTK] Crash in webkitWebViewBaseRenderHostFileDescriptor
1480         https://bugs.webkit.org/show_bug.cgi?id=199402
1481
1482         Reviewed by Michael Catanzaro.
1483
1484         There are two problems here:
1485
1486          - We need to ensure that the checks we do in HardwareAccelerationManager to disable AC mode are the same
1487            as the ones done in AcceleratedBackingStore create() methods. This is not the case for WPE renderer.
1488          - Some of the places where accelerateBackingStore is used, can be called even if AC mode is disabled, so we
1489            need to null-check there before using the backing store.
1490
1491         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1492         (webkitWebViewBaseDraw): Add an assert to ensure accelerateBackingStore is not nullptr here.
1493         (webkitWebViewBaseEnterAcceleratedCompositingMode): Ditto.
1494         (webkitWebViewBaseUpdateAcceleratedCompositingMode): Ditto.
1495         (webkitWebViewBaseExitAcceleratedCompositingMode): Ditto.
1496         (webkitWebViewBaseMakeGLContextCurrent): Ditto.
1497         (webkitWebViewBaseDidRelaunchWebProcess): Null-check accelerateBackingStore before using it.
1498         (webkitWebViewBasePageClosed): Ditto.
1499         (webkitWebViewBaseRenderHostFileDescriptor): Ditto.
1500         * UIProcess/gtk/AcceleratedBackingStore.cpp:
1501         (WebKit::AcceleratedBackingStore::checkRequirements): Call AcceleratedBackingStoreWayland::checkRequirements()
1502         or AcceleratedBackingStoreX11::checkRequirements() depending on the current display.
1503         (WebKit::AcceleratedBackingStore::create): Return early if AC mode is disabled in HardwareAccelerationManager.
1504         * UIProcess/gtk/AcceleratedBackingStore.h:
1505         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
1506         (WebKit::AcceleratedBackingStoreWayland::checkRequirements): Check requirements for hardware acceleration in Wayland.
1507         (WebKit::AcceleratedBackingStoreWayland::create): Assert that requirements are present.
1508         * UIProcess/gtk/AcceleratedBackingStoreWayland.h:
1509         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
1510         (WebKit::AcceleratedBackingStoreX11::checkRequirements): Check requirements for hardware acceleration in X11.
1511         (WebKit::AcceleratedBackingStoreX11::create): Assert that requirements are present.
1512         * UIProcess/gtk/AcceleratedBackingStoreX11.h:
1513         * UIProcess/gtk/HardwareAccelerationManager.cpp:
1514         (WebKit::HardwareAccelerationManager::HardwareAccelerationManager): Use
1515         AcceleratedBackingStore::checkRequirements() to decide whether to disable AC mode.
1516
1517 2019-07-17  Megan Gardner  <megan_gardner@apple.com>
1518
1519         Early Out of positionInfomation check if possible
1520         https://bugs.webkit.org/show_bug.cgi?id=199885
1521         <rdar://problem/53229413>
1522
1523         This is an early-out check that happens after most of the work is done.
1524         Move it to happen before we make all these calls, if in the end, we will not use the information.
1525
1526         Reviewed by Tim Horton.
1527
1528         * UIProcess/ios/WKContentViewInteraction.mm:
1529         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1530
1531 2019-07-17  Chris Dumez  <cdumez@apple.com>
1532
1533         Unreviewed, add debug logging to help diagnose flaky crashes on the bots.
1534
1535         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1536         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1537
1538 2019-07-17  Tim Horton  <timothy_horton@apple.com>
1539
1540         [macCatalyst] Unable to interact with YouTube video while it's playing
1541         https://bugs.webkit.org/show_bug.cgi?id=199893
1542         <rdar://problem/51871151>
1543
1544         Reviewed by Simon Fraser.
1545
1546         * Platform/spi/ios/UIKitSPI.h:
1547         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1548         (-[WKRemoteView initWithFrame:contextID:]):
1549         (-[WKUIRemoteView initWithFrame:pid:contextID:]):
1550         Disable remote context hit-testing for WKUIRemoteView just like we
1551         already do for WKRemoteView.
1552
1553 2019-07-17  Chris Dumez  <cdumez@apple.com>
1554
1555         Prewarm local storage in the NetworkProcess to reduce WebContent process hangs
1556         https://bugs.webkit.org/show_bug.cgi?id=199879
1557         <rdar://problem/53217757>
1558
1559         Reviewed by Ryosuke Niwa.
1560
1561         * NetworkProcess/WebStorage/StorageManager.cpp:
1562         (WebKit::StorageManager::prewarm):
1563         (WebKit::StorageManager::getValues):
1564         * NetworkProcess/WebStorage/StorageManager.h:
1565         * NetworkProcess/WebStorage/StorageManager.messages.in:
1566         * WebProcess/WebStorage/StorageAreaImpl.cpp:
1567         (WebKit::StorageAreaImpl::prewarm):
1568         * WebProcess/WebStorage/StorageAreaImpl.h:
1569         * WebProcess/WebStorage/StorageAreaMap.cpp:
1570         (WebKit::StorageAreaMap::loadValuesIfNeeded):
1571         (WebKit::StorageAreaMap::prewarm):
1572         * WebProcess/WebStorage/StorageAreaMap.h:
1573
1574 2019-07-19  Simon Fraser  <simon.fraser@apple.com>
1575
1576         [iOS WK2] Allow scrolling interaction on frames and oveflow scroll even when the main frame is rubber-banding
1577         https://bugs.webkit.org/show_bug.cgi?id=199963
1578         rdar://problem/52897797
1579
1580         Reviewed by Tim Horton.
1581
1582         Adopt UIKit SPI to allow for scrolling of inner UIScrollViews when the outer one is still rubber-banding.
1583
1584         * Platform/spi/ios/UIKitSPI.h:
1585         * UIProcess/API/Cocoa/WKWebView.mm:
1586         (-[WKWebView _initializeWithConfiguration:]):
1587         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1588         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
1589
1590 2019-07-17  Megan Gardner  <megan_gardner@apple.com>
1591
1592         Set WordIsNearTap flag, was not being set at all before
1593         https://bugs.webkit.org/show_bug.cgi?id=199880
1594
1595         Reviewed by Wenson Hsieh.
1596
1597         * WebProcess/WebPage/ios/WebPageIOS.mm:
1598         (WebKit::WebPage::selectWithGesture):
1599
1600 2019-07-17  Jiewen Tan  <jiewen_tan@apple.com>
1601
1602         Provide a NSURL cateogry to tell AppSSO Kerberos URLs
1603         https://bugs.webkit.org/show_bug.cgi?id=199887
1604         <rdar://problem/52323161>
1605
1606         Reviewed by Brent Fulgham.
1607
1608         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.h:
1609         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.mm:
1610         (+[NSURL _web_willPerformSOKerberosAuthorizationWithURL:]):
1611
1612 2019-07-17  Antoine Quint  <graouts@apple.com>
1613
1614         Disable Pointer Events prior to watchOS 6
1615         https://bugs.webkit.org/show_bug.cgi?id=199890
1616         <rdar://problem/53206113>
1617
1618         Reviewed by Dean Jackson.
1619
1620         * Configurations/FeatureDefines.xcconfig:
1621
1622 2019-07-17  Daniel Bates  <dabates@apple.com>
1623
1624         Typing into a cell in a Google Sheet lags behind by one character
1625         https://bugs.webkit.org/show_bug.cgi?id=199587
1626         <rdar://problem/51616845>
1627
1628         Reviewed by Brent Fulgham.
1629
1630         Remove all timers from the holding tank on text insertion or deletion (represented as an
1631         editing command). Timers that were in the holding tank never stopped ticking and will now
1632         be able to execute their action.
1633
1634         * WebProcess/WebPage/WebPage.cpp:
1635         (WebKit::WebPage::executeEditingCommand):
1636         (WebKit::WebPage::insertTextAsync):
1637         (WebKit::WebPage::setCompositionAsync):
1638         (WebKit::WebPage::confirmCompositionAsync):
1639         Call platformWillPerformEditingCommand().
1640
1641         * WebProcess/WebPage/WebPage.h:
1642         (WebKit::WebPage::platformWillPerformEditingCommand): Added.
1643         * WebProcess/WebPage/ios/WebPageIOS.mm:
1644         (WebKit::WebPage::platformWillPerformEditingCommand): Remove all the timers from the holding
1645         tank if we have a holding tank.
1646
1647 2019-07-17  Darin Adler  <darin@apple.com>
1648
1649         No need for isURLAllowed function in Frame
1650         https://bugs.webkit.org/show_bug.cgi?id=120266
1651
1652         Reviewed by Alex Christensen.
1653
1654         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1655         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
1656         Use is<HTMLFrameElementBase> instead of isFrameElementBase.
1657
1658 2019-07-17  Alex Christensen  <achristensen@webkit.org>
1659
1660         Add a runtime-disabled dialog element skeleton
1661         https://bugs.webkit.org/show_bug.cgi?id=199839
1662
1663         Reviewed by Ryosuke Niwa.
1664
1665         * Shared/WebPreferences.yaml:
1666         * UIProcess/API/C/WKPreferences.cpp:
1667         (WKPreferencesSetDialogElementEnabled):
1668         (WKPreferencesGetDialogElementEnabled):
1669         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1670         Add SPI to enable the dialog element for tests.
1671
1672 2019-07-17  Ryosuke Niwa  <rniwa@webkit.org>
1673
1674         [iOS] Option + Up or Down Arrow key doesn’t move cursor past paragraph boundaries in WebKit2
1675         https://bugs.webkit.org/show_bug.cgi?id=199851
1676
1677         Reviewed by Wenson Hsieh.
1678
1679         The bug was caused by the difference in the way AppKit and UIKit responds to Option + Up / Down.
1680
1681         On macOS, AppKit sends moveForward before sending moveToStartOfParagraph and moveBackward
1682         before sending moveToEndOfParagraph. As a result, when Option + Down is pressed when we are at
1683         the end of a line, we would first move to the beginning of the next line (i.e. after the line break)
1684         before moving or extending selection with the paragraph boundary granurality.
1685
1686         On iOS, UIKit only calls _moveToStartOfParagraph without moving forward by a character. As a result,
1687         moving forward by the paragraph boundary granurality immediately stops when we're starting at the
1688         end of a line when Option + Down is pressed. Option + Up case is similar.
1689
1690         Fix the bug on iOS by emulating what happens on macOS. Namely, move the selection forward or backward
1691         by the character granurality before moving by the paragraph boundary granurality.
1692
1693         * UIProcess/ios/WKContentViewInteraction.mm:
1694         (-[WKContentView _moveToStartOfParagraph:withHistory:]):
1695         (-[WKContentView _moveToEndOfParagraph:withHistory:]):
1696
1697 2019-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1698
1699         Unreviewed. Fix GTK and WPE debug build after r247508
1700
1701         * UIProcess/API/glib/WebKitWebResource.cpp:
1702         (webkitWebResourceCreate): Remove invalid assert.
1703
1704 2019-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1705
1706         [WPE][GTK] UI process crash due to NULL dereference in webkitWebViewResourceLoadStarted()
1707         https://bugs.webkit.org/show_bug.cgi?id=199621
1708
1709         Reviewed by Michael Catanzaro.
1710
1711         Null-check frame received in injected bundle message to ensure the frame hasn't been destroyed.
1712
1713         * UIProcess/API/glib/WebKitInjectedBundleClient.cpp:
1714         * UIProcess/API/glib/WebKitWebResource.cpp:
1715         (webkitWebResourceCreate): Receive a reference to the frame instead of a pointer.
1716         * UIProcess/API/glib/WebKitWebResourcePrivate.h:
1717         * UIProcess/API/glib/WebKitWebView.cpp:
1718         (webkitWebViewResourceLoadStarted): Ditto.
1719         * UIProcess/API/glib/WebKitWebViewPrivate.h:
1720
1721 2019-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1722
1723         [GTK][WPE] Do not assert when receiving invalid data in injected bundle messages
1724         https://bugs.webkit.org/show_bug.cgi?id=199830
1725
1726         Reviewed by Michael Catanzaro.
1727
1728         Just silently ignore them to avoid UI process crashes.
1729
1730         * UIProcess/API/glib/WebKitInjectedBundleClient.cpp:
1731
1732 2019-07-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1733
1734         [GTK] No web view updates after swapping web process if AC mode is forced
1735         https://bugs.webkit.org/show_bug.cgi?id=199826
1736
1737         Reviewed by Michael Catanzaro.
1738
1739         This is because when AC mode is forced the provisional page creates a drawing area that is always in AC
1740         mode. When swapping processes, the current drawing area is destroyed (which exists AC mode) and the provisional
1741         one is set. From that point the web process is in AC mode but the UI process isn't. We need to update the
1742         compositing mode when swapping processes.
1743
1744         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1745         (webkitWebViewBaseDidExitWebProcess):
1746         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h:
1747
1748 2019-07-16  Antoine Quint  <graouts@apple.com>
1749
1750         REGRESSION: fast/events/watchos/double-tap-to-zoom* tests crashing in com.apple.WebKit: -[WKContentView(WKInteraction) _singleTapDidReset:]
1751         https://bugs.webkit.org/show_bug.cgi?id=199840
1752         <rdar://problem/52856531>
1753
1754         Reviewed by Wenson Hsieh.
1755
1756         We need to ensure the NSNumber used for -[WKSyntheticTapGestureRecognizer lastActiveTouchIdentifier] is retained. This innocent change required
1757         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
1758         build errors, which leads to a much bigger patch than just the source change necessary to fix the crash.
1759
1760         * SourcesCocoa.txt:
1761         * UIProcess/ios/WKSyntheticTapGestureRecognizer.mm: Renamed from Source/WebKit/UIProcess/ios/WKSyntheticTapGestureRecognizer.m.
1762         * UIProcess/ios/forms/WKFormPeripheralBase.h:
1763         * UIProcess/ios/forms/WKFormPeripheralBase.mm:
1764         * WebKit.xcodeproj/project.pbxproj:
1765
1766 2019-07-16  Brent Fulgham  <bfulgham@apple.com>
1767
1768         Update WebContent Process sandbox based on user seed data
1769         https://bugs.webkit.org/show_bug.cgi?id=199799
1770         <rdar://problem/52903477>
1771
1772         Reviewed by Alexey Proskuryakov.
1773
1774         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1775
1776 2019-07-16  Andy Estes  <aestes@apple.com>
1777
1778         [macCatalyst] Do not include WebKitLegacy.h in WebKit.h
1779         https://bugs.webkit.org/show_bug.cgi?id=199833
1780         <rdar://problem/53036744>
1781
1782         Reviewed by Tim Horton.
1783
1784         * Shared/API/Cocoa/WebKit.h:
1785
1786 2019-07-16  Frederic Wang  <fwang@igalia.com>
1787
1788         Fix build warning because of missing super_class initializer
1789         https://bugs.webkit.org/show_bug.cgi?id=199825
1790
1791         Reviewed by Jonathan Bedard.
1792
1793         * UIProcess/ios/WKContentView.mm:
1794         (keyCommandsPlaceholderHackForEvernote):
1795
1796 2019-07-16  Tim Horton  <timothy_horton@apple.com>
1797
1798         NSTextFinder holes don't scroll with the page
1799         https://bugs.webkit.org/show_bug.cgi?id=199815
1800         <rdar://problem/52280514>
1801
1802         Reviewed by Simon Fraser.
1803
1804         * UIProcess/API/Cocoa/WKWebView.mm:
1805         (-[WKWebView _usePlatformFindUI]):
1806         (-[WKWebView _setUsePlatformFindUI:]):
1807         (-[WKWebView _ensureTextFinderClient]):
1808         Add a bit so that clients can choose whether they want our find UI,
1809         which respects scrolling, or the system find UI, which works when
1810         doing multi-document searches. Right now you can't have both.
1811
1812         (-[WKWebView scrollFindMatchToVisible:]):
1813         Implement and plumb scrollFindMatchToVisible.
1814
1815         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1816         * UIProcess/WebPageProxy.cpp:
1817         (WebKit::WebPageProxy::indicateFindMatch):
1818         * UIProcess/WebPageProxy.h:
1819         * WebProcess/WebPage/WebPage.cpp:
1820         (WebKit::WebPage::indicateFindMatch):
1821         * WebProcess/WebPage/WebPage.h:
1822         * WebProcess/WebPage/WebPage.messages.in:
1823         Plumb indicateFindMatch to FindController.
1824
1825         * UIProcess/mac/WKTextFinderClient.h:
1826         * UIProcess/mac/WKTextFinderClient.mm:
1827         (-[WKTextFinderClient initWithPage:view:usePlatformFindUI:]):
1828         Store whether or not we are using the platform find UI.
1829
1830         (-[WKTextFinderClient findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:]):
1831         If using WebKit find UI, turn on our UI in the options passed to findString[Matches].
1832
1833         (-[WKTextFinderClient scrollFindMatchToVisible:]):
1834         If using WebKit find UI, when the platform tells us to reveal a find match, indicate it.
1835
1836         (-[WKTextFinderClient didFindStringMatchesWithRects:didWrapAround:]):
1837         If using WebKit find UI, lie to the platform and return no rects so that it doesn't paint a yellow rectangle.
1838
1839         (-[WKTextFinderClient getImageForMatchResult:completionHandler:]):
1840         If using WebKit find UI, lie to the platform and return no image so that it doesn't paint a yellow rectangle.
1841
1842         (-[WKTextFinderClient initWithPage:view:]): Deleted.
1843
1844         * WebProcess/WebPage/FindController.cpp:
1845         (WebKit::FindController::updateFindUIAfterPageScroll):
1846         Make it possible to use our find UI with 'findStringMatches'; since the platform
1847         find infrastrucutre depends on knowing about all matches up front, we need
1848         to use 'findStringMatches' instead of 'findString', but we had never combined
1849         that with our UI. Don't throw away the other matches when we indicate one, and
1850         don't send DidFindString in the case we are coming from 'findStringMatches'.
1851         This all needs a bit of cleanup in the future.
1852
1853         (WebKit::FindController::findString):
1854         Tell updateFindUIAfterPageScroll that we are 'findString' so that it uses its normal behavior.
1855
1856         (WebKit::FindController::findStringMatches):
1857         Tell updateFindUIAfterPageScroll that we are 'findStringMatches' so that it uses the adjusted behavior.
1858
1859         (WebKit::FindController::indicateFindMatch):
1860         Add 'indicateFindMatch', which both selects the match and moves the indicator there.
1861
1862         * WebProcess/WebPage/FindController.h:
1863
1864 2019-07-16  Chris Dumez  <cdumez@apple.com>
1865
1866         Speed up StorageManager::getValues()
1867         https://bugs.webkit.org/show_bug.cgi?id=199812
1868
1869         Reviewed by Alex Christensen.
1870
1871         Made the following performance improvements:
1872         - Made StorageManager a WorkQueueMessageReceiver again (like it was before it
1873           got moved from the UIProcess to the Network process). This avoids a lot of
1874           thread hopping (IPC thread -> Main thread -> StorageManagerThread -> Main Thread)
1875           and a lot of isolatedCopying of the strings.
1876         - Move values around when possible to avoid copying.
1877         - Add fast path to StorageMap::importItems() for when the StorageMap is
1878           empty when importing (15ms -> 2.5ms).
1879
1880         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1881         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1882         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage):
1883         * NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
1884         (WebKit::LocalStorageDatabase::importItems):
1885         * NetworkProcess/WebStorage/StorageManager.cpp:
1886         (WebKit::StorageManager::addAllowedSessionStorageNamespaceConnection):
1887         (WebKit::StorageManager::removeAllowedSessionStorageNamespaceConnection):
1888         (WebKit::StorageManager::processDidCloseConnection):
1889         (WebKit::StorageManager::createLocalStorageMap):
1890         (WebKit::StorageManager::createTransientLocalStorageMap):
1891         (WebKit::StorageManager::createSessionStorageMap):
1892         (WebKit::StorageManager::destroyStorageMap):
1893         (WebKit::StorageManager::getValues):
1894         (WebKit::StorageManager::setItem):
1895         (WebKit::StorageManager::setItems):
1896         (WebKit::StorageManager::removeItem):
1897         (WebKit::StorageManager::clear):
1898         * NetworkProcess/WebStorage/StorageManager.h:
1899
1900         * Platform/IPC/Connection.cpp:
1901         (IPC::Connection::addWorkQueueMessageReceiver):
1902         (IPC::Connection::removeWorkQueueMessageReceiver):
1903         (IPC::Connection::processIncomingMessage):
1904         (IPC::Connection::dispatchMessage):
1905         (IPC::Connection::dispatchMessageToWorkQueueReceiver):
1906         * Platform/IPC/Connection.h:
1907         * WebProcess/WebStorage/StorageAreaMap.cpp:
1908         (WebKit::StorageAreaMap::loadValuesIfNeeded):
1909         Messages to WorkQueueMessageReceivers are normally dispatched from the IPC WorkQueue. However, there is a race if
1910         a client (here StorageManager) adds itself as a WorkQueueMessageReceiver as a result of receiving an IPC message
1911         on the main thread (here NetworkConnectionToWebProcess::WebPageWasAdded).
1912         The message might have already been dispatched from the IPC WorkQueue to the main thread by the time the
1913         client registers itself as a WorkQueueMessageReceiver. To address this, we check again for messages receivers
1914         once the message arrives on the main thread.
1915
1916 2019-07-16  Zalan Bujtas  <zalan@apple.com>
1917
1918         [ContentChangeObserver] Cancel ongoing content observation when tap is failed/cancelled
1919         https://bugs.webkit.org/show_bug.cgi?id=199828
1920         <rdar://problem/53152696>
1921
1922         Reviewed by Wenson Hsieh.
1923
1924         * WebProcess/WebPage/ios/WebPageIOS.mm:
1925         (WebKit::WebPage::commitPotentialTapFailed):
1926         (WebKit::WebPage::cancelPotentialTap):
1927
1928 2019-07-15  Alex Christensen  <achristensen@webkit.org>
1929
1930         Remove redundant WebsiteDataStoreConfiguration member
1931         https://bugs.webkit.org/show_bug.cgi?id=199820
1932
1933         Reviewed by Geoffrey Garen.
1934
1935         m_webStorageDirectory was only used for _WKWebsiteDataStoreConfiguration._webStorageDirectory's backing,
1936         which was copied over to m_localStorageDirectory of a new object in WKWebsiteDataStore's _initWithConfiguration.
1937         This is a baby step towards cleaning up this mess with no behavior change.  I see no reason to rename the SPI.
1938
1939         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
1940         (-[_WKWebsiteDataStoreConfiguration _webStorageDirectory]):
1941         (-[_WKWebsiteDataStoreConfiguration _setWebStorageDirectory:]):
1942         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
1943         (WebKit::WebsiteDataStoreConfiguration::copy):
1944         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
1945         (WebKit::WebsiteDataStoreConfiguration::webStorageDirectory const): Deleted.
1946         (WebKit::WebsiteDataStoreConfiguration::setWebStorageDirectory): Deleted.
1947
1948 2019-07-15  Fujii Hironori  <Hironori.Fujii@sony.com>
1949
1950         Make WKURLSchemeTask thread safe
1951         https://bugs.webkit.org/show_bug.cgi?id=199764
1952
1953         Unreviewed build fix for WinCairo port.
1954
1955         Source\WebKit\UIProcess\socket\RemoteInspectorProtocolHandler.cpp(82): error C2039: 'request': is not a member of 'WebKit::WebURLSchemeTask'
1956
1957         * UIProcess/WebURLSchemeTask.h:
1958         (WebKit::WebURLSchemeTask::request const): Restored WebURLSchemeTask::request with a threading assertion.
1959
1960 2019-07-15  Ryan Haddad  <ryanhaddad@apple.com>
1961
1962         Unreviewed, rolling out r247444.
1963
1964         Caused two scrolling tests to fail on iOS Simulator
1965
1966         Reverted changeset:
1967
1968         "Typing into a cell in a Google Sheet lags behind by one
1969         character"
1970         https://bugs.webkit.org/show_bug.cgi?id=199587
1971         https://trac.webkit.org/changeset/247444
1972
1973 2019-07-15  Zalan Bujtas  <zalan@apple.com>
1974
1975         outlook.live.com has odd viewport with edge gap
1976         https://bugs.webkit.org/show_bug.cgi?id=199822
1977         <rdar://problem/53029072>
1978
1979         Reviewed by Wenson Hsieh.
1980
1981         * WebProcess/WebPage/WebPage.h:
1982         * WebProcess/WebPage/ios/WebPageIOS.mm:
1983         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
1984         (WebKit::WebPage::dynamicViewportSizeUpdate):
1985         (WebKit::WebPage::resetViewportDefaultConfiguration):
1986         (WebKit::WebPage::immediatelyShrinkToFitContent):
1987         (WebKit::WebPage::viewLayoutSizeAdjustedForQuirks): Deleted.
1988
1989 2019-07-11  Myles C. Maxfield  <mmaxfield@apple.com>
1990
1991         New York font erroneously gets synthetic bold
1992         https://bugs.webkit.org/show_bug.cgi?id=199653
1993         <rdar://problem/51692592>
1994
1995         Reviewed by Simon Fraser.
1996
1997         Add the SPI to enable the new fonts.
1998
1999         * Shared/WebPreferences.yaml:
2000         * UIProcess/API/C/WKPreferences.cpp:
2001         (WKPreferencesSetShouldAllowDesignSystemUIFonts):
2002         (WKPreferencesGetShouldAllowDesignSystemUIFonts):
2003         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2004         * UIProcess/API/Cocoa/WKPreferences.mm:
2005         (-[WKPreferences _shouldAllowDesignSystemUIFonts]):
2006         (-[WKPreferences _setShouldAllowDesignSystemUIFonts:]):
2007         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2008
2009 2019-07-15  Brady Eidson  <beidson@apple.com>
2010
2011         Make WKURLSchemeTask thread safe.
2012         <rdar://problem/50471863> and https://bugs.webkit.org/show_bug.cgi?id=199764
2013
2014         Reviewed by Alex Christensen.
2015
2016         Punt most of the WKURLSchemeTask operations back to the main thread.
2017         Make accessing the NSURLRequest be thread safe with lock protection.
2018
2019         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
2020         (getExceptionTypeFromMainRunLoop):
2021         (-[WKURLSchemeTaskImpl dealloc]):
2022         (-[WKURLSchemeTaskImpl request]):
2023         (-[WKURLSchemeTaskImpl _requestOnlyIfCached]):
2024         (-[WKURLSchemeTaskImpl didReceiveResponse:]):
2025         (-[WKURLSchemeTaskImpl didReceiveData:]):
2026         (-[WKURLSchemeTaskImpl didFinish]):
2027         (-[WKURLSchemeTaskImpl didFailWithError:]):
2028         (-[WKURLSchemeTaskImpl _didPerformRedirection:newRequest:]):
2029
2030         * UIProcess/WebURLSchemeTask.cpp:
2031         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
2032         (WebKit::WebURLSchemeTask::~WebURLSchemeTask):
2033         (WebKit::WebURLSchemeTask::didPerformRedirection):
2034         (WebKit::WebURLSchemeTask::didReceiveResponse):
2035         (WebKit::WebURLSchemeTask::didReceiveData):
2036         (WebKit::WebURLSchemeTask::didComplete):
2037         (WebKit::WebURLSchemeTask::pageDestroyed):
2038         (WebKit::WebURLSchemeTask::stop):
2039         (WebKit::WebURLSchemeTask::nsRequest const):
2040
2041         * UIProcess/WebURLSchemeTask.h:
2042         (WebKit::WebURLSchemeTask::identifier const):
2043         (WebKit::WebURLSchemeTask::pageID const):
2044         (WebKit::WebURLSchemeTask::process):
2045         (WebKit::WebURLSchemeTask::process const): Deleted.
2046         (WebKit::WebURLSchemeTask::request const): Deleted.
2047
2048 2019-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
2049
2050         Followup to r247439
2051         https://bugs.webkit.org/show_bug.cgi?id=199788
2052         <rdar://problem/52142570>
2053
2054         Reviewed by Tim Horton.
2055
2056         As it turns out, sending modern async completion-handler based IPC messages while processing incoming sync
2057         messages results in a debug assertion. Instead of migrating FontAtSelection to the new async IPC mechanism,
2058         restore the older CallbackID-based async IPC.
2059
2060         * UIProcess/WebPageProxy.h:
2061         * UIProcess/WebPageProxy.messages.in:
2062         * UIProcess/mac/WebPageProxyMac.mm:
2063         (WebKit::WebPageProxy::fontAtSelection):
2064         (WebKit::WebPageProxy::fontAtSelectionCallback):
2065         * WebProcess/WebPage/WebPage.h:
2066         * WebProcess/WebPage/WebPage.messages.in:
2067         * WebProcess/WebPage/mac/WebPageMac.mm:
2068         (WebKit::WebPage::fontAtSelection):
2069
2070 2019-07-15  Dean Jackson  <dino@apple.com>
2071
2072         [WebGL] Remove software rendering and simplify context creation on macOS
2073         https://bugs.webkit.org/show_bug.cgi?id=199789
2074
2075         Reviewed by Sam Weinig.
2076
2077         Remove force software WebGL setting.
2078
2079         * Shared/WebPreferences.yaml:
2080         * UIProcess/API/C/WKPreferences.cpp:
2081         (WKPreferencesSetForceSoftwareWebGLRendering): Deleted.
2082         (WKPreferencesGetForceSoftwareWebGLRendering): Deleted.
2083         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2084
2085 2019-07-15  Daniel Bates  <dabates@apple.com>
2086
2087         Typing into a cell in a Google Sheet lags behind by one character
2088         https://bugs.webkit.org/show_bug.cgi?id=199587
2089         <rdar://problem/51616845>
2090
2091         Reviewed by Brent Fulgham.
2092
2093         Remove all timers from the holding tank on text insertion or deletion (represented as an
2094         editing command). Timers that were in the holding tank never stopped ticking and will now
2095         be able to execute their action.
2096
2097         * WebProcess/WebPage/WebPage.cpp:
2098         (WebKit::WebPage::executeEditingCommand):
2099         (WebKit::WebPage::insertTextAsync):
2100         (WebKit::WebPage::setCompositionAsync):
2101         (WebKit::WebPage::confirmCompositionAsync):
2102         Call platformWillPerformEditingCommand().
2103
2104         * WebProcess/WebPage/WebPage.h:
2105         (WebKit::WebPage::platformWillPerformEditingCommand): Added.
2106         * WebProcess/WebPage/ios/WebPageIOS.mm:
2107         (WebKit::WebPage::platformWillPerformEditingCommand): Remove all the timers from the holding
2108         tank if we have a holding tank.
2109
2110 2019-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
2111
2112         [macOS 10.15] Cannot unbold selected text when the system font is used
2113         https://bugs.webkit.org/show_bug.cgi?id=199788
2114         <rdar://problem/52142570>
2115
2116         Reviewed by Tim Horton.
2117
2118         In macOS 10.15, +[NSFont fontWithName:size:] no longer recognizes system fonts (of name
2119         ".SFNS-*") and returns nil instead. However, our existing implementation of
2120         WebPageProxy::fontAtSelection works by grabbing the font name in the web process, and
2121         sending it over to the UI process, where it is mapped to an NSFont. As a result, this always
2122         results in a nil font in macOS 10.15, which causes us to never update NSFontManager's
2123         selected font. In turn, this means that once selected text is bolded, it can't be unbolded
2124         via NSFontManager, since NSFontManager thinks that the text is still not bold.
2125
2126         To fix this, we simply encode and send a platform FontInfo instead of sending the font name.
2127         This allows the UI process to reconstruct NSFonts from font attribute dictionaries instead,
2128         and update the font manager.
2129
2130         * UIProcess/Cocoa/WebViewImpl.mm:
2131         (WebKit::WebViewImpl::updateFontManagerIfNeeded):
2132         * UIProcess/WebPageProxy.h:
2133         * UIProcess/WebPageProxy.messages.in:
2134         * UIProcess/mac/WebPageProxyMac.mm:
2135         (WebKit::WebPageProxy::fontAtSelection):
2136
2137         Refactor this to send a FontInfo (containing a font attribute dictionary) instead of a font
2138         name.
2139
2140         (WebKit::WebPageProxy::fontAtSelectionCallback): Deleted.
2141         * WebProcess/WebPage/WebPage.h:
2142         * WebProcess/WebPage/WebPage.messages.in:
2143
2144         Change FontAtSelection to use sendWithAsyncReply instead of sending a callback ID. This also
2145         allows us to remove FontAtSelectionCallback.
2146
2147         * WebProcess/WebPage/mac/WebPageMac.mm:
2148         (WebKit::WebPage::fontAtSelection):
2149
2150 2019-07-15  Jiewen Tan  <jiewen_tan@apple.com>
2151
2152         [iOS] SOAuthorizationSession should tell AppSSO whether the UIClient is capable of showing the extension UI
2153         https://bugs.webkit.org/show_bug.cgi?id=199790
2154         <rdar://problem/52790112>
2155
2156         Reviewed by Brent Fulgham.
2157
2158         On iOS, WebKit relies on a SPI -[WKUIDelegatePrivate _presentingViewControllerForWebView:] to present the
2159         extension UI. However, third party clients often don't implement this SPI. Therefore, WebKit will not be
2160         able to present the extension UI for them.
2161
2162         To be able to show the extension UI for third party WebKit clients, WebKit should unset SOAuthorization.enableEmbeddedAuthorizationViewController
2163         whenever clients don't implement the above SPI such that AppSSO could show the UI in their UI process.
2164
2165         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
2166         (WebKit::SOAuthorizationSession::start):
2167
2168 2019-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
2169
2170         REGRESSION: Chase app crashes immediately after authentication
2171         https://bugs.webkit.org/show_bug.cgi?id=199798
2172         <rdar://problem/53106179>
2173
2174         Reviewed by Alex Christensen.
2175
2176         After r247411, we sometimes try to consult `_page` from WKWebView, before WKWebView's `_page` has been set. This
2177         happens under a check for -[WKWebView _isEditable], from within -[WKContentView setupInteraction], which happens
2178         if the host app is not linked on the iOS 12 SDK or earlier. To mitigate this, simply add a null check in
2179         -_isEditable.
2180
2181         There's currently no great way to test this, since we don't have a mechanism for simulating linked-on checks.
2182
2183         * UIProcess/API/Cocoa/WKWebView.mm:
2184         (-[WKWebView _isEditable]):
2185
2186 2019-07-13  Andres Gonzalez  <andresg_22@apple.com>
2187
2188         Add accessibility support to WKDataListSuggestionsView.
2189         https://bugs.webkit.org/show_bug.cgi?id=199772
2190         <rdar://problem/47095851>
2191
2192         Reviewed by Chris Fleizach.
2193
2194         Added accessibility announcement notifications to show, dismiss and selection change for the datalist suggestions view.
2195         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
2196         (-[WKDataListSuggestionsView notifyAccessibilityClients:]):
2197         (-[WKDataListSuggestionsView moveSelectionByDirection:]):
2198         (-[WKDataListSuggestionsView invalidate]):
2199         (-[WKDataListSuggestionsView showSuggestionsDropdown:]):
2200
2201 2019-07-13  Zalan Bujtas  <zalan@apple.com>
2202
2203         Cannot bring up custom media controls at all on v.youku.com
2204         https://bugs.webkit.org/show_bug.cgi?id=199699
2205         <rdar://problem/51835327>
2206
2207         Reviewed by Simon Fraser.
2208
2209         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
2210         (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
2211         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
2212         (WebKit::WebPage::performDictionaryLookupAtLocation):
2213         * WebProcess/WebPage/WebFrame.cpp:
2214         (WebKit::WebFrame::hitTest const):
2215         * WebProcess/WebPage/WebPage.cpp:
2216         (WebKit::handleContextMenuEvent):
2217         (WebKit::WebPage::characterIndexForPointAsync):
2218         * WebProcess/WebPage/ios/WebPageIOS.mm:
2219         (WebKit::WebPage::handleStylusSingleTapAtPoint):
2220         (WebKit::textInteractionPositionInformation):
2221         * WebProcess/WebPage/mac/WebPageMac.mm:
2222         (WebKit::WebPage::shouldDelayWindowOrderingEvent):
2223         (WebKit::WebPage::acceptsFirstMouse):
2224         (WebKit::WebPage::performImmediateActionHitTestAtLocation):
2225
2226 2019-07-12  Andy Estes  <aestes@apple.com>
2227
2228         [Cocoa] -loadFileURL:allowingReadAccessToURL: should fully resolve file URLs
2229         https://bugs.webkit.org/show_bug.cgi?id=199768
2230         <rdar://problem/52002206>
2231
2232         Reviewed by Geoffrey Garen.
2233
2234         -loadFileURL:allowingReadAccessToURL: used -_web_originalDataAsWTFString from WKNSURLExtras
2235         to convert the file and read access NSURLs to strings, which under the hood calls
2236         CFURLGetBytes(). CFURLGetBytes() gets the URL's string without considering the base URL, so
2237         if the client creates a URL like this:
2238
2239             NSURL *url = [NSURL fileURLWithPath:@"tmpfile.txt" relativeToURL:[NSURL fileURLWithPath:@"/tmp"]]
2240
2241         ... then -_web_originalDataAsWTFString will merely return the string "tmpfile.txt". When
2242         that is later converted back to a URL in WebPageProxy::loadFile(), we lose track of the base
2243         component and refuse to load something that no longer looks like a file: URL.
2244
2245         Fixed this by fully resolving the URLs passed to -loadFileURL:allowingReadAccessToURL: when
2246         converting to strings by using -[NSURL absoluteString] instead of -_web_originalDataAsWTFString.
2247
2248         * Shared/Cocoa/WKNSURLExtras.mm:
2249         (-[NSURL _web_originalDataAsWTFString]):
2250         * UIProcess/API/Cocoa/WKWebView.mm:
2251         (-[WKWebView loadFileURL:allowingReadAccessToURL:]):
2252
2253 2019-07-12  Megan Gardner  <megan_gardner@apple.com>
2254
2255         Turn off two finger gestures for editable non-scaled content
2256         https://bugs.webkit.org/show_bug.cgi?id=199739
2257         <rdar://problem/52107190>
2258
2259         Reviewed by Tim Horton.
2260
2261         This gesture is blocking a selection gesture. Turn it off as it is not
2262         even being used in editable content.
2263
2264         * UIProcess/ios/WKContentViewInteraction.mm:
2265         (-[WKContentView setupInteraction]):
2266         (-[WKContentView _didChangeWebViewEditability]):
2267
2268 2019-07-12  Jiewen Tan  <jiewen_tan@apple.com>
2269
2270         SOAuthorizationSession::presentViewController should check WebPageProxy::isClosed()
2271         https://bugs.webkit.org/show_bug.cgi?id=199755
2272         <rdar://problem/52323585>
2273
2274         Reviewed by Chris Dumez.
2275
2276         WebPageProxy::pageClient() is not guaranteed to be non null all the time. Therefore, we should check
2277         WebPageProxy::isClosed() before using it.
2278
2279         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
2280         (WebKit::SOAuthorizationSession::presentViewController):
2281
2282 2019-07-12  Chris Dumez  <cdumez@apple.com>
2283
2284         Regression(macOS Catalina): Cannot quick look html documents in Mail
2285         https://bugs.webkit.org/show_bug.cgi?id=199754
2286         <rdar://problem/51304961>
2287
2288         Reviewed by Geoff Garen.
2289
2290         If the client asks us to load a file URL but does not provide a resource path, WebKit
2291         would fallback to issuing a sandbox extension for /. This no longer works on mac OS
2292         Catalina and it would thus fail to load the file.
2293
2294         To address the issue, if the attempt to create a sandbox extension for / fails, we now
2295         fall back to issuing one for the file's baseURL (path of containing folder).
2296
2297         * UIProcess/WebPageProxy.cpp:
2298         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
2299
2300 2019-07-12  Michael Catanzaro  <mcatanzaro@igalia.com>
2301
2302         WebBackForwardListItem::setPageState should receive pageState by rvalue reference
2303         https://bugs.webkit.org/show_bug.cgi?id=199535
2304
2305         Reviewed by Alex Christensen
2306
2307         Coverity is complaining here about copying PageState by value in the parameter list. It's
2308         sort of a false positive, in that the PageState really does need to be copied here, so this
2309         is the best we can do. But pass by value and then WTFMove() is a pretty strange way to write
2310         it. Passing by rvalue reference would be better. This makes the copy more clear.
2311
2312         * Shared/WebBackForwardListItem.h:
2313         (WebKit::WebBackForwardListItem::setPageState):
2314         * UIProcess/WebProcessProxy.cpp:
2315         (WebKit::WebProcessProxy::updateBackForwardItem):
2316
2317 2019-07-12  Youenn Fablet  <youenn@apple.com>
2318
2319         Add release logging for quota checks
2320         https://bugs.webkit.org/show_bug.cgi?id=199697
2321
2322         Reviewed by Alex Christensen.
2323
2324         Log requests made to the page and the result from the application.
2325
2326         * Platform/Logging.h:
2327         * UIProcess/WebPageProxy.cpp:
2328         (WebKit::WebPageProxy::requestStorageSpace):
2329
2330 2019-07-12  Youenn Fablet  <youenn@apple.com>
2331
2332         Remove unneeded variable in LocalStorageNamespace::getOrCreateStorageArea
2333         https://bugs.webkit.org/show_bug.cgi?id=199477
2334
2335         Reviewed by Alex Christensen.
2336
2337         * NetworkProcess/WebStorage/StorageManager.cpp:
2338         (WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea):
2339
2340 2019-07-12  Pawel Stanek  <p.stanek@metrological.com>
2341
2342         Connection::waitForSyncReply() uses wall time clock for timeout
2343         https://bugs.webkit.org/show_bug.cgi?id=198712
2344         Due to a nature of the system time (it might not be set, jump, be off
2345         by a lot) it is better to use monotonically increasing time which is
2346         exactly what's used in a similar place i.e. Connection::waitForMessage()
2347         
2348         Reviewed by Alex Christensen.
2349
2350         * Platform/IPC/Connection.cpp:
2351         (IPC::Connection::waitForSyncReply):
2352
2353 2019-07-12  Timothy Hatcher  <timothy@apple.com>
2354
2355         Drop DarkModeCSSEnabled as an experimental feature and always enable it.
2356         https://bugs.webkit.org/show_bug.cgi?id=199725
2357         rdar://problem/52970972
2358
2359         Reviewed by Megan Gardner.
2360
2361         * Shared/WebPreferences.yaml: Removed DarkModeCSSEnabled.
2362
2363 2019-07-11  Myles C. Maxfield  <mmaxfield@apple.com>
2364
2365         New York font erroneously gets synthetic bold
2366         https://bugs.webkit.org/show_bug.cgi?id=199653
2367         <rdar://problem/51692592>
2368
2369         Reviewed by Simon Fraser.
2370
2371         Add the SPI to enable the new fonts.
2372
2373         * Shared/WebPreferences.yaml:
2374         * UIProcess/API/C/WKPreferences.cpp:
2375         (WKPreferencesSetShouldAllowDesignSystemUIFonts):
2376         (WKPreferencesGetShouldAllowDesignSystemUIFonts):
2377         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2378         * UIProcess/API/Cocoa/WKPreferences.mm:
2379         (-[WKPreferences _shouldAllowDesignSystemUIFonts]):
2380         (-[WKPreferences _setShouldAllowDesignSystemUIFonts:]):
2381         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2382
2383 2019-07-11  Chris Dumez  <cdumez@apple.com>
2384
2385         ASSERTION FAILED: RunLoop::isMain() under IPC::Connection::sendWithAsyncReply()
2386         https://bugs.webkit.org/show_bug.cgi?id=199734
2387         <rdar://problem/52977439>
2388
2389         Reviewed by Geoffrey Garen.
2390
2391         It appears WKProcessTaskStateObserverDelegate's taskStateDidChange handler can get called
2392         on a background thread so we need to make sure we go back to the main thread before we
2393         go into WebKit and do IPC.
2394
2395         * Shared/Cocoa/ProcessTaskStateObserver.mm:
2396         (-[WKProcessTaskStateObserverDelegate process:taskStateDidChange:]):
2397
2398 2019-07-11  Sihui Liu  <sihui_liu@apple.com>
2399
2400         StorageArea should not be destructed on the main thread
2401         https://bugs.webkit.org/show_bug.cgi?id=199713
2402         <rdar://problem/52911900>
2403
2404         Reviewed by Alex Christensen.
2405
2406         After r246079, LocalStorageNameSpace could be destructed on the main thread and it may hold the last reference 
2407         to StorageArea. Then we saw the crashes that StorageArea was wrongly destructed on the main thread.
2408
2409         * NetworkProcess/NetworkSession.cpp:
2410         (WebKit::NetworkSession::~NetworkSession):
2411         * NetworkProcess/WebStorage/StorageManager.cpp:
2412         (WebKit::StorageManager::waitUntilTasksFinished):
2413         (WebKit::StorageManager::waitUntilWritesFinished): Deleted.
2414         * NetworkProcess/WebStorage/StorageManager.h:
2415
2416 2019-07-11  Tim Horton  <timothy_horton@apple.com>
2417
2418         Null deref of Range under WebPage::startAutoscrollAtPosition
2419         https://bugs.webkit.org/show_bug.cgi?id=199724
2420         <rdar://problem/41127089>
2421
2422         Reviewed by Dean Jackson.
2423
2424         * WebProcess/WebPage/ios/WebPageIOS.mm:
2425         (WebKit::WebPage::startAutoscrollAtPosition):
2426         Refactor this function to be early-return-y, and add one more
2427         early return if the Range is null.
2428
2429 2019-07-11  Pablo Saavedra  <psaavedra@igalia.com>
2430
2431         [WPE][GTK] Build failure with ENABLE_ACCESSIBILITY=OFF
2432         https://bugs.webkit.org/show_bug.cgi?id=199625
2433
2434         Added ENABLE(ACCESSIBILITY) and replaced HAVE(ACCESSIBILITY)
2435         with ENABLE(ACCESSIBILITY) in the code.
2436
2437         Additionally, the TestRunner code generator now honors the
2438         Conditional IDL format.
2439
2440         Reviewed by Konstantin Tokarev.
2441
2442         * UIProcess/API/glib/WebKitWebViewAccessible.cpp:
2443         * UIProcess/API/glib/WebKitWebViewAccessible.h:
2444         * UIProcess/API/wpe/PageClientImpl.cpp:
2445         * UIProcess/API/wpe/PageClientImpl.h:
2446         * UIProcess/API/wpe/WPEView.cpp:
2447         (WKWPE::m_backend):
2448         (WKWPE::View::~View):
2449         * UIProcess/API/wpe/WPEView.h:
2450         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2451         (WKAccessibilityRootObject):
2452         (WKAccessibilityFocusedObject):
2453         (WKAccessibilityEnableEnhancedAccessibility):
2454         (WKAccessibilityEnhancedAccessibilityEnabled):
2455         * WebProcess/WebPage/WebPage.cpp:
2456         * WebProcess/WebPage/WebPage.h:
2457         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
2458         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h:
2459         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2460         (WebKit::WebPage::platformInitialize):
2461         * WebProcess/WebPage/wpe/WebPageWPE.cpp:
2462         (WebKit::WebPage::platformInitialize):
2463         * WebProcess/wpe/WebProcessMainWPE.cpp:
2464
2465 2019-07-11  Commit Queue  <commit-queue@webkit.org>
2466
2467         Unreviewed, rolling out r247314.
2468         https://bugs.webkit.org/show_bug.cgi?id=199721
2469
2470         Caused performance regression. (Requested by deanj on
2471         #webkit).
2472
2473         Reverted changeset:
2474
2475         "Disable speculative loading if cache is not to be used for
2476         the load"
2477         https://bugs.webkit.org/show_bug.cgi?id=199644
2478         https://trac.webkit.org/changeset/247314
2479
2480 2019-07-11  Dean Jackson  <dino@apple.com>
2481
2482         CrashTracer: Regression : MobileSafari at UIKit: -[CALayerAccessibility__UIKit__QuartzCore setBounds:]
2483         https://bugs.webkit.org/show_bug.cgi?id=199720
2484         <rdar://problem/51470469>
2485
2486         Reviewed by Tim Horton.
2487
2488         Speculative fix after confirming that this crash can occur when
2489         a zero width/height view is used for a UITargetedPreview. We
2490         already guarded against this in the default flow, but not in
2491         the fallback path where we take a view snapshot.
2492
2493         * UIProcess/ios/WKContentViewInteraction.mm:
2494         (createFallbackTargetedPreview): Return early if rectangles are empty.
2495
2496 2019-07-11  Alex Christensen  <achristensen@webkit.org>
2497
2498         Use mobile UA on jsfiddle.net
2499         https://bugs.webkit.org/show_bug.cgi?id=199687
2500         <rdar://problem/50839844>
2501
2502         Reviewed by Maciej Stachowiak.
2503
2504         Text selection does not work on iPads using desktop UA.
2505         This isn't the best solution, but it's certainly *a* solution.
2506
2507         * UIProcess/ios/WebPageProxyIOS.mm:
2508         (WebKit::desktopClassBrowsingRecommendedForRequest):
2509
2510 2019-07-11  Simon Fraser  <simon.fraser@apple.com>
2511
2512         [iOS WK2] Can't place caret or select in content that overflows a contenteditable element
2513         https://bugs.webkit.org/show_bug.cgi?id=199741
2514         rdar://problem/50545233
2515
2516         Reviewed by Wenson Hsieh.
2517
2518         Various code paths for editing used renderer->absoluteBoundingBoxRect(), which is the border
2519         box of the element (or a set of line boxes for inline elements) converted to absolute
2520         coordinates. This excludes overflow content, but contenteditable needs to be able to
2521         place the caret in overflow content, and allow selection rects to be in the overflow area
2522         (if the element has visible overflow).
2523
2524         Try to clean this up by adding some static helpers on WebPage for accessing the relevant
2525         rects, and use them in code call from visiblePositionInFocusedNodeForPoint(), and
2526         code that is input to selectionClipRect.
2527
2528         This changes selectionClipRect to use the padding box (excluding borders), which is a progression.
2529
2530         * WebProcess/WebPage/WebPage.h:
2531         * WebProcess/WebPage/ios/WebPageIOS.mm:
2532         (WebKit::WebPage::platformEditorState const):
2533         (WebKit::elementBoundsInFrame):
2534         (WebKit::constrainPoint):
2535         (WebKit::WebPage::rootViewBoundsForElement):
2536         (WebKit::WebPage::absoluteInteractionBoundsForElement):
2537         (WebKit::WebPage::rootViewInteractionBoundsForElement):
2538         (WebKit::WebPage::dispatchSyntheticMouseEventsForSelectionGesture):
2539         (WebKit::WebPage::getFocusedElementInformation):
2540         (WebKit::innerFrameQuad): Deleted.
2541         (WebKit::elementRectInRootViewCoordinates): Deleted.
2542
2543 2019-07-11  Jonathan Bedard  <jbedard@apple.com>
2544
2545         [iOS 13] Enable WebKit build
2546         https://bugs.webkit.org/show_bug.cgi?id=199481
2547         <rdar://problem/52619048>
2548
2549         Reviewed by Tim Horton.
2550
2551         * Platform/spi/ios/UIKitSPI.h: Add UITextEffectsWindow.sharedTextEffectsWindowForWindowScene SPI.
2552         * UIProcess/ios/WKContentViewInteraction.mm:
2553         (-[WKContentView showGlobalMenuControllerInRect:]): setTargetRect, setMenuVisible marked depreciated in iOS 13.
2554         (-[WKContentView hideGlobalMenuController]): Ditto.
2555
2556 2019-07-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2557
2558         MobileSafari may crash under -[UIKeyboardTaskExecutionContext transferExecutionToMainThreadWithTask:]
2559         https://bugs.webkit.org/show_bug.cgi?id=199701
2560         <rdar://problem/52590170>
2561
2562         Reviewed by Tim Horton.
2563
2564         Mitigates a crash wherein we end up calling the completion handler of
2565         -requestAutocorrectionContextWithCompletionHandler: within a nested call
2566         to -requestAutocorrectionContextWithCompletionHandler:. In this particular
2567         case, a sync `window.open` from the web process to the UI process happens
2568         while the UI process is already handling a sync autocorrection context
2569         request. This causes the UI process to try and immediately dispatch the
2570         incoming sync message to avoid deadlock. However, Safari's logic to create
2571         and set up a new web view when opening a new window makes the new view the
2572         first responder, which then prompts UIKit logic to request an autocorrection
2573         context for the new web view.
2574
2575         To avoid the issue for now, simply use -resignFirstResponder as a cue to invoke
2576         pending autocorrection context handlers in the original web view before UIKit
2577         tries to request autocorrection context in the newly created view.
2578
2579         I attempted to write a test for this, but realized that we only end up hitting
2580         the debug assertion pointed out in <https://webkit.org/b/199680>; we should be
2581         able to write a test for this in the future, if we teach Connection to handle
2582         multiple outgoing sync messages.
2583
2584         For the time being, I've attached a manual test case to the bug.
2585
2586         * UIProcess/ios/WKContentViewInteraction.mm:
2587         (-[WKContentView resignFirstResponderForWebView]):
2588         (-[WKContentView _cancelPendingAutocorrectionContextHandler]):
2589
2590         Add a new helper to signify that a pending autocorrection context handler should be cancelled (invoked
2591         immediately with empty data). Use this in a few places where we currently explicitly pass
2592         -[WKAutocorrectionContext emptyAutocorrectionContext].
2593
2594         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
2595
2596 2019-07-10  Simon Fraser  <simon.fraser@apple.com>
2597
2598         [iOS WK2] With modal overlay and body overflow:hidden, can't access all the content
2599         https://bugs.webkit.org/show_bug.cgi?id=199693
2600         rdar://problem/51930364
2601
2602         Reviewed by Tim Horton.
2603
2604         A page with overflow:hidden on the root needs to be scrollable if:
2605         * it's zoomed
2606         * the visual viewport is smaller than the layout viewport (including visible keyboard)
2607         * scrolling is required to hide MobileSafari's squishy bars
2608
2609         This patch does the last two, plumbing a "visual viewport is smaller than layout viewport"
2610         bit up from WebCore via the scrolling tree (that way, when it changes we automatically trigger
2611         a commit), and checking for squished bars in WKWebView.
2612
2613         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2614         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
2615         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
2616         * UIProcess/API/Cocoa/WKWebView.mm:
2617         (-[WKWebView _didCommitLayerTree:]):
2618         (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:maximumUnobscuredSizeOverride:]):
2619         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2620         (WebKit::RemoteScrollingCoordinatorProxy::hasScrollableMainFrame const):
2621         * UIProcess/WebPageProxy.h:
2622         (WebKit::WebPageProxy::maximumUnobscuredSize const):
2623         * WebProcess/WebPage/ios/WebPageIOS.mm:
2624         (WebKit::WebPage::dynamicViewportSizeUpdate):
2625         (WebKit::WebPage::updateVisibleContentRects):
2626
2627 2019-07-10  Tim Horton  <timothy_horton@apple.com>
2628
2629         Long pressing on attachments will crash the WebContent process
2630         https://bugs.webkit.org/show_bug.cgi?id=199696
2631         <rdar://problem/52920241>
2632
2633         Reviewed by Dean Jackson.
2634
2635         * WebProcess/WebPage/ios/WebPageIOS.mm:
2636         (WebKit::linkIndicatorPositionInformation):
2637         (WebKit::elementPositionInformation):
2638         (WebKit::selectionPositionInformation):
2639         (WebKit::WebPage::positionInformation):
2640         Instead of one-off creating a node snapshot for <attachment>, just
2641         use TextIndicator. This way, we get an estimated background color,
2642         paint at the right resolution, etc.
2643
2644         Also, hitNode was often null where we were previously calling
2645         shareableBitmapSnapshotForNode, because it depends on the element
2646         having click event handlers. selectionPositionInformation() re-hit-tests
2647         more permissively to find the <attachment>, so moving this code
2648         inside that function ensures that we don't try to snapshot a null node.
2649
2650 2019-07-10  Dean Jackson  <dino@apple.com>
2651
2652         Safari’s context menu actions are missing options
2653         https://bugs.webkit.org/show_bug.cgi?id=199694
2654         <rdar://problem/52726822>
2655
2656         Reviewed by Tim Horton.
2657
2658         One of the most embarrassing errors I've ever made. I was returning
2659         early when something existed, instead of when it didn't exist.
2660         (*cough* tests *cough*)
2661
2662         * UIProcess/ios/WKContentViewInteraction.mm:
2663
2664 2019-07-10  Jon Lee  <jonlee@apple.com>
2665
2666         Opt trello.com to mobile UA
2667         https://bugs.webkit.org/show_bug.cgi?id=199686
2668         rdar://problem/51708119
2669
2670         Reviewed by Wenson Hsieh.
2671
2672         * UIProcess/ios/WebPageProxyIOS.mm:
2673         (WebKit::desktopClassBrowsingRecommendedForRequest): Currently the desktop version
2674         of the site prevents users from tapping cards to edit them. Opt trello into the mobile
2675         UA for now.
2676
2677 2019-07-10  Daniel Bates  <dabates@apple.com>
2678
2679         [iOS] Selection handles "Lollipops" can become gray and stay gray
2680         https://bugs.webkit.org/show_bug.cgi?id=198852
2681         <rdar://problem/51736130>
2682
2683         Reviewed by Wenson Hsieh.
2684
2685         Tell the text interaction assistant to update the selection UI when the tint color changes.
2686         We do this by way of deactivating and activating selection.
2687
2688         * UIProcess/ios/WKContentViewInteraction.mm:
2689         (-[WKContentView tintColorDidChange]):
2690
2691 2019-07-10  Dean Jackson  <dino@apple.com>
2692
2693         Share or Copy image from context menu does not share the correct data
2694         https://bugs.webkit.org/show_bug.cgi?id=199681
2695         <rdar://problem/50538771>
2696
2697         Reviewed by Tim Horton.
2698
2699         The UIContextMenuInteraction calls didEndInteraction before executing the
2700         actions of a selected menu item. This means we were assuming the interaction
2701         had finished before performing the action triggered in the interaction, ending
2702         up in the state where we had forgotten which element we were working with.
2703
2704         Rather than ask for UIKit to change, I'm just starting the interaction again
2705         as the action is run. Thankfully we already had the location of the interaction.
2706         There is a small risk that the page has changed in the meantime, but I'm not
2707         sure what to do about that.
2708
2709         While here, I moved a method only used by us into _WKElementActionInternal,
2710         and changed the location stored by _WKActivatedElementInfo from a CGPoint
2711         to an WebCore::IntPoint (since it doesn't escape WebKit).
2712
2713         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm: Use a WebCore::IntPoint rather than a CGPoint.
2714         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:]):
2715         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:userInfo:]):
2716         (-[_WKActivatedElementInfo _interactionLocation]):
2717         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
2718
2719         * UIProcess/API/Cocoa/_WKElementAction.h: Move uiActionForElementInfo to Internal.
2720         * UIProcess/API/Cocoa/_WKElementActionInternal.h:
2721
2722         * UIProcess/API/Cocoa/_WKElementAction.mm: When executing the handlers, restart the interaction
2723         using the location in _WKActivatedElementInfo.
2724         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
2725
2726         * UIProcess/ios/WKContentViewInteraction.mm: Explicitly start and stop interactions at
2727         the appropriate points in the UIContextMenu flow. This isn't really needed since we're
2728         doing it in the handlers, but it will be correct if the UIKit delegate order changes.
2729         (-[WKContentView continueContextMenuInteraction:]):
2730         (-[WKContentView contextMenuInteractionDidEnd:]):
2731
2732 2019-07-10  Chris Dumez  <cdumez@apple.com>
2733
2734         Crash under IPC::Connection::waitForMessage()
2735         https://bugs.webkit.org/show_bug.cgi?id=199680
2736         <rdar://problem/52500561>
2737
2738         Reviewed by Tim Horton.
2739
2740         IPC::Connection::waitForMessage() is crashing due to a null defererence of
2741         m_waitingForMessage. Since m_waitingForMessage is only ever set to null in
2742         waitForMessage(), this seems to imply we've re-entered waitForMessage().
2743         This is in theory possible since the loop inside waitForMessage() calls
2744         SyncMessageState::singleton().dispatchMessages() on every iteration to
2745         process incoming synchronous IPC messages. In theory, one of these sync
2746         IPC messages could run code which ends up calling waitForAndDispatchImmediately()
2747         (and thus waitForMessage()).
2748
2749         We had a debug assertion to try and catch re-entrancy with a comment stating
2750         "We don't support having multiple clients waiting for messages." but we
2751         would not see those in release and we would crash with a null dereference
2752         instead.
2753
2754         To address the crashes in release, return early in case of re-entrancy
2755         (we would still hit an assertion in debug).
2756
2757         * Platform/IPC/Connection.cpp:
2758         (IPC::Connection::Connection):
2759         (IPC::Connection::waitForMessage):
2760         * Platform/IPC/Connection.h:
2761
2762 2019-07-10  Tim Horton  <timothy_horton@apple.com>
2763
2764         Context menus are not presented for WKWebViews that don't have UIDelegates
2765         https://bugs.webkit.org/show_bug.cgi?id=199678
2766
2767         Reviewed by Dean Jackson.
2768
2769         * UIProcess/ios/WKContentViewInteraction.mm:
2770         (-[WKContentView continueContextMenuInteraction:]):
2771         Remove this unnecessary early-return if we don't have a UIDelegate.
2772         We have a default behavior that we totally want to happen.
2773         Also, rename completion() to continueWithContextMenuConfiguration()
2774         to reduce confusion between completion() and completionBlock() in
2775         this method.
2776
2777 2019-07-10  Commit Queue  <commit-queue@webkit.org>
2778
2779         Unreviewed, rolling out r247223.
2780         https://bugs.webkit.org/show_bug.cgi?id=199679
2781
2782         Caused perf regression. (Requested by deanj on #webkit).
2783
2784         Reverted changeset:
2785
2786         "[iPadOS] Viewport pops while loading sohu.com, xinhuanet.com,
2787         and various other websites"
2788         https://bugs.webkit.org/show_bug.cgi?id=199575
2789         https://trac.webkit.org/changeset/247223
2790
2791 2019-07-10  Youenn Fablet  <youenn@apple.com>
2792
2793         Disable speculative loading if cache is not to be used for the load
2794         https://bugs.webkit.org/show_bug.cgi?id=199644
2795
2796         Reviewed by Chris Dumez.
2797
2798         When the page is reloaded, loads are instructed to not use the cache.
2799         It is therefore unneeded to do speculative revalidation.
2800         Allow speculative revalidation if the cache policy is either the default HTTP policy or
2801         if policy is to refresh all cache data.
2802         Covered by added test.
2803
2804         * NetworkProcess/cache/NetworkCache.cpp:
2805         (WebKit::NetworkCache::cachePolicyValidForSpeculativeRevalidation):
2806         (WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):
2807
2808 2019-07-10  Alex Christensen  <achristensen@webkit.org>
2809
2810         Fix build after Foundation changes UIEdgeInsets definition
2811         https://bugs.webkit.org/show_bug.cgi?id=199660
2812         <rdar://problem/52390453>
2813
2814         Reviewed by Tim Horton.
2815
2816         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2817         * UIProcess/Cocoa/WKWebViewContentProvider.h:
2818
2819 2019-07-10  Antti Koivisto  <antti@apple.com>
2820
2821         Remove TouchActionData
2822         https://bugs.webkit.org/show_bug.cgi?id=199668
2823
2824         Reviewed by Simon Fraser.
2825
2826         * Shared/WebCoreArgumentCoders.cpp:
2827         (IPC::ArgumentCoder<EventTrackingRegions>::encode):
2828         (IPC::ArgumentCoder<EventTrackingRegions>::decode):
2829         (IPC::ArgumentCoder<TouchActionData>::encode): Deleted.
2830         (IPC::ArgumentCoder<TouchActionData>::decode): Deleted.
2831
2832 2019-07-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2833
2834         [WPE][GTK] GUniqueOutPtr::release should return a raw pointer
2835         https://bugs.webkit.org/show_bug.cgi?id=199579
2836
2837         Reviewed by Carlos Garcia Campos.
2838
2839         * NetworkProcess/glib/WebKitCachedResolver.cpp:
2840         (webkitCachedResolverLookupByNameAsync):
2841         (webkitCachedResolverLookupByNameWithFlagsAsync):
2842         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
2843         (processPendingIconsForPageURL):
2844         (webkit_favicon_database_get_favicon):
2845         * UIProcess/API/glib/WebKitUserContentFilterStore.cpp:
2846         (webkit_user_content_filter_store_save_from_file):
2847
2848 2019-07-09  Tim Horton  <timothy_horton@apple.com>
2849
2850         Fixed elements appear in the middle of full page screenshots taken when scrolled
2851         https://bugs.webkit.org/show_bug.cgi?id=199649
2852         <rdar://problem/52476226>
2853
2854         Reviewed by Simon Fraser.
2855
2856         * WebProcess/WebPage/ios/WebPageIOS.mm:
2857         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
2858         Temporarily expand the layout viewport to the size of the snapshotting page,
2859         so that fixed elements sit against the bounds of the page instead of
2860         wherever you're currently scrolled to.
2861
2862 2019-07-09  Simon Fraser  <simon.fraser@apple.com>
2863
2864         [iOS WK2] Use Optional<> for two data members of WKWebView
2865         https://bugs.webkit.org/show_bug.cgi?id=199637
2866
2867         Reviewed by Tim Horton.
2868
2869         Use Optional<CGSize> to replace _overridesViewLayoutSize/_viewLayoutSizeOverride
2870         and _overridesMaximumUnobscuredSize/_maximumUnobscuredSizeOverride.
2871
2872         No behavior change.
2873
2874         * UIProcess/API/Cocoa/WKWebView.mm:
2875         (-[WKWebView activeViewLayoutSize:]):
2876         (-[WKWebView _frameOrBoundsChanged]):
2877         (activeMaximumUnobscuredSize):
2878         (-[WKWebView _minimumLayoutSizeOverride]):
2879         (-[WKWebView _setViewLayoutSizeOverride:]):
2880         (-[WKWebView _maximumUnobscuredSizeOverride]):
2881         (-[WKWebView _setMaximumUnobscuredSizeOverride:]):
2882         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
2883         (-[WKWebView _clearOverrideLayoutParameters]):
2884
2885 2019-07-09  Chris Dumez  <cdumez@apple.com>
2886
2887         Fix integer type encoding / decoding in WKRemoteObjectCoder
2888         https://bugs.webkit.org/show_bug.cgi?id=199643
2889         <rdar://problem/52732342>
2890
2891         Reviewed by Anders Carlsson.
2892
2893         As per [1], q / Q match to long long / unsigned long long, not long / unsigned long.
2894
2895         [1] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html#//apple_ref/doc/uid/TP40008048-CH100
2896
2897         * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
2898         (encodeInvocationArguments):
2899         (decodeInvocationArguments):
2900
2901 2019-07-09  Chris Dumez  <cdumez@apple.com>
2902
2903         Cleanup uses of NetworkProcess::m_sessionByConnection
2904         https://bugs.webkit.org/show_bug.cgi?id=199586
2905
2906         Reviewed by Alex Christensen.
2907
2908         Avoid double HashMap lookups and call add() instead of ensure() when appropriate.
2909
2910         * NetworkProcess/NetworkProcess.cpp:
2911         (WebKit::NetworkProcess::networkSessionByConnection const):
2912         (WebKit::NetworkProcess::webPageWasAdded):
2913         (WebKit::NetworkProcess::webProcessWasDisconnected):
2914
2915 2019-07-09  Saagar Jha  <saagarjha@apple.com>
2916
2917         WKObject's minimum object alignment needs to be larger
2918         https://bugs.webkit.org/show_bug.cgi?id=199523
2919
2920         Reviewed by Alex Christensen.
2921
2922         WKObject's wrapped objects are currently constructed at addresses aligned to 8-byte boundaries, but some
2923         classes have more stringent requirements. By querying std::aligned_storage for the alignment of an object
2924         larger than anything we can construct, we should be able to satisfy alignment for any of WebKit's types.
2925
2926         * Shared/Cocoa/APIObject.mm: Use std::aligned_storage in conjunction with alignof to determine
2927         minimumObjectAlignment, instead of hardcoding 8.
2928
2929 2019-07-09  Megan Gardner  <megan_gardner@apple.com>
2930
2931         Don't strip out spaces for personalized Autocorrections
2932         https://bugs.webkit.org/show_bug.cgi?id=199476
2933         <rdar://problem/50782015>
2934
2935         Reviewed by Dean Jackson.
2936
2937         When inserting 'autocorrections' that are really predictive
2938         text suggestions based on personal data, we would remove the space
2939         before the suggestion, resulting in incorrect input.
2940         To fix, do not remove a space when the autocorrected text and the text it is 
2941         replacing do not have any length.
2942
2943         * WebProcess/WebPage/ios/WebPageIOS.mm:
2944         (WebKit::WebPage::applyAutocorrectionInternal):
2945
2946 2019-07-09  Truitt Savell  <tsavell@apple.com>
2947
2948         Unreviewed, rolling out r247230.
2949
2950         Caused storage/domstorage/localstorage/private-browsing-
2951         affects-storage.html to crash with an assertion.
2952
2953         Reverted changeset:
2954
2955         "Cleanup uses of NetworkProcess::m_sessionByConnection"
2956         https://bugs.webkit.org/show_bug.cgi?id=199586
2957         https://trac.webkit.org/changeset/247230
2958
2959 2019-07-09  Youenn Fablet  <youenn@apple.com>
2960
2961         XHR CORS requests logged twice in the server
2962         https://bugs.webkit.org/show_bug.cgi?id=199492
2963         <rdar://problem/52757558>
2964
2965         Reviewed by Chris Dumez.
2966
2967         Disable speculative loading for XHR and fetch.
2968         These speculative requests might have specific headers that are no longer relevant
2969         when reloading the page. This might then confuse servers.
2970
2971         * NetworkProcess/cache/NetworkCache.cpp:
2972         (WebKit::NetworkCache::makeStoreDecision):
2973         (WebKit::NetworkCache::canRequestUseSpeculativeRevalidation):
2974         (WebKit::NetworkCache::Cache::retrieve):
2975
2976 2019-07-09  Chris Dumez  <cdumez@apple.com>
2977
2978         Fix validation of method signature in decodeInvocation()
2979         https://bugs.webkit.org/show_bug.cgi?id=199629
2980         <rdar://problem/52731659>
2981
2982         Reviewed by Dan Bernstein.
2983
2984         The decoder was mistakenly assigning remoteMethodSignature to localMethodSignature
2985         before comparing remoteMethodSignature and localMethodSignature, thus making the
2986         check useless.
2987
2988         * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
2989         (decodeInvocation):
2990
2991 2019-07-09  Youenn Fablet  <youenn@apple.com>
2992
2993         Revert conditional WebPageProxy check to grant universal file read sandbox upon correct sandbox creation
2994         https://bugs.webkit.org/show_bug.cgi?id=199622
2995         <rdar://problem/52357508>
2996
2997         Reviewed by Alex Christensen.
2998
2999         On iOS, the sandbox extension to '/' will usually fail, thus the universal file read sandbox is not granted.
3000         This makes WebPageProxy cancel some file:// loads to the application own container.
3001         As a short term fix, go back to previous behavior.
3002         Covered by testing broken app identified in rdar://problem/52357508.
3003
3004         * UIProcess/WebPageProxy.cpp:
3005         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
3006
3007 2019-07-09  Sihui Liu  <sihui_liu@apple.com>
3008
3009         Only allow fetching and removing session credentials from WebsiteDataStore
3010         https://bugs.webkit.org/show_bug.cgi?id=199385
3011         <rdar://problem/52622080>
3012
3013         Reviewed by Alex Christensen.
3014
3015         Stop sending an extra message to network process for fetching or removing persistent credentials.
3016
3017         Also introduce a new SPI for clearing persistent credentials created in test.
3018
3019         * NetworkProcess/NetworkProcess.cpp:
3020         (WebKit::NetworkProcess::clearPermanentCredentialsForProtectionSpace):
3021         (WebKit::NetworkProcess::fetchWebsiteData):
3022         (WebKit::NetworkProcess::deleteWebsiteData):
3023         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
3024         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
3025         (WebKit::NetworkProcess::originsWithPersistentCredentials): Deleted.
3026         (WebKit::NetworkProcess::removeCredentialsWithOrigins): Deleted.
3027         * NetworkProcess/NetworkProcess.h:
3028         * NetworkProcess/NetworkProcess.messages.in:
3029         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3030         (WebKit::NetworkProcess::originsWithPersistentCredentials): Deleted.
3031         (WebKit::NetworkProcess::removeCredentialsWithOrigins): Deleted.
3032         * UIProcess/API/Cocoa/WKProcessPool.mm:
3033         (-[WKProcessPool _clearPermanentCredentialsForProtectionSpace:completionHandler:]):
3034         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3035         * UIProcess/WebProcessPool.cpp:
3036         (WebKit::WebProcessPool::clearPermanentCredentialsForProtectionSpace):
3037         * UIProcess/WebProcessPool.h:
3038         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3039         (WebKit::WebsiteDataStore::fetchDataAndApply):
3040         (WebKit::computeWebProcessAccessTypeForDataRemoval):
3041         (WebKit::WebsiteDataStore::removeData):
3042
3043 2019-07-09  Antoine Quint  <graouts@apple.com>
3044
3045         [Pointer Events] Scroll indicators should not show for scrollable content with touch-action: none
3046         https://bugs.webkit.org/show_bug.cgi?id=199618
3047
3048         Reviewed by Simon Fraser.
3049
3050         Even though we correctly didn't scroll when "touch-action: none" was specified on an element, we would only apply
3051         scrolling constraints after the panning gesture was recognized and the backing UIScrollView would show its scroll
3052         indicators. While this is correct when only "pan-x" or "pan-y" is specified, we should not show the scroll indicators
3053         at all for "touch-action: none" since no scrolling should happen.
3054
3055         To do this, we add a new method to the WKTouchActionGestureRecognizerDelegate protocol to indicate whether a given
3056         gesture recognizer may pan content in the WKWebView. If the gesture recognizer is the top-level scroll view or one
3057         created within the page to back "overflow: scroll" content or an iframe, we correctly make that gesture recognizer
3058         fail to recognize if neither "pan-x" nor "pan-y" is specified for this touch identifier.
3059
3060         * UIProcess/ios/WKContentViewInteraction.mm:
3061         (-[WKContentView gestureRecognizerMayPanWebView:]):
3062         * UIProcess/ios/WKTouchActionGestureRecognizer.h:
3063         * UIProcess/ios/WKTouchActionGestureRecognizer.mm:
3064         (-[WKTouchActionGestureRecognizer canPreventGestureRecognizer:]):
3065
3066 2019-07-09  Chris Dumez  <cdumez@apple.com>
3067
3068         Validate reply block signature in [WKRemoteObjectRegistry _invokeMethod]
3069         https://bugs.webkit.org/show_bug.cgi?id=199584
3070         <rdar://problem/46268249>
3071
3072         Reviewed by Geoffrey Garen.
3073
3074         Validate reply block signature in [WKRemoteObjectRegistry _invokeMethod] for robustness.
3075
3076         * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
3077         (validateReplyBlockSignature):
3078         (-[_WKRemoteObjectRegistry _invokeMethod:]):
3079
3080 2019-07-09  Alex Christensen  <achristensen@webkit.org>
3081
3082         UserData::decode should return false when decoding an unrecognized type
3083         https://bugs.webkit.org/show_bug.cgi?id=199598
3084         <rdar://52735138>
3085
3086         Reviewed by Ryosuke Niwa.
3087
3088         * Shared/UserData.cpp:
3089         (WebKit::UserData::decode):
3090
3091 2019-07-08  Chris Dumez  <cdumez@apple.com>
3092
3093         Speculative fix for crashes under LocalStorageDatabaseTracker::databasePath()
3094         https://bugs.webkit.org/show_bug.cgi?id=199599
3095         <rdar://problem/31169686>
3096
3097         Reviewed by Ryosuke Niwa.
3098
3099         Speculative fix for crashes under LocalStorageDatabaseTracker::databasePath():
3100         - Add new localStorageDirectory() getter to LocalStorageDatabaseTracker which
3101           calls isolatedCopy() on m_localStorageDirectory before returning it.
3102           Use it everywhere instead of m_localStorageDirectory since it is not safe
3103           to use the same String from various threads like it was done.
3104         - Move localStorageDirectory when constructing the LocalStorageDatabaseTracker
3105           instead of copying it.
3106         - Make sure that LocalStorageDatabaseTracker and StorageManager are both
3107           constructed and destroyed on the main thread.
3108
3109         * NetworkProcess/NetworkSession.cpp:
3110         (WebKit::NetworkSession::NetworkSession):
3111         * NetworkProcess/NetworkSession.h:
3112         * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
3113         (WebKit::LocalStorageDatabaseTracker::create):
3114         (WebKit::LocalStorageDatabaseTracker::LocalStorageDatabaseTracker):
3115         (WebKit::LocalStorageDatabaseTracker::localStorageDirectory const):
3116         (WebKit::LocalStorageDatabaseTracker::~LocalStorageDatabaseTracker):
3117         (WebKit::LocalStorageDatabaseTracker::deleteAllDatabases):
3118         (WebKit::LocalStorageDatabaseTracker::origins const):
3119         (WebKit::LocalStorageDatabaseTracker::databasePath const):
3120         * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.h:
3121         * NetworkProcess/WebStorage/StorageManager.cpp:
3122         (WebKit::StorageManager::create):
3123         (WebKit::StorageManager::StorageManager):
3124         (WebKit::StorageManager::~StorageManager):
3125         * NetworkProcess/WebStorage/StorageManager.h:
3126         * NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm:
3127         (WebKit::LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup const):
3128         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3129         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3130         * NetworkProcess/curl/NetworkSessionCurl.cpp:
3131         (WebKit::NetworkSessionCurl::NetworkSessionCurl):
3132         * NetworkProcess/soup/NetworkSessionSoup.cpp:
3133         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
3134
3135 2019-07-08  Chris Dumez  <cdumez@apple.com>
3136
3137         Use WeakHashSet for WebUserContentControllerProxy::m_processes
3138         https://bugs.webkit.org/show_bug.cgi?id=199591
3139         <rdar://problem/52798721>
3140
3141         Reviewed by Youenn Fablet.
3142
3143         Use WeakHashSet for WebUserContentControllerProxy::m_processses for safety. In theory, a WebProcessProxy could
3144         stay in the map if we failed to call WebProcessProxy::shutDown() before destroying it.
3145
3146         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
3147         (WebKit::WebUserContentControllerProxy::~WebUserContentControllerProxy):
3148         (WebKit::WebUserContentControllerProxy::addProcess):
3149         (WebKit::WebUserContentControllerProxy::removeProcess):
3150         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
3151         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
3152         (WebKit::WebUserContentControllerProxy::addUserScript):
3153         (WebKit::WebUserContentControllerProxy::removeUserScript):
3154         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
3155         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
3156         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
3157         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
3158         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
3159         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
3160         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
3161         (WebKit::WebUserContentControllerProxy::addContentRuleList):
3162         (WebKit::WebUserContentControllerProxy::removeContentRuleList):
3163         (WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
3164         * UIProcess/UserContent/WebUserContentControllerProxy.h:
3165         (WebKit::WebUserContentControllerProxy::addNetworkProcess):
3166         (WebKit::WebUserContentControllerProxy::removeNetworkProcess):
3167
3168 2019-07-08  Daniel Bates  <dabates@apple.com>
3169
3170         [iOS] Support select all in non-editable element
3171         https://bugs.webkit.org/show_bug.cgi?id=199257
3172         <rdar://problem/52553667>
3173
3174         Reviewed by Wenson Hsieh.
3175
3176         Unless we are populating the callout bar always advertise that WebKit can perform Select All
3177         when building with USE(UIKIT_KEYBOARD_ADDITIONS). This way you can press Command + A to select
3178         all text even in a non-editable element just like you can on Mac.
3179
3180         * UIProcess/ios/WKContentViewInteraction.mm:
3181         (-[WKContentView canPerformActionForWebView:withSender:]):
3182
3183 2019-07-08  Chris Dumez  <cdumez@apple.com>
3184
3185         Cleanup uses of NetworkProcess::m_sessionByConnection
3186         https://bugs.webkit.org/show_bug.cgi?id=199586
3187
3188         Reviewed by Alex Christensen.
3189
3190         Avoid double HashMap lookups and call add() instead of ensure() when appropriate.
3191
3192         * NetworkProcess/NetworkProcess.cpp:
3193         (WebKit::NetworkProcess::networkSessionByConnection const):
3194         (WebKit::NetworkProcess::webPageWasAdded):
3195         (WebKit::NetworkProcess::webProcessWasDisconnected):
3196
3197 2019-07-08  Tim Horton  <timothy_horton@apple.com>
3198
3199         WKWebView fails to render when another view uses CoreImage filters
3200         https://bugs.webkit.org/show_bug.cgi?id=199488
3201         <rdar://problem/52695825>
3202
3203         Reviewed by Dean Jackson.
3204
3205         * UIProcess/WebPageProxy.cpp:
3206         (WebKit::WebPageProxy::layerHostingModeDidChange):
3207         Update m_layerHostingMode when it changes, even if we can't message
3208         the Web Content process. This ensures that the next time we launch
3209         a Web Content process, WebPageCreationParameters will have the correct
3210         layer hosting mode, and is the usual pattern for such things.
3211
3212 2019-07-08  Wenson Hsieh  <wenson_hsieh@apple.com>
3213
3214         [iPadOS] Viewport pops while loading sohu.com, xinhuanet.com, and various other websites
3215         https://bugs.webkit.org/show_bug.cgi?id=199575
3216         <rdar://problem/51842220>
3217
3218         Reviewed by Simon Fraser.
3219
3220         Currently, the shrink-to-fit-content heuristic added to scale desktop sites fit within the viewport on iPadOS
3221         only runs during two intervals: after document load, and after page load. On very script-heavy websites, this
3222         may cause a visible jump, as rendering may commence well before the document is finished parsing.
3223
3224         To mitigate this, we move the first opportunity for the shrink-to-fit heuristic from after document, to right
3225         after the page transition has completed (before we unfreeze the layer tree).
3226
3227         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3228         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
3229         * WebProcess/WebPage/WebPage.cpp:
3230         (WebKit::WebPage::didCompletePageTransition):
3231         (WebKit::WebPage::didFinishDocumentLoad): Deleted.
3232
3233         Remove this didFinishDocumentLoad hook, which was only used to schedule the shrink-to-fit timer.
3234
3235         * WebProcess/WebPage/WebPage.h:
3236         * WebProcess/WebPage/ios/WebPageIOS.mm:
3237         (WebKit::WebPage::immediatelyShrinkToFitContent):
3238
3239         m_mainFrame might be null after page transition completes, so we need to ensure immediatelyShrinkToFitContent is
3240         robust in this scenario.
3241
3242 2019-07-08  Chris Dumez  <cdumez@apple.com>
3243
3244         Add threading assertion to WTF::CompletionHandler
3245         https://bugs.webkit.org/show_bug.cgi?id=199516
3246
3247         Reviewed by Alex Christensen.
3248
3249         Update some MessagePort-related code to use WTF::Function instead of WTF::CompletionHandler
3250         since the callback is always called on the main thread, even when it was created on a
3251         worker thread. Ideally, this code would be refactored so that the callback gets called on
3252         the worker thread directly.
3253
3254         * UIProcess/UIMessagePortChannelProvider.cpp:
3255         (WebKit::UIMessagePortChannelProvider::checkRemotePortForActivity):
3256         * UIProcess/UIMessagePortChannelProvider.h:
3257         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.cpp:
3258         (WebKit::WebMessagePortChannelProvider::checkRemotePortForActivity):
3259         * WebProcess/WebCoreSupport/WebMessagePortChannelProvider.h:
3260
3261 2019-07-08  Antoine Quint  <graouts@apple.com>
3262
3263         [Pointer Events] "touch-action: none" does not prevent double-tap-to-zoom
3264         https://bugs.webkit.org/show_bug.cgi?id=199571
3265         <rdar://problem/51715002>
3266
3267         Reviewed by Wenson Hsieh.
3268
3269         We add a new WKTouchActionGestureRecognizerDelegate method to check whether a gesture recognizer may lead to
3270         zooming the page as a result of double-tapping, which can be caused by two different gesture recognizers
3271         managed by WKContentViewInteraction. If that delegate method returns true and we have "touch-action: none"
3272         set for this touch, we cause those gesture recognizers to fail and prevent double-tap-to-zoom behavior.
3273
3274         * UIProcess/ios/WKContentViewInteraction.mm:
3275         (-[WKContentView gestureRecognizerMayDoubleTapToZoomWebView:]):
3276         * UIProcess/ios/WKTouchActionGestureRecognizer.h:
3277         * UIProcess/ios/WKTouchActionGestureRecognizer.mm:
3278         (-[WKTouchActionGestureRecognizer canPreventGestureRecognizer:]):
3279
3280 2019-07-08  Per Arne Vollan  <pvollan@apple.com>
3281
3282         [iOS] WebContent processes should not globally allow mach lookup to the AX server.
3283         https://bugs.webkit.org/show_bug.cgi?id=199386
3284         <rdar://problem/52487468>
3285
3286         Reviewed by Chris Fleizach.
3287
3288         Instead, a mach extension for this service should be issued to the WebContent process. This has already been implemented.
3289
3290         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3291
3292 2019-07-08  Claudio Saavedra  <csaavedra@igalia.com>
3293
3294         REGRESSION(r246671): [WPE][GTK] Crash in NetworkProcess since the DNS cache landed
3295         https://bugs.webkit.org/show_bug.cgi?id=199572
3296
3297         Reviewed by Michael Catanzaro.
3298
3299         The GError coming from the wrapped resolver shouldn't be freed,
3300         but passed onto the caller.
3301
3302         * NetworkProcess/glib/WebKitCachedResolver.cpp:
3303         (webkitCachedResolverLookupByNameAsync):
3304         (webkitCachedResolverLookupByNameWithFlagsAsync):
3305
3306 2019-07-07  Antoine Quint  <graouts@apple.com>
3307
3308         [Pointer Events] touch-action should affect the behavior of pinch-to-zoom to show tabs in Safari
3309         https://bugs.webkit.org/show_bug.cgi?id=199560
3310         <rdar://problem/52742265>
3311
3312         Reviewed by Dean Jackson.
3313
3314         There are other UIPinchGestureRecognizer objects that may lead to pinch-to-zoom behavior, for instance pinching
3315         out to show open tabs in Safari on iOS. We add a new WKUIDelegatePrivate method that will allow Safari to indicate
3316         that a UIPinchGestureRecognizer considered for prevention would lead to pinch-to-zoom behavior.
3317
3318         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3319         * UIProcess/ios/WKContentViewInteraction.mm:
3320         (-[WKContentView gestureRecognizerMayPinchToZoomWebView:]):
3321
3322 2019-07-08  Antoine Quint  <graouts@apple.com>
3323
3324         [Pointer Events] Enable only on the most recent version of the supported iOS family
3325         https://bugs.webkit.org/show_bug.cgi?id=199562
3326         <rdar://problem/52766511>
3327
3328         Reviewed by Dean Jackson.
3329
3330         * Configurations/FeatureDefines.xcconfig:
3331         * UIProcess/ios/WKContentViewInteraction.mm:
3332         (-[WKContentView cancelPointersForGestureRecognizer:]):
3333         (-[WKContentView activeTouchIdentifierForGestureRecognizer:]):
3334         (-[WKContentView touchActionActiveTouches]):
3335         * UIProcess/ios/WKSyntheticTapGestureRecognizer.m:
3336         (-[WKSyntheticTapGestureRecognizer touchesEnded:withEvent:]):
3337         * UIProcess/ios/WKTouchActionGestureRecognizer.h:
3338         * UIProcess/ios/WKTouchActionGestureRecognizer.mm:
3339         (-[WKTouchActionGestureRecognizer canPreventGestureRecognizer:]):
3340
3341 2019-07-08  Michael Catanzaro  <mcatanzaro@igalia.com>
3342
3343         [GTK] ViewGestureController constructor leaves m_direction uninitialized
3344         https://bugs.webkit.org/show_bug.cgi?id=199532
3345
3346         Reviewed by Carlos Garcia Campos.
3347
3348         This is harmless because it should never be read until after it's initialized, but still not
3349         robust. Fix it by assuming Back as the default value until the first swipe begins.
3350
3351         * UIProcess/ViewGestureController.h:
3352
3353 2019-07-07  Zalan Bujtas  <zalan@apple.com>
3354
3355         [ContentChangeObserver] Difficult to control videos on iqiyi.com as the actions are mouse hover
3356         https://bugs.webkit.org/show_bug.cgi?id=199542
3357         <rdar://problem/51886813>
3358
3359         Reviewed by Simon Fraser.
3360
3361         * WebProcess/WebPage/ios/WebPageIOS.mm:
3362         (WebKit::WebPage::handleSyntheticClick):
3363
3364 2019-07-06  Antoine Quint  <graouts@apple.com>
3365
3366         [Pointer Events] Use a gesture recognizer to prevent pinch-to-zoom behavior
3367         https://bugs.webkit.org/show_bug.cgi?id=199543
3368
3369         Reviewed by Dean Jackson.
3370
3371         We used to set the "enabled" property on the main UIScrollView's UIPinchGestureRecognizer to disable pinch-to-zoom
3372         behavior based on the "touch-action" CSS property. This was sub-optimal since this gesture recognizer can be publicly
3373         accessible by third-party developers, but also because it set state instead of a run-time solution.
3374
3375         We now introduce a new WKTouchActionGestureRecognizer dedicated to preventing clearly identified gesture recognizers
3376         from being recognized to disable some built-in behavior. As a new touch starts, we record the computed touch-action
3377         property for the given touch identifier on the WKTouchActionGestureRecognizer, then WKTouchActionGestureRecognizer
3378         determines, by implementing -[canPreventGestureRecognizer:], whether the possibly-prevented gesture recognizer
3379         is known to lead to a pinch-to-zoom behavior and whether it contains a touch that should prevent it.
3380
3381         To support the WKTouchActionGestureRecognizer, WKContentViewInteraction implements the new WKTouchActionGestureRecognizerDelegate
3382         protocol to indicate whether the possibly-prevented gesture recognizer is the main UIScrollView's UIPinchGestureRecognizer.
3383
3384         No new test since this changes the implementation of existing behavior.
3385
3386         * SourcesCocoa.txt:
3387         * UIProcess/ios/WKContentViewInteraction.h:
3388         * UIProcess/ios/WKContentViewInteraction.mm:
3389         (-[WKContentView setupInteraction]):
3390         (-[WKContentView cleanupInteraction]):
3391         (-[WKContentView _removeDefaultGestureRecognizers]):
3392         (-[WKContentView _addDefaultGestureRecognizers]):
3393         (-[WKContentView _handleTouchActionsForTouchEvent:]):
3394         (-[WKContentView gestureRecognizerMayPinchToZoomWebView:]):
3395         (-[WKContentView touchActionActiveTouches]):
3396         * UIProcess/ios/WKTouchActionGestureRecognizer.h: Added.
3397         * UIProcess/ios/WKTouchActionGestureRecognizer.mm: Added.
3398         (-[WKTouchActionGestureRecognizer initWithTouchActionDelegate:]):
3399         (-[WKTouchActionGestureRecognizer setTouchActions:forTouchIdentifier:]):
3400         (-[WKTouchActionGestureRecognizer clearTouchActionsForTouchIdentifier:]):
3401         (-[WKTouchActionGestureRecognizer touchesBegan:withEvent:]):
3402         (-[WKTouchActionGestureRecognizer touchesMoved:withEvent:]):
3403         (-[WKTouchActionGestureRecognizer touchesEnded:withEvent:]):
3404         (-[WKTouchActionGestureRecognizer touchesCancelled:withEvent:]):
3405         (-[WKTouchActionGestureRecognizer _updateState]):
3406         (-[WKTouchActionGestureRecognizer canBePreventedByGestureRecognizer:]):
3407         (-[WKTouchActionGestureRecognizer canPreventGestureRecognizer:]):
3408         * WebKit.xcodeproj/project.pbxproj:
3409
3410 2019-07-06  Chris Fleizach  <cfleizach@apple.com>
3411
3412         AX: CrashTracer: com.apple.WebKit.WebContent at WebKit: WebKit::WebSpeechSynthesisClient::speak
3413         https://bugs.webkit.org/show_bug.cgi?id=199435
3414
3415         Reviewed by Ryosuke Niwa.
3416
3417         Ensure we don't access null observers in speech callbacks.
3418
3419         * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp:
3420         (WebKit::WebSpeechSynthesisClient::voiceList):
3421         (WebKit::WebSpeechSynthesisClient::speak):
3422         (WebKit::WebSpeechSynthesisClient::pause):
3423         (WebKit::WebSpeechSynthesisClient::resume):
3424         * WebProcess/WebPage/WebPage.cpp:
3425         (WebKit::WebPage::speakingErrorOccurred):
3426         (WebKit::WebPage::boundaryEventOccurred):
3427         (WebKit::WebPage::voicesDidChange):
3428
3429 2019-07-05  Chris Dumez  <cdumez@apple.com>
3430
3431         Fix thread safety bug in WebResourceLoadStatisticsTelemetry::calculateAndSubmit()
3432         https://bugs.webkit.org/show_bug.cgi?id=199536
3433
3434         Reviewed by Youenn Fablet.
3435
3436         The resourceLoadStatisticsStore is an object that is created / used / destroyed on the background
3437         queue. It is therefore not safe to create a WeakPtr for it and use that WeakPtr on the main thread.
3438
3439         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
3440         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
3441
3442 2019-07-05  Michael Catanzaro  <mcatanzaro@igalia.com>
3443
3444         Unreviewed, fix -Wswitch warning
3445
3446         We don't support HTTPCookieAcceptPolicy::ExclusivelyFromMainDocumentDomain.
3447
3448         Fun fact, soup's OnlyFromMainDocumentDomain functions the same as Apple's
3449         ExclusivelyFromMainDocumentDomain. These should be renamed....
3450
3451         * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp:
3452         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
3453
3454 2019-07-05  Dean Jackson  <dino@apple.com>
3455
3456         [iOS] Context Menu - Add to Reading List does nothing
3457         https://bugs.webkit.org/show_bug.cgi?id=199504
3458         <rdar://problem/52554137>
3459
3460         Reviewed by Anders Carlsson.
3461
3462         We were holding weak references to the _WKElementAction in
3463         the handler provided to UIAction. By the time the handler was
3464         called, the object had been deallocated.
3465
3466         * UIProcess/API/Cocoa/_WKElementAction.mm:
3467         (-[_WKElementAction uiActionForElementInfo:]): Use strong references in handler.
3468
3469 2019-07-05  Ryosuke Niwa  <rniwa@webkit.org>
3470
3471         [iOS] Crash in WebKit::WebPage::positionInformation via Range::startPosition
3472         https://bugs.webkit.org/show_bug.cgi?id=199503
3473
3474         Reviewed by Wenson Hsieh.
3475
3476         The crash was caused because focusedElementPositionInformation asssumes Editor::compositionRange is not null
3477         whenever Editor::hasComposition returns true, which is not necessary the case when Editor::m_compositionNode
3478         contains no text (data is of length 0).
3479
3480         Fixed the crash by adding an early return for when Editor::compositionRange returns nullptr.
3481
3482         * WebProcess/WebPage/ios/WebPageIOS.mm:
3483         (WebKit::focusedElementPositionInformation):
3484
3485 2019-07-05  Zalan Bujtas  <zalan@apple.com>
3486
3487         [ContentChangeObserver] REGRESSION (r247015): facebook photo/video upload button is unresponsive to user interaction.
3488         https://bugs.webkit.org/show_bug.cgi?id=199502
3489         <rdar://problem/52547473>
3490
3491         Reviewed by Simon Fraser.
3492
3493         Apparently it's a common practice to put transparent elements over visible click targets (button like divs) and use the invisible
3494         elements to catch the user input (e.g. Facebook's Photo/Video button).
3495         This patch modifies the original "do not trigger click on invisible targets" heuristic to a more restrictive "do not trigger
3496         click if the click target was previously hidden and became visible through touch start".
3497         If this still breaks some use cases, we could turn it into YouTube quirk.       
3498
3499         * WebProcess/WebPage/ios/WebPageIOS.mm:
3500         (WebKit::WebPage::handleSyntheticClick):
3501
3502 2019-07-05  Ryan Haddad  <ryanhaddad@apple.com>
3503
3504         Unreviewed, rolling out r247123.
3505
3506         Caused TestWebKitAPI.Challenge.BasicProposedCredential to
3507         fail.
3508
3509         Reverted changeset: