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