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