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