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