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