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