Link prefetch not useful for top-level navigation
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-05-08  Rob Buis  <rbuis@igalia.com>
2
3         Link prefetch not useful for top-level navigation
4         https://bugs.webkit.org/show_bug.cgi?id=195623
5
6         Reviewed by Youenn Fablet.
7
8         Cache cross-domain top-level prefetches in a dedicated cache. When a navigation
9         to the same url is done within a threshold (5 seconds), reuse the
10         prefetch cache entry, move it to the disk cache and navigate to
11         the url, meaning no extra network trip is needed. When not used within
12         the threshold period, the prefetch entry will be erased using a timer.
13
14         * NetworkProcess/NetworkProcess.cpp:
15         (WebKit::NetworkProcess::lowMemoryHandler):
16         * NetworkProcess/NetworkResourceLoader.cpp:
17         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
18         (WebKit::NetworkResourceLoader::didReceiveResponse):
19         (WebKit::NetworkResourceLoader::didReceiveBuffer):
20         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
21         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const):
22         * NetworkProcess/NetworkResourceLoader.h:
23         * NetworkProcess/NetworkSession.h:
24         (WebKit::NetworkSession::prefetchCache):
25         (WebKit::NetworkSession::clearPrefetchCache):
26         * NetworkProcess/cache/PrefetchCache.cpp: Added.
27         (WebKit::PrefetchCache::Entry::Entry):
28         (WebKit::PrefetchCache::PrefetchCache):
29         (WebKit::PrefetchCache::~PrefetchCache):
30         (WebKit::PrefetchCache::clear):
31         (WebKit::PrefetchCache::take):
32         (WebKit::PrefetchCache::store):
33         (WebKit::PrefetchCache::clearExpiredEntries):
34         * NetworkProcess/cache/PrefetchCache.h: Added.
35         (WebKit::PrefetchCache::Entry::releaseBuffer):
36         * Shared/WebPreferences.yaml:
37         * Sources.txt:
38         * WebKit.xcodeproj/project.pbxproj:
39
40 2019-05-07  Chris Dumez  <cdumez@apple.com>
41
42         Simplify logic to prevent App Nap in WebPage
43         https://bugs.webkit.org/show_bug.cgi?id=197674
44
45         Reviewed by Geoff Garen.
46
47         Simplify logic to prevent App Nap in WebPage. We do not need both m_userActivityHysteresis and
48         m_userActivity since UserActivity is already a HysteresisActivity. We had 2 levels of
49         HysteresisActivity stacked on top of one another. Also rename "process suppression" to "app nap" as
50         I find it clearer.
51
52         * WebProcess/WebPage/WebPage.cpp:
53         (WebKit::WebPage::updateThrottleState):
54         (WebKit::WebPage::mouseEvent):
55         (WebKit::WebPage::wheelEvent):
56         (WebKit::WebPage::keyEvent):
57         (WebKit::WebPage::updatePreferences):
58         (WebKit::m_userActivityHysteresis): Deleted.
59         (WebKit::WebPage::updateUserActivity): Deleted.
60         * WebProcess/WebPage/WebPage.h:
61
62 2019-05-07  Carlos Garcia Campos  <cgarcia@igalia.com>
63
64         REGRESSION(r244230): Web Automation: use null instead of empty string as success result of scripts when alert is open
65         https://bugs.webkit.org/show_bug.cgi?id=197655
66
67         Reviewed by Devin Rousso.
68
69         This regressed in r244230, the case of an alert open while running a script is now handled in WebKit side, but
70         an empty string is returned as a result, which is not a valid JSON serialized string. That made all user prompts
71         tests to fail.
72
73         * UIProcess/Automation/WebAutomationSession.cpp:
74         (WebKit::WebAutomationSession::willShowJavaScriptDialog): Use null as script result instead of an empty string.
75
76 2019-05-07  Ryan Haddad  <ryanhaddad@apple.com>
77
78         Unreviewed, rolling out r245038.
79
80         Breaks internal builds.
81
82         Reverted changeset:
83
84         "Add SPI to set a list of hosts to which to send custom header
85         fields cross-origin"
86         https://bugs.webkit.org/show_bug.cgi?id=197397
87         https://trac.webkit.org/changeset/245038
88
89 2019-05-07  Jiewen Tan  <jiewen_tan@apple.com>
90
91         [WebAuthN] A new request should always suppress the pending request if any
92         https://bugs.webkit.org/show_bug.cgi?id=191517
93         <rdar://problem/46888222>
94
95         Reviewed by Brent Fulgham.
96
97         Previously we blocked new WebAuthN requests whenever a pending request was in progress
98         to prevent background tabs from DoS foreground tabs. However, in r244938, the WebAuthN
99         API was changed to restrict request handling to the focused document. Therefore, we no
100         longer have a risk of DoS.
101
102         Apart from the vanished benefit, this behavoir actually blocks new pages to use
103         WebAuthN API in the period between [the previous initating page is closed, the pending
104         request is hanedled/timeout].
105
106         Also, it makes sense to have the current focused document preempt the pending request.
107         Therefore, the policy will be to always cancel any pending requests whenever a new
108         request is made. This will enforce the policy of handling only one request at a time.
109
110         Note that the current implementation doesn't explicitly cancel pending requests in the
111         Authenticators, which means that we could receive responses from the Authenticator that
112         were meant for a previous (now cancelled) request. A follow-up patch (see Bug 191523)
113         will implement an Authenticator feature to support immediate cancellation.
114
115         In the meantime, to protect the atomicity of the request/response pair, i.e., preventing an old
116         response being used for a new request, there are two safeguards:
117         1) In web process, each request to UI process is paired with an incremental ID, and therefore an old
118         response from UI process would have a different ID than the current request, which will then be ignored.
119         2) In UI process, all responses from authenticators will be piped to the main run loop for processing.
120         Therefore, when the new request comes in, the old response is either processed or waiting in the pipe.
121         To prevent the latter being processed, the new request will immediately destroy any authenticators bound
122         to the old response in the current run loop. Hence, in the next run loop when dealing the old response,
123         the lambda will have no where to hand the response over.
124
125         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
126         (WebKit::AuthenticatorManager::makeCredential):
127         (WebKit::AuthenticatorManager::getAssertion):
128         (WebKit::AuthenticatorManager::clearStateAsync):
129         (WebKit::AuthenticatorManager::clearState):
130         (WebKit::AuthenticatorManager::timeOutTimerFired):
131         * UIProcess/WebAuthentication/AuthenticatorManager.h:
132         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
133         (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
134         (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
135         (WebKit::WebAuthenticatorCoordinatorProxy::requestReply):
136         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
137         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in:
138         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
139         (WebKit::WebAuthenticatorCoordinator::makeCredential):
140         (WebKit::WebAuthenticatorCoordinator::getAssertion):
141         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.messages.in:
142
143 2019-05-07  Per Arne Vollan  <pvollan@apple.com>
144
145         [macOS] Crash with sandbox error
146         https://bugs.webkit.org/show_bug.cgi?id=197675
147         <rdar://problem/50473330>
148
149         Reviewed by Geoffrey Garen.
150
151         This crash is caused by missing syscall rules in the sandbox.
152
153         * WebProcess/com.apple.WebProcess.sb.in:
154
155 2019-05-07  Alex Christensen  <achristensen@webkit.org>
156
157         Add SPI to set a list of hosts to which to send custom header fields cross-origin
158         https://bugs.webkit.org/show_bug.cgi?id=197397
159
160         Reviewed by Geoff Garen.
161
162         * Shared/API/APIObject.h:
163         * Shared/Cocoa/APIObject.mm:
164         (API::Object::newObject):
165         * Shared/WebsitePoliciesData.cpp:
166         (WebKit::WebsitePoliciesData::decode):
167         * Shared/WebsitePoliciesData.h:
168         * SourcesCocoa.txt:
169         * UIProcess/API/APICustomHeaderFields.h: Added.
170         * UIProcess/API/APIWebsitePolicies.cpp:
171         (API::WebsitePolicies::WebsitePolicies):
172         (API::WebsitePolicies::copy const):
173         (API::WebsitePolicies::data):
174         * UIProcess/API/APIWebsitePolicies.h:
175         * UIProcess/API/C/WKWebsitePolicies.cpp:
176         (WKWebsitePoliciesCopyCustomHeaderFields):
177         (WKWebsitePoliciesSetCustomHeaderFields):
178         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
179         (-[WKWebpagePreferences _customHeaderFields]):
180         (-[WKWebpagePreferences _setCustomHeaderFields:]):
181         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
182         * UIProcess/API/Cocoa/_WKCustomHeaderFields.h: Added.
183         * UIProcess/API/Cocoa/_WKCustomHeaderFields.mm: Added.
184         (-[_WKCustomHeaderFields init]):
185         (-[_WKCustomHeaderFields dealloc]):
186         (-[_WKCustomHeaderFields fields]):
187         (-[_WKCustomHeaderFields setFields:]):
188         (-[_WKCustomHeaderFields thirdPartyDomains]):
189         (-[_WKCustomHeaderFields setThirdPartyDomains:]):
190         (-[_WKCustomHeaderFields _apiObject]):
191         * UIProcess/API/Cocoa/_WKCustomHeaderFieldsInternal.h: Added.
192         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
193         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
194         (-[_WKWebsitePolicies customHeaderFields]): Deleted.
195         (-[_WKWebsitePolicies setCustomHeaderFields:]): Deleted.
196         * UIProcess/Cocoa/WebViewImpl.h:
197         * UIProcess/Cocoa/WebViewImpl.mm:
198         (WebKit::WebViewImpl::takeFocus):
199         (WebKit::WebViewImpl::accessibilityAttributeValue):
200         * WebKit.xcodeproj/project.pbxproj:
201
202 2019-05-07  Adrian Perez de Castro  <aperez@igalia.com>
203
204         [GTK][WPE] Cannot build documentation with gtk-doc
205         https://bugs.webkit.org/show_bug.cgi?id=197663
206
207         Reviewed by Philippe Normand.
208
209         * UIProcess/API/glib/WebKitSettings.cpp:
210         (webkit_settings_class_init): Escape content which gets wrongly interpreted as
211         SGML tags by gtk-doc as Markdown preformatted content, which fits well for the
212         tag names in the documentation for the WebKitSettings:enable-media property.
213
214 2019-05-07  John Wilander  <wilander@apple.com>
215
216         Storage Access API: Make two changes requested by developers and complete refactoring and cleanup
217         https://bugs.webkit.org/show_bug.cgi?id=197648
218         <rdar://problem/50527493>
219
220         Reviewed by Chris Dumez.
221
222         Developers have requested two minor changes to the Storage Access API:
223         - Only consume the user gesture when the user explicitly denies access.
224         - Make document.hasStorageAccess() return true instead of false when the feature is off.
225
226         In addition to this, we have refactoring and cleanup to do. Namely:
227         - Make use of WebCore::RegistrableDomain all the way.
228         - Remove dead code in WebKit::NetworkProcess since the calls now go through NetworkConnectionToWebProcess.
229         - Introduce boolean enums for state handling.
230         - Break out the Storage Access API functionality into a supplement of WebCore::Document.
231
232         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
233         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
234         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
235         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
236         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
237         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
238         (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt const):
239             These changes are due to the new enums WebCore::StorageAccessWasGranted and
240             WebCore::StorageAccessPromptWasShown.
241         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
242         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
243         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
244         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
245         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess):
246         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
247         (WebKit::ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt):
248             These changes are due to the new enums WebCore::StorageAccessWasGranted and
249             WebCore::StorageAccessPromptWasShown.
250         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
251         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
252             These changes are due to the new enums WebCore::StorageAccessWasGranted and
253             WebCore::StorageAccessPromptWasShown.
254         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
255         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
256         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
257         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
258             These changes are due to the new enums WebCore::StorageAccessWasGranted and
259             WebCore::StorageAccessPromptWasShown.
260         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted): Deleted.
261             This function is now no longer exposed and its functionality could be folded into
262             the existing WebResourceLoadStatisticsStore::requestStorageAccess() which is more
263             clearly named.
264         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
265         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
266         (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
267         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
268             These changes are due to the new enums WebCore::StorageAccessWasGranted and
269             WebCore::StorageAccessPromptWasShown.
270         * NetworkProcess/NetworkConnectionToWebProcess.h:
271         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
272         * NetworkProcess/NetworkProcess.cpp:
273         (WebKit::NetworkProcess::hasStorageAccessForFrame): Deleted.
274         (WebKit::NetworkProcess::hasStorageAccess): Deleted.
275         (WebKit::NetworkProcess::requestStorageAccess): Deleted.
276         (WebKit::NetworkProcess::requestStorageAccessGranted): Deleted.
277         (WebKit::NetworkProcess::grantStorageAccess): Deleted.
278         (WebKit::NetworkProcess::removeAllStorageAccess): Deleted.
279             These functions were left behind in the move of ITP to the network process.
280             This communication goes through WebKit::NetworkConnectionToWebProcess since a while back.
281         * NetworkProcess/NetworkProcess.h:
282         * NetworkProcess/NetworkProcess.messages.in:
283         * Scripts/webkit/messages.py:
284             Instructions for derived IPC code on how to include the new enums
285             WebCore::StorageAccessWasGranted and WebCore::StorageAccessPromptWasShown.
286         * UIProcess/Network/NetworkProcessProxy.cpp:
287         (WebKit::NetworkProcessProxy::hasStorageAccessForFrame): Deleted.
288         (WebKit::NetworkProcessProxy::hasStorageAccess): Deleted.
289         (WebKit::NetworkProcessProxy::requestStorageAccess): Deleted.
290         (WebKit::NetworkProcessProxy::grantStorageAccess): Deleted.
291         (WebKit::NetworkProcessProxy::removeAllStorageAccess): Deleted.
292             These functions were left behind in the move of ITP to the network process.
293             This communication goes through WebKit::NetworkConnectionToWebProcess since a while back.
294         * UIProcess/Network/NetworkProcessProxy.h:
295         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
296         (WebKit::WebsiteDataStore::hasStorageAccess): Deleted.
297         (WebKit::WebsiteDataStore::requestStorageAccess): Deleted.
298         (WebKit::WebsiteDataStore::grantStorageAccess): Deleted.
299             These functions were left behind in the move of ITP to the network process.
300             This communication goes through WebKit::NetworkConnectionToWebProcess since a while back.
301         * UIProcess/WebsiteData/WebsiteDataStore.h:
302         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
303         (WebKit::WebChromeClient::hasStorageAccess):
304         (WebKit::WebChromeClient::requestStorageAccess):
305             These changes are due to the new enums WebCore::StorageAccessWasGranted and
306             WebCore::StorageAccessPromptWasShown. They also receive WebCore::RegistrableDomain
307             objects instead of Strings now.
308         * WebProcess/WebCoreSupport/WebChromeClient.h:
309         * WebProcess/WebPage/WebPage.cpp:
310         (WebKit::WebPage::hasStorageAccess):
311         (WebKit::WebPage::requestStorageAccess):
312             These changes are due to the new enums WebCore::StorageAccessWasGranted and
313             WebCore::StorageAccessPromptWasShown. They also receive WebCore::RegistrableDomain
314             objects instead of Strings now.
315         * WebProcess/WebPage/WebPage.h:
316
317 2019-05-07  John Wilander  <wilander@apple.com>
318
319         Change IsITPFirstPartyWebsiteDataRemovalEnabled from DEFAULT_EXPERIMENTAL_FEATURES_ENABLED to true.
320         https://bugs.webkit.org/show_bug.cgi?id=197667
321         <rdar://problem/50549288>
322
323         Reviewed by Brent Fulgham.
324
325         * Shared/WebPreferences.yaml:
326
327 2019-05-07  Tim Horton  <timothy_horton@apple.com>
328
329         iOSMac Share Sheet shows up at the wrong place
330         https://bugs.webkit.org/show_bug.cgi?id=197649
331         <rdar://problem/49922942>
332
333         Reviewed by Megan Gardner.
334
335         * UIProcess/ios/WKContentViewInteraction.h:
336         * UIProcess/ios/WKContentViewInteraction.mm:
337         (-[WKContentView _showShareSheet:inRect:completionHandler:]):
338         (-[WKContentView _hoverGestureRecognizerChanged:]):
339         Pass the last mouse-over location as the presentation location for the 
340         share sheet, if we don't have a rect to present from. Centering the popover
341         like we do on iPad doesn't work so well (at all) with a macOS context menu.
342
343 2019-05-07  Chris Dumez  <cdumez@apple.com>
344
345         Rename ConnectionMac.mm to ConnectionCocoa.mm since it is used on both macOS and iOS
346         https://bugs.webkit.org/show_bug.cgi?id=197661
347
348         Reviewed by Alexey Proskuryakov.
349
350         * Platform/IPC/cocoa/ConnectionCocoa.mm: Renamed from Source/WebKit/Platform/IPC/mac/ConnectionMac.mm.
351         (IPC::ConnectionTerminationWatchdog::createConnectionTerminationWatchdog):
352         (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
353         (IPC::ConnectionTerminationWatchdog::watchdogTimerFired):
354         (IPC::Connection::platformInvalidate):
355         (IPC::Connection::cancelReceiveSource):
356         (IPC::Connection::terminateSoon):
357         (IPC::Connection::platformInitialize):
358         (IPC::Connection::open):
359         (IPC::Connection::sendMessage):
360         (IPC::Connection::platformCanSendOutgoingMessages const):
361         (IPC::Connection::sendOutgoingMessage):
362         (IPC::Connection::initializeSendSource):
363         (IPC::Connection::resumeSendSource):
364         (IPC::createMessageDecoder):
365         (IPC::readFromMachPort):
366         (IPC::Connection::receiveSourceEventHandler):
367         (IPC::Connection::identifier const):
368         (IPC::Connection::getAuditToken):
369         (IPC::Connection::kill):
370         (IPC::AccessibilityProcessSuspendedNotification):
371         (IPC::Connection::willSendSyncMessage):
372         (IPC::Connection::didReceiveSyncReply):
373         (IPC::Connection::remoteProcessID const):
374         * Platform/IPC/cocoa/ImportanceAssertion.h: Renamed from Source/WebKit/Platform/IPC/mac/ImportanceAssertion.h.
375         (IPC::ImportanceAssertion::ImportanceAssertion):
376         (IPC::ImportanceAssertion::~ImportanceAssertion):
377         * Platform/IPC/cocoa/MachMessage.cpp: Renamed from Source/WebKit/Platform/IPC/mac/MachMessage.cpp.
378         (IPC::MachMessage::create):
379         (IPC::MachMessage::MachMessage):
380         (IPC::MachMessage::~MachMessage):
381         (IPC::MachMessage::messageSize):
382         (IPC::MachMessage::leakDescriptors):
383         * Platform/IPC/cocoa/MachMessage.h: Renamed from Source/WebKit/Platform/IPC/mac/MachMessage.h.
384         (IPC::MachMessage::size const):
385         (IPC::MachMessage::header):
386         (IPC::MachMessage::messageReceiverName const):
387         (IPC::MachMessage::messageName const):
388         * Platform/IPC/cocoa/MachPort.h: Renamed from Source/WebKit/Platform/IPC/mac/MachPort.h.
389         (IPC::MachPort::MachPort):
390         (IPC::MachPort::encode const):
391         (IPC::MachPort::decode):
392         (IPC::MachPort::port const):
393         (IPC::MachPort::disposition const):
394         * PlatformMac.cmake:
395         * SourcesCocoa.txt:
396         * WebKit.xcodeproj/project.pbxproj:
397
398 2019-05-07  Antti Koivisto  <antti@apple.com>
399
400         <body> with overflow:hidden shouldn't be keyboard scrollable on iOS
401         https://bugs.webkit.org/show_bug.cgi?id=197659
402         <rdar://problem/50541453>
403
404         Reviewed by Antoine Quint.
405
406         * UIProcess/ios/WKContentViewInteraction.mm:
407         (-[WKContentView isScrollableForKeyboardScrollViewAnimator:]):
408
409         Disable also keyboard scrolling when touch scrolling is disabled.
410
411 2019-05-07  Wenson Hsieh  <wenson_hsieh@apple.com>
412
413         [macOS] Avoid crashing the UI process when writing empty data to the pasteboard
414         https://bugs.webkit.org/show_bug.cgi?id=197644
415         <rdar://problem/50526364>
416
417         Reviewed by Tim Horton.
418
419         Test: WebKit.WKWebProcessPlugInDoNotCrashWhenCopyingEmptyClientData
420
421         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
422         (WebKit::WebPlatformStrategies::setBufferForType):
423
424         Make this function robust by not attempting to create a shared memory buffer in the case where the given data
425         buffer is empty.
426
427 2019-05-07  Carlos Garcia Campos  <cgarcia@igalia.com>
428
429         [GTK] Crash in webkitWebViewBaseSetEnableBackForwardNavigationGesture
430         https://bugs.webkit.org/show_bug.cgi?id=197653
431
432         Reviewed by Žan Doberšek.
433
434         We still need to null-check the ViewGestureController there, since it can be called with a running process but
435         not yet attached when using a related view.
436
437         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
438         (webkitWebViewBaseSetEnableBackForwardNavigationGesture):
439
440 2019-05-07  Antti Koivisto  <antti@apple.com>
441
442         <body> with overflow:hidden CSS is scrollable on iOS
443         https://bugs.webkit.org/show_bug.cgi?id=153852
444         <rdar://problem/38715356>
445
446         Reviewed by Antoine Quint.
447
448         Disable touch scrolling of the main scroll view when <body> has overflow:hidden.
449
450         This already works for subframes where we don't create a scrollview in the first place.
451         The patch also adds a test for that.
452
453         * UIProcess/API/Cocoa/WKWebView.mm:
454         (-[WKWebView _didCommitLayerTree:]):
455
456         Update scrollability after scrolling tree commits.
457
458         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
459         (WebKit::RemoteScrollingCoordinatorProxy::hasScrollableMainFrame const):
460
461         Base the decision on root ScrollingTreeScrollingNode::canHaveScrollbars() which is computed from overflow.
462         This matches Mac where wheel event dispatch is similarly blocked based on this property.
463
464         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
465
466 2019-05-06  James Savage  <james.savage@apple.com>
467
468         Improve coordination for creating UIWindow instances.
469         https://bugs.webkit.org/show_bug.cgi?id=197578.
470         <rdar://problem/50456965>.
471
472         Reviewed by Wenson Hsieh.
473
474         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
475         (makeWindowFromView): Pull out window creation.
476         (-[WKFullScreenWindowController enterFullScreen]): Call new helper function.
477
478 2019-05-06  Tim Horton  <timothy_horton@apple.com>
479
480         _overrideViewportWithArguments does not work when called before loading
481         https://bugs.webkit.org/show_bug.cgi?id=197638
482         <rdar://problem/50505111>
483
484         Reviewed by Wenson Hsieh.
485
486         * WebProcess/WebPage/ios/WebPageIOS.mm:
487         (WebKit::WebPage::setOverrideViewportArguments):
488
489 2019-05-06  Chris Dumez  <cdumez@apple.com>
490
491         ASSERT at WebKit::NetworkCache::makeSafeToUseMemoryMapForPath under Storage::StoreBodyAsBlob when running WebDriver tests
492         https://bugs.webkit.org/show_bug.cgi?id=197635
493         <rdar://problem/50473149>
494
495         Reviewed by Geoffrey Garen.
496
497         We need to make sure the the path at blobPathString exists before calling FileSystem::makeSafeToUseMemoryMapForPath().
498         If the blob does not already exist when BlobStorage::add() is called, what will create it is the call to Data::mapToFile().
499
500         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
501         (WebKit::NetworkCache::BlobStorage::add):
502
503 2019-05-06  Wenson Hsieh  <wenson_hsieh@apple.com>
504
505         Occasional crashes in layout tests when firing the shrink-to-fit-content timer
506         https://bugs.webkit.org/show_bug.cgi?id=197629
507         <rdar://problem/50514382>
508
509         Reviewed by Tim Horton.
510
511         Fixes several crashing layout tests by stopping the shrink-to-fit-content timer when the page closes.
512
513         * WebProcess/WebPage/WebPage.cpp:
514         (WebKit::WebPage::close):
515
516 2019-05-04  Per Arne Vollan  <pvollan@apple.com>
517
518         -[WKWebsiteDataStore removeDataOfTypes:forDataRecords:completionHandler:] doesn't delete _WKWebsiteDataTypeCredentials
519         https://bugs.webkit.org/show_bug.cgi?id=197510
520
521         Reviewed by Alex Christensen.
522
523         * NetworkProcess/NetworkProcess.cpp:
524         (WebKit::NetworkProcess::fetchWebsiteData):
525         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
526         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
527
528 2019-05-06  Keith Rollin  <krollin@apple.com>
529
530         Temporarily disable generate-xcfilelists
531         https://bugs.webkit.org/show_bug.cgi?id=197619
532         <rdar://problem/50507392>
533
534         Reviewed by Alex Christensen.
535
536         We need to perform a significant update to the generate-xcfilelist
537         scripts. This work involves coordinated work with another facility. If
538         the work does not occur in tandem, the build will be broken. To avoid
539         this, disable the invoking of the scripts during the transition. The
540         checking will be restored once the new scripts are in place.
541
542         * Scripts/check-xcfilelists.sh:
543
544 2019-05-06  Chris Dumez  <cdumez@apple.com>
545
546         Unreviewed build fix after r244984.
547
548         * WebProcess/cocoa/WebProcessCocoa.mm:
549
550 2019-05-06  Chris Dumez  <cdumez@apple.com>
551
552         Prewarmed WebContent processes never app nap
553         https://bugs.webkit.org/show_bug.cgi?id=197630
554
555         Reviewed by Geoffrey Garen.
556
557         Do not require actually having a WebPage in the WebContent process to App Nap.
558
559         * WebProcess/WebPage/WebPage.cpp:
560         (WebKit::WebPage::updateThrottleState):
561         * WebProcess/cocoa/WebProcessCocoa.mm:
562         (WebKit::WebProcess::platformInitializeWebProcess):
563
564 2019-05-06  Daniel Bates  <dabates@apple.com>
565
566         Fix the build after r244975
567         (https://bugs.webkit.org/show_bug.cgi?id=197474)
568
569         Actually make use of the Keyboard Event when building with USE(UIKIT_KEYBOARD_ADDITIONS)
570         and substitute -> for . since it's now passed by reference.
571
572         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
573         (WebKit::WebEditorClient::handleInputMethodKeydown):
574
575 2019-05-06  Jer Noble  <jer.noble@apple.com>
576
577         Adopt AVStreamDataParser.audiovisualMIMETypes
578         https://bugs.webkit.org/show_bug.cgi?id=197581
579         <rdar://problem/50458981>
580
581         Reviewed by Eric Carlson.
582
583         * WebProcess/cocoa/WebProcessCocoa.mm:
584         (WebKit::WebProcess::platformInitializeWebProcess):
585         (WebKit::WebProcess::platformTerminate):
586         (WebKit::WebProcess::setMediaMIMETypes):
587
588 2019-05-06  Chris Dumez  <cdumez@apple.com>
589
590         Terminate service workers that use too much CPU / power
591         https://bugs.webkit.org/show_bug.cgi?id=197626
592         <rdar://problem/50374707>
593
594         Reviewed by Geoffrey Garen.
595
596         Terminate service worker processes that use over 50% CPU on average over the last 8 minutes,
597         similarly to what we do for background WebContent processes.
598
599         * UIProcess/WebProcessProxy.cpp:
600         (WebKit::WebProcessProxy::didExceedCPULimit):
601         * WebProcess/WebProcess.cpp:
602         (WebKit::WebProcess::initializeProcess):
603         * WebProcess/cocoa/WebProcessCocoa.mm:
604         (WebKit::WebProcess::updateCPULimit):
605         (WebKit::WebProcess::updateCPUMonitorState):
606
607 2019-05-06  Daniel Bates  <dabates@apple.com>
608
609         Google Docs & Yahoo! Japan: Can’t compose characters with Chinese or Japanese keyboard
610         https://bugs.webkit.org/show_bug.cgi?id=197474
611         <rdar://problem/47219324>
612
613         Reviewed by Ryosuke Niwa.
614
615         Adopt UIKit SPI (added in <rdar://problem/50181162>) to ask the Input Manager to handle
616         the key event. If the Input Manager handled it then we pass along this information to
617         WebCore, just as we do for Mac, so that it can alter its event handling logic. Otherwise,
618         we handle the event as we do now.
619
620         A large part of this patch is fixing up #if defs to compile more Mac code when building
621         on iOS.
622
623         * Platform/spi/ios/UIKitSPI.h: Expose more SPI.
624         * Shared/NativeWebKeyboardEvent.h:
625         * Shared/WebEvent.h:
626         * Shared/WebEventConversion.cpp:
627         (WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
628         * Shared/WebKeyboardEvent.cpp:
629         (WebKit::WebKeyboardEvent::WebKeyboardEvent):
630         (WebKit::WebKeyboardEvent::encode const):
631         (WebKit::WebKeyboardEvent::decode):
632         * Shared/ios/NativeWebKeyboardEventIOS.mm:
633         (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
634         * Shared/ios/WebIOSEventFactory.h:
635         * Shared/ios/WebIOSEventFactory.mm:
636         (WebIOSEventFactory::createWebKeyboardEvent):
637         Compile more Mac code on iOS. Just like on Mac we maintain some bookkeeping on
638         whether an event was handled by the Input Manager.
639
640         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
641         (WebKit::WebAutomationSession::sendSynthesizedEventsToPage): Pass NativeWebKeyboardEvent::HandledByInputMethod::No
642         to keep the behavior we have now.
643
644         * UIProcess/ios/WKContentViewInteraction.h:
645         * UIProcess/ios/WKContentViewInteraction.mm:
646         (-[WKContentView cleanupInteraction]):
647         (-[WKContentView shouldSuppressUpdateCandidateView]): Added. Used to tell UIKit whether to
648         suppress updating/showing the candidate view.
649         (-[WKContentView setMarkedText:selectedRange:]):
650         Bookkeeping to track whether we need to delay showing/updating the inline candidate view.
651         The concept in UIKit is deferment, but at the time of writing its simply a request to delay
652         the update for 0.4 seconds. We opt into this delay only for the first key that begins
653         marked text (i.e. the transition from no marked text to marked text). We do this because we
654         may not have up-to-date editor state at the time UIKit is ready to show/update the inline
655         candidate view for us to answer -textFirstRect and -textLastRect, which UIKit calls as part
656         of computing the frame rect for the inline candidate view on screen. Once we receive up-to-date
657         editor state, in -selectionChanged, we tell UIKit to layout the keyboard, which ultimately
658         causes it to re-compute the frame rect for the inline candidate view and show it.
659
660         (-[WKContentView handleKeyWebEvent:]): Pass NativeWebKeyboardEvent::HandledByInputMethod::No
661         to keep the behavior we have now. 
662         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]): Ask the keyboard to handle the
663         event using the Input Manager. If it was handled then there is no need to delay calling the
664         completion handler, call it, then tell the web process about the key event and that it was
665         already handled by the Input Manager.
666         (-[WKContentView _selectionChanged]): Tell the keyboard to update the candidate view, if needed.
667         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
668         (WebKit::WebEditorClient::handleInputMethodKeydown): Mark the event as default handled if
669         the UI process told us that the event was handled by the Input Manager just like we do on Mac.
670
671 2019-05-06  Alex Christensen  <achristensen@webkit.org>
672
673         Null check m_mainFrame in WebPageProxy.cpp
674         https://bugs.webkit.org/show_bug.cgi?id=197618
675         <rdar://problem/47463054>
676
677         Reviewed by Geoffrey Garen.
678
679         It's already null checked in some places, and the places where it isn't are causing crashes.
680         Let's fix all of them.
681
682         * UIProcess/WebPageProxy.cpp:
683         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
684         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
685         (WebKit::WebPageProxy::createNewPage):
686
687 2019-05-06  Brent Fulgham  <bfulgham@apple.com>
688
689         Use more efficient path resolution logic
690         https://bugs.webkit.org/show_bug.cgi?id=197389
691         <rdar://problem/50268491>
692
693         Reviewed by Maciej Stachowiak.
694
695         The code in SandboxExtensionsCocoa.mm 'resolveSymlinksInPath' is pretty inefficient, and tries to reproduce (badly)
696         logic that is already provided by the operating system.
697
698         To make matters worse, 'resolvePathForSandboxExtension' was effectively performing the work of fully resolving
699         symlinks twice, since NSString's 'stringByStandardizingPath' method does some of this already.
700
701         Instead, we should just use NSString's 'stringByResolvingSymlinksInPath', which does the symlink resolution
702         using more efficient logic than our 'resolveSymlinksInPath' code.
703
704         * Shared/Cocoa/SandboxExtensionCocoa.mm:
705         (WebKit::resolveSymlinksInPath): Removed.
706         (WebKit::resolvePathForSandboxExtension): Remove redundant call to 'resolveSymlinksInPath', and switches from
707         'stringByStandardizingPath' to 'stringByResolvingSymlinksInPath', which can take the place of both calls.
708         (WebKit::stringByResolvingSymlinksInPath): Switch to call 'stringByResolvingSymlinksInPath'.
709
710 2019-05-06  Wenson Hsieh  <wenson_hsieh@apple.com>
711
712         Introduce SPI to request modern compatibility mode but defer to site-specific quirks
713         https://bugs.webkit.org/show_bug.cgi?id=197614
714         <rdar://problem/50208577>
715
716         Reviewed by Tim Horton.
717
718         Add plumbing for a new _allowSiteSpecificQuirksToOverrideCompatibilityMode SPI property on
719         WKWebpagePreferences.
720
721         * UIProcess/API/APIWebsitePolicies.cpp:
722         (API::WebsitePolicies::copy const):
723         * UIProcess/API/APIWebsitePolicies.h:
724         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
725         (-[WKWebpagePreferences _allowSiteSpecificQuirksToOverrideCompatibilityMode]):
726         (-[WKWebpagePreferences _setAllowSiteSpecificQuirksToOverrideCompatibilityMode:]):
727         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
728         * UIProcess/WebPageProxy.cpp:
729
730         Use currentRequest instead of originalRequest; see internal change for more details.
731
732         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
733
734 2019-05-06  Ryan Haddad  <ryanhaddad@apple.com>
735
736         Unreviewed, rolling out r244917.
737
738         Caused
739         TestWebKitAPI.WKWebView.InitializingWebViewWithEphemeralStorageDoesNotLog
740         failure on debug bots.
741
742         Reverted changeset:
743
744         "Use more efficient path resolution logic"
745         https://bugs.webkit.org/show_bug.cgi?id=197389
746         https://trac.webkit.org/changeset/244917
747
748 2019-05-04  Alex Christensen  <achristensen@webkit.org>
749
750         Revert r244953 and r244954 because they broke internal builds.
751         https://bugs.webkit.org/show_bug.cgi?id=197534
752
753         * Platform/spi/ios/PDFKitSPI.h:
754         * Platform/spi/ios/UIKitSPI.h: Added.
755         (currentUserInterfaceIdiomIsPad):
756         * Shared/DocumentEditingContext.mm:
757         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
758         * Shared/ios/NativeWebKeyboardEventIOS.mm:
759         * Shared/ios/NativeWebTouchEventIOS.mm:
760         * Shared/ios/WebIconUtilities.mm:
761         * UIProcess/API/Cocoa/NSAttributedString.mm:
762         * UIProcess/API/Cocoa/WKWebView.mm:
763         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
764         * UIProcess/API/Cocoa/WKWebViewInternal.h:
765         * UIProcess/ApplicationStateTracker.mm:
766         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
767         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
768         * UIProcess/Cocoa/WKShareSheet.mm:
769         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
770         * UIProcess/Gamepad/ios/UIGamepadProviderIOS.mm:
771         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
772         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
773         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
774         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
775         * UIProcess/WKImagePreviewViewController.mm:
776         * UIProcess/_WKTouchEventGenerator.mm:
777         * UIProcess/ios/DragDropInteractionState.h:
778         * UIProcess/ios/InputViewUpdateDeferrer.mm:
779         * UIProcess/ios/PageClientImplIOS.mm:
780         * UIProcess/ios/SmartMagnificationController.mm:
781         * UIProcess/ios/TextCheckerIOS.mm:
782         * UIProcess/ios/ViewGestureControllerIOS.mm:
783         * UIProcess/ios/WKActionSheet.mm:
784         * UIProcess/ios/WKActionSheetAssistant.mm:
785         * UIProcess/ios/WKContentView.mm:
786         * UIProcess/ios/WKContentViewInteraction.h:
787         * UIProcess/ios/WKContentViewInteraction.mm:
788         * UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm:
789         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
790         * UIProcess/ios/WKPDFPageNumberIndicator.mm:
791         * UIProcess/ios/WKPDFView.mm:
792         * UIProcess/ios/WKPasswordView.mm:
793         * UIProcess/ios/WKScrollView.h:
794         * UIProcess/ios/WKScrollView.mm:
795         * UIProcess/ios/WKSyntheticTapGestureRecognizer.h:
796         * UIProcess/ios/WKWebEvent.mm:
797         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.h:
798         * UIProcess/ios/WebPageProxyIOS.mm:
799         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
800         * UIProcess/ios/forms/WKFileUploadPanel.mm:
801         * UIProcess/ios/forms/WKFocusedFormControlView.h:
802         * UIProcess/ios/forms/WKFormColorControl.mm:
803         * UIProcess/ios/forms/WKFormColorPicker.mm:
804         * UIProcess/ios/forms/WKFormInputControl.mm:
805         * UIProcess/ios/forms/WKFormPopover.mm:
806         * UIProcess/ios/forms/WKFormSelectControl.h:
807         * UIProcess/ios/forms/WKFormSelectControl.mm:
808         * UIProcess/ios/forms/WKFormSelectPicker.mm:
809         * UIProcess/ios/forms/WKFormSelectPopover.mm:
810         * UIProcess/ios/forms/WKNumberPadViewController.mm:
811         * UIProcess/ios/forms/WKQuickboardListViewController.h:
812         * UIProcess/ios/forms/WKSelectMenuListViewController.mm:
813         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
814         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
815         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
816         * WebKit.xcodeproj/project.pbxproj:
817         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
818         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
819         * WebProcess/WebPage/ios/WebPageIOS.mm:
820         * WebProcess/cocoa/WebProcessCocoa.mm:
821
822 2019-05-04  Alex Christensen  <achristensen@webkit.org>
823
824         Merge the three UIKitSPI.h files into a single one in PAL
825         https://bugs.webkit.org/show_bug.cgi?id=197534
826
827         Reviewed by Darin Adler.
828
829         * Platform/spi/ios/PDFKitSPI.h:
830         * Platform/spi/ios/UIKitSPI.h: Removed.
831         * Shared/DocumentEditingContext.mm:
832         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
833         * Shared/ios/NativeWebKeyboardEventIOS.mm:
834         * Shared/ios/NativeWebTouchEventIOS.mm:
835         * Shared/ios/WebIconUtilities.mm:
836         * UIProcess/API/Cocoa/NSAttributedString.mm:
837         * UIProcess/API/Cocoa/WKWebView.mm:
838         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
839         * UIProcess/API/Cocoa/WKWebViewInternal.h:
840         * UIProcess/ApplicationStateTracker.mm:
841         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
842         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
843         * UIProcess/Cocoa/WKShareSheet.mm:
844         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
845         * UIProcess/Gamepad/ios/UIGamepadProviderIOS.mm:
846         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
847         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
848         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
849         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
850         * UIProcess/WKImagePreviewViewController.mm:
851         * UIProcess/_WKTouchEventGenerator.mm:
852         * UIProcess/ios/DragDropInteractionState.h:
853         * UIProcess/ios/InputViewUpdateDeferrer.mm:
854         * UIProcess/ios/PageClientImplIOS.mm:
855         * UIProcess/ios/SmartMagnificationController.mm:
856         * UIProcess/ios/TextCheckerIOS.mm:
857         * UIProcess/ios/ViewGestureControllerIOS.mm:
858         * UIProcess/ios/WKActionSheet.mm:
859         * UIProcess/ios/WKActionSheetAssistant.mm:
860         * UIProcess/ios/WKContentView.mm:
861         * UIProcess/ios/WKContentViewInteraction.h:
862         * UIProcess/ios/WKContentViewInteraction.mm:
863         * UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm:
864         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
865         * UIProcess/ios/WKPDFPageNumberIndicator.mm:
866         * UIProcess/ios/WKPDFView.mm:
867         * UIProcess/ios/WKPasswordView.mm:
868         * UIProcess/ios/WKScrollView.h:
869         * UIProcess/ios/WKScrollView.mm:
870         * UIProcess/ios/WKSyntheticTapGestureRecognizer.h:
871         * UIProcess/ios/WKWebEvent.mm:
872         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.h:
873         * UIProcess/ios/WebPageProxyIOS.mm:
874         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
875         * UIProcess/ios/forms/WKFileUploadPanel.mm:
876         * UIProcess/ios/forms/WKFocusedFormControlView.h:
877         * UIProcess/ios/forms/WKFormColorControl.mm:
878         * UIProcess/ios/forms/WKFormColorPicker.mm:
879         * UIProcess/ios/forms/WKFormInputControl.mm:
880         * UIProcess/ios/forms/WKFormPopover.mm:
881         * UIProcess/ios/forms/WKFormSelectControl.h:
882         * UIProcess/ios/forms/WKFormSelectControl.mm:
883         * UIProcess/ios/forms/WKFormSelectPicker.mm:
884         * UIProcess/ios/forms/WKFormSelectPopover.mm:
885         * UIProcess/ios/forms/WKNumberPadViewController.mm:
886         * UIProcess/ios/forms/WKQuickboardListViewController.h:
887         * UIProcess/ios/forms/WKSelectMenuListViewController.mm:
888         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
889         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
890         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
891         * WebKit.xcodeproj/project.pbxproj:
892         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
893         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
894         * WebProcess/WebPage/ios/WebPageIOS.mm:
895         * WebProcess/cocoa/WebProcessCocoa.mm:
896
897 2019-05-03  Wenson Hsieh  <wenson_hsieh@apple.com>
898
899         REGRESSION (r244897): Caret may appear wider than normal after zooming to focus an editable element
900         https://bugs.webkit.org/show_bug.cgi?id=197579
901
902         Reviewed by Tim Horton.
903
904         Fixes a couple of flaky tests (CaretSelectionRectAfterRestoringFirstResponderWithRetainActiveFocusedState and
905         CaretSelectionRectAfterRestoringFirstResponder) that began failing after r244897. These tests both begin by
906         focusing an editable element, which causes the web view to zoom in. The tests subsequently check that the caret
907         rect is {{ 16, 13 }, { 2, 15 }}. While the specified caret rect (coming from EditorState) is {{ 16, 13 }, { 3,
908         15 }}, the narrower caret rect is used because we take measures to preserve the width of the caret relative to
909         the view (see the inverse scaling logic in -[WKContentView selectedTextRange] for more details).
910
911         See below for more details.
912
913         * UIProcess/ios/WKContentViewInteraction.h:
914
915         Remove _isZoomingToRevealFocusedElement, now that we don't need it anymore (see -observeValueForKeyPath:).
916
917         * UIProcess/ios/WKContentViewInteraction.mm:
918         (-[WKContentView cleanupInteraction]):
919         (-[WKContentView observeValueForKeyPath:ofObject:change:context:]):
920
921         Stop bailing from a selection update when changing scale, while zooming to reveal the focused element. This
922         check was added in r239441 to prevent UIWKTextInteractionAssistant's selection scrolling logic from interfering
923         with WKContentView-driven logic for zooming to the focused element. However, since r244141, this is no longer
924         necessary since selection scrolling is only driven by code in the web process.
925
926         This new update while zooming to reveal the focused element ensures that the WKTextRange returned by
927         -selectedTextRange after zooming will have a width that is inversely scaled using the content view's current
928         scale, such that it has a consistent width (relative to the web view) across different scales.
929
930         (-[WKContentView _zoomToRevealFocusedElement]):
931         * UIProcess/ios/WebPageProxyIOS.mm:
932         (WebKit::WebPageProxy::layerTreeCommitComplete):
933
934         Remove any attempt here to notify PageClient about editor states after focus. This logic was actually incorrect,
935         since it didn't ensure that the layer tree commit that is being completed actually contained an editor state; as
936         such, the "editor state" received here could be stale.
937
938 2019-05-03  Zalan Bujtas  <zalan@apple.com>
939
940         [iOS] outlook.live.com: Compose email frame not fully visible and not scrollable
941         https://bugs.webkit.org/show_bug.cgi?id=197573
942         <rdar://problem/48008441>
943
944         Reviewed by Wenson Hsieh.
945
946         * WebProcess/WebPage/WebPage.h:
947         * WebProcess/WebPage/ios/WebPageIOS.mm:
948         (WebKit::WebPage::adjustLayoutSizeIfNeeded):
949         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
950         (WebKit::WebPage::dynamicViewportSizeUpdate):
951         (WebKit::WebPage::immediatelyShrinkToFitContent):
952
953 2019-05-03  Dean Jackson  <dino@apple.com>
954
955         Make imageForElementActionType a class method on _WKElementAction
956         https://bugs.webkit.org/show_bug.cgi?id=197588
957         <rdar://problem/50463157>
958
959         Reviewed by Wenson Hsieh.
960
961         Make this helper function a class method, so that it can
962         be more easily detected.
963
964         * UIProcess/API/Cocoa/_WKElementAction.h:
965         * UIProcess/API/Cocoa/_WKElementAction.mm:
966         (+[_WKElementAction imageForElementActionType:]):
967         (_WKUIImageForElementActionType): Deleted.
968
969 2019-05-03  Chris Dumez  <cdumez@apple.com>
970
971         Unresponsive Service Worker processes should get killed
972         https://bugs.webkit.org/show_bug.cgi?id=197580
973         <rdar://problem/50458239>
974
975         Reviewed by Geoffrey Garen.
976
977         Enable the background responsiveness logic for service worker processes so that they get
978         killed if they becomes unresponsive. The logic was previously not enabling the timer for
979         service worker processes because it required having a page.
980
981         * UIProcess/BackgroundProcessResponsivenessTimer.cpp:
982         (WebKit::BackgroundProcessResponsivenessTimer::shouldBeActive const):
983         * UIProcess/WebProcessProxy.cpp:
984         (WebKit::WebProcessProxy::didBecomeUnresponsive):
985         (WebKit::WebProcessProxy::didFinishLaunching):
986
987 2019-05-03  Youenn Fablet  <youenn@apple.com>
988
989         [iOS] set the default maximum camera count to 1 for enumerateDevices
990         https://bugs.webkit.org/show_bug.cgi?id=197566
991
992         Reviewed by Eric Carlson.
993
994         The previous number for iOS was 2 as there is a front and a back camera.
995         Since we are by default setting deviceIds to "", it is better to just have one,
996         as it might confuse applications to have two devices with the same ID.
997
998         Covered by updated test.
999
1000         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1001         (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
1002
1003 2019-05-03  Daniel Bates  <dabates@apple.com>
1004
1005         Pass KeyboardEvent by reference in more places
1006         https://bugs.webkit.org/show_bug.cgi?id=197480
1007
1008         Reviewed by Wenson Hsieh.
1009
1010         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1011         (WebKit::WebEditorClient::handleKeyboardEvent):
1012         (WebKit::WebEditorClient::handleInputMethodKeydown):
1013         * WebProcess/WebCoreSupport/WebEditorClient.h:
1014         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
1015         (WebKit::WebEditorClient::handleKeyboardEvent):
1016         (WebKit::WebEditorClient::handleInputMethodKeydown):
1017         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
1018         (WebKit::WebEditorClient::handleKeyboardEvent):
1019         (WebKit::WebEditorClient::handleInputMethodKeydown):
1020         * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
1021         (WebKit::WebEditorClient::handleKeyboardEvent):
1022         (WebKit::WebEditorClient::handleInputMethodKeydown):
1023         * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp:
1024         (WebKit::WebEditorClient::handleKeyboardEvent):
1025         (WebKit::WebEditorClient::handleInputMethodKeydown):
1026         * WebProcess/WebPage/WebPage.h:
1027         * WebProcess/WebPage/ios/WebPageIOS.mm:
1028         (WebKit::WebPage::handleEditingKeyboardEvent):
1029         * WebProcess/WebPage/mac/WebPageMac.mm:
1030         (WebKit::WebPage::handleEditingKeyboardEvent):
1031         * WebProcess/WebPage/win/WebPageWin.cpp:
1032         (WebKit::WebPage::handleEditingKeyboardEvent):
1033
1034 2019-05-03  Youenn Fablet  <youenn@apple.com>
1035
1036         Enable Fetch Keep Alive by default
1037         https://bugs.webkit.org/show_bug.cgi?id=197331
1038
1039         Reviewed by Geoffrey Garen.
1040
1041         * Shared/WebPreferences.yaml:
1042
1043 2019-05-03  Devin Rousso  <drousso@apple.com>
1044
1045         REGRESSION(r230367): a "." is prepended before cookies set without an explicit domain
1046         https://bugs.webkit.org/show_bug.cgi?id=197268
1047         <rdar://problem/49767847>
1048
1049         Reviewed by Alex Christensen.
1050
1051         RFC 2965 states "If an explicitly specified value does not start with a dot, the user agent
1052         supplies a leading dot.", so we should only be adding a leading "." if a `domain` is provided.
1053
1054         In order to not regress r230367, also delete all cookies for the non-"."-prefixed domain.
1055
1056         * UIProcess/Automation/WebAutomationSession.cpp:
1057         (WebKit::WebAutomationSession::addSingleCookie):
1058         (WebKit::WebAutomationSession::deleteAllCookies):
1059
1060         * UIProcess/WebCookieManagerProxy.h:
1061         * UIProcess/WebCookieManagerProxy.cpp:
1062         (WebKit::WebCookieManagerProxy::deleteCookiesForHostnames): Added.
1063         (WebKit::WebCookieManagerProxy::deleteCookiesForHostname): Deleted.
1064         * UIProcess/API/C/WKCookieManager.cpp:
1065         (WKCookieManagerDeleteCookiesForHostname):
1066         * NetworkProcess/Cookies/WebCookieManager.messages.in:
1067         * NetworkProcess/Cookies/WebCookieManager.h:
1068         * NetworkProcess/Cookies/WebCookieManager.cpp:
1069         (WebKit::WebCookieManager::deleteCookiesForHostnames): Added.
1070         (WebKit::WebCookieManager::deleteCookiesForHostname): Deleted.
1071         Since the underlying `NetworkStorageSession` accepts a list of domains, extend that support
1072         to allow the IPC to send a list of domains as well, but still keep the C API the same.
1073
1074 2019-05-03  Sihui Liu  <sihui_liu@apple.com>
1075
1076         Add assertion to check whether shm files have maximum FileProtection of CompleteUnlessOpen
1077         https://bugs.webkit.org/show_bug.cgi?id=197390
1078         <rdar://problem/42685773>
1079
1080         Reviewed by Geoffrey Garen.
1081
1082         Move data protection check to WebCore so it can be applied to database files.
1083
1084         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
1085         (WebKit::NetworkCache::BlobStorage::add):
1086         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
1087         (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath): Deleted.
1088         * NetworkProcess/cache/NetworkCacheFileSystem.h:
1089         * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm: Removed.
1090         * SourcesCocoa.txt:
1091         * UIProcess/API/APIContentRuleListStore.cpp:
1092         (API::openAndMapOrCopyContentRuleList):
1093         (API::compiledToFile):
1094
1095 2019-05-03  Chris Dumez  <cdumez@apple.com>
1096
1097         ASSERTION FAILED: [weakThis->m_view window] == weakThis->m_targetWindowForMovePreparation
1098         https://bugs.webkit.org/show_bug.cgi?id=197574
1099         <rdar://problem/50453181>
1100
1101         Reviewed by Tim Horton.
1102
1103         Tweak the assertion so that it holds even if the WebView gets closed because the completion
1104         handler has been called.
1105
1106         * UIProcess/Cocoa/WebViewImpl.mm:
1107         (WebKit::WebViewImpl::prepareForMoveToWindow):
1108
1109 2019-05-03  Brent Fulgham  <bfulgham@apple.com>
1110
1111         Use more efficient path resolution logic
1112         https://bugs.webkit.org/show_bug.cgi?id=197389
1113         <rdar://problem/50268491>
1114
1115         Reviewed by Maciej Stachowiak.
1116
1117         The code in SandboxExtensionsCocoa.mm 'resolveSymlinksInPath' is pretty inefficient, and tries to reproduce (badly)
1118         logic that is already provided by the operating system.
1119
1120         To make matters worse, 'resolvePathForSandboxExtension' was effectively performing the work of fully resolving
1121         symlinks twice, since NSString's 'stringByStandardizingPath' method does some of this already.
1122
1123         Instead, we should just use NSString's 'stringByResolvingSymlinksInPath', which does the symlink resolution
1124         using more efficient logic than our 'resolveSymlinksInPath' code.
1125
1126         * Shared/Cocoa/SandboxExtensionCocoa.mm:
1127         (WebKit::resolveSymlinksInPath): Removed.
1128         (WebKit::resolvePathForSandboxExtension): Remove redundant call to 'resolveSymlinksInPath', and switches from
1129         'stringByStandardizingPath' to 'stringByResolvingSymlinksInPath', which can take the place of both calls.
1130         (WebKit::stringByResolvingSymlinksInPath): Switch to call 'stringByResolvingSymlinksInPath'.
1131
1132 2019-05-02  Dean Jackson  <dino@apple.com>
1133
1134         Need additional UIPreviewAction information in WKImagePreviewViewController
1135         https://bugs.webkit.org/show_bug.cgi?id=197540
1136         <rdar://problem/50430510>
1137
1138         Reviewed by Wenson Hsieh.
1139
1140         Include a WebKitAdditions file to provide a macro for
1141         additional UIPreviewAction information.
1142
1143         While here, take the opportunity to move from the deprecated
1144         UIViewControllerPreviewAction to the newer UIPreviewAction.
1145
1146         * UIProcess/WKImagePreviewViewController.mm:
1147         (-[WKImagePreviewViewController previewActionItems]):
1148
1149 2019-05-02  Dean Jackson  <dino@apple.com>
1150
1151         Provide UIImages for element actions
1152         https://bugs.webkit.org/show_bug.cgi?id=197539
1153         <rdar://problem/50430363>
1154
1155         Reviewed by Wenson Hsieh.
1156
1157         Use an additions include to export a function that
1158         relates a UIImage to a _WKElementAction.
1159
1160         * UIProcess/API/Cocoa/_WKElementAction.h:
1161         * UIProcess/API/Cocoa/_WKElementAction.mm:
1162         (_WKUIImageForElementActionType):
1163
1164 2019-05-03  Jay Mulani  <jmulani@apple.com>
1165
1166         Expose full screen controller SPI to check if full screen is open and close full screen
1167         https://bugs.webkit.org/show_bug.cgi?id=197263
1168
1169         Reviewed by Jer Noble.
1170
1171         * UIProcess/API/Cocoa/WKWebView.mm:
1172         (-[WKWebView closeFullScreenWindowController]):
1173         (-[WKWebView fullScreenWindowController]):
1174         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1175         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1176
1177 2019-05-03  Youenn Fablet  <youenn@apple.com>
1178
1179         LayoutTest imported/w3c/web-platform-tests/xhr/event-upload-progress-crossorigin.htm is a flaky failure
1180         https://bugs.webkit.org/show_bug.cgi?id=182849
1181         <rdar://problem/50353372>
1182
1183         Reviewed by Alex Christensen.
1184
1185         In case of restarting the load after a redirection, which now happens in case
1186         of following cross origin redirections with same-origin credentials, make sure to
1187         update the request as would do NetworkLoad.
1188         This is in particular important to preserve the request body.
1189
1190         Covered by WPT updated test.
1191
1192         * NetworkProcess/NetworkLoad.cpp:
1193         (WebKit::updateRequest):
1194         (WebKit::NetworkLoad::updateRequestAfterRedirection const):
1195         (WebKit::NetworkLoad::continueWillSendRequest):
1196         * NetworkProcess/NetworkLoad.h:
1197         * NetworkProcess/NetworkResourceLoader.cpp:
1198         (WebKit::NetworkResourceLoader::continueWillSendRequest):
1199
1200 2019-05-03  Commit Queue  <commit-queue@webkit.org>
1201
1202         Unreviewed, rolling out r244881.
1203         https://bugs.webkit.org/show_bug.cgi?id=197559
1204
1205         Breaks compilation of jsconly on linux, breaking compilation
1206         for jsc-i386-ews, jsc-mips-ews and jsc-armv7-ews (Requested by
1207         guijemont on #webkit).
1208
1209         Reverted changeset:
1210
1211         "[CMake] Refactor WEBKIT_MAKE_FORWARDING_HEADERS into
1212         WEBKIT_COPY_FILES"
1213         https://bugs.webkit.org/show_bug.cgi?id=197174
1214         https://trac.webkit.org/changeset/244881
1215
1216 2019-05-02  Wenson Hsieh  <wenson_hsieh@apple.com>
1217
1218         REGRESSION: Layout test editing/selection/ios/selection-after-changing-text-with-callout-menu.html is failing
1219         https://bugs.webkit.org/show_bug.cgi?id=197532
1220         <rdar://problem/50177144>
1221
1222         Reviewed by Ryosuke Niwa.
1223
1224         Fixes layout tests that began failing after r244546. See below for details.
1225
1226         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1227         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
1228
1229         Partially reverts a change in r244546, after which we commit the layer tree and scroll before updating the
1230         page's editor state. The purpose of this change was to ensure that UI process-side element focus scrolling logic
1231         would not conflict with web-process-driven scrolling logic.
1232
1233         Instead, we split the existing logic in WebPageProxy::editorStateChanged into two pieces: one that updates the
1234         editor state (by setting m_editorState), and a second that dispatches updates to PageClient when the first
1235         editor state is received after focusing an element. During a layer tree commit in the UI process, we first
1236         update the editor state, then commit the layer tree and apply scroll position changes, and finally scroll to
1237         reveal the focused element if necessary.
1238
1239         When an editor state is delivered to the UI process in an out-of-band update (i.e. not in a layer tree commit),
1240         simply dispatch the initial editor state for a focused element immediately.
1241
1242         * UIProcess/WebPageProxy.cpp:
1243         (WebKit::WebPageProxy::scheduleFullEditorStateUpdate):
1244
1245         Add an IPC message to schedule an editor state update in the next remote layer tree commit. See below for more
1246         details.
1247
1248         (WebKit::WebPageProxy::editorStateChanged):
1249         (WebKit::WebPageProxy::dispatchDidReceiveEditorStateAfterFocus):
1250         * UIProcess/WebPageProxy.h:
1251         * UIProcess/gtk/WebPageProxyGtk.cpp:
1252         (WebKit::WebPageProxy::updateEditorState):
1253         (WebKit::WebPageProxy::editorStateChanged): Deleted.
1254         * UIProcess/ios/WKContentViewInteraction.mm:
1255         (-[WKContentView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
1256
1257         Additionally ensure that an editor state update is scheduled. This addresses a potential source of flakiness in
1258         the layout test editing/selection/ios/selection-after-changing-text-with-callout-menu.html, where an editor
1259         state update may only be scheduled after the next layout timer fires (this is the case in custom callout menu
1260         actions that change the DOM but do not otherwise trigger any editing commands).
1261
1262         In the problematic scenario, the client could make a change that triggers layout soon; but before the layout
1263         timer fires, the timer for the next remote layer tree commit could fire, such that the next layer tree commit
1264         would not contain the relevant editor state.
1265
1266         This extra step ensures that we always *schedule* an editor state update when performing a callout menu action
1267         that does not automatically dismiss, so that we can prevent the callout bar from dismissing during the correct
1268         scope.
1269
1270         * UIProcess/ios/WebPageProxyIOS.mm:
1271         (WebKit::WebPageProxy::layerTreeCommitComplete):
1272         (WebKit::WebPageProxy::updateEditorState):
1273
1274         Rename editorStateChanged to updateEditorState, and make the editorStateChanged codepath only executed when an
1275         out-of-band editor state update is delivered to the UI process.
1276
1277         (WebKit::WebPageProxy::dispatchDidReceiveEditorStateAfterFocus):
1278
1279         Notify the UI process that the initial editor state has been received; this prompts us to scroll to reveal the
1280         focused element, if needed.
1281
1282         (WebKit::WebPageProxy::editorStateChanged): Deleted.
1283         * UIProcess/mac/WebPageProxyMac.mm:
1284         (WebKit::WebPageProxy::updateEditorState):
1285         (WebKit::WebPageProxy::editorStateChanged): Deleted.
1286         * UIProcess/win/WebPageProxyWin.cpp:
1287         (WebKit::WebPageProxy::updateEditorState):
1288         (WebKit::WebPageProxy::editorStateChanged): Deleted.
1289         * UIProcess/wpe/WebPageProxyWPE.cpp:
1290         (WebKit::WebPageProxy::updateEditorState):
1291         (WebKit::WebPageProxy::editorStateChanged): Deleted.
1292         * WebProcess/WebPage/WebPage.h:
1293         * WebProcess/WebPage/WebPage.messages.in:
1294
1295 2019-05-02  Timothy Hatcher  <timothy@apple.com>
1296
1297         NSAttributedString conversion in a loop returns nil and WKUnknownError every other time.
1298         https://bugs.webkit.org/show_bug.cgi?id=197523
1299
1300         Reviewed by Darin Adler.
1301
1302         Caching the WKWebView was loading about:blank to unload the previous content.
1303         This was causing subsequent rapid conversions to fail since the blank load
1304         would be confused with the real content loading. Loading a blank page wasn't
1305         really needed, it just helped keep the cached view in a cleaner state. Instead
1306         of adding complexity to track the extra navigation, we can eliminate the blank load.
1307         Ultimately a process swap will likely happen on the next navigation, and unused
1308         cached views are closed quickly -- so stale content isn't held around too long.
1309         This also avoids extra work and speeds up conversions a bit.
1310
1311         * UIProcess/API/Cocoa/NSAttributedString.mm:
1312         (+[_WKAttributedStringWebViewCache cacheWebView:]): Don't load about:blank when caching.
1313         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1314         (WebKit::WebPage::getContentsAsAttributedString): Use rangeOfContents() for a fail
1315         safe way to get the range needed.
1316
1317 2019-05-02  John Wilander  <wilander@apple.com>
1318
1319         Make both filterForRegistrableDomains() in WebKit::NetworkProcess use WebCore::RegistrableDomain::uncheckedCreateFromHost()
1320         https://bugs.webkit.org/show_bug.cgi?id=197521
1321         <rdar://problem/49651503>
1322
1323         Reviewed by Brent Fulgham.
1324
1325         * NetworkProcess/NetworkProcess.cpp:
1326         (WebKit::filterForRegistrableDomains):
1327
1328 2019-05-02  Per Arne Vollan  <pvollan@apple.com>
1329
1330         -[WKWebsiteDataStore removeDataOfTypes:forDataRecords:completionHandler:] doesn't delete _WKWebsiteDataTypeCredentials
1331         https://bugs.webkit.org/show_bug.cgi?id=197510
1332         <rdar://problem/50372338>
1333
1334         Reviewed by Alex Christensen.
1335
1336         When asked to delete persistent credentials for a set of origins, send a message to the network process with the
1337         list of origins. The network process will then delete all persistent credentials from these origins from
1338         NSURLCredentialStorage.
1339
1340         * NetworkProcess/NetworkProcess.cpp:
1341         (WebKit::NetworkProcess::removeCredentialsWithOrigins):
1342         * NetworkProcess/NetworkProcess.h:
1343         * NetworkProcess/NetworkProcess.messages.in:
1344         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1345         (WebKit::NetworkProcess::removeCredentialsWithOrigins):
1346         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1347         (WebKit::WebsiteDataStore::removeData):
1348
1349 2019-05-02  Don Olmstead  <don.olmstead@sony.com>
1350
1351         [CMake] Refactor WEBKIT_MAKE_FORWARDING_HEADERS into WEBKIT_COPY_FILES
1352         https://bugs.webkit.org/show_bug.cgi?id=197174
1353
1354         Reviewed by Alex Christensen.
1355
1356         Replace WEBKIT_MAKE_FORWARDING_HEADERS with WEBKIT_COPY_FILES and make dependencies
1357         for framework headers explicit.
1358
1359         * CMakeLists.txt:
1360         * PlatformWin.cmake:
1361
1362 2019-05-02  Per Arne Vollan  <pvollan@apple.com>
1363
1364         [macOS] Fix syscall sandbox violation
1365         https://bugs.webkit.org/show_bug.cgi?id=197517
1366         <rdar://problem/49945031>
1367
1368         Reviewed by Brent Fulgham.
1369
1370         A syscall needs to be added to the sandbox on macOS.
1371
1372         * WebProcess/com.apple.WebProcess.sb.in:
1373
1374 2019-05-02  Alex Christensen  <achristensen@webkit.org>
1375
1376         Safe browsing warning should update colors when a user switches between light and dark appearance
1377         https://bugs.webkit.org/show_bug.cgi?id=197443
1378         <rdar://problem/49883917>
1379
1380         Reviewed by Tim Horton.
1381
1382         We draw the WKSafeBrowsingExclamationPoint ourselves, so we need to call setNeedsDisplay when viewDidChangeEffectiveAppearance is called.
1383         Instead of setting NSView.layer.backgroundColor we need to make an NSView subclass I call WKSafeBrowsingBox and we need to set its layer's
1384         backgroundColor in updateLayer, otherwise the CGColor isn't updated from the NSColor.
1385
1386         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
1387         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
1388         (colorForItem):
1389         (-[WKSafeBrowsingExclamationPoint viewDidChangeEffectiveAppearance]):
1390         (-[WKSafeBrowsingBox setSafeBrowsingBackgroundColor:]):
1391         (-[WKSafeBrowsingBox updateLayer]):
1392         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]):
1393         (-[WKSafeBrowsingWarning addContent]):
1394         (-[WKSafeBrowsingWarning showDetailsClicked]):
1395         (setBackground): Deleted.
1396
1397 2019-05-02  Frederic Wang  <fwang@igalia.com>
1398
1399         [GTK][WPE] Disable "thin", "thick", "medium" values of mfrac@linethickness at runtime
1400         https://bugs.webkit.org/show_bug.cgi?id=196142
1401
1402         This patch introduces some experimental runtime flag to let users
1403         disable MathML features that are removed from MathML Core [1]. For now,
1404         these features are only disabled on GTK and WPE ports.
1405
1406         [1] https://mathml-refresh.github.io/mathml-core/
1407
1408         Reviewed by Rob Buis.
1409
1410         * Shared/WebPreferences.yaml:
1411         * Shared/WebPreferencesDefaultValues.h:
1412
1413 2019-05-01  Wenson Hsieh  <wenson_hsieh@apple.com>
1414
1415         Add the ability to import WebKitAdditions snippets in WebKit.apinotes
1416         https://bugs.webkit.org/show_bug.cgi?id=197487
1417         <rdar://problem/50389085>
1418
1419         Reviewed by Tim Horton.
1420
1421         * Shared/API/Cocoa/WebKit.apinotes: Import a new WebKitAdditions file.
1422
1423         * WebKit.xcodeproj/project.pbxproj: Check all files in Headers/ and PrivateHeaders/ that need replacement, not
1424         simply anything ending with ".h".
1425
1426         * mac/replace-webkit-additions-includes.py:
1427         (main): Teach the replacement script to handle files in Headers/ or PrivateHeaders/ that don't end in ".h".
1428
1429 2019-05-01  Alex Christensen  <achristensen@webkit.org>
1430
1431         Protect against null crash in fetchDiskCacheEntries
1432         https://bugs.webkit.org/show_bug.cgi?id=197399
1433         <rdar://problem/47759337>
1434
1435         Reviewed by Antti Koivisto.
1436
1437         If the call to Entry::decodeStorageRecord returns nullptr in Storage::traverse, do not call the traverseHandler, which expects
1438         that when it is called with nullptr that is the end of the traversal.
1439
1440         * NetworkProcess/cache/NetworkCache.cpp:
1441         (WebKit::NetworkCache::Cache::traverse):
1442
1443 2019-05-01  Wenson Hsieh  <wenson_hsieh@apple.com>
1444
1445         [iOS] Add a version of viewport shrink-to-fit heuristics that preserves page layout
1446         https://bugs.webkit.org/show_bug.cgi?id=197342
1447         <rdar://problem/50063091>
1448
1449         Reviewed by Tim Horton.
1450
1451         This patch introduces a new shrink-to-fit heuristic that attempts to lay out the contents of the page at a
1452         larger width in order to shrink content to fit the viewport. This is similar to existing shrink-to-fit behaviors
1453         used for viewport sizing in multitasking mode, except that it not only scales the view, but additionally expands
1454         the layout size, such that the overall layout of the page is preserved. In fact, the reason we ended up
1455         reverting the existing flavor of shrink-to-fit in all cases except for multitasking was that page layout was not
1456         preserved, which caused elements that poke out of the viewport to make the rest of the page look out of
1457         proportion — see <rdar://problem/23818102> and related radars.
1458
1459         Covered by 5 new layout tests, and by adjusting a couple of existing layout tests. See comments below for more
1460         details.
1461
1462         * Platform/Logging.h:
1463
1464         Add a new ViewportSizing logging channel. This will only log on pages that overflow the viewport and shrink to
1465         fit as a result.
1466
1467         * Shared/WebPreferences.yaml:
1468
1469         Turn IgnoreViewportScalingConstraints off by default. This preference currently controls whether we allow
1470         shrink-to-fit behaviors, and is only used by Safari when it is in multitasking mode. The value of this
1471         preference is currenly *on* by default, and is turned off almost immediately during every page load after the
1472         first visible content rect update, wherein visibleContentRectUpdateInfo.allowShrinkToFit() is false.
1473
1474         However, this sometimes causes a brief jitter during page load; to fix this, make the default value for
1475         IgnoreViewportScalingConstraints false, and change the logic in WebPage::updateVisibleContentRects to
1476         setCanIgnoreScalingConstraints to true if either the IgnoreViewportScalingConstraints preference (not only
1477         affected by an internal debug switch) is true, or WKWebView SPI is used to enable the behavior.
1478
1479         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1480         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
1481         (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad):
1482
1483         Add a new hook for WebFrameLoaderClient to call into WebPage when document load finishes. Also, tweak
1484         dispatchDidFinishLoad to take a WebFrame& instead of a WebFrame* in a drive-by fix (the frame is assumed to be
1485         non-null anyways).
1486
1487         * WebProcess/WebPage/WebPage.cpp:
1488         (WebKit::WebPage::didCommitLoad):
1489         (WebKit::WebPage::didFinishDocumentLoad):
1490         (WebKit::WebPage::didFinishLoad):
1491
1492         When finishing document load or finishing the overall load, kick off the shrink-to-fit timer; when committing a
1493         load, cancel the timer.
1494
1495         * WebProcess/WebPage/WebPage.h:
1496         * WebProcess/WebPage/ios/WebPageIOS.mm:
1497         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
1498
1499         Don't allow the minimum effective device width from the client to stomp over any minimum effective device width
1500         set as a result of the new shrink-to-fit heuristic; on some pages that load quickly, this can result in a race
1501         where the minimum effective device width (i.e. a value that lower-bounds the minimum layout width) is first set
1502         by the shrink-to-fit heuristic, and then set to an incorrect value by the client.
1503
1504         In the near future, web view SPI used to set the minimum effective device width should actually be removed
1505         altogether, since the new shrink-to-fit heuristic supersedes any need for the client to fiddle with the minimum
1506         effective device width.
1507
1508         (WebKit::WebPage::dynamicViewportSizeUpdate):
1509
1510         When performing a dynamic viewport size update, additionally re-run the shrink-to-fit heuristic. This allows
1511         the minimum layout size of the viewport to be updated, if necessary. An example of where this matters is when a
1512         web page is *below* a tablet/desktop layout breakpoint in portrait device orientation, but then exceeds this
1513         layout breakpoint in landscape orientation. In this scenario, rotating the device should swap between these two
1514         page layouts.
1515
1516         (WebKit::WebPage::resetViewportDefaultConfiguration):
1517         (WebKit::WebPage::scheduleShrinkToFitContent):
1518         (WebKit::WebPage::shrinkToFitContentTimerFired):
1519         (WebKit::WebPage::immediatelyShrinkToFitContent):
1520
1521         Leverage the existing capability for a viewport to have a "minimum effective device width" to grant the viewport
1522         a larger layout size than it would normally have, and then scale down to fit within the bounds of the view. One
1523         challenge with this overall approach is that laying out at a larger width may cause the page to lay out even
1524         wider in response, which may actually worsen horizontal scrolling. To mitigate this, we only attempt to lay out
1525         at the current content width once; if laying out at this width reduced the amount of horizontal scrolling by any
1526         amount, then proceed with this layout width; otherwise, revert to the previous layout width.
1527
1528         (WebKit::WebPage::shouldIgnoreMetaViewport const):
1529
1530         Pull some common logic out into a readonly getter.
1531
1532         (WebKit::WebPage::updateVisibleContentRects):
1533
1534         See the comment below WebPreferences.yaml, above.
1535
1536 2019-05-01  Dean Jackson  <dino@apple.com>
1537
1538         Link Previews that use WKImagePreviewViewController are not always scaled correctly
1539         https://bugs.webkit.org/show_bug.cgi?id=197450
1540         <rdar://problem/50357695>
1541
1542         Reviewed by Wenson Hsieh.
1543
1544         Tell the UIImageView that we create in WKImagePreviewViewController to use
1545         a filling scaling method.
1546
1547         * UIProcess/WKImagePreviewViewController.mm:
1548         (-[WKImagePreviewViewController initWithCGImage:defaultActions:elementInfo:]):
1549
1550 2019-05-01  Darin Adler  <darin@apple.com>
1551
1552         WebKit has too much of its own UTF-8 code and should rely more on ICU's UTF-8 support
1553         https://bugs.webkit.org/show_bug.cgi?id=195535
1554
1555         Reviewed by Alexey Proskuryakov.
1556
1557         * Shared/API/APIString.h: Removed uneeded includes and also switched to #pragma once.
1558
1559         * Shared/API/c/WKString.cpp: Moved include of UTF8Conversion.h here.
1560         (WKStringGetUTF8CStringImpl): Updated for changes to return values.
1561
1562 2019-05-01  Shawn Roberts  <sroberts@apple.com>
1563
1564         Unreviewed, rolling out r244821.
1565
1566         Causing
1567
1568         Reverted changeset:
1569
1570         "WebKit has too much of its own UTF-8 code and should rely
1571         more on ICU's UTF-8 support"
1572         https://bugs.webkit.org/show_bug.cgi?id=195535
1573         https://trac.webkit.org/changeset/244821
1574
1575 2019-05-01  Youenn Fablet  <youenn@apple.com>
1576
1577         Kept alive loaders should use the redirected request in case of redirections
1578         https://bugs.webkit.org/show_bug.cgi?id=197337
1579
1580         Reviewed by Alex Christensen.
1581
1582         Instead of using the request, the redirected request should be used in case of redirection.
1583
1584         * NetworkProcess/NetworkResourceLoader.cpp:
1585         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
1586         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
1587
1588 2019-04-29  Darin Adler  <darin@apple.com>
1589
1590         WebKit has too much of its own UTF-8 code and should rely more on ICU's UTF-8 support
1591         https://bugs.webkit.org/show_bug.cgi?id=195535
1592
1593         Reviewed by Alexey Proskuryakov.
1594
1595         * Shared/API/APIString.h: Removed uneeded includes and also switched to #pragma once.
1596
1597         * Shared/API/c/WKString.cpp: Moved include of UTF8Conversion.h here.
1598         (WKStringGetUTF8CStringImpl): Updated for changes to return values.
1599
1600 2019-04-30  Chris Dumez  <cdumez@apple.com>
1601
1602         Regression(PSON) URL scheme handlers can no longer respond asynchronously
1603         https://bugs.webkit.org/show_bug.cgi?id=197426
1604         <rdar://problem/50256169>
1605
1606         Reviewed by Brady Eidson.
1607
1608         The issue was that when committing the provisional process, we would call WebPageProxy::processDidTerminate()
1609         which would call WebPageProxy::stopAllURLSchemeTasks(). This would terminate all URL scheme tasks associated
1610         with the page, including the one associated with the provisisional page / process.
1611
1612         To address the issue, pass m_process to stopAllURLSchemeTasks() in processDidTerminate() and only stop the
1613         tasks associated with the m_process (which is the process we're about to swap away from).
1614
1615         * UIProcess/WebPageProxy.cpp:
1616         (WebKit::WebPageProxy::processDidTerminate):
1617         (WebKit::WebPageProxy::stopAllURLSchemeTasks):
1618         * UIProcess/WebPageProxy.h:
1619         * UIProcess/WebURLSchemeHandler.cpp:
1620         (WebKit::WebURLSchemeHandler::processForTaskIdentifier):
1621         (WebKit::WebURLSchemeHandler::stopAllTasksForPage):
1622         * UIProcess/WebURLSchemeHandler.h:
1623         * UIProcess/WebURLSchemeTask.h:
1624         (WebKit::WebURLSchemeTask::process const):
1625
1626 2019-04-30  John Wilander  <wilander@apple.com>
1627
1628         Add logging of Ad Click Attribution errors and events to a dedicated channel
1629         https://bugs.webkit.org/show_bug.cgi?id=197332
1630         <rdar://problem/49918800>
1631
1632         Reviewed by Youenn Fablet.
1633
1634         This patch adds an experimental Ad Click Attribution debug mode which
1635         logs information. Most changes are just log output in the various
1636         functions in WebKit::AdClickAttributionManager.
1637
1638         The constructor to WebKit::AdClickAttributionManager now takes a
1639         PAL::SessionID so that the log functions can make sure they don't
1640         output anything in ephemeral sessions.
1641
1642         WebProcessPool::platformInitializeNetworkProcess() now picks up the
1643         debug mode setting from the incoming
1644         WebKit::NetworkProcessCreationParameters object.
1645
1646         NetworkResourceLoader::handleAdClickAttributionConversion() was
1647         moved to AdClickAttributionManager::handleConversion() to keep all
1648         the logging in one file.
1649
1650         * NetworkProcess/AdClickAttributionManager.cpp:
1651         (WebKit::AdClickAttributionManager::storeUnconverted):
1652         (WebKit::AdClickAttributionManager::handleConversion):
1653         (WebKit::AdClickAttributionManager::convert):
1654         (WebKit::AdClickAttributionManager::fireConversionRequest):
1655         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
1656         (WebKit::AdClickAttributionManager::clearExpired):
1657         (WebKit::AdClickAttributionManager::debugModeEnabled const):
1658         * NetworkProcess/AdClickAttributionManager.h:
1659         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
1660         (WebKit::AdClickAttributionManager::m_sessionID):
1661         * NetworkProcess/NetworkProcess.cpp:
1662         (WebKit::NetworkProcess::initializeNetworkProcess):
1663         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1664         (WebKit::NetworkProcessCreationParameters::encode const):
1665         (WebKit::NetworkProcessCreationParameters::decode):
1666         * NetworkProcess/NetworkProcessCreationParameters.h:
1667         * NetworkProcess/NetworkResourceLoader.cpp:
1668         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
1669         (WebKit::NetworkResourceLoader::handleAdClickAttributionConversion): Deleted.
1670         * NetworkProcess/NetworkSession.cpp:
1671         (WebKit::NetworkSession::NetworkSession):
1672         (WebKit::NetworkSession::handleAdClickAttributionConversion):
1673         (WebKit::NetworkSession::convertAdClickAttribution): Deleted.
1674         * NetworkProcess/NetworkSession.h:
1675         * Platform/Logging.h:
1676         * Shared/WebPreferences.yaml:
1677         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1678         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1679
1680 2019-04-30  Devin Rousso  <drousso@apple.com>
1681
1682         Crash when running test wpt/tests/element_click/bubbling.py::test_element_disappears_during_click
1683         https://bugs.webkit.org/show_bug.cgi?id=197361
1684         <rdar://problem/49861407>
1685
1686         Reviewed by Brian Burg.
1687
1688         Don't assume that all elements have client rects (e.g. `getClientRects`). If the container
1689         element isn't visible, then the child won't be either.
1690
1691         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
1692         (WebKit::SimulatedInputDispatcher::resolveLocation):
1693         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
1694         * UIProcess/Automation/WebAutomationSession.cpp:
1695         (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
1696
1697 2019-04-30  Chris Dumez  <cdumez@apple.com>
1698
1699         Unreviewed, rolling out r244802.
1700
1701         Caused an API test failure
1702
1703         Reverted changeset:
1704
1705         "Regression(PSON) URL scheme handlers can no longer respond
1706         asynchronously"
1707         https://bugs.webkit.org/show_bug.cgi?id=197426
1708         https://trac.webkit.org/changeset/244802
1709
1710 2019-04-30  Chris Dumez  <cdumez@apple.com>
1711
1712         Regression(PSON) URL scheme handlers can no longer respond asynchronously
1713         https://bugs.webkit.org/show_bug.cgi?id=197426
1714         <rdar://problem/50256169>
1715
1716         Reviewed by Brady Eidson.
1717
1718         The issue was that when committing the provisional process, we would call WebPageProxy::processDidTerminate()
1719         which would call WebPageProxy::stopAllURLSchemeTasks(). This would terminate all URL scheme tasks associated
1720         with the page, including the one associated with the provisisional page / process.
1721
1722         To address the issue, pass m_process to stopAllURLSchemeTasks() in processDidTerminate() and only stop the
1723         tasks associated with the m_process (which is the process we're about to swap away from).
1724
1725         * UIProcess/WebPageProxy.cpp:
1726         (WebKit::WebPageProxy::processDidTerminate):
1727         (WebKit::WebPageProxy::stopAllURLSchemeTasks):
1728         * UIProcess/WebPageProxy.h:
1729         * UIProcess/WebURLSchemeHandler.cpp:
1730         (WebKit::WebURLSchemeHandler::processForTaskIdentifier):
1731         (WebKit::WebURLSchemeHandler::stopAllTasksForPage):
1732         * UIProcess/WebURLSchemeHandler.h:
1733         * UIProcess/WebURLSchemeTask.h:
1734         (WebKit::WebURLSchemeTask::process const):
1735
1736 2019-04-30  Chris Dumez  <cdumez@apple.com>
1737
1738         Only use a related page's process if that page has not been closed yet
1739         https://bugs.webkit.org/show_bug.cgi?id=197393
1740         <rdar://problem/50302423>
1741
1742         Reviewed by Tim Horton.
1743
1744         We should not attempt to use a related page's process if that related page has already been closed.
1745         Once closed, a page's process is invalid and trying to launch a new process for the closed page
1746         leads to crashes such as the one in the radar.
1747
1748         * UIProcess/WebPageProxy.cpp:
1749         (WebKit::WebPageProxy::launchProcess):
1750         * UIProcess/WebProcessPool.cpp:
1751         (WebKit::WebProcessPool::createWebPage):
1752
1753 2019-04-30  Tim Horton  <timothy_horton@apple.com>
1754
1755         Long-standing rare crash under -[WKWebView _web_immediateActionAnimationControllerForHitTestResultInternal...]
1756         https://bugs.webkit.org/show_bug.cgi?id=197404
1757         <rdar://problem/24589331>
1758
1759         Reviewed by Wenson Hsieh.
1760
1761         * UIProcess/mac/WKImmediateActionController.mm:
1762         (-[WKImmediateActionController _updateImmediateActionItem]):
1763         (-[WKImmediateActionController menuItem:previewItemAtPoint:]):
1764         (-[WKImmediateActionController menuItem:itemFrameForPoint:]):
1765         (-[WKImmediateActionController _animationControllerForDataDetectedLink]):
1766         Add some null checks; _webHitTestResult can be null if we (somehow) get
1767         an immediate action gesture without having previously gotten a
1768         mouseDidMoveOverElement from the Web Content process. Cover all our bases.
1769
1770 2019-04-30  Per Arne Vollan  <pvollan@apple.com>
1771
1772         [iOS] Fix crash caused by sandbox violation
1773         https://bugs.webkit.org/show_bug.cgi?id=197416
1774         <rdar://problem/50266257>
1775
1776         Reviewed by Brent Fulgham.
1777
1778         Add syscall to the iOS sandbox.
1779
1780         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1781
1782 2019-04-30  Zalan Bujtas  <zalan@apple.com>
1783
1784         [iOS] Double-tapping a post to like doesn't work on Instagram.com (needs 'dblclick' event)
1785         https://bugs.webkit.org/show_bug.cgi?id=197347
1786         <rdar://problem/49393423>
1787
1788         Reviewed by Wenson Hsieh.
1789
1790         This patch adds support for dispatching dblclick event as the result of the double tap gesture.
1791
1792         1. The new double tap gesture recognizer always fires regardless of what type of action the other, existing double gesture recognizers (double-tap to zoom) trigger.
1793         2. The dblclick event is dispatched on the node with registered dblclick event handler unless the node prohibits double tap gesture (touch-action != auto).
1794
1795         * UIProcess/WebPageProxy.h:
1796         * UIProcess/ios/WKContentViewInteraction.h:
1797         * UIProcess/ios/WKContentViewInteraction.mm:
1798         (-[WKContentView setupInteraction]):
1799         (-[WKContentView cleanupInteraction]):
1800         (-[WKContentView _removeDefaultGestureRecognizers]):
1801         (-[WKContentView _addDefaultGestureRecognizers]):
1802         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1803         (-[WKContentView gestureRecognizerShouldBegin:]):
1804         (-[WKContentView _doubleTapRecognizedForDoubleClick:]):
1805         * UIProcess/ios/WebPageProxyIOS.mm:
1806         (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
1807         * WebProcess/WebPage/WebPage.h:
1808         * WebProcess/WebPage/WebPage.messages.in:
1809         * WebProcess/WebPage/ios/WebPageIOS.mm:
1810         (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
1811
1812 2019-04-30  Antti Koivisto  <antti@apple.com>
1813
1814         Tighten type of ScrollingTree:rootNode() to ScrollingTreeFrameScrollingNode
1815         https://bugs.webkit.org/show_bug.cgi?id=197414
1816
1817         Reviewed by Frédéric Wang.
1818
1819         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1820
1821 2019-04-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1822
1823         REGRESSION(r244750): [GTK][WPE] Network process is crashing in all layout tests
1824         https://bugs.webkit.org/show_bug.cgi?id=197406
1825
1826         Reviewed by Žan Doberšek.
1827
1828         Do not trasnfer ownership of cachePath to traverseDirectory() lambda, since it's passed also as first argument
1829         and it can be passed as a reference.
1830
1831         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1832         (WebKit::NetworkCache::Storage::deleteOldVersions):
1833
1834 2019-04-29  Truitt Savell  <tsavell@apple.com>
1835
1836         Unreviewed, rolling out r244755.
1837
1838         Casued several test failures on iOS
1839
1840         Reverted changeset:
1841
1842         "Double-tapping a post to like doesn't work on Instagram.com
1843         (needs 'dblclick' event)"
1844         https://bugs.webkit.org/show_bug.cgi?id=197347
1845         https://trac.webkit.org/changeset/244755
1846
1847 2019-04-29  Chris Dumez  <cdumez@apple.com>
1848
1849         [iOS] The UIProcess may get killed for trying to stay runnable in the background for more than 30 seconds
1850         https://bugs.webkit.org/show_bug.cgi?id=197385
1851         <rdar://problem/50001505>
1852
1853         Reviewed by Geoffrey Garen.
1854
1855         If the UIProcess holds a background assertion for itself for 30 seconds, the assertion's invalidation handler
1856         will get called and it is our responsibility to release this assertion or the UIProcess will get killed by the
1857         system. The logic in ProcessAssertion would normally do that but it would also happily try and re-take another
1858         background process assertion shortly after the previous one expired (and before the UIProcess got suspended).
1859         When doing so, the new background assertion would expire right away and we would get killed without its
1860         invalidation handler getting called.
1861
1862         To address the issue, the logic in ProcessAssertion will now prevent taking a new background assertion after
1863         one expires and until the application becomes foreground again.
1864
1865         * UIProcess/ios/ProcessAssertionIOS.mm:
1866         (-[WKProcessAssertionBackgroundTaskManager init]):
1867         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
1868
1869 2019-04-29  Alex Christensen  <achristensen@webkit.org>
1870
1871         <rdar://problem/50299396> Fix internal High Sierra build
1872         https://bugs.webkit.org/show_bug.cgi?id=197388
1873
1874         * Configurations/Base.xcconfig:
1875
1876 2019-04-29  Zalan Bujtas  <zalan@apple.com>
1877
1878         [iOS] Double-tapping a post to like doesn't work on Instagram.com (needs 'dblclick' event)
1879         https://bugs.webkit.org/show_bug.cgi?id=197347
1880         <rdar://problem/49393423>
1881
1882         Reviewed by Wenson Hsieh.
1883
1884         This patch adds support for dispatching dblclick event as the result of the double tap gesture.
1885
1886         1. The new double tap gesture recognizer always fires regardless of what type of action the other, existing double gesture recognizers (double-tap to zoom) trigger.
1887         2. The dblclick event is dispatched on the node with registered dblclick event handler unless the node prohibits double tap gesture (touch-action != auto).
1888
1889         * UIProcess/WebPageProxy.h:
1890         * UIProcess/ios/WKContentViewInteraction.h:
1891         * UIProcess/ios/WKContentViewInteraction.mm:
1892         (-[WKContentView setupInteraction]):
1893         (-[WKContentView cleanupInteraction]):
1894         (-[WKContentView _removeDefaultGestureRecognizers]):
1895         (-[WKContentView _addDefaultGestureRecognizers]):
1896         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1897         (-[WKContentView gestureRecognizerShouldBegin:]):
1898         (-[WKContentView _doubleTapRecognizedForDoubleClick:]):
1899         * UIProcess/ios/WebPageProxyIOS.mm:
1900         (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
1901         * WebProcess/WebPage/WebPage.h:
1902         * WebProcess/WebPage/WebPage.messages.in:
1903         * WebProcess/WebPage/ios/WebPageIOS.mm:
1904         (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
1905
1906 2019-04-29  Tim Horton  <timothy_horton@apple.com>
1907
1908         REGRESSION (r244142): Fandango accounts tab crashes under Color()
1909         https://bugs.webkit.org/show_bug.cgi?id=197380
1910         <rdar://problem/50186175>
1911
1912         Reviewed by Megan Gardner.
1913
1914         * UIProcess/API/Cocoa/WKWebView.mm:
1915         (baseScrollViewBackgroundColor):
1916         We now call -_updateScrollViewBackground from -setBackgroundColor:.
1917         -setBackgroundColor: can be called from -[UIView initWithCoder:]; if it
1918         is, WKWebView's _page is not yet initialized, so we crash. Return an invalid color.
1919         Then, the caller falls back to WKContentView's backgroundColor. But WKContentView
1920         isn't initialized yet either. So add a further fallback.
1921
1922 2019-04-29  Dean Jackson  <dino@apple.com>
1923
1924         Add InteractionIsHappening to SuppressSelectionAssistantReason
1925         https://bugs.webkit.org/show_bug.cgi?id=197375
1926         <rdar://problem/50304986>
1927
1928         Reviewed by Megan Gardner.
1929
1930         Add a new reason for suppressing the selection assistant, to
1931         be used in a follow-up patch.
1932
1933         * UIProcess/ios/WKContentViewInteraction.h: Add InteractionIsHappening.
1934
1935 2019-04-29  Alex Christensen  <achristensen@webkit.org>
1936
1937         Storage::deleteOldVersions does not need to retain Storage
1938         https://bugs.webkit.org/show_bug.cgi?id=197336
1939         <rdar://problem/48679972>
1940
1941         Reviewed by Darin Adler.
1942
1943         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1944         (WebKit::NetworkCache::Storage::deleteOldVersions):
1945         Something is wrong with the lifetime of Storage, but we only need a String, not the whole Storage.
1946
1947 2019-04-29  Brent Fulgham  <bfulgham@apple.com>
1948
1949         [Cocoa] Move common sandbox files from Shared/mac to Shared/Cocoa
1950         https://bugs.webkit.org/show_bug.cgi?id=197376
1951         <rdar://problem/50305272>
1952
1953         Reviewed by Dean Jackson.
1954
1955         The Apple sandboxing logic currently lives in the inappropriate 'Shared/mac' directory. This is
1956         confusing because the code is used by all Apple ports, not just macOS.
1957
1958         This patch just moves the relevant files from 'Shared/mac' to 'Shared/Cocoa' to avoid this confusion.
1959
1960         * Shared/Cocoa/SandboxExtensionCocoa.mm: Renamed from Source/WebKit/Shared/mac/SandboxExtensionMac.mm.
1961         * Shared/Cocoa/SandboxInitialiationParametersCocoa.mm: Renamed from Source/WebKit/Shared/mac/SandboxInitialiationParametersMac.mm.
1962         * Shared/Cocoa/SandboxUtilities.h: Renamed from Source/WebKit/Shared/mac/SandboxUtilities.h.
1963         * Shared/Cocoa/SandboxUtilities.mm: Renamed from Source/WebKit/Shared/mac/SandboxUtilities.mm.
1964         * SourcesCocoa.txt:
1965         * WebKit.xcodeproj/project.pbxproj:
1966
1967 2019-04-29  Alexander Mikhaylenko  <exalm7659@gmail.com>
1968
1969         [GTK] Back/forward gesture snapshot always times out
1970         https://bugs.webkit.org/show_bug.cgi?id=197233
1971
1972         Reviewed by Michael Catanzaro.
1973
1974         Delaying web process launch caused a regression where we create ViewGestureController when the
1975         web process doesn't yet exist. The controller immediately tries to connect to it and fails,
1976         and because of that never receives DidHitRenderTreeSizeThreshold() message, so navigation
1977         snapshot always stays until timeout after performing the gesture.
1978
1979         To prevent this, create the controller in webkitWebViewBaseDidRelaunchWebProcess() instead of
1980         webkitWebViewBaseCreateWebPage(). Additionally, since settings are now created earlier than
1981         ViewGestureController, store the value of whether swipe gesture is enabled in WebKitWebViewBase
1982         and immediately apply it when creating the controller.
1983
1984         Since there is now a point where controller is null, make webkitWebViewBaseViewGestureController()
1985         return null and add null checks everywhere.
1986
1987         * UIProcess/API/glib/WebKitWebView.cpp:
1988         (enableBackForwardNavigationGesturesChanged):
1989         Move the logic into webkitWebViewBaseSetEnableBackForwardNavigationGesture().
1990         * UIProcess/API/gtk/PageClientImpl.cpp:
1991         (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): Add a null check.
1992         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1993         (webkitWebViewBaseDraw): Ditto.
1994         (webkitWebViewBaseScrollEvent): Ditto.
1995         (webkitWebViewBaseSetEnableBackForwardNavigationGesture): Added. In addition to what was in
1996         WebKitWebViewBase::enableBackForwardNavigationGesturesChanged(), store the value in a field
1997         for the case ViewGestureController doesn't exist yet.
1998         (webkitWebViewBaseViewGestureController): Return a pointer instead of reference.
1999         (webkitWebViewBaseCreateWebPage): Stop creating ViewGestureController.
2000         (webkitWebViewBaseDidRelaunchWebProcess): Move creating ViewGestureController here. Also
2001         immediately call setSwipeGestureEnabled() with the stored value.
2002         (webkitWebViewBaseDidStartProvisionalLoadForMainFrame): Add a null check.
2003         (webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame):Ditto.
2004         (webkitWebViewBaseDidFinishLoadForMainFrame): Ditto.
2005         (webkitWebViewBaseDidFailLoadForMainFrame): Ditto.
2006         (webkitWebViewBaseDidSameDocumentNavigationForMainFrame): Ditto.
2007         (webkitWebViewBaseDidRestoreScrollPosition): Ditto.
2008         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
2009
2010 2019-04-29  Chris Dumez  <cdumez@apple.com>
2011
2012         User-facing strings should use curly quotes instead of straight
2013         https://bugs.webkit.org/show_bug.cgi?id=197370
2014
2015         Reviewed by Geoffrey Garen.
2016
2017         Update localizable alert text that was recently added to use curly quotes instead of
2018         straight ones, as per our guidelines.
2019
2020         * UIProcess/Cocoa/WKOrientationAccessAlert.mm:
2021         (WebKit::presentOrientationAccessAlert):
2022         * UIProcess/Cocoa/WKStorageAccessAlert.mm:
2023         (WebKit::presentStorageAccessAlert):
2024
2025 2019-04-29  Alex Christensen  <achristensen@webkit.org>
2026
2027         Build fix.
2028
2029         * UIProcess/ios/WKActionSheet.mm:
2030         (-[WKActionSheet updateSheetPosition]):
2031
2032 2019-04-29  Commit Queue  <commit-queue@webkit.org>
2033
2034         Unreviewed, rolling out r244648.
2035         https://bugs.webkit.org/show_bug.cgi?id=197363
2036
2037          Lots of tests  are crashing (Requested by KaL on #webkit).
2038
2039         Reverted changeset:
2040
2041         "[GTK] Back/forward gesture snapshot always times out"
2042         https://bugs.webkit.org/show_bug.cgi?id=197233
2043         https://trac.webkit.org/changeset/244648
2044
2045 2019-04-29  Michael Catanzaro  <mcatanzaro@igalia.com>
2046
2047         [WPE][GTK] window-object-cleared documentation should reference webkit_frame_get_js_context_for_script_world()
2048         https://bugs.webkit.org/show_bug.cgi?id=197357
2049
2050         Reviewed by Carlos Garcia Campos.
2051
2052         We should recommend using the non-deprecated replacement for
2053         webkit_frame_get_javascript_context_for_script_world().
2054
2055         * WebProcess/InjectedBundle/API/glib/WebKitScriptWorld.cpp:
2056
2057 2019-04-27  Chris Dumez  <cdumez@apple.com>
2058
2059         Improve safety of MachMessage class
2060         https://bugs.webkit.org/show_bug.cgi?id=197323
2061         <rdar://problem/44291920>
2062
2063         Reviewed by Darin Adler.
2064
2065         Improve safety of MachMessage class and clean things up a bit.
2066
2067         * Platform/IPC/mac/ConnectionMac.mm:
2068         (IPC::Connection::sendOutgoingMessage):
2069         - Pass MessageReceiverName / MessageName when constructing the MachMessage rather
2070           than setting them afterwards since they never change for a given MachMessage.
2071         - Set header->msgh_id to the right value right away instead of setting it first
2072           to inlineBodyMessageID and then later fixing it to be outOfLineBodyMessageID
2073           when the body is out of line.
2074         - When messageBodyIsOOL was true, we would call getDescriptorAndSkip() which
2075           would advance the pointer by sizeof(mach_msg_port_descriptor_t), even though
2076           the descriptor type is mach_msg_ool_descriptor_t. This would not matter in
2077           the end because we would not use the messageData pointer after this but
2078           still.
2079
2080         * Platform/IPC/mac/MachMessage.cpp:
2081         (IPC::MachMessage::create):
2082         Use fastZeroedMalloc() instead of fastMalloc() for safety, given that this class
2083         has a mach_msg_header_t flexible array member. This is what is recommended by the
2084         mach documentation. It is much safer because it otherwize relies on the user
2085         (Connection::sendOutgoingMessage()) to initialize ALL the message members
2086         correctly. I suspect this was the cause of <rdar://problem/44291920> because
2087         Connection::sendOutgoingMessage() would fail to initialize header->msgh_voucher_port
2088         and the MachMessage destructor would then call mach_msg_destroy(header()), which
2089         would mach_msg_destroy_port(header->msgh_voucher_port).
2090
2091         (IPC::MachMessage::MachMessage):
2092         Pass MessageReceiverName / MessageName when constructing the MachMessage rather
2093         than setting them afterwards since they never change for a given MachMessage.
2094
2095         (IPC::MachMessage::messageSize):
2096         Drop if checks for portDescriptorCount and memoryDescriptorCount since the logic
2097         will do the right thing even if they are 0.
2098
2099         * Platform/IPC/mac/MachMessage.h:
2100         (IPC::MachMessage::header):
2101         (IPC::MachMessage::messageReceiverName const):
2102         (IPC::MachMessage::messageName const):
2103
2104 2019-04-26  Wenson Hsieh  <wenson_hsieh@apple.com>
2105
2106         Rename m_LayerTreeFreezeReasons to m_layerTreeFreezeReasons
2107         https://bugs.webkit.org/show_bug.cgi?id=197343
2108
2109         Reviewed by Antti Koivisto.
2110
2111         No change in behavior.
2112
2113         * WebProcess/WebPage/WebPage.cpp:
2114         (WebKit::WebPage::freezeLayerTree):
2115         (WebKit::WebPage::unfreezeLayerTree):
2116         (WebKit::WebPage::updateDrawingAreaLayerTreeFreezeState):
2117         * WebProcess/WebPage/WebPage.h:
2118
2119 2019-04-26  Keith Rollin  <krollin@apple.com>
2120
2121         Enable new build rule for post-processing headers when using XCBuild
2122         https://bugs.webkit.org/show_bug.cgi?id=197340
2123         <rdar://problem/50226685>
2124
2125         Reviewed by Brent Fulgham.
2126
2127         In Bug 197116, we conditionally disabled the old method for
2128         post-processing header files when we are using the new XCBuild build
2129         system. This check-in conditionally enables the new post-processing
2130         facility. Note that the old system is disabled and the new system
2131         enabled only when the USE_NEW_BUILD_SYSTEM environment variable is set
2132         to YES.
2133
2134         * Configurations/WebKit.xcconfig:
2135
2136 2019-04-26  Jessie Berlin  <jberlin@webkit.org>
2137
2138         Add new mac target numbers
2139         https://bugs.webkit.org/show_bug.cgi?id=197313
2140
2141         Reviewed by Alex Christensen.
2142
2143         * Configurations/Version.xcconfig:
2144         * Configurations/WebKitTargetConditionals.xcconfig:
2145
2146 2019-04-26  Youenn Fablet  <youenn@apple.com>
2147
2148         Use kDNSServiceFlagsKnownUnique to speed up mdns name registration for ICE candidates
2149         https://bugs.webkit.org/show_bug.cgi?id=197328
2150
2151         Reviewed by Eric Carlson.
2152
2153         This allows skipping the probing step of MDNS name registration.
2154         We can do that as registered names are random UUIDs.
2155
2156         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
2157         (WebKit::NetworkMDNSRegister::registerMDNSName):
2158
2159 2019-04-26  Chris Dumez  <cdumez@apple.com>
2160
2161         [iOS] Our process assertion should not allow idle sleep
2162         https://bugs.webkit.org/show_bug.cgi?id=197317
2163         <rdar://problem/50137740>
2164
2165         Reviewed by Geoffrey Garen.
2166
2167         Our process assertion should not allow idle sleep. This is bad for power because the device
2168         may switch between sleep and awake state frequently, as it get woken up by network packages.
2169
2170         * UIProcess/ios/ProcessAssertionIOS.mm:
2171
2172 2019-04-26  Eric Carlson  <eric.carlson@apple.com>
2173
2174         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
2175         https://bugs.webkit.org/show_bug.cgi?id=197171
2176         <rdar://problem/47454979>
2177
2178         Reviewed by Youenn Fablet.
2179
2180         * Shared/ios/WebIconUtilities.mm:
2181         (WebKit::iconForVideoFile):
2182         * Shared/mac/WebCoreArgumentCodersMac.mm:
2183         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
2184         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
2185         * UIProcess/Cocoa/UIDelegate.mm:
2186         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
2187         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
2188         (WebKit::PlatformCALayerRemoteCustom::clone const):
2189
2190 2019-04-26  Commit Queue  <commit-queue@webkit.org>
2191
2192         Unreviewed, rolling out r244683.
2193         https://bugs.webkit.org/show_bug.cgi?id=197320
2194
2195         Causing crash on iOS Simulator and EWS failures (Requested by
2196         sroberts on #webkit).
2197
2198         Reverted changeset:
2199
2200         "[iOS] Add internal setting to force -webkit-text-size-adjust
2201         to "auto""
2202         https://bugs.webkit.org/show_bug.cgi?id=197275
2203         https://trac.webkit.org/changeset/244683
2204
2205 2019-04-26  Youenn Fablet  <youenn@apple.com>
2206
2207         Use normal loading path for ping loads
2208         https://bugs.webkit.org/show_bug.cgi?id=196807
2209
2210         Reviewed by Alex Christensen.
2211
2212         In case a NetworkResourceLoader has the keepAlive option we do the following:
2213         - Always use NetworkLoadChecker as we might need it to do checks after the Web context is gone.
2214         - In case of aborting a KeepAlive loader, remove it from NetworkConnectionToWebProcess map
2215         and add it to a kept-alive NetworkSession load set. The loader is only kept alive if it
2216         has not yet received a response. Mark the loader as kept-alive.
2217         - In case loader is kept-alive, cancel the load as soon as a response is gathered.
2218
2219         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2220         (WebKit::NetworkConnectionToWebProcess::transferKeptAliveLoad):
2221         * NetworkProcess/NetworkConnectionToWebProcess.h:
2222         * NetworkProcess/NetworkProcess.cpp:
2223         (WebKit::NetworkProcess::addKeptAliveLoad):
2224         (WebKit::NetworkProcess::removeKeptAliveLoad):
2225         * NetworkProcess/NetworkProcess.h:
2226         * NetworkProcess/NetworkResourceLoadMap.cpp:
2227         (WebKit::NetworkResourceLoadMap::remove):
2228         (WebKit::NetworkResourceLoadMap::take):
2229         * NetworkProcess/NetworkResourceLoadMap.h:
2230         * NetworkProcess/NetworkResourceLoader.cpp:
2231         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
2232         (WebKit::NetworkResourceLoader::cleanup):
2233         (WebKit::NetworkResourceLoader::abort):
2234         (WebKit::NetworkResourceLoader::didReceiveResponse):
2235         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
2236         * NetworkProcess/NetworkResourceLoader.h:
2237         * WebProcess/Network/WebLoaderStrategy.cpp:
2238         (WebKit::maximumBufferingTime):
2239         (WebKit::WebLoaderStrategy::usePingLoad const):
2240         * WebProcess/Network/WebLoaderStrategy.h:
2241
2242 2019-04-26  Alex Christensen  <achristensen@webkit.org>
2243
2244         Fix internal High Sierra build after r244653
2245         https://bugs.webkit.org/show_bug.cgi?id=197131
2246
2247         * DerivedSources.make:
2248         -std=gnu++17 didn't exist yet.  -std=gnu++1z did.
2249
2250 2019-04-26  Alex Christensen  <achristensen@webkit.org>
2251
2252         Fix an internal High Sierra build after r244653
2253        ​https://bugs.webkit.org/show_bug.cgi?id=197131
2254
2255         * DerivedSources.make:
2256         Apparently we can't use gnu++17 when preprocessing Platform.h in the makefile.
2257
2258 2019-04-26  Sihui Liu  <sihui_liu@apple.com>
2259
2260         Stop IDB transactions to release locked database files when network process is ready to suspend
2261         https://bugs.webkit.org/show_bug.cgi?id=196372
2262         <rdar://problem/48930116>
2263
2264         Reviewed by Brady Eidson.
2265
2266         * NetworkProcess/NetworkProcess.cpp:
2267         (WebKit::NetworkProcess::processWillSuspendImminently):
2268         (WebKit::NetworkProcess::prepareToSuspend):
2269         (WebKit::NetworkProcess::resume):
2270
2271 2019-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
2272
2273         [iOS] Add internal setting to force -webkit-text-size-adjust to "auto"
2274         https://bugs.webkit.org/show_bug.cgi?id=197275
2275         <rdar://problem/50211019>
2276
2277         Reviewed by Simon Fraser.
2278
2279         * Shared/WebPreferences.yaml:
2280         * UIProcess/WebPreferences.h:
2281
2282 2019-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
2283
2284         [iOS] Implement idempotent mode for text autosizing
2285         https://bugs.webkit.org/show_bug.cgi?id=197250
2286         <rdar://problem/50211034>
2287
2288         Reviewed by Jon Lee.
2289
2290         Push the initial scale down into the page.
2291
2292         * WebProcess/WebPage/ios/WebPageIOS.mm:
2293         (WebKit::WebPage::dynamicViewportSizeUpdate):
2294         (WebKit::WebPage::viewportConfigurationChanged):
2295
2296 2019-04-25  Alex Christensen  <achristensen@webkit.org>
2297
2298         Make NetworkCache blobs safe for mmap instead of not using blobs
2299         https://bugs.webkit.org/show_bug.cgi?id=197264
2300         <rdar://problem/49564348>
2301
2302         Reviewed by Antti Koivisto.
2303
2304         This does what r244597 did for WKContentRuleLists but for the NetworkCache's blobs.
2305         Those are the two cases where we were calling mmap and seeing crashes in apps with
2306         default file protection of NSFileProtectionComplete.
2307
2308         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
2309         (WebKit::NetworkCache::BlobStorage::add):
2310         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
2311         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath): Deleted.
2312         * NetworkProcess/cache/NetworkCacheFileSystem.h:
2313         * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm:
2314         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
2315         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2316         (WebKit::NetworkCache::Storage::Storage):
2317         (WebKit::NetworkCache::Storage::synchronize):
2318         (WebKit::NetworkCache::Storage::mayContainBlob const):
2319         (WebKit::NetworkCache::Storage::shouldStoreBodyAsBlob):
2320         (WebKit::NetworkCache::estimateRecordsSize): Deleted.
2321         * NetworkProcess/cache/NetworkCacheStorage.h:
2322
2323 2019-04-25  Simon Fraser  <simon.fraser@apple.com>
2324
2325         REGRESSION (r234330): 3 legacy-animation-engine/compositing tests are flaky failures
2326         https://bugs.webkit.org/show_bug.cgi?id=188357
2327         <rdar://problem/42986633>
2328
2329         Reviewed by Dean Jackson.
2330         
2331         DumpRenderTree had no code that set page.setCompositingPolicyOverride() to Normal, so some
2332         tests would fall into low memory mode and have different behavior.
2333         
2334         Fix by moving the code that calls setCompositingPolicyOverride(Normal) from the WK2 layer
2335         to Internals, so it's shared by DRT and WTR.
2336         
2337         We no longer need the WK2 C SPI glue.
2338
2339         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2340         (WKBundlePageSetEventThrottlingBehaviorOverride):
2341         (WKBundlePageSetCompositingPolicyOverride): Deleted.
2342         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
2343
2344 2019-04-25  Chris Dumez  <cdumez@apple.com>
2345
2346         Trying to load a main resource outside the sandbox should not crash the WebContent process
2347         https://bugs.webkit.org/show_bug.cgi?id=197299
2348         <rdar://problem/49808042>
2349
2350         Reviewed by Geoffrey Garen.
2351
2352         Trying to load a main resource outside the sandbox should not crash the WebContent process. We should
2353         simply ignore the load and log an error message.
2354
2355         * UIProcess/WebPageProxy.cpp:
2356         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2357
2358 2019-04-25  Timothy Hatcher  <timothy@apple.com>
2359
2360         Only send a synthetic mouse out event if synthetic mouse move events were sent.
2361         https://bugs.webkit.org/show_bug.cgi?id=197295
2362         rdar://problem/49040233
2363
2364         Reviewed by Zalan Bujtas.
2365
2366         * WebProcess/WebPage/ios/WebPageIOS.mm:
2367         (WebKit::WebPage::completeSyntheticClick):
2368
2369 2019-04-25  Timothy Hatcher  <timothy@apple.com>
2370
2371         Disable date and time inputs on iOSMac.
2372         https://bugs.webkit.org/show_bug.cgi?id=197287
2373         rdar://problem/46794376
2374
2375         Reviewed by Wenson Hsieh.
2376
2377         * Configurations/FeatureDefines.xcconfig:
2378
2379 2019-04-25  Brady Eidson  <beidson@apple.com>
2380
2381         REGRESSION (243388): WebProcess::shouldFreezeOnSuspension() decision is flipped
2382         <rdar://problem/49755494> and https://bugs.webkit.org/show_bug.cgi?id=197284
2383
2384         Reviewed by Chris Dumez.
2385
2386         * WebProcess/cocoa/WebProcessCocoa.mm:
2387         (WebKit::WebProcess::shouldFreezeOnSuspension const): If any non-suspended pages are in the process it should
2388           be eligible. Only if all pages are suspended should it be jetsam-able.
2389
2390 2019-04-25  Alex Christensen  <achristensen@webkit.org>
2391
2392         Start using C++17
2393         https://bugs.webkit.org/show_bug.cgi?id=197131
2394
2395         Reviewed by Darin Adler.
2396
2397         * Configurations/Base.xcconfig:
2398         * DerivedSources.make:
2399
2400 2019-04-25  Alexander Mikhaylenko  <exalm7659@gmail.com>
2401
2402         [GTK] Back/Forward gesture interferes with scrolling
2403         https://bugs.webkit.org/show_bug.cgi?id=197168
2404
2405         Reviewed by Michael Catanzaro.
2406
2407         When the gesture is released with 0 velocity close to an edge of the webview,
2408         the finishing animation is way too long, and in some cases it can look like the
2409         gesture is already over, when it's still animating. By scrolling vertically while
2410         that happens, it's possible to reset animation over and over again.
2411
2412         To reduce the duration in this case, instead of using maximum possible duration
2413         (400ms), introduce a base velocity and use it for calculating the duration if
2414         the actual velocity, relative to the end point, is equal to or less than 0.
2415
2416         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
2417         (WebKit::ViewGestureController::SwipeProgressTracker::startAnimation):
2418
2419 2019-04-25  Alexander Mikhaylenko  <exalm7659@gmail.com>
2420
2421         [GTK] Back/forward gesture snapshot always times out
2422         https://bugs.webkit.org/show_bug.cgi?id=197233
2423
2424         Reviewed by Michael Catanzaro.
2425
2426         Delaying web process launch caused a regression where we create ViewGestureController when the
2427         web process doesn't yet exist. The controller immediately tries to connect to it and fails,
2428         and because of that never receives DidHitRenderTreeSizeThreshold() message, so navigation
2429         snapshot always stays until timeout after performing the gesture.
2430
2431         To prevent this, create the controller in webkitWebViewBaseDidRelaunchWebProcess() instead of
2432         webkitWebViewBaseCreateWebPage(). Additionally, since settings are now created earlier than
2433         ViewGestureController, store the value of whether swipe gesture is enabled in WebKitWebViewBase
2434         and immediately apply it when creating the controller.
2435
2436         * UIProcess/API/glib/WebKitWebView.cpp:
2437         (enableBackForwardNavigationGesturesChanged):
2438         Move the logic into webkitWebViewBaseSetEnableBackForwardNavigationGesture().
2439         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2440         (webkitWebViewBaseSetEnableBackForwardNavigationGesture): Added. In addition to what was in
2441         WebKitWebViewBase::enableBackForwardNavigationGesturesChanged(), store the value in a field
2442         for the case ViewGestureController doesn't exist yet.
2443         (webkitWebViewBaseCreateWebPage): Stop creating ViewGestureController.
2444         (webkitWebViewBaseDidRelaunchWebProcess): Move creating ViewGestureController here. Also
2445         immediately call setSwipeGestureEnabled() with the stored value.
2446         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
2447
2448 2019-04-25  Youenn Fablet  <youenn@apple.com>
2449
2450         [Mac iOS WK2] Layout Test http/wpt/cache-storage/cache-quota-after-restart.any.html is a flaky failure
2451         https://bugs.webkit.org/show_bug.cgi?id=197040
2452         <rdar://problem/49997641>
2453
2454         Reviewed by Antti Koivisto.
2455
2456         Delay write operations in case synchronize is ongoing.
2457         This is restricted to AvoidRandomness mode which is always used by CacheAPI
2458         and is also used by network cache for layout tests.
2459
2460         Tested by cache-quota-after-restart.any.html no longer exhibiting write disk errors.
2461
2462         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2463         (WebKit::NetworkCache::Storage::synchronize):
2464         (WebKit::NetworkCache::Storage::store):
2465
2466 2019-04-25  Commit Queue  <commit-queue@webkit.org>
2467
2468         Unreviewed, rolling out r244627.
2469         https://bugs.webkit.org/show_bug.cgi?id=197282
2470
2471         Causing internal build failures (Requested by ShawnRoberts on
2472         #webkit).
2473
2474         Reverted changeset:
2475
2476         "Create AVFoundationSoftLink.{h,mm} to reduce duplicate code"
2477         https://bugs.webkit.org/show_bug.cgi?id=197171
2478         https://trac.webkit.org/changeset/244627
2479
2480 2019-04-24  Carlos Garcia Campos  <cgarcia@igalia.com>
2481
2482         [GTK] Hardcoded text color in input fields
2483         https://bugs.webkit.org/show_bug.cgi?id=126907
2484
2485         Reviewed by Michael Catanzaro.
2486
2487         Implement PageClient::effectiveAppearanceIsDark() for GTK port.
2488
2489         * UIProcess/API/gtk/PageClientImpl.cpp:
2490         (WebKit::PageClientImpl::effectiveAppearanceIsDark const): Check if gtk-application-prefer-dark-theme setting is
2491         enabled, or the theme name contains the -dark suffix or the GTK_THEME environment variable contains the :dark suffix.
2492         * UIProcess/API/gtk/PageClientImpl.h:
2493         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2494         (themeChanged): Notify the WebPageProxy that the theme has changed.
2495         (webkitWebViewBaseSetToplevelOnScreenWindow): Connect to notify::gtk-application-prefer-dark-theme and notify::gtk-theme-name.
2496         * WebProcess/WebPage/WebPage.cpp:
2497         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2498         (WebKit::WebPage::setUseDarkAppearance): Set gtk-application-prefer-dark-theme setting accordingly.
2499
2500 2019-04-24  Zalan Bujtas  <zalan@apple.com>
2501
2502         Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
2503         https://bugs.webkit.org/show_bug.cgi?id=196948
2504         <rdar://problem/49927131>
2505
2506         Reviewed by Tim Horton.
2507
2508         Move intrinsicContentSizeDidChange out of DrawingArea. Intrinsic content size is a layout concept and
2509         after r244291 there's no reason to have it in DrawingArea.
2510
2511         * UIProcess/DrawingAreaProxy.h:
2512         (WebKit::DrawingAreaProxy::didUpdateGeometry):
2513         (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
2514         * UIProcess/DrawingAreaProxy.messages.in:
2515         * UIProcess/WebPageProxy.cpp:
2516         (WebKit::WebPageProxy::didChangeIntrinsicContentSize):
2517         (WebKit::WebPageProxy::setViewLayoutSize):
2518         * UIProcess/WebPageProxy.h:
2519         * UIProcess/WebPageProxy.messages.in:
2520         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
2521         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2522         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
2523         * UIProcess/mac/WebPageProxyMac.mm:
2524         (WebKit::WebPageProxy::intrinsicContentSizeDidChange): Deleted.
2525         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2526         (WebKit::WebChromeClient::intrinsicContentsSizeChanged const):
2527         * WebProcess/WebCoreSupport/WebChromeClient.h:
2528         * WebProcess/WebPage/WebPage.cpp:
2529         (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded):
2530         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
2531         * WebProcess/WebPage/WebPage.h:
2532         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2533         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2534         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
2535         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded): Deleted.
2536
2537 2019-04-24  Commit Queue  <commit-queue@webkit.org>
2538
2539         Unreviewed, rolling out r244228.
2540         https://bugs.webkit.org/show_bug.cgi?id=197262
2541
2542         Causes compat issues (Requested by smfr on #webkit).
2543
2544         Reverted changeset:
2545
2546         "Unreviewed test gardening for Windows."
2547         https://trac.webkit.org/changeset/244228
2548
2549 2019-04-24  Eric Carlson  <eric.carlson@apple.com>
2550
2551         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
2552         https://bugs.webkit.org/show_bug.cgi?id=197171
2553         <rdar://problem/47454979>
2554
2555         Reviewed by Youenn Fablet.
2556
2557         * Shared/ios/WebIconUtilities.mm:
2558         (WebKit::iconForVideoFile):
2559         * Shared/mac/WebCoreArgumentCodersMac.mm:
2560         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
2561         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
2562         * UIProcess/Cocoa/UIDelegate.mm:
2563         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
2564         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
2565         (WebKit::PlatformCALayerRemoteCustom::clone const):
2566
2567 2019-04-24  Per Arne Vollan  <pvollan@apple.com>
2568
2569         [macOS] Fix syscall sandbox violation
2570         https://bugs.webkit.org/show_bug.cgi?id=197247
2571         <rdar://problem/50026580>
2572
2573         Reviewed by Brent Fulgham.
2574
2575         A missing syscall in the sandbox of the WebContent process is causing a crash.
2576
2577         * WebProcess/com.apple.WebProcess.sb.in:
2578
2579 2019-04-24  John Wilander  <wilander@apple.com>
2580
2581         Age out unconverted Ad Click Attributions after one week.
2582         https://bugs.webkit.org/show_bug.cgi?id=197238
2583         <rdar://problem/50177349>
2584
2585         Reviewed by Chris Dumez.
2586
2587         AdClickAttributionManager::storeUnconverted() and
2588         AdClickAttributionManager::convert() now start by calling the new
2589         AdClickAttributionManager::clearExpired() function to remove any
2590         expired, unconverted attributions before continuing.
2591
2592         The rest of the patch is infrastructure to allow tests to expire
2593         all unconverted attributions early.
2594
2595         * NetworkProcess/AdClickAttributionManager.cpp:
2596         (WebKit::AdClickAttributionManager::storeUnconverted):
2597         (WebKit::AdClickAttributionManager::convert):
2598         (WebKit::AdClickAttributionManager::clearExpired):
2599         (WebKit::AdClickAttributionManager::markAllUnconvertedAsExpiredForTesting):
2600         * NetworkProcess/AdClickAttributionManager.h:
2601         * NetworkProcess/NetworkProcess.cpp:
2602         (WebKit::NetworkProcess::markAdClickAttributionsAsExpiredForTesting):
2603         * NetworkProcess/NetworkProcess.h:
2604         * NetworkProcess/NetworkProcess.messages.in:
2605         * NetworkProcess/NetworkSession.cpp:
2606         (WebKit::NetworkSession::markAdClickAttributionsAsExpiredForTesting):
2607         * NetworkProcess/NetworkSession.h:
2608         * UIProcess/API/C/WKPage.cpp:
2609         (WKPageSetAdClickAttributionConversionURLForTesting):
2610         (WKPageMarkAdClickAttributionsAsExpiredForTesting):
2611         * UIProcess/API/C/WKPagePrivate.h:
2612         * UIProcess/WebPageProxy.cpp:
2613         (WebKit::WebPageProxy::markAdClickAttributionsAsExpiredForTesting):
2614         * UIProcess/WebPageProxy.h:
2615
2616 2019-04-24  Wenson Hsieh  <wenson_hsieh@apple.com>
2617
2618         Plumb the navigation's request when determining recommended compatibility mode
2619         https://bugs.webkit.org/show_bug.cgi?id=197225
2620         <rdar://problem/48389965>
2621
2622         Reviewed by Alex Christensen.
2623
2624         Adds a new argument to effectiveCompatibilityModeAfterAdjustingPolicies.
2625
2626         * UIProcess/WebPageProxy.cpp:
2627         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2628         (WebKit::WebPageProxy::effectiveCompatibilityModeAfterAdjustingPolicies):
2629         * UIProcess/WebPageProxy.h:
2630
2631 2019-04-24  Tim Horton  <timothy_horton@apple.com>
2632
2633         Clean up WKActionSheetAssistant's use of LaunchServices
2634         https://bugs.webkit.org/show_bug.cgi?id=194645
2635         <rdar://problem/47707952>
2636
2637         Reviewed by Andy Estes.
2638
2639         * UIProcess/ios/WKActionSheetAssistant.mm:
2640         (applicationHasAppLinkEntitlements):
2641         (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]):
2642         (-[WKActionSheetAssistant _appendOpenActionsForURL:actions:elementInfo:]):
2643         (appLinkForURL): Deleted.
2644         Make this function much more early-returny and flat.
2645         Adopt LS sync SPI instead of using a semaphore ourselves.
2646         Adopt modern open SPI.
2647
2648 2019-04-24  Simon Fraser  <simon.fraser@apple.com>
2649
2650         Make it possible to control the renderTreeAsText output by setting options on testRunner
2651         https://bugs.webkit.org/show_bug.cgi?id=197133
2652
2653         Reviewed by Sam Weinig.
2654
2655         Add testRunner.setRenderTreeDumpOptions() and expose the subset of RenderAsTextFlag flags
2656         that make sense in testing (those that don't dump unstable data like addresses), and plumb
2657         these flags through the various framework layers.
2658
2659         Convert RenderAsTextBehavior to an OptionSet<RenderAsTextFlag>.
2660
2661         Fix code generation in WebKitTestRunner to generate bindings for IDL const values,
2662         and hand-code DumpRenderTree bindings.
2663
2664         Some cleanup of the TestRunners, using member initializers.
2665
2666         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2667         (WKBundlePageCopyRenderTreeExternalRepresentation):
2668         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
2669         * WebProcess/WebPage/WebPage.cpp:
2670         (WebKit::toRenderAsTextFlags):
2671         (WebKit::WebPage::renderTreeExternalRepresentation const):
2672         (WebKit::WebPage::renderTreeExternalRepresentationForPrinting const):
2673         * WebProcess/WebPage/WebPage.h:
2674
2675 2019-04-24  Alex Christensen  <achristensen@webkit.org>
2676
2677         WKContentRuleLists should have a maximum FileProtection of CompleteUnlessOpen
2678         https://bugs.webkit.org/show_bug.cgi?id=197078
2679         <rdar://problem/49564348>
2680
2681         Reviewed by Geoff Garen.
2682
2683         r242735 was a fix for crashes when using mmap'd memory in apps with default FileProtection of NSFileProtectionComplete.
2684         It is more memory efficient and just as secure to reduce the FileProtection of these files to NSFileProtectionCompleteUnlessOpen.
2685
2686         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
2687         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
2688         (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath):
2689         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting): Deleted.
2690         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting): Deleted.
2691         * NetworkProcess/cache/NetworkCacheFileSystem.h:
2692         * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm: Added.
2693         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
2694         (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath):
2695         * Shared/WebCompiledContentRuleList.cpp:
2696         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
2697         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
2698         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
2699         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
2700         (WebKit::WebCompiledContentRuleList::actions const):
2701         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const): Deleted.
2702         * Shared/WebCompiledContentRuleList.h:
2703         * Shared/WebCompiledContentRuleListData.cpp:
2704         (WebKit::WebCompiledContentRuleListData::encode const):
2705         (WebKit::WebCompiledContentRuleListData::decode):
2706         (WebKit::WebCompiledContentRuleListData::size const): Deleted.
2707         (WebKit::WebCompiledContentRuleListData::dataPointer const): Deleted.
2708         * Shared/WebCompiledContentRuleListData.h:
2709         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
2710         * SourcesCocoa.txt:
2711         * UIProcess/API/APIContentRuleList.cpp:
2712         (API::ContentRuleList::usesCopiedMemory const): Deleted.
2713         * UIProcess/API/APIContentRuleList.h:
2714         * UIProcess/API/APIContentRuleListStore.cpp:
2715         (API::openAndMapOrCopyContentRuleList):
2716         (API::compiledToFile):
2717         (API::createExtension):
2718         (API::ContentRuleListStore::getContentRuleListSource):
2719         (API::ContentRuleListStore::readContentsOfFile): Deleted.
2720         (API::MappedOrCopiedData::dataPointer const): Deleted.
2721         * UIProcess/API/APIContentRuleListStore.h:
2722         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
2723         (API::ContentRuleListStore::readContentsOfFile): Deleted.
2724         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
2725         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]): Deleted.
2726         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
2727         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
2728         (-[_WKUserContentFilter usesCopiedMemory]): Deleted.
2729         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
2730         * WebKit.xcodeproj/project.pbxproj:
2731
2732 2019-04-24  David Kilzer  <ddkilzer@apple.com>
2733
2734         Fix build due to missing SPI declaration of kAXSFullKeyboardAccessEnabledNotification
2735
2736         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm: Import
2737         AccessibilitySupportSPI.h.
2738
2739 2019-04-24  Chris Dumez  <cdumez@apple.com>
2740
2741         URL set by document.open() is communicated with the WebPageProxy but not the WebFrameProxy
2742         https://bugs.webkit.org/show_bug.cgi?id=197214
2743         <rdar://problem/49237544>
2744
2745         Reviewed by Alex Christensen.
2746
2747         URL set by document.open() is communicated with the WebPageProxy (since r244361) but not the
2748         WebFrameProxy. This patch fixes this.
2749
2750         * UIProcess/API/Cocoa/WKWebView.mm:
2751         (-[WKWebView _mainFrameURL]):
2752         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2753         * UIProcess/FrameLoadState.cpp:
2754         (WebKit::FrameLoadState::didExplicitOpen):
2755         * UIProcess/FrameLoadState.h:
2756         * UIProcess/WebFrameProxy.cpp:
2757         (WebKit::WebFrameProxy::didExplicitOpen):
2758         * UIProcess/WebFrameProxy.h:
2759         * UIProcess/WebPageProxy.cpp:
2760         (WebKit::WebPageProxy::didExplicitOpenForFrame):
2761
2762 2019-04-24  Chris Dumez  <cdumez@apple.com>
2763
2764         X-Frame-Options header should be ignored when frame-ancestors CSP directive is present
2765         https://bugs.webkit.org/show_bug.cgi?id=197226
2766         <rdar://problem/50155649>
2767
2768         Reviewed by Alex Christensen.
2769
2770         * NetworkProcess/NetworkResourceLoader.cpp:
2771         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
2772
2773 2019-04-24  Dean Jackson  <dino@apple.com>
2774
2775         Rename _highlightLongPressCanClick and only add gesture recognizer when necessary
2776         https://bugs.webkit.org/show_bug.cgi?id=197231
2777         <rdar://problem/50164234>
2778
2779         Reviewed by Antoine Quint.
2780
2781         Rename _highlightLongPressCanClick to _longPressCanClick since it will be
2782         used in other places.
2783
2784         Only attach the _highlightLongPressGestureRecognizer when we're not
2785         using long presses for preview. This might revert in the future, if we
2786         can set up an appropriate gesture resolution between the two.
2787
2788         * UIProcess/ios/WKContentViewInteraction.h:
2789         * UIProcess/ios/WKContentViewInteraction.mm:
2790         (-[WKContentView setupInteraction]):
2791         (-[WKContentView _webTouchEvent:preventsNativeGestures:]):
2792         (-[WKContentView _highlightLongPressRecognized:]):
2793         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
2794         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
2795         (-[WKContentView _previewItemControllerDidCancelPreview:]):
2796
2797 2019-04-24  chris fleizach  <cfleizach@apple.com>
2798
2799         AX: Remove deprecated Accessibility Object Model events
2800         https://bugs.webkit.org/show_bug.cgi?id=197073
2801         <rdar://problem/50027819>
2802
2803         Reviewed by Ryosuke Niwa.
2804
2805         * Platform/spi/ios/AccessibilitySupportSPI.h:
2806         * UIProcess/API/Cocoa/WKWebView.mm:
2807         (-[WKWebView _initializeWithConfiguration:]):
2808         (-[WKWebView dealloc]):
2809         (accessibilityEventsEnabledChangedCallback): Deleted.
2810         (-[WKWebView _updateAccessibilityEventsEnabled]): Deleted.
2811         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2812         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm:
2813         * UIProcess/WebPageProxy.cpp:
2814         (WebKit::WebPageProxy::updateAccessibilityEventsEnabled): Deleted.
2815         * UIProcess/WebPageProxy.h:
2816         * WebProcess/WebPage/WebPage.cpp:
2817         (WebKit::WebPage::updateAccessibilityEventsEnabled): Deleted.
2818         * WebProcess/WebPage/WebPage.h:
2819         * WebProcess/WebPage/WebPage.messages.in:
2820
2821 2019-04-23  John Wilander  <wilander@apple.com>
2822
2823         Move Ad Click Attribution from internal feature to experimental feature
2824         https://bugs.webkit.org/show_bug.cgi?id=197218
2825         <rdar://problem/47651691>
2826
2827         Reviewed by Brent Fulgham.
2828
2829         * Shared/WebPreferences.yaml:
2830
2831 2019-04-23  Keith Rollin  <krollin@apple.com>
2832
2833         Add Xcode version check for Header post-processing scripts
2834         https://bugs.webkit.org/show_bug.cgi?id=197116
2835         <rdar://problem/50058968>
2836
2837         Reviewed by Brent Fulgham.
2838
2839         There are several places in our Xcode projects that post-process
2840         header files after they've been exported. Because of XCBuild, we're
2841         moving to a model where the post-processing is performed at the same
2842         time the header files are exported, rather than as a distinct
2843         post-processing step. This patch disables the distinct step when the
2844         inline processing is available.
2845
2846         In practice, this means prefixing appropriate post-processing Custom
2847         Build phases with:
2848
2849         if [ "${XCODE_VERSION_MAJOR}" -ge "1100" -a "${USE_NEW_BUILD_SYSTEM}" = "YES" ]; then
2850             # In this configuration, post-processing is performed at the same time as copying in the postprocess-header-rule script, so there's no need for this separate step.
2851             exit 0
2852         fi
2853
2854         * WebKit.xcodeproj/project.pbxproj:
2855
2856 2019-04-23  John Wilander  <wilander@apple.com>
2857
2858         Remove Ad Click Attribution data when removing website data
2859         https://bugs.webkit.org/show_bug.cgi?id=197215
2860         <rdar://problem/47668988>
2861
2862         Reviewed by Chris Dumez.
2863
2864         This patch adds a new WebsiteDataType called AdClickAttributions and flags
2865         it as owned by the network process.
2866
2867         The new website data type is added to the Cocoa API layer for
2868         website data records management.
2869
2870         When either of the two WebsiteDataStore::removeData() functions calls
2871         NetworkProcess::deleteWebsiteData() or
2872         NetworkProcess::deleteWebsiteDataForOrigins() over IPC, the network
2873         process now calls into AdClickAttributionManager::clear() and
2874         AdClickAttributionManager::clearForRegistrableDomain() respectively,
2875         if the website datatypes include WebsiteDataType::AdClickAttributions.
2876
2877         The patch removes a couple of completion handlers in NetworkSession function
2878         calls are because those are not asynchronous.
2879
2880         * NetworkProcess/AdClickAttributionManager.cpp:
2881         (WebKit::AdClickAttributionManager::clear):
2882         (WebKit::AdClickAttributionManager::clearForRegistrableDomain):
2883         (WebKit::AdClickAttributionManager::toString const):
2884         * NetworkProcess/AdClickAttributionManager.h:
2885         * NetworkProcess/NetworkProcess.cpp:
2886         (WebKit::NetworkProcess::deleteWebsiteData):
2887         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2888         (WebKit::NetworkProcess::clearAdClickAttribution):
2889         * NetworkProcess/NetworkSession.cpp:
2890         (WebKit::NetworkSession::clearAdClickAttribution):
2891         (WebKit::NetworkSession::clearAdClickAttributionForRegistrableDomain):
2892         * NetworkProcess/NetworkSession.h:
2893         * Shared/WebsiteData/WebsiteData.cpp:
2894         (WebKit::WebsiteData::ownerProcess):
2895         * Shared/WebsiteData/WebsiteDataType.h:
2896         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2897         (WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval):
2898         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2899         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
2900         (dataTypesToString):
2901         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
2902         (WebKit::toWebsiteDataType):
2903         (WebKit::toWKWebsiteDataTypes):
2904         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
2905         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2906         (+[WKWebsiteDataStore _allWebsiteDataTypesIncludingPrivate]):
2907
2908 2019-04-23  Tim Horton  <timothy_horton@apple.com>
2909
2910         Return annotated text checking strings via UIWKDocumentContext
2911         https://bugs.webkit.org/show_bug.cgi?id=197177
2912         <rdar://problem/49064839>
2913
2914         Reviewed by Ryosuke Niwa.
2915
2916         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h:
2917         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
2918         (WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions):
2919         * WebProcess/WebPage/ios/WebPageIOS.mm:
2920         (WebKit::WebPage::requestDocumentEditingContext):
2921         Respect the UIWKDocumentRequestAnnotation flag, returning an attributed
2922         string containing the platform text checking annotations.
2923
2924 2019-04-23  Commit Queue  <commit-queue@webkit.org>
2925
2926         Unreviewed, rolling out r244556.
2927         https://bugs.webkit.org/show_bug.cgi?id=197212
2928
2929         Causing build failures on multiple builders (Requested by
2930         ShawnRoberts on #webkit).
2931
2932         Reverted changeset:
2933
2934         "Create AVFoundationSoftLink.{h,mm} to reduce duplicate code"
2935         https://bugs.webkit.org/show_bug.cgi?id=197171
2936         https://trac.webkit.org/changeset/244556
2937
2938 2019-04-23  Remy Demarest  <rdemarest@apple.com>
2939
2940         Build fix after r244545.
2941
2942         Reviewed by Tim Horton.
2943
2944         * Platform/spi/mac/AppKitSPI.h:
2945         The SPI was an IPI in High Sierra.
2946
2947 2019-04-23  Per Arne Vollan  <pvollan@apple.com>
2948
2949         [iOS] Input field on ddg.gg is auto focused when url is entered with the software keyboard
2950         https://bugs.webkit.org/show_bug.cgi?id=196740
2951
2952         Reviewed by Megan Gardner.
2953
2954         When an url for a page with an autofocused input field  is entered with the software keyboard,
2955         the input field is auto selected, and the software keyboard reappears. This does not happen
2956         when picking the url from favorites. After using the software keyboard to enter the url, the
2957         activity state is being changed to focused. The method '_elementDidFocus' checks whether the
2958         activity state changed, and allows the software keyboard to be shown in this case. To avoid
2959         showing the software keyboard in this case, send the changing activity state bitfield to the
2960         UI process, and check if the focus flag is the only flag set.
2961   
2962         * UIProcess/ios/WKContentViewInteraction.mm:
2963         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2964
2965 2019-04-23  Guy Lewin  <guy@lewin.co.il>
2966
2967         Multiple File Input Icon Set Regardless of File List
2968         https://bugs.webkit.org/show_bug.cgi?id=195537
2969
2970         Reviewed by Alexey Proskuryakov.
2971
2972         Add WKOpenPanelResultListenerChooseMediaFiles() to choose files with
2973         icon and display string on iOS file open panels
2974
2975         * UIProcess/API/C/WKOpenPanelResultListener.cpp:
2976         (WKOpenPanelResultListenerChooseMediaFiles):
2977         * UIProcess/API/C/WKOpenPanelResultListener.h:
2978
2979 2019-04-23  Eric Carlson  <eric.carlson@apple.com>
2980
2981         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
2982         https://bugs.webkit.org/show_bug.cgi?id=197171
2983         <rdar://problem/47454979>
2984
2985         Reviewed by Youenn Fablet.
2986
2987         * Shared/ios/WebIconUtilities.mm:
2988         (WebKit::iconForVideoFile):
2989         * Shared/mac/WebCoreArgumentCodersMac.mm:
2990         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
2991         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
2992         * UIProcess/Cocoa/UIDelegate.mm:
2993         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
2994         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
2995         (WebKit::PlatformCALayerRemoteCustom::clone const):
2996
2997 2019-04-22  Dean Jackson  <dino@apple.com>
2998
2999         Use additional members and protocols from WebKitAdditions in WKContentViewInteraction
3000         https://bugs.webkit.org/show_bug.cgi?id=197184
3001         <rdar://problem/50113848>
3002
3003         Reviewed by Wenson Hsieh.
3004
3005         WebKitAdditions defines some macros to include additional members
3006         and protocols for WKContentViewInteraction.
3007
3008         It also defines some new functions. Provide empty version
3009         of those functions when WebKitAdditions is not available.
3010
3011         * UIProcess/ios/WKContentViewInteraction.h:
3012         * UIProcess/ios/WKContentViewInteraction.mm:
3013         (-[WKContentView _registerPreview]):
3014         (-[WKContentView _unregisterPreview]):
3015
3016 2019-04-23  Tim Horton  <timothy_horton@apple.com>
3017
3018         Action sheet shares a stringified URL instead of a URL object
3019         https://bugs.webkit.org/show_bug.cgi?id=197185
3020         <rdar://problem/49962249>
3021
3022         Reviewed by Darin Adler.
3023
3024         * UIProcess/Cocoa/WKShareSheet.h:
3025         * UIProcess/Cocoa/WKShareSheet.mm:
3026         (-[WKShareSheet presentWithParameters:inRect:completionHandler:]):
3027         (-[WKShareSheet presentWithParameters:completionHandler:]): Deleted.
3028         * UIProcess/Cocoa/WebViewImpl.mm:
3029         (WebKit::WebViewImpl::showShareSheet):
3030         * UIProcess/ios/PageClientImplIOS.mm:
3031         (WebKit::PageClientImpl::showShareSheet):
3032         Make it possible to optionally provide WKShareSheet with
3033         a rect to present relative to.
3034
3035         * UIProcess/ios/WKContentViewInteraction.h:
3036         * UIProcess/ios/WKContentViewInteraction.mm:
3037         (-[WKContentView _showShareSheet:inRect:completionHandler:]):
3038         (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]):
3039         (-[WKContentView _showShareSheet:completionHandler:]): Deleted.
3040         Instead of stringifying the URL and using the text selection assistant's
3041         share method, hand WKShareSheet a proper URL.
3042
3043 2019-04-23  Ryosuke Niwa  <rniwa@webkit.org>
3044
3045         [iOS] element.focus() sometimes fails to reveal the focused element when it becomes editable dynamically
3046         https://bugs.webkit.org/show_bug.cgi?id=197188
3047
3048         Reviewed by Wenson Hsieh.
3049
3050         Commit the scroll tree update before revealing the keyboard via editor state update.
3051
3052         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
3053         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
3054
3055 2019-04-23  Remy Demarest  <rdemarest@apple.com>
3056
3057         Fix layout issues occuring when entering full screen mode.
3058         https://bugs.webkit.org/show_bug.cgi?id=197086
3059         <rdar://problem/47733671>.
3060
3061         Reviewed by Darin Adler.
3062
3063         This issue is the result of changing the style mask of the window after entering
3064         full screen mode. Safari adds an invisible toolbar to display the URL of the page
3065         which ends up breaking the layout. Having that window use a style that includes a
3066         titlebar fixes the bug.
3067
3068         * Platform/spi/mac/AppKitSPI.h:
3069         Declare an SPI to be used in WKFullScreenWindowController.
3070
3071         * UIProcess/Cocoa/WebViewImpl.mm:
3072         (WebKit::WebViewImpl::fullScreenWindow): Make the full screen window show a titlebar
3073         and make the content view underlap the titlebar to match the current behavior.
3074         Remove NSWindowStyleMaskBorderless which has no effects since it is equal to zero.
3075
3076         * UIProcess/mac/WKFullScreenWindowController.mm:
3077         (-[WKFullScreenWindowController initWithWindow:webView:page:]): Hide the titlebar
3078         before beginning the animation to full screen.
3079         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Show the title
3080         bar when in full screen instead of a blank bar.
3081         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): Hide the title
3082         bar to restore the initial setting.
3083
3084 2019-04-23  John Wilander  <wilander@apple.com>
3085
3086         Ad Click Attribution redirects to well-known location should not trigger a conversion if they are blocked by content blockers
3087         https://bugs.webkit.org/show_bug.cgi?id=197183
3088         <rdar://problem/47763188>
3089
3090         Reviewed by Alex Christensen.
3091
3092         Ad Click Attribution conversions are picked up in the redirect handler
3093         in WebKit::NetworkResourceLoader. Content blocking typically happens in
3094         the continued redirect request handling in the web content process and
3095         a blocked request comes back empty.
3096
3097         We need to call the WebKit::NetworkLoadChecker in the network process
3098         for these specific redirects, just like we do for Ping.
3099
3100         The change makes use of the existing function
3101         NetworkLoadChecker::enableContentExtensionsCheck() for this purpose.
3102
3103         In essence, this change makes it possible to block all conversions made
3104         to a "/.well-known/ad-click-attribution/" URL.
3105
3106         * NetworkProcess/NetworkResourceLoader.cpp:
3107         (WebKit::NetworkResourceLoader::handleAdClickAttributionConversion):
3108             New convenience function.
3109         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
3110             Now calls NetworkLoadChecker::enableContentExtensionsCheck() if
3111             an Ad Click Attribution conversion was found in the redirect URL.
3112         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
3113             If the request was not blocked, it will store any found conversion here.
3114         * NetworkProcess/NetworkResourceLoader.h:
3115
3116 2019-04-23  Don Olmstead  <don.olmstead@sony.com>
3117
3118         [CMake][Win] Use target oriented design for WebKit
3119         https://bugs.webkit.org/show_bug.cgi?id=197173
3120
3121         Reviewed by Alex Christensen.
3122
3123         Enumerate public framework headers for WinCairo's WebKit implementation and copy them.
3124         Migrate to use WebKit_DERIVED_SOURCES_DIR.
3125
3126         * CMakeLists.txt:
3127         * PlatformGTK.cmake:
3128         * PlatformWPE.cmake:
3129         * PlatformWin.cmake:
3130
3131 2019-04-23  Chris Dumez  <cdumez@apple.com>
3132
3133         [Process-Swap-On-Navigation] WebKit hangs when going back to a form submission's page due to Process-Swap-On-Navigation on iOS 12.2 and higher
3134         https://bugs.webkit.org/show_bug.cgi?id=197097
3135         <rdar://problem/50048318>
3136
3137         Reviewed by Alex Christensen.
3138
3139         The issue is that when doing a history navigation with form data, we try to resubmit the form.
3140         We initially use the ReturnCacheDataDontLoad cache policy without prompting the user to get
3141         cached data. If this fails, we sent a DidFailProvisionalLoadForFrame IPC to the UIProcess but
3142         the WebContent process actually retries the load with ReturnCacheDataElseLoad cache policy.
3143         This new load triggers a new decidePolicyForNavigationAction.
3144
3145         This would cause trouble with process-swapping because we normally destroy the
3146         ProvisionalPageProxy as soon as we receive a DidFailProvisionalLoadForFrame IPC from the
3147         provisional process. As a result, the provisional process would not be able to retry.
3148
3149         To address the issue, we add pass a flag with the DidFailProvisionalLoadForFrame IPC to
3150         if the load will continue or not. When this flag is set, the UIProcess does not destroy
3151         the provisional page.
3152
3153         * Scripts/webkit/messages.py:
3154         Minor IPC message handler build fix.
3155
3156         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
3157         (-[WKURLSchemeTaskImpl _onlyIfCached]):
3158         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
3159         Add new _onlyIfCached SPI to WKURLSchemeTaskPrivate to allow for API testing.
3160
3161         * UIProcess/ProvisionalPageProxy.cpp:
3162         (WebKit::ProvisionalPageProxy::cancel):
3163         Pass WillContinueLoading flag.
3164
3165         (WebKit::ProvisionalPageProxy::validateInput):
3166         Consider IPC with a navigationID of 0 as valid. When the navigation is triggered by the
3167         WebContent process, it sends us a DecidePolicyForNavigationActionAsync IPC with a navigationID
3168         of 0, until the UIProcess can generate a valid identifier.
3169
3170         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
3171
3172         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
3173         When the WebPageProxy has generated a navigationID for the new WebContent process-initiated
3174         navigation, update m_navigationID so that follow-up IPC is considered valid.
3175
3176         * UIProcess/ProvisionalPageProxy.h:
3177         * UIProcess/WebPageProxy.cpp:
3178         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
3179         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
3180         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
3181         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3182         * UIProcess/WebPageProxy.h:
3183         * UIProcess/WebPageProxy.messages.in:
3184         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3185         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
3186         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3187
3188 2019-04-22  Zalan Bujtas  <zalan@apple.com>
3189
3190         [ContentChangeObserver] Some dropdown menus may close without user gesture on americanexpress.com
3191         https://bugs.webkit.org/show_bug.cgi?id=197175
3192         <rdar://problem/49613013>
3193
3194         Reviewed by Simon Fraser.
3195
3196         Do not generate additional synthetic mouse events (e.g. mouseout in this case) when the content handles the click event. This helps cases when the synthetic mouseout ended up dismissing the dropdown menus.
3197         However it won't regress cases like youtube.com, where sending mouseout is required to have the control bar dismissed on play. 
3198
3199         * WebProcess/WebPage/ios/WebPageIOS.mm:
3200         (WebKit::WebPage::completeSyntheticClick):
3201
3202 2019-04-22  Alex Christensen  <achristensen@webkit.org>
3203
3204         Deprecate WKContextCreateWithInjectedBundlePath
3205         https://bugs.webkit.org/show_bug.cgi?id=197169
3206
3207         Reviewed by Youenn Fablet.
3208
3209         * UIProcess/API/C/WKContext.h:
3210
3211 2019-04-22  Alex Christensen  <achristensen@webkit.org>
3212
3213         REGRESSION(r230681) Do not use stored credentials if WKBundlePageResourceLoadClient.shouldUseCredentialStorage returns false
3214         https://bugs.webkit.org/show_bug.cgi?id=197093
3215         <rdar://problem/49708268>
3216
3217         Reviewed by Chris Dumez.
3218
3219         Only get the StoredCredentialsPolicy from the NetworkLoadChecker if we haven't already been told not to use credentials.
3220         Also add some test infrastructure for clearing persistent credentials added by the test.
3221
3222         * NetworkProcess/NetworkProcess.cpp:
3223         (WebKit::NetworkProcess::removeCredential):
3224         * NetworkProcess/NetworkProcess.h:
3225         * NetworkProcess/NetworkProcess.messages.in:
3226         * NetworkProcess/NetworkResourceLoader.cpp:
3227         (WebKit::NetworkResourceLoader::startNetworkLoad):
3228         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3229         (WebKit::NetworkProcess::removeCredential):
3230         * UIProcess/API/Cocoa/WKProcessPool.mm:
3231         (-[WKProcessPool _removeCredential:forProtectionSpace:completionHandler:]):
3232         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3233         * UIProcess/WebProcessPool.cpp:
3234         (WebKit::WebProcessPool::removeCredential):
3235         * UIProcess/WebProcessPool.h:
3236
3237 2019-04-22  Chris Dumez  <cdumez@apple.com>
3238
3239         Delayed WebProcessLaunch may break the _relatedWebView SPI
3240         https://bugs.webkit.org/show_bug.cgi?id=197160
3241
3242         Reviewed by Alex Christensen.
3243
3244         Delayed WebProcessLaunch may break the _relatedWebView SPI. The breakage would happen if the client
3245         would relate a WebView to another which has not launched its initial process yet.
3246
3247         To address the issue, when we need a running process for a WebView which has a related view, we need
3248         to make sure the related view has a running process and use that process. Previously, we would share
3249         the "dummy" process instead.
3250
3251         * UIProcess/WebPageProxy.cpp:
3252         (WebKit::WebPageProxy::launchProcess):
3253         (WebKit::WebPageProxy::ensureRunningProcess):
3254         * UIProcess/WebPageProxy.h:
3255         * UIProcess/WebProcessPool.cpp:
3256         (WebKit::WebProcessPool::createWebPage):
3257
3258 2019-04-22  David Quesada  <david_quesada@apple.com>
3259
3260         Remove linked-on-or-after check for download attribute handling
3261         https://bugs.webkit.org/show_bug.cgi?id=197176
3262         rdar://problem/48459714
3263
3264         Reviewed by Alex Christensen.
3265
3266         There are no apps linked prior to this SDK version that are using the _WKDownload SPI,
3267         so it doesn't make sense to preserve the old behavior of forcing download-attribute
3268         links to start downloads.
3269
3270         * UIProcess/Cocoa/VersionChecks.h:
3271         * UIProcess/WebPageProxy.cpp:
3272         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3273
3274 2019-04-22  Chris Dumez  <cdumez@apple.com>
3275
3276         Unreviewed, rolling out r244502.
3277
3278         Caused crashes on the bots
3279
3280         Reverted changeset:
3281
3282         "Delayed WebProcessLaunch may break the _relatedWebView SPI"
3283         https://bugs.webkit.org/show_bug.cgi?id=197160
3284         https://trac.webkit.org/changeset/244502
3285
3286 2019-04-22  Ryan Haddad  <ryanhaddad@apple.com>
3287
3288         Unreviewed, rolling out r244437.
3289
3290         Still breaks internal tests.
3291
3292         Reverted changeset:
3293
3294         "InjectedBundle parameters often need initialization function
3295         called before unarchiving"
3296         https://bugs.webkit.org/show_bug.cgi?id=189709
3297         https://trac.webkit.org/changeset/244437
3298
3299 2019-04-22  Chris Dumez  <cdumez@apple.com>
3300
3301         Delayed WebProcessLaunch may break the _relatedWebView SPI
3302         https://bugs.webkit.org/show_bug.cgi?id=197160
3303
3304         Reviewed by Alex Christensen.
3305
3306         Delayed WebProcessLaunch may break the _relatedWebView SPI. The breakage would happen if the client
3307         would relate a WebView to another which has not launched its initial process yet.
3308
3309         To address the issue, when we need a running process for a WebView which has a related view, we need
3310         to make sure the related view has a running process and use that process. Previously, we would share
3311         the "dummy" process instead.
3312
3313         * UIProcess/WebPageProxy.cpp:
3314         (WebKit::WebPageProxy::launchProcess):
3315         (WebKit::WebPageProxy::ensureRunningProcess):
3316         * UIProcess/WebPageProxy.h:
3317         * UIProcess/WebProcessPool.cpp:
3318         (WebKit::WebProcessPool::createWebPage):
3319
3320 2019-04-22  Ludovico de Nittis  <ludovico.denittis@collabora.com>
3321
3322         [GTK] fix gtk_style_context_set_background deprecation
3323         https://bugs.webkit.org/show_bug.cgi?id=196912
3324
3325         Reviewed by Carlos Garcia Campos.
3326
3327         Since gtk 3.18 gtk_style_context_set_background has been deprecated.
3328         Backgrounds are not rendered in the UI process, so it can be
3329         simply removed.
3330
3331         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3332         (webkitWebViewBaseRealize):
3333
3334 2019-04-21  Wenson Hsieh  <wenson_hsieh@apple.com>
3335
3336         Defer EditorState updates until the next layer tree flush in a few additional circumstances
3337         https://bugs.webkit.org/show_bug.cgi?id=197145
3338         <rdar://problem/50078170>
3339
3340         Reviewed by Darin Adler.
3341
3342         Gets rid of sendPartialEditorStateAndSchedulePostLayoutUpdate(), in favor of always scheduling a full editor
3343         state update after the next compositing flush.
3344
3345         * WebProcess/WebPage/WebPage.cpp:
3346         (WebKit::WebPage::updateEditorStateAfterLayoutIfEditabilityChanged):
3347         (WebKit::WebPage::setNeedsFontAttributes):
3348         (WebKit::WebPage::didChangeOverflowScrollPosition):
3349         (WebKit::WebPage::didChangeSelection):
3350         (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
3351         (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate): Deleted.
3352         * WebProcess/WebPage/WebPage.h:
3353         * WebProcess/WebPage/ios/WebPageIOS.mm:
3354         (WebKit::WebPage::platformEditorState const):
3355         (WebKit::WebPage::updateVisibleContentRects):
3356
3357 2019-04-21  Chris Dumez  <cdumez@apple.com>
3358
3359         Regression(r243767) WebFrame::m_navigationIsContinuingInAnotherProcess flag is never reset
3360         https://bugs.webkit.org/show_bug.cgi?id=197144
3361
3362         Reviewed by Darin Adler.
3363
3364         WebFrame::m_navigationIsContinuingInAnotherProcess flag is never reset since it was introduced in
3365         r243767. This leads to leaking Navigation objects in the UIProcess when reusing a previously
3366         suspended process because such process will no longer send the DidDestroyNavigation IPC.
3367
3368         It turns out that resetting the flags causes API tests such as ProcessSwap.QuickBackForwardNavigationWithPSON
3369         to ASSERT. This is because when the UIProcess quickly navigate back and forth without waiting for policy
3370         decisions, we may end up getting the policy decision for a particular navigation *after* we've sent the
3371         DidDestroyNavigation.
3372
3373         As a result, this patch reverts r243767 and fixes in the assertion in http/tests/adClickAttribution/store-ad-click-attribution.html
3374         another way. We initially assumed that the logic in WebPageProxy::didDestroyNavigation() was failing to
3375         ignore the DidDestroyNavigation from the previous process after a swap due to a race, maybe because it was
3376         sometimes received too late and m_provisionalPage was already cleared. However, this would not make sense
3377         since the test is crashing consistently and the page would no longer be able to receive IPC from the
3378         previous process *after* we've committed the provisional process/page.
3379
3380         The real issue was that the DidDestroyNavigation IPC was received *before* we could construct the
3381         provisional page, which is why the logic in WebPageProxy::didDestroyNavigation() was failing to ignore
3382         the bad IPC. In WebPageProxy::receivedNavigationPolicyDecision(), we were calling receivedPolicyDecision()
3383         (which would send the DidReceivePolicyDecision to the previous WebProcess) and then continueNavigationInNewProcess()
3384         in order to construct the provisional page. I personally did not expect we could receive IPC between the
3385         calls to receivedNavigationPolicyDecision() and receivedPolicyDecision(), since we are not yielding and since
3386         the DidReceivePolicyDecision IPC is asynchronous. However, this is exactly what was happening in the context
3387         of this test. The reason is that the DidReceivePolicyDecision IPC was getting wrapped in a synchronous message
3388         and sent as synchronous message due to the Connection::m_inDispatchMessageMarkedToUseFullySynchronousModeForTesting
3389         flag which seems to get set in the test due to some EventSender IPC. I believe this is because the test uses
3390         EventSender to do a click on a link which triggers the navigation.
3391
3392         To address the issue, I now call receivedNavigationPolicyDecision() *after* continueNavigationInNewProcess()
3393         to make sure that we always start the provisional load in the new process before we tell the previous process
3394         to stop loading. This way, there is no way we get IPC from the previous process about the current navigation
3395         before we have a provisional page.
3396
3397         * UIProcess/WebPageProxy.cpp:
3398         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3399         (WebKit::WebPageProxy::didDestroyNavigation):
3400         * WebProcess/WebPage/WebFrame.cpp:
3401         (WebKit::WebFrame::didReceivePolicyDecision):
3402         (WebKit::WebFrame::documentLoaderDetached):
3403         * WebProcess/WebPage/WebFrame.h:
3404
3405 2019-04-20  Chris Dumez  <cdumez@apple.com>
3406
3407         Unreviewed, fix iOS build with recent SDKs.
3408
3409         * UIProcess/API/Cocoa/WKWebView.mm:
3410         (deviceOrientation):
3411         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3412         (-[WKFullScreenViewController initWithWebView:]):
3413         (-[WKFullScreenViewController viewWillTransitionToSize:withTransitionCoordinator:]):
3414         (-[WKFullScreenViewController _statusBarFrameDidChange:]):
3415
3416 2019-04-19  John Wilander  <wilander@apple.com>
3417
3418         Disable Ad Click Attribution in ephemeral sessions and make sure conversion requests use an ephemeral, stateless session
3419         https://bugs.webkit.org/show_bug.cgi?id=197108
3420         <rdar://problem/49918702>
3421
3422         Reviewed by Alex Christensen.
3423
3424         This patch introduces a new NSURLSession in WebKit::NetworkSessionCocoa called
3425         m_ephemeralStatelessCookielessSession. As its name implies, it's ephemeral, 
3426         stateless, and has a NSHTTPCookieAcceptPolicyNever cookie policy.
3427