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