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