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