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