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