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