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