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