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