[WPE] Do not use a sync IPC message to send the host FD to the web process
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-02-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2
3         [WPE] Do not use a sync IPC message to send the host FD to the web process
4         https://bugs.webkit.org/show_bug.cgi?id=194216
5
6         Reviewed by Darin Adler.
7
8         It can be sent as a web page creation parameter instead.
9
10         * PlatformWPE.cmake:
11         * Shared/WebPageCreationParameters.cpp:
12         (WebKit::WebPageCreationParameters::encode const):
13         (WebKit::WebPageCreationParameters::decode):
14         * Shared/WebPageCreationParameters.h:
15         * SourcesWPE.txt:
16         * UIProcess/API/wpe/CompositingManagerProxy.cpp: Removed.
17         * UIProcess/API/wpe/CompositingManagerProxy.h: Removed.
18         * UIProcess/API/wpe/CompositingManagerProxy.messages.in: Removed.
19         * UIProcess/API/wpe/PageClientImpl.cpp:
20         (WebKit::PageClientImpl::hostFileDescriptor):
21         * UIProcess/API/wpe/PageClientImpl.h:
22         * UIProcess/API/wpe/WPEView.cpp:
23         (WKWPE::m_backend):
24         * UIProcess/API/wpe/WPEView.h:
25         (WKWPE::View::create):
26         * UIProcess/PageClient.h:
27         * UIProcess/WebPageProxy.cpp:
28         (WebKit::WebPageProxy::creationParameters):
29         * WebProcess/WebPage/WebPage.cpp:
30         (WebKit::m_hostFileDescriptor):
31         * WebProcess/WebPage/WebPage.h:
32         (WebKit::WebPage::releaseHostFileDescriptor):
33         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
34         (WebKit::AcceleratedSurfaceWPE::AcceleratedSurfaceWPE):
35         (WebKit::AcceleratedSurfaceWPE::initialize):
36         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.h:
37         * WebProcess/WebPage/wpe/CompositingManager.cpp: Removed.
38         * WebProcess/WebPage/wpe/CompositingManager.h: Removed.
39
40 2019-02-04  Carlos Garcia Campos  <cgarcia@igalia.com>
41
42         [GTK][WPE] Add enable-javascript-markup setting
43         https://bugs.webkit.org/show_bug.cgi?id=193439
44
45         Reviewed by Michael Catanzaro.
46
47         Expose JavaScriptMarkupEnabled setting in the GLib API.
48
49         * UIProcess/API/glib/WebKitSettings.cpp:
50         (webKitSettingsSetProperty):
51         (webKitSettingsGetProperty):
52         (webkit_settings_class_init):
53         (webkit_settings_get_enable_javascript_markup):
54         (webkit_settings_set_enable_javascript_markup):
55         * UIProcess/API/gtk/WebKitSettings.h:
56         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
57         * UIProcess/API/wpe/WebKitSettings.h:
58         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
59
60 2019-02-10  Darin Adler  <darin@apple.com>
61
62         Switch uses of StringBuilder with String::format for hex numbers to use HexNumber.h instead
63         https://bugs.webkit.org/show_bug.cgi?id=194485
64
65         Reviewed by Daniel Bates.
66
67         * UIProcess/DeviceIdHashSaltStorage.cpp:
68         (WebKit::DeviceIdHashSaltStorage::completeDeviceIdHashSaltForOriginCall): Use
69         appendUnsignedAsHex instead of appendUnsigned64AsHex.
70
71         * UIProcess/WebBackForwardList.cpp:
72         (WebKit::WebBackForwardList::loggingString): Use appendUnsignedAsHex and
73         reinterpret_cast<uintptr_t> instead of String::format and "%p".
74
75 2019-02-10  Commit Queue  <commit-queue@webkit.org>
76
77         Unreviewed, rolling out r241167.
78         https://bugs.webkit.org/show_bug.cgi?id=194482
79
80         Broke the GTK mediastream tests (Requested by philn on
81         #webkit).
82
83         Reverted changeset:
84
85         "Filter out Overconstrainederror.constraint when getUserMedia
86         is not granted"
87         https://bugs.webkit.org/show_bug.cgi?id=194240
88         https://trac.webkit.org/changeset/241167
89
90 2019-02-09  Darin Adler  <darin@apple.com>
91
92         Eliminate unnecessary String temporaries by using StringConcatenateNumbers
93         https://bugs.webkit.org/show_bug.cgi?id=194021
94
95         Reviewed by Geoffrey Garen.
96
97         * NetworkProcess/NetworkResourceLoader.cpp:
98         (WebKit::escapeIDForJSON): Use an ASCIILiteral to create a String.
99
100         * NetworkProcess/cache/NetworkCacheStorage.cpp:
101         (WebKit::NetworkCache::makeVersionedDirectoryPath): Remove String::number and let
102         makeString do the conversion without allocating/destroying a String.
103
104         * NetworkProcess/mac/RemoteNetworkingContext.mm: Removed "using namespace WebCore".
105         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession): Remove String::number
106         and let makeString do the conversion without allocating/destroying a String.
107
108         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp: Removed "using namespace WebCore".
109         (WebKit::registerMDNSNameCallback): Added explicit WebCore prefix as needed.
110         (WebKit::NetworkMDNSRegister::registerMDNSName): Ditto. Also remove String::number
111         and let makeString do the conversion without allocating/destroying a String.
112
113         * UIProcess/WebPageGroup.cpp:
114         (WebKit::pageGroupData): Remove String::number and let makeString do the conversion
115         without allocating/destroying a String.
116         * UIProcess/WebPageProxy.cpp:
117         (WebKit::WebPageProxy::createInspectorTargets): Ditto.
118         * UIProcess/ios/WKLegacyPDFView.mm:
119         (-[WKLegacyPDFView _URLForLinkAnnotation:]): Ditto.
120         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
121         (WebKit::uniqueWorldName): Ditto.
122         * WebProcess/WebPage/WebPageInspectorTarget.cpp:
123         (WebKit::WebPageInspectorTarget::identifier const): Ditto.
124
125 2019-02-09  Alexander Mikhaylenko  <exalm7659@gmail.com>
126
127         [GTK] Fix typo in the newly added API
128         https://bugs.webkit.org/show_bug.cgi?id=194472
129
130         Reviewed by Michael Catanzaro.
131
132         Fix a typo: enableed -> enabled.
133
134         * UIProcess/API/glib/WebKitSettings.cpp:
135         (webkit_settings_set_enable_back_forward_navigation_gestures):
136         * UIProcess/API/gtk/WebKitSettings.h:
137
138 2019-02-08  Alex Christensen  <achristensen@webkit.org>
139
140         Speculative fix for Mojave API test after r241223
141         https://bugs.webkit.org/show_bug.cgi?id=194427
142
143         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
144         (WebKit::XPCInitializationHandler):
145         (WebKit::XPCServiceMain):
146         Set the __APPLEEVENTSSERVICENAME environment variable before handling any xpc messages like we used to.
147         I'll worry about making things right in the daemon later.
148
149 2019-02-08  Chris Dumez  <cdumez@apple.com>
150
151         [WK2][macOS] Avoid creating new CVDisplayLink objects for each WebProcess
152         https://bugs.webkit.org/show_bug.cgi?id=194463
153
154         Reviewed by Tim Horton.
155
156         Avoid creating new CVDisplayLink objects for each WebProcess. We really only need one per
157         display, creating such object is expensive and it is even worse in a PSON world where we
158         swap process on navigation.
159
160         This patch moves the DisplayLink storing from WebProcessProxy to WebProcessPool. Also,
161         a DisplayLink can now be associated to several IPC connections instead of having a 1:1
162         mapping. When a DisplayLink no longer has any observers, we now merely stop it instead
163         of destroying it.
164
165         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
166         (WebKit::WebProcessPool::startDisplayLink):
167         (WebKit::WebProcessPool::stopDisplayLink):
168         (WebKit::WebProcessPool::stopDisplayLinks):
169         * UIProcess/WebProcessPool.h:
170         * UIProcess/WebProcessProxy.cpp:
171         (WebKit::WebProcessProxy::~WebProcessProxy):
172         (WebKit::WebProcessProxy::processWillShutDown):
173         (WebKit::WebProcessProxy::shutDown):
174         * UIProcess/WebProcessProxy.h:
175         * UIProcess/mac/DisplayLink.cpp:
176         (WebKit::DisplayLink::DisplayLink):
177         (WebKit::DisplayLink::addObserver):
178         (WebKit::DisplayLink::removeObserver):
179         (WebKit::DisplayLink::removeObservers):
180         (WebKit::DisplayLink::hasObservers const):
181         (WebKit::DisplayLink::displayLinkCallback):
182         * UIProcess/mac/DisplayLink.h:
183         * UIProcess/mac/WebProcessProxyMac.mm:
184         (WebKit::WebProcessProxy::startDisplayLink):
185         (WebKit::WebProcessProxy::stopDisplayLink):
186
187 2019-02-08  Alexander Mikhaylenko  <exalm7659@gmail.com>
188
189         [GTK] Implement back/forward touchpad gesture
190         https://bugs.webkit.org/show_bug.cgi?id=193919
191
192         Reviewed by Michael Catanzaro.
193
194         Move ViewSnapshotStore and ViewGestureController from Cocoa/Mac directory
195         to UIProcess/, also move some parts of mac/ViewGestreControllerMac.mm to
196         ViewGestureController.cpp, split up Mac- and iOS-specific parts of
197         ViewSnapshotStore.cpp into mac/ViewSnapshotMac.mm, then implement 2-finger
198         touchpad swipe back-forward gesture for GTK based on that.
199
200         To avoid name conflict, rename existing ViewGestureController class inside
201         UIProcess/API/gtk/WebKitWebViewBase.cpp into TouchGestureController.
202
203         Since GTK gestures can only work with 3 or 4 fingers, treat horizontal
204         scrolling events as a swipe as long as there's nowhere to scroll in that
205         direction and web page doesn't handle the scrolling.
206
207         This is only allowed for touchpads, even though it can theoretically work
208         with touch mice and trackpoints.
209
210         The gesture requires every item in back-forward list to have a snapshot.
211         There's already an existing infrastructure for that, so the patch changes
212         a bunch of #if PLATFORM(COCOA) statements to also check for GTK platform.
213         The snapshots have to be taken in sync, so the implementation draws webview
214         widget into a Cairo image surface.
215
216         The gesture is disabled by default, and can be enabled by setting the newly
217         added 'enable-back-forward-navigation-gestures' property in WebKitSettings to
218         true.
219
220         Gesture drawing is implemented via Cairo. When the gesture is active, the
221         actual page is drawn into a Cairo group, which is then drawn together with
222         a given snapshot, as well as dimming and a drop shadow over the "lower" layer.
223
224         Also add a memory pressure handler that clears snapshot store when low on memory.
225
226         * DerivedSources-input.xcfilelist:
227         * PlatformGTK.cmake:
228         * PlatformMac.cmake:
229         * Shared/SessionState.h: Add snapshot to back-forward items for GTK.
230         * Shared/WebBackForwardListItem.h: Add snapshot to back-forward items for GTK.
231         * SourcesCocoa.txt:
232         * SourcesGTK.txt:
233         * UIProcess/API/glib/WebKitSettings.cpp:
234         Added 'enable-back-forward-navigation-gestures' property for enabling the gesture.
235         (webKitSettingsSetProperty):
236         (webKitSettingsGetProperty):
237         (webkit_settings_class_init):
238         (webkit_settings_get_enable_back_forward_navigation_gestures): Added, GTK only.
239         (webkit_settings_set_enable_back_forward_navigation_gestures): Added, GTK only.
240         * UIProcess/API/glib/WebKitWebView.cpp:
241         (enableBackForwardNavigationGesturesChanged): Added, GTK only.
242         (webkitWebViewUpdateSettings):
243         (webkitWebViewDisconnectSettingsSignalHandlers):
244         * UIProcess/API/gtk/PageClientImpl.cpp:
245         (WebKit::PageClientImpl::setViewNeedsDisplay): Redraw the whole screen instead of a region during the gesture.
246         (WebKit::PageClientImpl::takeViewSnapshot): Added.
247         (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): Pass unhandled events to the gesture controller.
248         (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot): Redraw the widget immediately after removing snapshot.
249         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame): Added, send a notification to the gesture controller.
250         (WebKit::PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame):  Send a notification to the gesture controller.
251         (WebKit::PageClientImpl::didFinishLoadForMainFrame):  Send a notification to the gesture controller.
252         (WebKit::PageClientImpl::didFailLoadForMainFrame):  Added, send a notification to the gesture controller.
253         (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):  Send a notification to the gesture controller.
254         (WebKit::PageClientImpl::didRestoreScrollPosition):  Added, send a notification to the gesture controller.
255         * UIProcess/API/gtk/PageClientImpl.h:
256         * UIProcess/API/gtk/WebKitSettings.h:
257         Add webkit_settings_get_enable_back_forward_navigation_gestures() and webkit_settings_get_enable_back_forward_navigation_gestures()
258         to public API.
259         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
260         (webkitWebViewBaseDraw): Pass drawing to ViewGestureController during the gesture.
261         (webkitWebViewBaseScrollEvent): Pass scroll events to ViewGestureController during the gesture.
262         (webkitWebViewBaseGestureController): Renamed ViewGestureController to TouchGestureController.
263         (webkitWebViewBaseViewGestureController): Added.
264         (webkitWebViewBaseCreateWebPage): Create an instance of ViewGestureController.
265         (webkitWebViewBaseTakeViewSnapshot): Added.
266         (webkitWebViewBaseDidStartProvisionalLoadForMainFrame): Added.
267         (webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame): Added.
268         (webkitWebViewBaseDidFinishLoadForMainFrame): Added.
269         (webkitWebViewBaseDidFailLoadForMainFrame): Added.
270         (webkitWebViewBaseDidSameDocumentNavigationForMainFrame): Added.
271         (webkitWebViewBaseDidRestoreScrollPosition): Added.
272         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
273         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Mentioned the added functions in docs.
274         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
275         (WebKit::WebProcessPool::platformInitialize): Move the check from WebMemoryPressureHandlerCocoa.mm here.
276         * UIProcess/PageClient.h: Add takeViewSnapshot() for GTK.
277         * UIProcess/ViewGestureController.cpp: Renamed from Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp.
278         (WebKit::ViewGestureController::ViewGestureController):
279         (WebKit::ViewGestureController::~ViewGestureController):
280         (WebKit::ViewGestureController::disconnectFromProcess):
281         (WebKit::ViewGestureController::connectToProcess):
282         (WebKit::ViewGestureController::controllerForGesture):
283         (WebKit::ViewGestureController::takeNextGestureID):
284         (WebKit::ViewGestureController::willBeginGesture):
285         (WebKit::ViewGestureController::didEndGesture):
286         (WebKit::ViewGestureController::setAlternateBackForwardListSourcePage):
287         (WebKit::ViewGestureController::canSwipeInDirection const):
288         (WebKit::ViewGestureController::didStartProvisionalOrSameDocumentLoadForMainFrame):
289         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
290         (WebKit::ViewGestureController::didFirstVisuallyNonEmptyLayoutForMainFrame):
291         (WebKit::ViewGestureController::didRepaintAfterNavigation):
292         (WebKit::ViewGestureController::didHitRenderTreeSizeThreshold):
293         (WebKit::ViewGestureController::didRestoreScrollPosition):
294         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
295         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
296         (WebKit::ViewGestureController::checkForActiveLoads):
297         (WebKit::ViewGestureController::SnapshotRemovalTracker::SnapshotRemovalTracker):
298         (WebKit::ViewGestureController::SnapshotRemovalTracker::eventsDescription):
299         (WebKit::ViewGestureController::SnapshotRemovalTracker::log const):
300         (WebKit::ViewGestureController::SnapshotRemovalTracker::resume):
301         (WebKit::ViewGestureController::SnapshotRemovalTracker::start):
302         (WebKit::ViewGestureController::SnapshotRemovalTracker::reset):
303         (WebKit::ViewGestureController::SnapshotRemovalTracker::stopWaitingForEvent):
304         (WebKit::ViewGestureController::SnapshotRemovalTracker::eventOccurred):
305         (WebKit::ViewGestureController::SnapshotRemovalTracker::cancelOutstandingEvent):
306         (WebKit::ViewGestureController::SnapshotRemovalTracker::hasOutstandingEvent):
307         (WebKit::ViewGestureController::SnapshotRemovalTracker::fireRemovalCallbackIfPossible):
308         (WebKit::ViewGestureController::SnapshotRemovalTracker::fireRemovalCallbackImmediately):
309         (WebKit::ViewGestureController::SnapshotRemovalTracker::watchdogTimerFired):
310         (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog):
311         (WebKit::deltaShouldCancelSwipe):
312         (WebKit::ViewGestureController::PendingSwipeTracker::PendingSwipeTracker):
313         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanBecomeSwipe):
314         (WebKit::ViewGestureController::PendingSwipeTracker::handleEvent):
315         (WebKit::ViewGestureController::PendingSwipeTracker::eventWasNotHandledByWebCore):
316         (WebKit::ViewGestureController::PendingSwipeTracker::tryToStartSwipe):
317         (WebKit::ViewGestureController::PendingSwipeTracker::reset):
318         (WebKit::ViewGestureController::startSwipeGesture):
319         (WebKit::ViewGestureController::isPhysicallySwipingLeft const):
320         (WebKit::ViewGestureController::shouldUseSnapshotForSize):
321         (WebKit::ViewGestureController::forceRepaintIfNeeded):
322         (WebKit::ViewGestureController::willEndSwipeGesture):
323         (WebKit::ViewGestureController::endSwipeGesture):
324         (WebKit::ViewGestureController::requestRenderTreeSizeNotificationIfNeeded):
325         * UIProcess/ViewGestureController.h: Renamed from Source/WebKit/UIProcess/Cocoa/ViewGestureController.h.
326         (WebKit::ViewGestureController::wheelEventWasNotHandledByWebCore):
327         (WebKit::ViewGestureController::shouldIgnorePinnedState):
328         (WebKit::ViewGestureController::setShouldIgnorePinnedState):
329         (WebKit::ViewGestureController::hasActiveMagnificationGesture const):
330         (WebKit::ViewGestureController::setCustomSwipeViews):
331         (WebKit::ViewGestureController::setCustomSwipeViewsTopContentInset):
332         (WebKit::ViewGestureController::setDidMoveSwipeSnapshotCallback):
333         (WebKit::ViewGestureController::backgroundColorForCurrentSnapshot const):
334         (WebKit::ViewGestureController::didFinishLoadForMainFrame):
335         (WebKit::ViewGestureController::didFailLoadForMainFrame):
336         (WebKit::ViewGestureController::setSwipeGestureEnabled):
337         (WebKit::ViewGestureController::isSwipeGestureEnabled):
338         (WebKit::ViewGestureController::SnapshotRemovalTracker::pause):
339         (WebKit::ViewGestureController::SnapshotRemovalTracker::isPaused const):
340         (WebKit::ViewGestureController::SnapshotRemovalTracker::hasRemovalCallback const):
341         (WebKit::ViewGestureController::SnapshotRemovalTracker::renderTreeSizeThreshold const):
342         (WebKit::ViewGestureController::SnapshotRemovalTracker::setRenderTreeSizeThreshold):
343         (WebKit::ViewGestureController::PendingSwipeTracker::shouldIgnorePinnedState):
344         (WebKit::ViewGestureController::PendingSwipeTracker::setShouldIgnorePinnedState):
345         (WebKit::ViewGestureController::SwipeProgressTracker::progress const):
346         (WebKit::ViewGestureController::SwipeProgressTracker::direction const):
347         * UIProcess/ViewGestureController.messages.in: Renamed from Source/WebKit/UIProcess/Cocoa/ViewGestureController.messages.in.
348         * UIProcess/ViewSnapshotStore.cpp: Copied from Source/WebKit/UIProcess/mac/ViewSnapshotStore.mm.
349         (WebKit::ViewSnapshotStore::ViewSnapshotStore):
350         (WebKit::ViewSnapshotStore::~ViewSnapshotStore):
351         (WebKit::ViewSnapshotStore::singleton):
352         (WebKit::ViewSnapshotStore::didAddImageToSnapshot):
353         (WebKit::ViewSnapshotStore::willRemoveImageFromSnapshot):
354         (WebKit::ViewSnapshotStore::pruneSnapshots):
355         (WebKit::ViewSnapshotStore::recordSnapshot):
356         (WebKit::ViewSnapshotStore::discardSnapshotImages):
357         (WebKit::ViewSnapshot::~ViewSnapshot):
358         * UIProcess/ViewSnapshotStore.h: Renamed from Source/WebKit/UIProcess/mac/ViewSnapshotStore.h.
359         (WebKit::ViewSnapshot::setRenderTreeSize):
360         (WebKit::ViewSnapshot::renderTreeSize const):
361         (WebKit::ViewSnapshot::setBackgroundColor):
362         (WebKit::ViewSnapshot::backgroundColor const):
363         (WebKit::ViewSnapshot::setViewScrollPosition):
364         (WebKit::ViewSnapshot::viewScrollPosition const):
365         (WebKit::ViewSnapshot::setDeviceScaleFactor):
366         (WebKit::ViewSnapshot::deviceScaleFactor const):
367         (WebKit::ViewSnapshot::surface const):
368         (WebKit::ViewSnapshot::imageSizeInBytes const):
369         (WebKit::ViewSnapshot::size const):
370         (WebKit::ViewSnapshotStore::setDisableSnapshotVolatilityForTesting):
371         (WebKit::ViewSnapshotStore::disableSnapshotVolatilityForTesting const):
372         * UIProcess/WebBackForwardList.cpp:
373         (WebKit::WebBackForwardList::didRemoveItem): Unset snapshot for GTK.
374         * UIProcess/WebMemoryPressureHandler.cpp: Copied from Source/WebKit/UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.mm.
375         (WebKit::installMemoryPressureHandler):
376         * UIProcess/WebMemoryPressureHandler.h: Renamed from Source/WebKit/UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.h.
377         * UIProcess/WebPageProxy.cpp:
378         (WebKit::WebPageProxy::recordNavigationSnapshot): Take snapshots for GTK.
379         * UIProcess/WebPageProxy.h:
380         * UIProcess/gtk/ViewGestureControllerGtk.cpp: Added. This is a port of
381         UIProcess/mac/ViewGestureControllerMac.mm. SwipeProgressTracker class is a
382         re-implementation of trackSwipeEventWithOptions.
383         (WebKit::isEventStop):
384         (WebKit::ViewGestureController::platformTeardown):
385         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanStartSwipe):
386         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanEndSwipe):
387         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe):
388         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventGetScrollingDeltas):
389         (WebKit::ViewGestureController::handleScrollWheelEvent):
390         (WebKit::ViewGestureController::trackSwipeGesture):
391         (WebKit::ViewGestureController::SwipeProgressTracker::SwipeProgressTracker):
392         (WebKit::ViewGestureController::SwipeProgressTracker::startTracking):
393         (WebKit::ViewGestureController::SwipeProgressTracker::reset):
394         (WebKit::ViewGestureController::SwipeProgressTracker::handleEvent):
395         (WebKit::ViewGestureController::SwipeProgressTracker::startAnimation):
396         (WebKit::easeOutCubic):
397         (WebKit::ViewGestureController::SwipeProgressTracker::onAnimationTick):
398         (WebKit::ViewGestureController::SwipeProgressTracker::endAnimation):
399         (WebKit::ViewGestureController::beginSwipeGesture):
400         (WebKit::ViewGestureController::handleSwipeGesture):
401         (WebKit::ViewGestureController::draw):
402         (WebKit::ViewGestureController::removeSwipeSnapshot):
403         (WebKit::ViewGestureController::beginSimulatedSwipeInDirectionForTesting):
404         (WebKit::ViewGestureController::completeSimulatedSwipeInDirectionForTesting):
405         * UIProcess/gtk/ViewSnapshotStoreGtk.cpp: Renamed from Source/WebKit/UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.mm.
406         (WebKit::ViewSnapshot::create):
407         (WebKit::ViewSnapshot::ViewSnapshot):
408         (WebKit::ViewSnapshot::hasImage const):
409         (WebKit::ViewSnapshot::clearImage):
410         (WebKit::ViewSnapshot::imageSizeInBytes const):
411         (WebKit::ViewSnapshot::size const):
412         * UIProcess/gtk/WebProcessPoolGtk.cpp:
413         (WebKit::memoryPressureMonitorDisabled): Added.
414         (WebKit::WebProcessPool::platformInitialize): Install memory pressure handler.
415         (WebKit::WebProcessPool::platformInitializeWebProcess): Use memoryPressureMonitorDisabled().
416         * UIProcess/mac/ViewGestureControllerMac.mm:
417         Moved many functions into UIProcess/ViewGestureController.cpp
418         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanStartSwipe):
419         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanEndSwipe):
420         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanInfluenceSwipe):
421         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventGetScrollingDeltas):
422         (WebKit::ViewGestureController::trackSwipeGesture):
423         (WebKit::scrollEventCanInfluenceSwipe): Deleted.
424         (WebKit::deltaShouldCancelSwipe): Deleted.
425         (WebKit::ViewGestureController::PendingSwipeTracker::PendingSwipeTracker): Deleted.
426         (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanBecomeSwipe): Deleted.
427         (WebKit::ViewGestureController::PendingSwipeTracker::handleEvent): Deleted.
428         (WebKit::ViewGestureController::PendingSwipeTracker::eventWasNotHandledByWebCore): Deleted.
429         (WebKit::ViewGestureController::PendingSwipeTracker::tryToStartSwipe): Deleted.
430         (WebKit::ViewGestureController::PendingSwipeTracker::reset): Deleted.
431         (WebKit::ViewGestureController::willEndSwipeGesture): Deleted.
432         (WebKit::ViewGestureController::shouldUseSnapshotForSize): Deleted.
433         (WebKit::ViewGestureController::isPhysicallySwipingLeft const): Deleted.
434         (WebKit::ViewGestureController::endSwipeGesture): Deleted.
435         (WebKit::ViewGestureController::forceRepaintIfNeeded): Deleted.
436         (WebKit::ViewGestureController::requestRenderTreeSizeNotificationIfNeeded): Deleted.
437         * UIProcess/mac/ViewSnapshotStoreMac.mm: Renamed from Source/WebKit/UIProcess/mac/ViewSnapshotStore.mm.
438         (WebKit::ViewSnapshotStore::snapshottingContext):
439         (WebKit::ViewSnapshot::create):
440         (WebKit::ViewSnapshot::ViewSnapshot):
441         (WebKit::ViewSnapshot::setSurface):
442         (WebKit::ViewSnapshot::hasImage const):
443         (WebKit::ViewSnapshot::clearImage):
444         (WebKit::ViewSnapshot::setVolatile):
445         (WebKit::ViewSnapshot::asLayerContents):
446         (WebKit::ViewSnapshot::asImageForTesting):
447         * WebKit.xcodeproj/project.pbxproj:
448         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
449         Make SetRenderTreeSizeNotificationThreshold() cross-platform.
450         (WebKit::ViewGestureGeometryCollector::ViewGestureGeometryCollector):
451         (WebKit::ViewGestureGeometryCollector::computeMinimumAndMaximumViewportScales const):
452         (WebKit::ViewGestureGeometryCollector::mainFrameDidLayout):
453         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
454         * WebProcess/WebPage/ViewGestureGeometryCollector.messages.in:
455         * WebProcess/WebPage/WebPage.cpp:
456         Start using ViewGestureGeometryCollector for GTK.
457         (WebKit::WebPage::mainFrameDidLayout):
458         * WebProcess/WebPage/WebPage.h:
459
460 2019-02-08  Alex Christensen  <achristensen@webkit.org>
461
462         Add SPI to use networking daemon instead of XPC service
463         https://bugs.webkit.org/show_bug.cgi?id=194427
464
465         Reviewed by Geoffrey Garen.
466
467         There is still work to be done, but with the proper plist it starts and loads webpages!
468
469         * NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm:
470         (WebKit::DaemonMain):
471         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
472         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
473         (WebKit::XPCEventHandler):
474         (WebKit::XPCInitializationHandler):
475         (WebKit::XPCServiceMain):
476         (WebKit::XPCServiceEventHandler): Deleted.
477         * UIProcess/API/APIProcessPoolConfiguration.h:
478         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
479         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
480         (-[_WKProcessPoolConfiguration usesNetworkingDaemon]):
481         (-[_WKProcessPoolConfiguration setUsesNetworkingDaemon:]):
482         * UIProcess/AuxiliaryProcessProxy.cpp:
483         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
484         * UIProcess/Launcher/ProcessLauncher.h:
485         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
486         (WebKit::serviceName):
487         (WebKit::ProcessLauncher::launchProcess):
488         * UIProcess/Network/NetworkProcessProxy.cpp:
489         (WebKit::NetworkProcessProxy::getLaunchOptions):
490         * UIProcess/WebProcessPool.cpp:
491         (WebKit::WebProcessPool::usesNetworkingDaemon const):
492         * UIProcess/WebProcessPool.h:
493
494 2019-02-08  Truitt Savell  <tsavell@apple.com>
495
496         Unreviewed, rolling out r241197.
497
498         Broke iOS Simulator Debug build and casued 1 API failure on
499         High Sierra
500
501         Reverted changeset:
502
503         "Add SPI to use networking daemon instead of XPC service"
504         https://bugs.webkit.org/show_bug.cgi?id=194427
505         https://trac.webkit.org/changeset/241197
506
507 2019-02-08  Beth Dakin  <bdakin@apple.com>
508
509         Abstract and discussion comments needed for afterScreenUpdates
510         https://bugs.webkit.org/show_bug.cgi?id=194442
511
512         Reviewed by Wenson Hsieh.
513
514         Forgot to add these comments with https://bugs.webkit.org/show_bug.cgi?id=194362
515         * UIProcess/API/Cocoa/WKSnapshotConfiguration.h:
516
517 2019-02-08  Beth Dakin  <bdakin@apple.com>
518
519         Add afterScreenUpdates to WKSnapshotConfiguration
520         https://bugs.webkit.org/show_bug.cgi?id=194362
521         -and corresponding-
522         <rdar://problem/40655528> Please add an "after screen updates" property to 
523         WKSnapshotConfiguration (to solve blank snapshots)
524
525         Reviewed by Tim Horton.
526
527         This is the WebKit equivalent of - (UIView *)snapshotViewAfterScreenUpdates:(BOOL)afterUpdates;
528         This makes our snapshotting API more predictable and reliable on iOS devices, 
529         which is why the new configuration property defaults to YES.
530
531         New property that defaults to YES.
532         * UIProcess/API/Cocoa/WKSnapshotConfiguration.h:
533         * UIProcess/API/Cocoa/WKSnapshotConfiguration.mm:
534         (-[WKSnapshotConfiguration init]):
535         (-[WKSnapshotConfiguration copyWithZone:]):
536
537         When afterScreenUpdates is set, invoke the snapshot via 
538         callAfterNextPresentationUpdate.
539         * UIProcess/API/Cocoa/WKWebView.mm:
540         (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
541         (-[WKWebView _callCompletionHandler:withSnapshotImage:atDeviceScale:]):
542
543 2019-02-08  Alex Christensen  <achristensen@webkit.org>
544
545         Add SPI to use networking daemon instead of XPC service
546         https://bugs.webkit.org/show_bug.cgi?id=194427
547
548         Reviewed by Geoffrey Garen.
549
550         There is still work to be done, but with the proper plist it starts and loads webpages!
551
552         * NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm:
553         (WebKit::DaemonMain):
554         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
555         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
556         (WebKit::XPCEventHandler):
557         (WebKit::XPCInitializationHandler):
558         (WebKit::XPCServiceMain):
559         (WebKit::XPCServiceEventHandler): Deleted.
560         * UIProcess/API/APIProcessPoolConfiguration.h:
561         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
562         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
563         (-[_WKProcessPoolConfiguration usesNetworkingDaemon]):
564         (-[_WKProcessPoolConfiguration setUsesNetworkingDaemon:]):
565         * UIProcess/AuxiliaryProcessProxy.cpp:
566         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
567         * UIProcess/Launcher/ProcessLauncher.h:
568         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
569         (WebKit::serviceName):
570         (WebKit::ProcessLauncher::launchProcess):
571         * UIProcess/Network/NetworkProcessProxy.cpp:
572         (WebKit::NetworkProcessProxy::getLaunchOptions):
573         * UIProcess/WebProcessPool.cpp:
574         (WebKit::WebProcessPool::usesNetworkingDaemon const):
575         * UIProcess/WebProcessPool.h:
576
577 2019-02-08  Keith Rollin  <krollin@apple.com>
578
579         Unreviewed build fix.
580
581         r241135 modified how entitlements were built up for the macOS. Those
582         changes broke the iOSMac builds. Bring back some deletions in order to
583         fix iOSMac.
584
585         * Configurations/PluginService.64.xcconfig:
586         * Configurations/PluginService.entitlements: Added.
587         * WebKit.xcodeproj/project.pbxproj:
588
589 2019-02-07  Chris Dumez  <cdumez@apple.com>
590
591         Mark more heap-allocated classes as fast allocated
592         https://bugs.webkit.org/show_bug.cgi?id=194422
593
594         Reviewed by Ryosuke Niwa.
595
596         * NetworkProcess/NetworkLoad.cpp:
597         * NetworkProcess/NetworkLoadChecker.h:
598         * NetworkProcess/NetworkResourceLoader.cpp:
599         * Platform/IPC/Connection.h:
600         * Platform/IPC/mac/ImportanceAssertion.h:
601         * PluginProcess/PluginCreationParameters.h:
602         * Shared/API/Cocoa/RemoteObjectRegistry.h:
603         * Shared/WebEvent.h:
604         * UIProcess/API/APIHTTPCookieStore.cpp:
605         * UIProcess/API/APINotificationProvider.h:
606         * UIProcess/API/Cocoa/PageLoadStateObserver.h:
607         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
608         * UIProcess/API/Cocoa/WKWebView.mm:
609         (-[WKWebView _setInputDelegate:]):
610         * UIProcess/API/gtk/PageClientImpl.h:
611         * UIProcess/BackingStore.h:
612         * UIProcess/Cocoa/AutomationClient.h:
613         * UIProcess/Cocoa/DiagnosticLoggingClient.h:
614         * UIProcess/Cocoa/DownloadClient.h:
615         * UIProcess/Cocoa/FindClient.h:
616         * UIProcess/Cocoa/NavigationState.h:
617         * UIProcess/Cocoa/UIDelegate.h:
618         * UIProcess/Cocoa/ViewGestureController.h:
619         * UIProcess/DeviceIdHashSaltStorage.h:
620         * UIProcess/Downloads/DownloadProxyMap.h:
621         * UIProcess/Gamepad/UIGamepad.h:
622         * UIProcess/Notifications/WebNotificationProvider.h:
623         * UIProcess/ProcessAssertion.h:
624         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
625         * UIProcess/WebContextInjectedBundleClient.h:
626         * UIProcess/WebFormClient.h:
627         * UIProcess/WebGeolocationProvider.h:
628         * UIProcess/WebPageProxy.h:
629         * WebProcess/Automation/WebAutomationSessionProxy.h:
630         * WebProcess/InjectedBundle/API/APIInjectedBundleBundleClient.h:
631         * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h:
632         * WebProcess/InjectedBundle/API/APIInjectedBundlePageContextMenuClient.h:
633         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
634         * WebProcess/InjectedBundle/API/APIInjectedBundlePageResourceLoadClient.h:
635         * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
636         * WebProcess/InjectedBundle/APIInjectedBundleFormClient.h:
637         * WebProcess/Network/webrtc/LibWebRTCNetwork.h:
638         * WebProcess/Network/webrtc/LibWebRTCSocket.h:
639         * WebProcess/Network/webrtc/WebRTCResolver.h:
640         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
641         * WebProcess/WebPage/DrawingArea.h:
642
643 2019-02-07  Wenson Hsieh  <wenson_hsieh@apple.com>
644
645         [iOS] [WK2] Modernize code for applying autocorrection
646         https://bugs.webkit.org/show_bug.cgi?id=194397
647
648         Reviewed by Tim Horton.
649
650         * UIProcess/ios/WKContentViewInteraction.h:
651         * UIProcess/ios/WKContentViewInteraction.mm:
652         (-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]):
653         (-[WKContentView applyAutocorrection:toString:withCompletionHandler:]):
654
655         Use BlockPtr instead of temporarily storing the completion handler.
656
657         * WebProcess/WebPage/WebPage.h:
658         * WebProcess/WebPage/WebPage.messages.in:
659
660         Change a LegacySync to Delayed.
661
662         * WebProcess/WebPage/ios/WebPageIOS.mm:
663         (WebKit::WebPage::applyAutocorrection):
664         (WebKit::WebPage::syncApplyAutocorrection):
665         (WebKit::WebPage::applyAutocorrectionInternal):
666
667 2019-02-07  Wenson Hsieh  <wenson_hsieh@apple.com>
668
669         [iOS] Clicking links in Safari using Apple Pencil is much more difficult after r238475
670         https://bugs.webkit.org/show_bug.cgi?id=194415
671         <rdar://problem/47550281>
672
673         Reviewed by Tim Horton.
674
675         Fix the bug by not firing the Apple-pencil-exclusive tap gesture recognizer in the case where editable images
676         are disabled. This gesture recognizer is only used for inserting editable images, and currently conflicts with
677         the synthetic click gesture recognizer used to recognize clicks from generic digitizer inputs.
678
679         * UIProcess/ios/WKContentViewInteraction.mm:
680         (-[WKContentView gestureRecognizerShouldBegin:]):
681         (-[WKContentView _stylusSingleTapRecognized:]):
682
683 2019-02-07  Per Arne Vollan  <pvollan@apple.com>
684
685         [macOS] Block coreservicesd in sandbox.
686         https://bugs.webkit.org/show_bug.cgi?id=192670
687
688         Reviewed by Alexey Proskuryakov.
689
690         We should block CoreServices in newer versions of macOS. In order to achieve this we need to avoid calling
691         _RegisterApplication before entering the sandbox, since this call will open up a connection to CoreServices.
692         The call to _RegisterApplication is moved to ChildProcess::updateProcessName, since it is needed to
693         successfully update the process name. The call to ChildProcess::updateProcessName is made after entering
694         the sandbox.
695
696         * Shared/AuxiliaryProcess.cpp:
697         (WebKit::AuxiliaryProcess::initialize):
698         * WebProcess/cocoa/WebProcessCocoa.mm:
699         (WebKit::WebProcess::initializeProcessName):
700         (WebKit::WebProcess::platformInitializeProcess):
701         * WebProcess/com.apple.WebProcess.sb.in:
702
703 2019-02-07  Youenn Fablet  <youenn@apple.com>
704
705         Filter out Overconstrainederror.constraint when getUserMedia is not granted
706         https://bugs.webkit.org/show_bug.cgi?id=194240
707
708         Reviewed by Eric Carlson.
709
710         Make sure in UIProcess to filter out constraint if either the page was not granted gum access or it has no persistent access.
711
712         Refactor UserMediaPermissionRequestManagerProxy to make the implementation easier to understand.
713
714         Covered by added test.
715
716         * UIProcess/UserMediaPermissionCheckProxy.cpp:
717         (WebKit::UserMediaPermissionCheckProxy::setUserMediaAccessInfo):
718         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
719         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
720         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
721         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess):
722         (WebKit::UserMediaPermissionRequestManagerProxy::getRequestAction):
723         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
724         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
725         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest):
726         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest):
727         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
728         (WebKit::UserMediaPermissionRequestManagerProxy::wasGrantedVideoOrAudioAccess):
729         (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
730         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
731         (WebKit::UserMediaPermissionRequestManagerProxy::createPermissionRequest): Deleted.
732         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
733         * UIProcess/UserMediaPermissionRequestProxy.h:
734         (WebKit::UserMediaPermissionRequestProxy::isPending const):
735         (WebKit::UserMediaPermissionRequestProxy::setEligibleVideoDeviceUIDs):
736         (WebKit::UserMediaPermissionRequestProxy::setEligibleAudioDeviceUIDs):
737         (WebKit::UserMediaPermissionRequestProxy::hasAudioDevice const):
738         (WebKit::UserMediaPermissionRequestProxy::hasVideoDevice const):
739         (WebKit::UserMediaPermissionRequestProxy::hasPersistentAccess const):
740         (WebKit::UserMediaPermissionRequestProxy::setHasPersistentAccess):
741         (WebKit::UserMediaPermissionRequestProxy::userMediaID const):
742         (WebKit::UserMediaPermissionRequestProxy::topLevelDocumentSecurityOrigin const):
743         (WebKit::UserMediaPermissionRequestProxy::userMediaDocumentSecurityOrigin const):
744         (WebKit::UserMediaPermissionRequestProxy::userRequest const):
745         (WebKit::UserMediaPermissionRequestProxy::setDeviceIdentifierHashSalt):
746         (WebKit::UserMediaPermissionRequestProxy::deviceIdentifierHashSalt const):
747         (WebKit::UserMediaPermissionRequestProxy::audioDevice const):
748         (WebKit::UserMediaPermissionRequestProxy::videoDevice const):
749         * UIProcess/WebPageProxy.cpp:
750         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
751         * UIProcess/WebPageProxy.h:
752
753 2019-02-07  Wenson Hsieh  <wenson_hsieh@apple.com>
754
755         [iOS] [WK2] Modernize autocorrection context code
756         https://bugs.webkit.org/show_bug.cgi?id=194373
757
758         Reviewed by Tim Horton.
759
760         * Shared/ios/WebAutocorrectionContext.h: Added.
761         (WebKit::WebAutocorrectionContext::encode const):
762         (WebKit::WebAutocorrectionContext::decode):
763
764         Introduce a WebAutocorrectionContext struct that encapsulates the individual pieces of autocorrection context.
765         Change to use this instead of a long list of arguments when propagating autocorrection context information over
766         IPC.
767
768         * UIProcess/AutoCorrectionCallback.h:
769         * UIProcess/WebPageProxy.h:
770         * UIProcess/WebPageProxy.messages.in:
771         * UIProcess/ios/WKContentViewInteraction.h:
772         * UIProcess/ios/WKContentViewInteraction.mm:
773         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
774         (+[WKAutocorrectionContext autocorrectionContextWithContext:]):
775         (+[WKAutocorrectionContext autocorrectionContextWithData:markedText:selectedText:afterText:selectedRangeInMarkedText:]): Deleted.
776
777         Change this constructor to take an entire WebAutocorrectionContext.
778
779         * UIProcess/ios/WebPageProxyIOS.mm:
780         (WebKit::WebPageProxy::autocorrectionContextCallback):
781         (WebKit::WebPageProxy::requestAutocorrectionContext):
782         (WebKit::WebPageProxy::autocorrectionContextSync):
783         (WebKit::WebPageProxy::getAutocorrectionContext): Deleted.
784         * WebKit.xcodeproj/project.pbxproj:
785         * WebProcess/WebPage/WebPage.h:
786         * WebProcess/WebPage/WebPage.messages.in:
787
788         Use Delayed instead of LegacySync.
789
790         * WebProcess/WebPage/ios/WebPageIOS.mm:
791         (WebKit::WebPage::autocorrectionContext):
792
793         Renamed from computeAutocorrectionContext. This is now a private method on WebPage that uses the focused or main
794         frame to compute and return a WebAutocorrectionContext.
795
796         (WebKit::WebPage::requestAutocorrectionContext):
797         (WebKit::WebPage::autocorrectionContextSync):
798
799         Renamed getAutocorrectionContext to autocorrectionContextSync.
800
801         (WebKit::computeAutocorrectionContext): Deleted.
802         (WebKit::WebPage::getAutocorrectionContext): Deleted.
803
804 2019-02-07  Youenn Fablet  <youenn@apple.com>
805
806         Simplify applyConstraints callbacks
807         https://bugs.webkit.org/show_bug.cgi?id=194297
808
809         Reviewed by Eric Carlson.
810
811         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
812         (WebKit::UserMediaCaptureManagerProxy::applyConstraints):
813         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
814         (WebKit::UserMediaCaptureManager::Source::applyConstraintsSucceeded):
815         (WebKit::UserMediaCaptureManager::Source::applyConstraintsFailed):
816         (WebKit::UserMediaCaptureManager::applyConstraintsFailed):
817         * WebProcess/cocoa/UserMediaCaptureManager.h:
818
819 2019-02-07  Brent Fulgham  <bfulgham@apple.com>
820
821         Permit additional IOKit Properties needed by Media PlugIns on older Mac Hardware
822         https://bugs.webkit.org/show_bug.cgi?id=194412
823         <rdar://problem/47820615>
824
825         Reviewed by Per Arne Vollan.
826
827         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
828
829 2019-02-07  Brent Fulgham  <bfulgham@apple.com>
830
831         Permit additional IOKit Properties needed by older Mac Hardware
832         https://bugs.webkit.org/show_bug.cgi?id=194410
833         <rdar://problem/47820620>
834
835         Reviewed by Per Arne Vollan.
836
837         * WebProcess/com.apple.WebProcess.sb.in:
838
839 2019-02-07  Brady Eidson  <beidson@apple.com>
840
841         Rename the TAKE_DOWNLOAD_ASSERTION macro.
842
843         Rubberstamped by Andy Estes.
844
845         * NetworkProcess/Downloads/DownloadMap.cpp:
846         * NetworkProcess/Downloads/DownloadMap.h:
847
848 2019-02-07  Keith Rollin  <krollin@apple.com>
849
850         Fix XCBuild issue related to codesigning WebContent process
851         https://bugs.webkit.org/show_bug.cgi?id=193799
852         <rdar://problem/47533890>
853
854         Reviewed by Brent Fulgham.
855
856         Building with XCBuild enabled results in the error message "cannot
857         read entitlement data" when trying to codesign the macOS XPC
858         processes. The reason for this error message is that there is a build
859         step that deletes any previous "stale" generated .xcent file before
860         building up a new one. With XCBuild enabled, the build steps got
861         re-ordered, such that the step that deletes this file could get
862         executed after the steps that build up the file. The built-up set of
863         entitlements is now gone, and the build process fails when `codesign`
864         tries to access it.
865
866         The apparent quick-fix to this problem -- of tweaking dependencies so
867         that the build steps execute in the desired order -- wouldn't work
868         with XCBuild. Establishing these dependencies would require both
869         having multiple build phases produce the same .xcent file as output,
870         as well as a build phase that has this file as an input and an output.
871         XCBuild either forbids or frowns upon these configurations.
872
873         Ultimately, the solution that worked was to take over complete control
874         of the codesigning process. This means (a) not specifying a base
875         .entitlements file that XCode uses to start with (and which was
876         subsequently altered via custom build scripts), (b) not letting XCode
877         automatically and silently inject a 'get-task-all' entitlement used to
878         facilitate debugging (we now add that entitlement by hand), and (c)
879         building up all of our entitlements by hand via a single custom
880         script. Because of the addition of this custom script, many other
881         scripts and entitlements files could now be removed.
882
883         * Configurations/BaseXPCService.xcconfig:
884         * Configurations/Databases-iOS.entitlements: Removed.
885         * Configurations/Network-OSX-restricted.entitlements: Removed.
886         * Configurations/Network-OSX-sandbox.entitlements: Removed.
887         * Configurations/Network-OSX.entitlements: Removed.
888         * Configurations/NetworkService.xcconfig:
889         * Configurations/PluginService.64.xcconfig:
890         * Configurations/PluginService.entitlements: Removed.
891         * Configurations/WebContent-OSX-sandbox.entitlements: Removed.
892         * Configurations/WebContent-OSX.entitlements: Removed.
893         * Configurations/WebContent-or-Plugin-OSX-restricted.entitlements: Removed.
894         * Configurations/WebContentService.xcconfig:
895         * Scripts/copy-webcontent-resources-to-private-headers.sh:
896         * Scripts/process-entitlements.sh: Added.
897         * Scripts/process-network-sandbox-entitlements.sh: Removed.
898         * Scripts/process-webcontent-or-plugin-entitlements.sh: Removed.
899         * Scripts/process-webcontent-sandbox-entitlements.sh: Removed.
900         * WebKit.xcodeproj/project.pbxproj:
901
902 2019-02-07  Alex Christensen  <achristensen@webkit.org>
903
904         Fix internal build after r241127
905         https://bugs.webkit.org/show_bug.cgi?id=191394
906
907         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
908         Add some (un)availability macros.
909
910 2019-02-07  Youenn Fablet  <youenn@apple.com>
911
912         Make to clear sources from UserMediaCaptureManagerProxy and UserMediaCaptureManager when no longer needed
913         https://bugs.webkit.org/show_bug.cgi?id=194312
914
915         Reviewed by Eric Carlson.
916
917         Sources in UserMediaCaptureManager and Proxy are never removed once added to their HashMap.
918         Use the 'ended' mechanism to do the clean-up on WebProcess side.
919         As part of this clean-up, send IPC to UIProcess to do clean-up on proxy side.
920         On WebProcess crash case, clean-up the proxy as well.
921
922         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
923         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
924         (WebKit::UserMediaCaptureManagerProxy::end):
925         (WebKit::UserMediaCaptureManagerProxy::clear):
926         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
927         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
928         * UIProcess/WebProcessProxy.cpp:
929         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
930         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
931         (WebKit::UserMediaCaptureManager::sourceEnded):
932         * WebProcess/cocoa/UserMediaCaptureManager.h:
933
934 2019-02-07  Alex Christensen  <achristensen@webkit.org>
935
936         Print backgrounds preference should be honored instead of WKWebViewConfiguration value
937         https://bugs.webkit.org/show_bug.cgi?id=194364
938         <rdar://problem/47627599>
939
940         Reviewed by Tim Horton.
941
942         Without this patch, changing the preference for printing the background has no effect.
943         This patch fixes that, and I verified it manually by checking "Print backgrounds" in Safari's print menu.
944         Unfortunately, the only way to test this is actually printing because only values from WebPageProxy::preferences
945         or WebPageProxy::configuration's preferences are exposed to the API, but values from WebPageProxy::preferencesStore
946         are used when printing.  Actually printing verifies this change fixes the bug.
947
948         * UIProcess/API/Cocoa/WKWebView.mm:
949         (-[WKWebView _initializeWithConfiguration:]):
950
951 2019-02-07  Chris Dumez  <cdumez@apple.com>
952
953         Mark DisplayLink as fast allocated
954         https://bugs.webkit.org/show_bug.cgi?id=194400
955
956         Reviewed by Geoffrey Garen.
957
958         * UIProcess/mac/DisplayLink.h:
959
960 2019-02-07  Per Arne Vollan  <pvollan@apple.com>
961
962         [macOS] API test times out after r241026
963         https://bugs.webkit.org/show_bug.cgi?id=194372
964
965         Reviewed by Alex Christensen.
966
967         The API test TestWebKitAPI.RenderingProgress.FirstMeaningfulPaint times out after r241026.
968         A new function pointer, layoutMilestones, is added to WKBundlePageLoaderClient, in order
969         for clients to decide which milestones they would like to listen for.
970
971         * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
972         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
973         (layoutMilestones):
974         (setUpPageLoaderClient):
975         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
976         (WebKit::InjectedBundlePageLoaderClient::layoutMilestones const):
977         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
978
979 2019-02-07  Alex Christensen  <achristensen@webkit.org>
980
981         Deprecate WKBundlePageSetDefersLoading
982         https://bugs.webkit.org/show_bug.cgi?id=191394
983
984         Reviewed by Dean Jackson.
985
986         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
987         (WKBundlePageSetDefersLoading):
988         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
989         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
990         (-[WKWebProcessPlugInBrowserContextController _defersLoading]):
991         (-[WKWebProcessPlugInBrowserContextController _setDefersLoading:]):
992         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
993
994 2019-02-07  Alex Christensen  <achristensen@webkit.org>
995
996         Digital crown should scroll safe browsing warning on watchOS
997         https://bugs.webkit.org/show_bug.cgi?id=194363
998         <rdar://problem/47348124>
999
1000         Reviewed by Wenson Hsieh.
1001
1002         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
1003         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
1004         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]):
1005         (-[WKSafeBrowsingWarning addContent]):
1006
1007 2019-02-07  Alex Christensen  <achristensen@webkit.org>
1008
1009         Shrink and hyphenate safe browsing warning text on watchOS
1010         https://bugs.webkit.org/show_bug.cgi?id=194361
1011         <rdar://problem/47466549>
1012
1013         Reviewed by Geoffrey Garen.
1014
1015         Some internationalizations use long words that didn't fit on small watches.
1016
1017         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
1018         (fontOfSize):
1019         (-[WKSafeBrowsingWarning addContent]):
1020         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
1021
1022 2019-02-07  Miguel Gomez  <magomez@igalia.com>
1023
1024         [WPE] Implement GStreamer based holepunch
1025         https://bugs.webkit.org/show_bug.cgi?id=193715
1026
1027         Reviewed by Xabier Rodriguez-Calvar.
1028
1029         Add a new parameter to the calls of TextureMapper::drawSolidColor().
1030
1031         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1032         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
1033
1034 2019-02-06  Benjamin Poulain  <benjamin@webkit.org>
1035
1036         Unreviewed, rolling out r240759 and r240944.
1037
1038         Some timer uses are done off the main thread, WebCore::Timer
1039         cannot be used
1040
1041         Reverted changesets:
1042
1043         "<rdar://problem/47570443> Responsiveness timers are too
1044         expensive for frequent events"
1045         https://bugs.webkit.org/show_bug.cgi?id=194003
1046         https://trac.webkit.org/changeset/240759
1047
1048         "Use deferrable timer to restart the Responsiveness Timer on
1049         each wheel event"
1050         https://bugs.webkit.org/show_bug.cgi?id=194135
1051         https://trac.webkit.org/changeset/240944
1052
1053 2019-02-06  chris fleizach  <cfleizach@apple.com>
1054
1055         AX:  com.apple.WebKit.WebContent at WebKit: -[WKAccessibilityWebPageObjectBase axObjectCache]
1056         https://bugs.webkit.org/show_bug.cgi?id=194306
1057         <rdar://problem/47764549>
1058
1059         Reviewed by Zalan Bujtas.
1060
1061         Check the page reference is still valid.
1062         Modernize code in this area.
1063
1064         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
1065
1066 2019-02-06  Daniel Bates  <dabates@apple.com>
1067
1068         Move toNSEventModifierFlags() and toNSButtonNumber() to WebEventFactory.mm
1069         https://bugs.webkit.org/show_bug.cgi?id=194321
1070
1071         Reviewed by Jer Noble.
1072
1073         Move some code to WebEventFactory so that it can be shared by both WKNavigationAction.mm
1074         and UIDelegate.mm among other benefits.
1075
1076         * Shared/mac/WebEventFactory.h:
1077         * Shared/mac/WebEventFactory.mm:
1078         (WebKit::WebEventFactory::toNSEventModifierFlags):
1079         (WebKit::WebEventFactory::toNSButtonNumber):
1080         * UIProcess/API/Cocoa/WKNavigationAction.mm:
1081         (-[WKNavigationAction modifierFlags]):
1082         (-[WKNavigationAction buttonNumber]):
1083         (toNSEventModifierFlags): Deleted.
1084         (toNSButtonNumber): Deleted.
1085         * UIProcess/Cocoa/UIDelegate.mm:
1086         (WebKit::UIDelegate::UIClient::mouseDidMoveOverElement):
1087         (WebKit::toNSEventModifierFlags): Deleted.
1088
1089 2019-02-06  Andy Estes  <aestes@apple.com>
1090
1091         [Payment Request] It should be possible to require a phonetic name for shipping contacts
1092         https://bugs.webkit.org/show_bug.cgi?id=194311
1093         <rdar://46733045>
1094
1095         Reviewed by Alex Christensen.
1096
1097         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1098         (WebKit::WebPaymentCoordinator::supportsVersion): Deleted.
1099         * WebProcess/ApplePay/WebPaymentCoordinator.h:
1100
1101 2019-02-06  Keith Rollin  <krollin@apple.com>
1102
1103         Really enable the automatic checking and regenerations of .xcfilelists during builds
1104         https://bugs.webkit.org/show_bug.cgi?id=194357
1105         <rdar://problem/47861231>
1106
1107         Reviewed by Chris Dumez.
1108
1109         Bug 194124 was supposed to enable the automatic checking and
1110         regenerating of .xcfilelist files during the build. While related
1111         changes were included in that patch, the change to actually enable the
1112         operation somehow was omitted. This patch actually enables the
1113         operation. The check-xcfilelist.sh scripts now check
1114         WK_DISABLE_CHECK_XCFILELISTS, and if it's "1", opts-out the developer
1115         from the checking.
1116
1117         * Scripts/check-xcfilelists.sh:
1118
1119 2019-02-06  John Wilander  <wilander@apple.com>
1120
1121         Forward Ad Click Attribution data from HTMLAnchorElement::handleClick() to WebKit::NavigationActionData
1122         https://bugs.webkit.org/show_bug.cgi?id=194325
1123         <rdar://problem/47840283>
1124
1125         Reviewed by Chris Dumez.
1126
1127         * Shared/NavigationActionData.cpp:
1128         (WebKit::NavigationActionData::encode const):
1129         (WebKit::NavigationActionData::decode):
1130         * Shared/NavigationActionData.h:
1131             Now holds an optional WebCore::AdClickAttribution object.
1132
1133 2019-02-06  Daniel Bates  <dabates@apple.com>
1134
1135         Fix the Apple Internal build. See <rdar://problem/47860943> for more details.
1136
1137         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
1138         (-[WKFullscreenStackView init]):
1139
1140 2019-02-06  Daniel Bates  <dabates@apple.com>
1141
1142         Standardize on ControlKey instead of CtrlKey
1143         https://bugs.webkit.org/show_bug.cgi?id=194317
1144
1145         Reviewed by Tim Horton.
1146
1147         * Shared/WebEventConversion.cpp:
1148         (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
1149         (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
1150         (WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
1151         (WebKit::WebKit2PlatformTouchEvent::WebKit2PlatformTouchEvent):
1152         (WebKit::WebKit2PlatformGestureEvent::WebKit2PlatformGestureEvent):
1153         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
1154         (WebKit::WebEditorClient::handleKeyboardEvent):
1155         * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp:
1156         (WebKit::handleKeyPress):
1157
1158 2019-02-06  Per Arne Vollan  <pvollan@apple.com>
1159
1160         Roll out parts of r238819 since it is a PLT performance regression.
1161         https://bugs.webkit.org/show_bug.cgi?id=194346
1162
1163         Unreviewed performance fix.
1164
1165         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1166         (didStartProvisionalLoadForFrame):
1167         (didReceiveServerRedirectForProvisionalLoadForFrame):
1168         (didFinishLoadForFrame):
1169         (globalObjectIsAvailableForFrame):
1170         (didRemoveFrameFromHierarchy):
1171         (didCommitLoadForFrame):
1172         (didFinishDocumentLoadForFrame):
1173         (didFailProvisionalLoadWithErrorForFrame):
1174         (didFailLoadWithErrorForFrame):
1175         (didSameDocumentNavigationForFrame):
1176         (didLayoutForFrame):
1177         (didReachLayoutMilestone):
1178         (didFirstVisuallyNonEmptyLayoutForFrame):
1179         (didHandleOnloadEventsForFrame):
1180         (userAgentForURL):
1181         (setUpPageLoaderClient):
1182         (willSendRequestForFrame):
1183         (didInitiateLoadForResource):
1184         (didFinishLoadForResource):
1185         (didFailLoadForResource):
1186         (setUpResourceLoadClient):
1187         (-[WKWebProcessPlugInBrowserContextController setLoadDelegate:]):
1188         (ResourceLoadClient::ResourceLoadClient): Deleted.
1189         (ResourceLoadClient::loadDelegate const): Deleted.
1190         (ResourceLoadClient::pluginContextController const): Deleted.
1191         (PageLoaderClient::PageLoaderClient): Deleted.
1192         (PageLoaderClient::loadDelegate const): Deleted.
1193         (PageLoaderClient::pluginContextController const): Deleted.
1194         (PageLoaderClient::didStartProvisionalLoadForFrame): Deleted.
1195         (PageLoaderClient::didReceiveServerRedirectForProvisionalLoadForFrame): Deleted.
1196         (PageLoaderClient::didFinishLoadForFrame): Deleted.
1197         (PageLoaderClient::globalObjectIsAvailableForFrame): Deleted.
1198         (PageLoaderClient::didRemoveFrameFromHierarchy): Deleted.
1199         (PageLoaderClient::didCommitLoadForFrame): Deleted.
1200         (PageLoaderClient::didFinishDocumentLoadForFrame): Deleted.
1201         (PageLoaderClient::didFailProvisionalLoadWithErrorForFrame): Deleted.
1202         (PageLoaderClient::didFailLoadWithErrorForFrame): Deleted.
1203         (PageLoaderClient::didSameDocumentNavigationForFrame): Deleted.
1204         (PageLoaderClient::didLayoutForFrame): Deleted.
1205         (PageLoaderClient::didReachLayoutMilestone): Deleted.
1206         (PageLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame): Deleted.
1207         (PageLoaderClient::layoutMilestones const): Deleted.
1208         (PageLoaderClient::didHandleOnloadEventsForFrame): Deleted.
1209         (PageLoaderClient::userAgentForURL const): Deleted.
1210         (ResourceLoadClient::willSendRequestForFrame): Deleted.
1211         (ResourceLoadClient::didInitiateLoadForResource): Deleted.
1212         (ResourceLoadClient::didFinishLoadForResource): Deleted.
1213         (ResourceLoadClient::didFailLoadForResource): Deleted.
1214
1215 2019-02-06  Michael Catanzaro  <mcatanzaro@igalia.com>
1216
1217         REGRESSION(r240785): [SOUP] Broke cookie persistent storage
1218         https://bugs.webkit.org/show_bug.cgi?id=194209
1219
1220         Reviewed by Carlos Garcia Campos.
1221
1222         I missed a spot when moving the persistent storage parameters from NetworkProcess to
1223         NetworkSession. They have to be initialized separately for the default session.
1224
1225         * UIProcess/soup/WebProcessPoolSoup.cpp:
1226         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1227
1228 2019-02-05  Alex Christensen  <achristensen@webkit.org>
1229
1230         Stop using blobRegistry in NetworkProcess
1231         https://bugs.webkit.org/show_bug.cgi?id=194027
1232
1233         Reviewed by Youenn Fablet.
1234
1235         * NetworkProcess/Downloads/DownloadManager.cpp:
1236         (WebKit::DownloadManager::startDownload):
1237         * NetworkProcess/Downloads/PendingDownload.cpp:
1238         (WebKit::PendingDownload::PendingDownload):
1239         * NetworkProcess/Downloads/PendingDownload.h:
1240         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
1241         (WebKit::NetworkBlobRegistry::registerFileBlobURL):
1242         (WebKit::NetworkBlobRegistry::registerBlobURL):
1243         (WebKit::NetworkBlobRegistry::registerBlobURLOptionallyFileBacked):
1244         (WebKit::NetworkBlobRegistry::registerBlobURLForSlice):
1245         (WebKit::NetworkBlobRegistry::unregisterBlobURL):
1246         (WebKit::NetworkBlobRegistry::blobSize):
1247         (WebKit::NetworkBlobRegistry::writeBlobsToTemporaryFiles):
1248         (WebKit::NetworkBlobRegistry::writeBlobToFilePath):
1249         (WebKit::NetworkBlobRegistry::connectionToWebProcessDidClose):
1250         (WebKit::NetworkBlobRegistry::filesInBlob):
1251         (WebKit::NetworkBlobRegistry::singleton): Deleted.
1252         * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
1253         (WebKit::NetworkBlobRegistry::blobRegistry):
1254         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1255         (WebKit::NetworkConnectionToWebProcess::didClose):
1256         (WebKit::NetworkConnectionToWebProcess::resolveBlobReferences):
1257         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
1258         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
1259         (WebKit::NetworkConnectionToWebProcess::loadPing):
1260         (WebKit::NetworkConnectionToWebProcess::preconnectTo):
1261         (WebKit::NetworkConnectionToWebProcess::registerFileBlobURL):
1262         (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
1263         (WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
1264         (WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
1265         (WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
1266         (WebKit::NetworkConnectionToWebProcess::unregisterBlobURL):
1267         (WebKit::NetworkConnectionToWebProcess::blobSize):
1268         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
1269         (WebKit::NetworkConnectionToWebProcess::filesInBlob):
1270         (WebKit::NetworkConnectionToWebProcess::blobRegistry):
1271         * NetworkProcess/NetworkConnectionToWebProcess.h:
1272         * NetworkProcess/NetworkDataTask.cpp:
1273         (WebKit::NetworkDataTask::create):
1274         * NetworkProcess/NetworkDataTaskBlob.cpp:
1275         (WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob):
1276         * NetworkProcess/NetworkDataTaskBlob.h:
1277         * NetworkProcess/NetworkLoad.cpp:
1278         (WebKit::NetworkLoad::NetworkLoad):
1279         (WebKit::NetworkLoad::initialize):
1280         * NetworkProcess/NetworkLoad.h:
1281         * NetworkProcess/NetworkProcess.cpp:
1282         (WebKit::NetworkProcess::NetworkProcess):
1283         (WebKit::NetworkProcess::removeNetworkConnectionToWebProcess):
1284         * NetworkProcess/NetworkProcess.h:
1285         (WebKit::NetworkProcess::networkBlobRegistry):
1286         * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
1287         (WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
1288         * NetworkProcess/NetworkResourceLoader.cpp:
1289         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
1290         (WebKit::NetworkResourceLoader::startNetworkLoad):
1291         * NetworkProcess/PreconnectTask.cpp:
1292         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1293         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
1294
1295 2019-02-05  Daniel Bates  <dabates@apple.com>
1296
1297         Fix a typo in r241006. Substitute Modifier for Modifiers.
1298
1299         * Shared/mac/NativeWebGestureEventMac.mm:
1300         (WebKit::NativeWebGestureEvent::NativeWebGestureEvent):
1301
1302 2019-02-05  Daniel Bates  <dabates@apple.com>
1303
1304         Attempt to fix the build following r241000
1305         (https://bugs.webkit.org/show_bug.cgi?id=194241)
1306
1307         Substitute OptionSet<WebEvent::Modifier> for Modifiers.
1308
1309         * Shared/mac/NativeWebGestureEventMac.mm:
1310         (WebKit::NativeWebGestureEvent::NativeWebGestureEvent):
1311         * Shared/mac/WebGestureEvent.h:
1312         (WebKit::WebGestureEvent::WebGestureEvent):
1313
1314 2019-02-05  Truitt Savell  <tsavell@apple.com>
1315
1316         Unreviewed, rolling out r240984.
1317
1318         Revision casued two API timeouts
1319
1320         Reverted changeset:
1321
1322         "Stop using blobRegistry in NetworkProcess"
1323         https://bugs.webkit.org/show_bug.cgi?id=194027
1324         https://trac.webkit.org/changeset/240984
1325
1326 2019-02-05  Youenn Fablet  <youenn@apple.com>
1327
1328         UserMediaPermissionRequestManagerProxy lambdas should check for 'this' being valid
1329         https://bugs.webkit.org/show_bug.cgi?id=194246
1330
1331         Reviewed by Eric Carlson.
1332
1333         With PSON enabled, the manager proxy can be destroyed.
1334         It is thus important for its callbacks to check for 'this' to be valid.
1335
1336         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1337         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
1338         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
1339         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
1340
1341 2019-02-05  Daniel Bates  <dabates@apple.com>
1342
1343         Attempt to fix the build following r241000
1344         (https://bugs.webkit.org/show_bug.cgi?id=194241)
1345
1346         Substitute WebEvent::Modifier::CapsLockKey for WebEvent::CapsLockKey.
1347
1348         * Shared/gtk/WebEventFactory.cpp:
1349         (WebKit::modifiersForEvent):
1350         * Shared/mac/WebEventFactory.mm:
1351         (WebKit::modifiersForEvent):
1352         * UIProcess/API/Cocoa/WKNavigationAction.mm:
1353         (toNSEventModifierFlags):
1354         * UIProcess/Automation/WebAutomationSession.cpp:
1355         (WebKit::protocolModifierToWebEventModifier):
1356         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
1357         (WebKit::modifiersToEventState):
1358         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
1359         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
1360         * UIProcess/Cocoa/UIDelegate.mm:
1361         (WebKit::toNSEventModifierFlags):
1362
1363 2019-02-05  Daniel Bates  <dabates@apple.com>
1364
1365         Make WebEvent::Modifiers an OptionSet
1366         https://bugs.webkit.org/show_bug.cgi?id=194241
1367
1368         Reviewed by Simon Fraser.
1369
1370         Use an OptionSet to represent the bitmask of keyboard modifier flags. This improves type safety
1371         and makes debugging more enjoyable because our LLDB pretty-printers have built-in support for
1372         OptionSet.
1373
1374         While I am at it, make WebEvent::Modifier an enum class. It is currently an enum. This makes
1375         this enum more closely match WebCore::PlatformEvent::Modifier.
1376
1377         * Shared/API/c/WKSharedAPICast.h:
1378         (WebKit::toAPI):
1379         * Shared/NavigationActionData.cpp:
1380         (WebKit::NavigationActionData::encode const):
1381         (WebKit::NavigationActionData::decode):
1382         * Shared/NavigationActionData.h:
1383         * Shared/WebEvent.cpp:
1384         (WebKit::WebEvent::WebEvent):
1385         * Shared/WebEvent.h:
1386         (WebKit::WebEvent::shiftKey const):
1387         (WebKit::WebEvent::controlKey const):
1388         (WebKit::WebEvent::altKey const):
1389         (WebKit::WebEvent::metaKey const):
1390         (WebKit::WebEvent::capsLockKey const):
1391         (WebKit::WebEvent::modifiers const):
1392         (WebKit::WebTouchEvent::WebTouchEvent):
1393         * Shared/WebEventConversion.cpp:
1394         (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent):
1395         * Shared/WebKeyboardEvent.cpp:
1396         (WebKit::WebKeyboardEvent::WebKeyboardEvent):
1397         * Shared/WebMouseEvent.cpp:
1398         (WebKit::WebMouseEvent::WebMouseEvent):
1399         * Shared/WebTouchEvent.cpp:
1400         (WebKit::WebTouchEvent::WebTouchEvent):
1401         * Shared/WebWheelEvent.cpp:
1402         (WebKit::WebWheelEvent::WebWheelEvent):
1403         * Shared/gtk/WebEventFactory.cpp:
1404         (WebKit::modifiersForEvent):
1405         * Shared/ios/NativeWebTouchEventIOS.mm:
1406         (WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
1407         * Shared/ios/WebIOSEventFactory.mm:
1408         (modifiersForEvent):
1409         (WebIOSEventFactory::createWebKeyboardEvent):
1410         (WebIOSEventFactory::createWebMouseEvent):
1411         * Shared/libwpe/WebEventFactory.cpp:
1412         (WebKit::modifiersForEventModifiers):
1413         (WebKit::WebEventFactory::createWebWheelEvent):
1414         (WebKit::WebEventFactory::createWebTouchEvent):
1415         * Shared/mac/WebEventFactory.mm:
1416         (WebKit::modifiersForEvent):
1417         (WebKit::WebEventFactory::createWebMouseEvent):
1418         (WebKit::WebEventFactory::createWebWheelEvent):
1419         (WebKit::WebEventFactory::createWebKeyboardEvent):
1420         * Shared/win/WebEventFactory.cpp:
1421         (WebKit::modifiersForEvent):
1422         (WebKit::modifiersForCurrentKeyState):
1423         (WebKit::WebEventFactory::createWebMouseEvent):
1424         (WebKit::WebEventFactory::createWebWheelEvent):
1425         (WebKit::WebEventFactory::createWebKeyboardEvent):
1426         * UIProcess/API/APINavigationAction.h:
1427         * UIProcess/API/APIUIClient.h:
1428         (API::UIClient::mouseDidMoveOverElement):
1429         * UIProcess/API/C/WKPage.cpp:
1430         (WKPageSetPageUIClient):
1431         * UIProcess/API/Cocoa/WKNavigationAction.mm:
1432         (toNSEventModifierFlags):
1433         * UIProcess/API/glib/WebKitPrivate.cpp:
1434         (toPlatformModifiers):
1435         * UIProcess/API/glib/WebKitPrivate.h:
1436         * UIProcess/API/glib/WebKitUIClient.cpp:
1437         * UIProcess/API/glib/WebKitWebView.cpp:
1438         (webkitWebViewMouseTargetChanged):
1439         * UIProcess/API/glib/WebKitWebViewPrivate.h:
1440         * UIProcess/Automation/WebAutomationSession.cpp:
1441         (WebKit::WebAutomationSession::simulateMouseInteraction):
1442         (WebKit::protocolModifierToWebEventModifier):
1443         (WebKit::WebAutomationSession::performMouseInteraction):
1444         * UIProcess/Automation/WebAutomationSession.h:
1445         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
1446         (WebKit::modifiersToEventState):
1447         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
1448         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
1449         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
1450         * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp:
1451         (WebKit::modifiersToEventState):
1452         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
1453         * UIProcess/Cocoa/UIDelegate.h:
1454         * UIProcess/Cocoa/UIDelegate.mm:
1455         (WebKit::toNSEventModifierFlags):
1456         (WebKit::UIDelegate::UIClient::mouseDidMoveOverElement):
1457         * UIProcess/WebPageProxy.cpp:
1458         (WebKit::WebPageProxy::mouseDidMoveOverElement):
1459         * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
1460         (API::InjectedBundle::PageUIClient::mouseDidMoveOverElement):
1461         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
1462         (WebKit::InjectedBundleNavigationAction::modifiersForNavigationAction):
1463         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.h:
1464         (WebKit::InjectedBundleNavigationAction::modifiers const):
1465         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
1466         (WebKit::InjectedBundlePageUIClient::mouseDidMoveOverElement):
1467         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
1468         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1469         (WebKit::PDFPlugin::showContextMenuAtPoint):
1470         * WebProcess/Plugins/PluginView.cpp:
1471         (WebKit::PluginView::createWebEvent const):
1472         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1473         (WebKit::WebChromeClient::mouseDidMoveOverElement):
1474         * WebProcess/WebPage/WebPage.cpp:
1475         (WebKit::WebPage::simulateMouseDown):
1476         (WebKit::WebPage::simulateMouseUp):
1477         (WebKit::WebPage::simulateMouseMotion):
1478
1479 2019-02-05  Tim Horton  <timothy_horton@apple.com>
1480
1481         Reproducible crash under WKShareSheet presentWithParameters when cancelling a share
1482         https://bugs.webkit.org/show_bug.cgi?id=194301
1483         <rdar://problem/47719379>
1484
1485         Reviewed by Beth Dakin.
1486
1487         * UIProcess/Cocoa/WKShareSheet.mm:
1488         (-[WKShareSheet presentWithParameters:completionHandler:]):
1489         NSSharingServicePicker's delegate callbacks can be called synchronously.
1490         We release the WKShareSheet (which holds our reference to the NSSharingServicePicker)
1491         under sharingServicePicker:didChooseSharingService:. On older versions of macOS,
1492         there was nothing keeping the NSSharingServicePicker alive inside
1493         showRelativeToRect:ofView:preferredEdge:, thus the whole chain of references would
1494         fall and result in sending a message to a released NSSharingServicePicker.
1495         To resolve this, keep an extra reference to the WKShareSheet until
1496         presentation is complete.
1497
1498 2019-02-05  Keith Rollin  <krollin@apple.com>
1499
1500         Enable the automatic checking and regenerations of .xcfilelists during builds
1501         https://bugs.webkit.org/show_bug.cgi?id=194124
1502         <rdar://problem/47721277>
1503
1504         Reviewed by Tim Horton.
1505
1506         Bug 193790 add a facility for checking -- during build time -- that
1507         any needed .xcfilelist files are up-to-date and for updating them if
1508         they are not. This facility was initially opt-in by setting
1509         WK_ENABLE_CHECK_XCFILELISTS until other pieces were in place and until
1510         the process seemed robust. Its now time to enable this facility and
1511         make it opt-out. If there is a need to disable this facility, set and
1512         export WK_DISABLE_CHECK_XCFILELISTS=1 in your environment before
1513         running `make` or `build-webkit`, or before running Xcode from the
1514         command line.
1515
1516         Additionally, remove the step that generates a list of source files
1517         going into the UnifiedSources build step. It's only necessarily to
1518         specify Sources.txt and SourcesCocoa.txt as inputs.
1519
1520         * UnifiedSources-input.xcfilelist: Removed.
1521         * WebKit.xcodeproj/project.pbxproj:
1522
1523 2019-02-05  Brady Eidson  <beidson@apple.com>
1524
1525         Add a new DownloadMap type that manages taking an assertion automatically.
1526         https://bugs.webkit.org/show_bug.cgi?id=194294
1527
1528         Reviewed by Alex Christensen.
1529
1530         If we don't need the download assertion, we use a vanilla HashMap like today.
1531         If we need the download assertion, we use the new DownloadMap class instead.
1532
1533         The new DownloadMap is a wrapper around a HashMap that also creates/destroys the assertion as needed.
1534
1535         * NetworkProcess/Downloads/DownloadManager.cpp:
1536         (WebKit::DownloadManager::dataTaskBecameDownloadTask):
1537         (WebKit::DownloadManager::downloadFinished):
1538         * NetworkProcess/Downloads/DownloadManager.h:
1539
1540         * NetworkProcess/Downloads/DownloadMap.cpp: Added.
1541         (WebKit::DownloadMap::get const):
1542         (WebKit::DownloadMap::isEmpty const):
1543         (WebKit::DownloadMap::size const):
1544         (WebKit::DownloadMap::contains const):
1545         (WebKit::DownloadMap::add):
1546         (WebKit::DownloadMap::remove):
1547         * NetworkProcess/Downloads/DownloadMap.h: Added.
1548
1549         * Sources.txt:
1550
1551         * UIProcess/ios/ProcessAssertionIOS.mm:
1552         (WebKit::ProcessAssertion::ProcessAssertion):
1553
1554         * WebKit.xcodeproj/project.pbxproj:
1555
1556 2019-02-05  Brady Eidson  <beidson@apple.com>
1557
1558         Fix iOS simulator build after r240954
1559
1560         Unreviewed.
1561
1562         * UIProcess/ios/ProcessAssertionIOS.mm:
1563         (WebKit::ProcessAssertion::ProcessAssertion): Implement the new constructor.
1564
1565 2019-02-05  Alex Christensen  <achristensen@webkit.org>
1566
1567         Stop using blobRegistry in NetworkProcess
1568         https://bugs.webkit.org/show_bug.cgi?id=194027
1569
1570         Reviewed by Youenn Fablet.
1571
1572         * NetworkProcess/Downloads/DownloadManager.cpp:
1573         (WebKit::DownloadManager::startDownload):
1574         * NetworkProcess/Downloads/PendingDownload.cpp:
1575         (WebKit::PendingDownload::PendingDownload):
1576         * NetworkProcess/Downloads/PendingDownload.h:
1577         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
1578         (WebKit::NetworkBlobRegistry::registerFileBlobURL):
1579         (WebKit::NetworkBlobRegistry::registerBlobURL):
1580         (WebKit::NetworkBlobRegistry::registerBlobURLOptionallyFileBacked):
1581         (WebKit::NetworkBlobRegistry::registerBlobURLForSlice):
1582         (WebKit::NetworkBlobRegistry::unregisterBlobURL):
1583         (WebKit::NetworkBlobRegistry::blobSize):
1584         (WebKit::NetworkBlobRegistry::writeBlobsToTemporaryFiles):
1585         (WebKit::NetworkBlobRegistry::writeBlobToFilePath):
1586         (WebKit::NetworkBlobRegistry::connectionToWebProcessDidClose):
1587         (WebKit::NetworkBlobRegistry::filesInBlob):
1588         (WebKit::NetworkBlobRegistry::singleton): Deleted.
1589         * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
1590         (WebKit::NetworkBlobRegistry::blobRegistry):
1591         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1592         (WebKit::NetworkConnectionToWebProcess::didClose):
1593         (WebKit::NetworkConnectionToWebProcess::resolveBlobReferences):
1594         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
1595         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
1596         (WebKit::NetworkConnectionToWebProcess::loadPing):
1597         (WebKit::NetworkConnectionToWebProcess::preconnectTo):
1598         (WebKit::NetworkConnectionToWebProcess::registerFileBlobURL):
1599         (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
1600         (WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
1601         (WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
1602         (WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
1603         (WebKit::NetworkConnectionToWebProcess::unregisterBlobURL):
1604         (WebKit::NetworkConnectionToWebProcess::blobSize):
1605         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
1606         (WebKit::NetworkConnectionToWebProcess::filesInBlob):
1607         (WebKit::NetworkConnectionToWebProcess::blobRegistry):
1608         * NetworkProcess/NetworkConnectionToWebProcess.h:
1609         * NetworkProcess/NetworkDataTask.cpp:
1610         (WebKit::NetworkDataTask::create):
1611         * NetworkProcess/NetworkDataTaskBlob.cpp:
1612         (WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob):
1613         * NetworkProcess/NetworkDataTaskBlob.h:
1614         * NetworkProcess/NetworkLoad.cpp:
1615         (WebKit::NetworkLoad::NetworkLoad):
1616         (WebKit::NetworkLoad::initialize):
1617         * NetworkProcess/NetworkLoad.h:
1618         * NetworkProcess/NetworkProcess.cpp:
1619         (WebKit::NetworkProcess::NetworkProcess):
1620         (WebKit::NetworkProcess::removeNetworkConnectionToWebProcess):
1621         * NetworkProcess/NetworkProcess.h:
1622         (WebKit::NetworkProcess::networkBlobRegistry):
1623         * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
1624         (WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
1625         * NetworkProcess/NetworkResourceLoader.cpp:
1626         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
1627         (WebKit::NetworkResourceLoader::startNetworkLoad):
1628         * NetworkProcess/PreconnectTask.cpp:
1629         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1630         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
1631
1632 2019-02-05  Ryan Haddad  <ryanhaddad@apple.com>
1633
1634         Unreviewed, rolling out r240742.
1635
1636         Causes crashes on iOS simulator.
1637
1638         Reverted changeset:
1639
1640         "[iOS] Keyups for non-modifier keys identified as "Dead" when
1641         not focused in a content-editable element"
1642         https://bugs.webkit.org/show_bug.cgi?id=192824
1643         https://trac.webkit.org/changeset/240742
1644
1645 2019-02-05  Alex Christensen  <achristensen@webkit.org>
1646
1647         Protect globalWebSocketStreamMap with a Lock
1648         https://bugs.webkit.org/show_bug.cgi?id=194224
1649         <rdar://problem/47581081>
1650
1651         Reviewed by Ryosuke Niwa.
1652
1653         * WebProcess/Network/WebSocketStream.cpp:
1654         (WebKit::WebSocketStream::streamWithIdentifier):
1655         (WebKit::WebSocketStream::networkProcessCrashed):
1656         (WebKit::WebSocketStream::WebSocketStream):
1657         (WebKit::WebSocketStream::~WebSocketStream):
1658
1659 2019-02-04  Alex Christensen  <achristensen@webkit.org>
1660
1661         Add Networking Daemon skeleton
1662         https://bugs.webkit.org/show_bug.cgi?id=194278
1663
1664         Reviewed by Zalan Bujtas.
1665
1666         Daemon skeletons? This is spooky stuff.
1667
1668         * NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.h: Added.
1669         * NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm: Added.
1670         (WebKit::DaemonMain):
1671         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1672         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1673         (WebKit::NetworkDataTaskCocoa::restrictRequestReferrerToOriginIfNeeded):
1674         * Shared/API/Cocoa/WKMain.h:
1675         * Shared/API/Cocoa/WKMain.mm:
1676         (WKDaemonMain):
1677         * Shared/EntryPointUtilities/Cocoa/AuxiliaryProcessMain.cpp:
1678         (main):
1679         * SourcesCocoa.txt:
1680         * UnifiedSources-input.xcfilelist:
1681         * WebKit.xcodeproj/project.pbxproj:
1682
1683 2019-02-04  Yusuke Suzuki  <ysuzuki@apple.com>
1684
1685         [JSC] Shrink size of VM by lazily allocating IsoSubspaces for non-common types
1686         https://bugs.webkit.org/show_bug.cgi?id=193993
1687
1688         Reviewed by Keith Miller.
1689
1690         * WebProcess/Plugins/Netscape/JSNPMethod.h:
1691         * WebProcess/Plugins/Netscape/JSNPObject.h:
1692
1693 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
1694
1695         Move some macOS/iOS scrolling code into the scrolling/cocoa directory
1696         https://bugs.webkit.org/show_bug.cgi?id=194245
1697
1698         Reviewed by Zalan Bujtas.
1699
1700         Use PLATFORM(MAC), not !PLATFORM(IOS_FAMILY).
1701
1702         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1703         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1704
1705 2019-02-04  Ms2ger  <Ms2ger@igalia.com>
1706
1707         [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI
1708         https://bugs.webkit.org/show_bug.cgi?id=174816
1709
1710         Reviewed by Michael Catanzaro.
1711
1712         Add webkit_uri_for_display for GTK and WPE.
1713
1714         * PlatformGTK.cmake:
1715         * PlatformWPE.cmake:
1716         * SourcesGTK.txt:
1717         * SourcesWPE.txt:
1718         * UIProcess/API/glib/WebKitURIUtilities.cpp: Added.
1719         (webkit_uri_for_display):
1720         * UIProcess/API/gtk/WebKitURIUtilities.h: Added.
1721         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1722         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
1723         * UIProcess/API/gtk/webkit2.h:
1724         * UIProcess/API/wpe/WebKitURIUtilities.h: Added.
1725         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
1726         * UIProcess/API/wpe/docs/wpe-docs.sgml:
1727         * UIProcess/API/wpe/webkit.h:
1728
1729 2019-02-04  Alex Christensen  <achristensen@webkit.org>
1730
1731         Move XPCService main to a shared file calling a C function
1732         https://bugs.webkit.org/show_bug.cgi?id=194256
1733
1734         Reviewed by Brady Eidson.
1735
1736         This not only reduces a few kilobytes of duplicated binary from the XPCService executables,
1737         It will allow me to introduce a new kind of executable which will need to parse argv and call a different C function.
1738         This is similar to r236075 but more general.
1739
1740         * Shared/API/Cocoa/WKMain.h: Added.
1741         * Shared/API/Cocoa/WKMain.mm: Added.
1742         (WKXPCServiceMain):
1743         * Shared/EntryPointUtilities/Cocoa/AuxiliaryProcessMain.cpp: Added.
1744         (main):
1745         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
1746         (main): Deleted.
1747         * SourcesCocoa.txt:
1748         * WebKit.xcodeproj/project.pbxproj:
1749
1750 2019-02-04  Alex Christensen  <achristensen@webkit.org>
1751
1752         Make MessageSender functions const
1753         https://bugs.webkit.org/show_bug.cgi?id=194247
1754
1755         Reviewed by Brady Eidson.
1756
1757         * NetworkProcess/Downloads/Download.cpp:
1758         (WebKit::Download::messageSenderConnection const):
1759         (WebKit::Download::messageSenderDestinationID const):
1760         (WebKit::Download::messageSenderConnection): Deleted.
1761         (WebKit::Download::messageSenderDestinationID): Deleted.
1762         * NetworkProcess/Downloads/Download.h:
1763         * NetworkProcess/Downloads/PendingDownload.cpp:
1764         (WebKit::PendingDownload::messageSenderConnection const):
1765         (WebKit::PendingDownload::messageSenderDestinationID const):
1766         (WebKit::PendingDownload::messageSenderConnection): Deleted.
1767         (WebKit::PendingDownload::messageSenderDestinationID): Deleted.
1768         * NetworkProcess/Downloads/PendingDownload.h:
1769         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
1770         (WebKit::WebIDBConnectionToClient::messageSenderConnection const):
1771         (WebKit::WebIDBConnectionToClient::messageSenderConnection): Deleted.
1772         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
1773         * NetworkProcess/NetworkResourceLoader.cpp:
1774         (WebKit::NetworkResourceLoader::messageSenderConnection const):
1775         (WebKit::NetworkResourceLoader::messageSenderConnection): Deleted.
1776         * NetworkProcess/NetworkResourceLoader.h:
1777         * NetworkProcess/NetworkSocketStream.cpp:
1778         (WebKit::NetworkSocketStream::messageSenderConnection const):
1779         (WebKit::NetworkSocketStream::messageSenderDestinationID const):
1780         (WebKit::NetworkSocketStream::messageSenderConnection): Deleted.
1781         (WebKit::NetworkSocketStream::messageSenderDestinationID): Deleted.
1782         * NetworkProcess/NetworkSocketStream.h:
1783         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
1784         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1785         (WebKit::WebSWServerToContextConnection::messageSenderConnection const):
1786         (WebKit::WebSWServerToContextConnection::messageSenderDestinationID const):
1787         (WebKit::WebSWServerToContextConnection::messageSenderConnection): Deleted.
1788         (WebKit::WebSWServerToContextConnection::messageSenderDestinationID): Deleted.
1789         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
1790         * Platform/IPC/MessageSender.h:
1791         * Shared/AuxiliaryProcess.cpp:
1792         (WebKit::AuxiliaryProcess::messageSenderConnection const):
1793         (WebKit::AuxiliaryProcess::messageSenderDestinationID const):
1794         (WebKit::AuxiliaryProcess::messageSenderConnection): Deleted.
1795         (WebKit::AuxiliaryProcess::messageSenderDestinationID): Deleted.
1796         * Shared/AuxiliaryProcess.h:
1797         * UIProcess/WebConnectionToWebProcess.cpp:
1798         (WebKit::WebConnectionToWebProcess::messageSenderConnection const):
1799         (WebKit::WebConnectionToWebProcess::messageSenderDestinationID const):
1800         (WebKit::WebConnectionToWebProcess::messageSenderConnection): Deleted.
1801         (WebKit::WebConnectionToWebProcess::messageSenderDestinationID): Deleted.
1802         * UIProcess/WebConnectionToWebProcess.h:
1803         * UIProcess/WebPageProxy.cpp:
1804         (WebKit::WebPageProxy::messageSenderConnection const):
1805         (WebKit::WebPageProxy::messageSenderDestinationID const):
1806         (WebKit::WebPageProxy::messageSenderConnection): Deleted.
1807         (WebKit::WebPageProxy::messageSenderDestinationID): Deleted.
1808         * UIProcess/WebPageProxy.h:
1809         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1810         (WebKit::WebIDBConnectionToServer::messageSenderConnection const):
1811         (WebKit::WebIDBConnectionToServer::messageSenderConnection): Deleted.
1812         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
1813         * WebProcess/Network/WebResourceLoader.cpp:
1814         (WebKit::WebResourceLoader::messageSenderConnection const):
1815         (WebKit::WebResourceLoader::messageSenderDestinationID const):
1816         (WebKit::WebResourceLoader::messageSenderConnection): Deleted.
1817         (WebKit::WebResourceLoader::messageSenderDestinationID): Deleted.
1818         * WebProcess/Network/WebResourceLoader.h:
1819         * WebProcess/Network/WebSocketStream.cpp:
1820         (WebKit::WebSocketStream::messageSenderConnection const):
1821         (WebKit::WebSocketStream::messageSenderDestinationID const):
1822         (WebKit::WebSocketStream::messageSenderConnection): Deleted.
1823         (WebKit::WebSocketStream::messageSenderDestinationID): Deleted.
1824         * WebProcess/Network/WebSocketStream.h:
1825         * WebProcess/Storage/WebSWClientConnection.h:
1826         * WebProcess/WebConnectionToUIProcess.cpp:
1827         (WebKit::WebConnectionToUIProcess::messageSenderConnection const):
1828         (WebKit::WebConnectionToUIProcess::messageSenderDestinationID const):
1829         (WebKit::WebConnectionToUIProcess::messageSenderConnection): Deleted.
1830         (WebKit::WebConnectionToUIProcess::messageSenderDestinationID): Deleted.
1831         * WebProcess/WebConnectionToUIProcess.h:
1832         * WebProcess/WebPage/WebPage.cpp:
1833         (WebKit::WebPage::messageSenderConnection const):
1834         (WebKit::WebPage::messageSenderDestinationID const):
1835         (WebKit::WebPage::messageSenderConnection): Deleted.
1836         (WebKit::WebPage::messageSenderDestinationID): Deleted.
1837         * WebProcess/WebPage/WebPage.h:
1838
1839 2019-02-04  Brady Eidson  <beidson@apple.com>
1840
1841         Take additional process assertion while downloading.
1842         <rdar://problem/47741356> and https://bugs.webkit.org/show_bug.cgi?id=194239
1843
1844         Reviewed by Chris Dumez.
1845
1846         When the first download starts, grab this new assertion.
1847         When the last download ends, release it.
1848
1849         * Configurations/Network-iOS.entitlements:
1850
1851         * NetworkProcess/Downloads/DownloadManager.cpp:
1852         (WebKit::DownloadManager::dataTaskBecameDownloadTask):
1853         (WebKit::DownloadManager::downloadFinished):
1854         * NetworkProcess/Downloads/DownloadManager.h:
1855
1856         * Platform/spi/ios/AssertionServicesSPI.h:
1857
1858         * UIProcess/ProcessAssertion.cpp:
1859         (WebKit::ProcessAssertion::ProcessAssertion):
1860         * UIProcess/ProcessAssertion.h:
1861         (WebKit::ProcessAssertion::ProcessAssertion):
1862
1863         * UIProcess/WebProcessProxy.cpp:
1864         (WebKit::WebProcessProxy::didSetAssertionState):
1865
1866         * UIProcess/ios/ProcessAssertionIOS.mm:
1867         (WebKit::flagsForState):
1868         (WebKit::reasonForState):
1869         (WebKit::ProcessAssertion::ProcessAssertion):
1870
1871 2019-02-04  Said Abou-Hallawa  <said@apple.com>
1872
1873         [CG] Enable setAdditionalSupportedImageTypes for WK1
1874         https://bugs.webkit.org/show_bug.cgi?id=194190
1875
1876         Reviewed by Tim Horton.
1877
1878         Move the function webCoreStringVectorFromNSStringArray from WebKit to
1879         WebCore so it can be used by both WebKit and WebKitLegacy.
1880
1881         * Platform/mac/StringUtilities.h:
1882         * Platform/mac/StringUtilities.mm:
1883         (WebKit::webCoreStringVectorFromNSStringArray): Deleted.
1884         * UIProcess/API/Cocoa/WKWebView.mm:
1885         (-[WKWebView _initializeWithConfiguration:]):
1886
1887 2019-02-04  Benjamin Poulain  <benjamin@webkit.org>
1888
1889         Use deferrable timer to restart the Responsiveness Timer on each wheel event
1890         https://bugs.webkit.org/show_bug.cgi?id=194135
1891
1892         Reviewed by Simon Fraser.
1893
1894         Simon Fraser suggested a neat improvement over my previous optimization
1895         of ResponsivenessTimer.
1896
1897         Instead of reseting the deadline with every event, we can let the timer
1898         fire and add the missing time from the last start.
1899
1900         I implemented that behavior in the new Deferrable Timer class and use
1901         it from ResponsivenessTimer.
1902
1903         * NetworkProcess/watchos/NetworkProximityAssertion.h:
1904         * UIProcess/ResponsivenessTimer.h:
1905         * WebProcess/Plugins/PluginView.h:
1906
1907 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
1908
1909         PageOverlayController's layers should be created lazily
1910         https://bugs.webkit.org/show_bug.cgi?id=194199
1911         rdar://problem/46571593
1912
1913         Reviewed by Tim Horton.
1914         
1915         Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays()
1916         and use them to only parent the overlay-hosting layers when necessary.
1917
1918         For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can
1919         simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(),
1920         which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer
1921         compositing updates that parents the layerWithDocumentOverlays().
1922
1923         View overlays are added to the layer tree via the DrawingArea. When we go between having
1924         none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer()
1925         on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a
1926         compositing flush (this has to be done manually because view overlay layers are outside the
1927         subtree managed by RenderLayerCompositor).
1928         
1929         Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer;
1930         there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view
1931         overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without
1932         having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer().
1933
1934         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1935         (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer):
1936         * WebProcess/WebCoreSupport/WebChromeClient.h:
1937         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1938         (WebKit::AcceleratedDrawingArea::attachViewOverlayGraphicsLayer):
1939         * WebProcess/WebPage/AcceleratedDrawingArea.h:
1940         * WebProcess/WebPage/DrawingArea.h:
1941         (WebKit::DrawingArea::attachViewOverlayGraphicsLayer):
1942         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
1943         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1944         (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer):
1945         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1946         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1947         (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer):
1948         (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged):
1949
1950 2019-02-04  Michael Catanzaro  <mcatanzaro@igalia.com>
1951
1952         Unreviewed, improve preprocessor guard
1953         https://bugs.webkit.org/show_bug.cgi?id=194166
1954         <rdar://problem/47694328>
1955
1956         AC mode is only optional in GTK port. Requested by Zan.
1957
1958         * WebProcess/WebPage/WebPage.cpp:
1959         (WebKit::WebPage::updatePreferences):
1960
1961 2019-02-04  Sihui Liu  <sihui_liu@apple.com>
1962
1963         IndexedDB: leak WebIDBConnectionToServer in layout tests
1964         https://bugs.webkit.org/show_bug.cgi?id=193688
1965         <rdar://problem/47353263>
1966
1967         Reviewed by Geoffrey Garen.
1968
1969         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1970         (WebKit::NetworkConnectionToWebProcess::didClose):
1971         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
1972         (WebKit::NetworkConnectionToWebProcess::removeIDBConnectionToServer): Deleted.
1973         * NetworkProcess/NetworkConnectionToWebProcess.h:
1974         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1975         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1976         (WebKit::WebIDBConnectionToServer::~WebIDBConnectionToServer):
1977
1978 2019-02-04  Antoine Quint  <graouts@apple.com>
1979
1980         <rdar://problem/47788802>
1981
1982         Unreviewed build fix.
1983
1984         * Platform/spi/ios/UIKitSPI.h:
1985
1986 2019-02-04  Youenn Fablet  <youenn@apple.com>
1987
1988         Capture state should be managed consistently when doing process swapping
1989         https://bugs.webkit.org/show_bug.cgi?id=194122
1990         <rdar://problem/47609293>
1991
1992         Reviewed by Eric Carlson.
1993
1994         When doing PSON, WebPageProxy::resetState is called.
1995         It resets the media state, but does not call the client delegates.
1996         Instead of directly updating the media state, call the routine used to update it so that client delegates are called.
1997
1998         Covered by new API test and layout test.
1999
2000         * UIProcess/API/Cocoa/WKWebView.mm:
2001         (-[WKWebView _mediaCaptureState]):
2002         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2003         * UIProcess/WebPageProxy.cpp:
2004         (WebKit::WebPageProxy::resetState):
2005         (WebKit::WebPageProxy::isPlayingMediaDidChange):
2006         (WebKit::WebPageProxy::updatePlayingMediaDidChange):
2007         * UIProcess/WebPageProxy.h:
2008
2009 2019-02-04  Antoine Quint  <graouts@apple.com>
2010
2011         Use a dedicated type instead of int32_t for pointer identifiers
2012         https://bugs.webkit.org/show_bug.cgi?id=194217
2013
2014         Reviewed by Antti Koivisto.
2015
2016         * Scripts/webkit/messages.py:
2017         * UIProcess/WebPageProxy.cpp:
2018         (WebKit::WebPageProxy::cancelPointer):
2019         * UIProcess/WebPageProxy.h:
2020         * WebProcess/WebPage/WebPage.cpp:
2021         (WebKit::WebPage::cancelPointer):
2022         * WebProcess/WebPage/WebPage.h:
2023         * WebProcess/WebPage/WebPage.messages.in:
2024
2025 2019-02-04  Michael Catanzaro  <mcatanzaro@igalia.com>
2026
2027         Unreviewed, avoid -Wswitch warnings introduced in r240880
2028         https://bugs.webkit.org/show_bug.cgi?id=193740
2029         <rdar://problem/47527267>
2030
2031         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2032         (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse):
2033
2034 2019-02-04  Alexander Mikhaylenko  <exalm7659@gmail.com>
2035
2036         [GTK] Allow pinch zoom on touchpad
2037         https://bugs.webkit.org/show_bug.cgi?id=194201
2038
2039         Reviewed by Michael Catanzaro.
2040
2041         Enable touchpad events for WebkitWebViewBase, then feed touchpad
2042         pinch events to GestureController.
2043
2044         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2045         (webkitWebViewBaseRealize): Added GDK_TOUCHPAD_GESTURE_MASK to event mask.
2046         (webkitWebViewBaseEvent): Added.
2047         (webkit_web_view_base_class_init): Override event vfunc.
2048
2049 2019-02-04  Michael Catanzaro  <mcatanzaro@igalia.com>
2050
2051         Unreviewed, only force settings.acceleratedCompositingEnabled() to true for Cocoa ports
2052         https://bugs.webkit.org/show_bug.cgi?id=194166
2053         <rdar://problem/47694328>
2054
2055         Accelerated compositing is broken for me at least. We're a long way from being able to force
2056         it.
2057
2058         * WebProcess/WebPage/WebPage.cpp:
2059         (WebKit::WebPage::updatePreferences):
2060
2061 2019-02-04  Abderrahim Kitouni  <akitouni@gnome.org>
2062
2063         [GTK] Remove last python2 dependency from CMake build process
2064         https://bugs.webkit.org/show_bug.cgi?id=194218
2065
2066         Reviewed by Michael Catanzaro.
2067
2068         * InspectorGResources.cmake:
2069
2070 2019-02-04  Antti Koivisto  <antti@apple.com>
2071
2072         Rename GraphicsLayer and PlatformCALayer type enum values to match "scroll container layer" convention
2073         https://bugs.webkit.org/show_bug.cgi?id=194215
2074
2075         Reviewed by Frédéric Wang.
2076
2077         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
2078         (WebKit::RemoteLayerBackingStore::drawInContext):
2079         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
2080         (WebKit::RemoteLayerTreeHost::makeNode):
2081         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
2082         (WebKit::RemoteLayerTreeHost::makeNode):
2083
2084 2019-02-03  Antti Koivisto  <antti@apple.com>
2085
2086         [iOS] Tiles not created in large scrollable iframes
2087         https://bugs.webkit.org/show_bug.cgi?id=193665
2088
2089         Reviewed by Simon Fraser.
2090
2091         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
2092         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateBeforeChildren):
2093         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
2094         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateBeforeChildren):
2095
2096         We now use scrollContainerLayer consistently so remove the special cases.
2097
2098 2019-02-03  Fujii Hironori  <Hironori.Fujii@sony.com>
2099
2100         [curl] [WebKit] Assertion failures of missing networkStorageSession for storage/indexeddb tests
2101         https://bugs.webkit.org/show_bug.cgi?id=194141
2102
2103         Reviewed by Ross Kirsling.
2104
2105         Implemented WebKit::NetworkProcess::switchToNewTestingSession and
2106         WebKit::NetworkProcess::ensureSession for curl port.
2107
2108         * NetworkProcess/NetworkProcess.cpp:
2109         (WebKit::NetworkProcess::switchToNewTestingSession):
2110         (WebKit::NetworkProcess::ensureSession):
2111
2112 2019-02-03  Simon Fraser  <simon.fraser@apple.com>
2113
2114         Make setNeedsLayout on the root more explicitly about triggering its side-effects
2115         https://bugs.webkit.org/show_bug.cgi?id=194198
2116
2117         Reviewed by Antti Koivisto.
2118
2119         Call the newly named functions.
2120
2121         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2122         (WebKit::PDFPlugin::updateScrollbars):
2123         * WebProcess/Plugins/PluginView.cpp:
2124         (WebKit::PluginView::didInitializePlugin):
2125         * WebProcess/WebPage/WebPage.cpp:
2126         (WebKit::WebPage::setHeaderBannerHeightForTesting):
2127         (WebKit::WebPage::setFooterBannerHeightForTesting):
2128         * WebProcess/WebPage/mac/PageBannerMac.mm:
2129         (WebKit::PageBanner::addToPage):
2130         (WebKit::PageBanner::detachFromPage):
2131         (WebKit::PageBanner::hide):
2132
2133 2019-02-03  Ryosuke Niwa  <rniwa@webkit.org>
2134
2135         Validate navigation policy decisions to avoid crashes in continueLoadAfterNavigationPolicy
2136         https://bugs.webkit.org/show_bug.cgi?id=194189
2137
2138         Reviewed by Geoffrey Garen.
2139
2140         Pass the policy check identifier around functions and store it in PolicyDecisionSender
2141         so that we can send it back to WebCore with the navigation policy decision.
2142
2143         We also store it in WebFrame in the case the policy decision had to be invalidated
2144         before the decision was received (via WebFrame::invalidatePolicyListener).
2145
2146         * Scripts/webkit/messages.py:
2147         * UIProcess/ProvisionalPageProxy.cpp:
2148         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
2149         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
2150         * UIProcess/ProvisionalPageProxy.h:
2151         * UIProcess/WebPageProxy.cpp:
2152         (WebKit::WebPageProxy::PolicyDecisionSender): Added PolicyCheckIdentifier as a member.
2153         (WebKit::WebPageProxy::PolicyDecisionSender::create):
2154         (WebKit::WebPageProxy::PolicyDecisionSender::send):
2155         (WebKit::WebPageProxy::PolicyDecisionSender::PolicyDecisionSender):
2156         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2157         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
2158         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
2159         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2160         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
2161         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2162         (WebKit::WebPageProxy::decidePolicyForResponse):
2163         (WebKit::WebPageProxy::decidePolicyForResponseShared):
2164         * UIProcess/WebPageProxy.h:
2165         * UIProcess/WebPageProxy.messages.in:
2166         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2167         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2168         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
2169         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2170         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2171         * WebProcess/WebPage/WebFrame.cpp:
2172         (WebKit::WebFrame::setUpPolicyListener):
2173         (WebKit::WebFrame::invalidatePolicyListener):
2174         (WebKit::WebFrame::didReceivePolicyDecision):
2175         * WebProcess/WebPage/WebFrame.h:
2176         * WebProcess/WebPage/WebPage.cpp:
2177         (WebKit::WebPage::didReceivePolicyDecision):
2178         * WebProcess/WebPage/WebPage.h:
2179         * WebProcess/WebPage/WebPage.messages.in:
2180
2181 2019-02-03  Megan Gardner  <megan_gardner@apple.com>
2182
2183         Turn on Smart Paste
2184         https://bugs.webkit.org/show_bug.cgi?id=193786
2185
2186         Reviewed by Ryosuke Niwa.
2187
2188         * Platform/spi/ios/UIKitSPI.h:
2189         * UIProcess/ios/TextCheckerIOS.mm:
2190         (WebKit::TextChecker::isSmartInsertDeleteEnabled):
2191         Use the flag from UIKit to determine if smart copy paste should be
2192         turned on.
2193
2194 2019-02-02  Simon Fraser  <simon.fraser@apple.com>
2195
2196         Tidy up data memebers of FrameView and related classes to shrink class sizes
2197         https://bugs.webkit.org/show_bug.cgi?id=194197
2198
2199         Reviewed by Zalan Bujtas.
2200
2201         * UIProcess/PageClient.h: Declare enum size.
2202
2203 2018-12-16  Darin Adler  <darin@apple.com>
2204
2205         Convert additional String::format clients to alternative approaches
2206         https://bugs.webkit.org/show_bug.cgi?id=192746
2207
2208         Reviewed by Alexey Proskuryakov.
2209
2210         * UIProcess/Cocoa/ViewGestureController.cpp:
2211         (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog):
2212         Use makeString and FormattedNumber.
2213
2214         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
2215         (WebKit::LocalAuthenticator::getAssertion): Added a comment about an
2216         incorrect format specifier and left this code as is for now.
2217
2218 2019-02-01  David Kilzer  <ddkilzer@apple.com>
2219
2220         Move soft-linking of TelephonyUtilities.framework out of TUCallSPI.h
2221         <https://webkit.org/b/193866>
2222
2223         Reviewed by Alex Christensen.
2224
2225         * Platform/mac/MenuUtilities.mm:
2226         - Update for rename of TUCallSPI.h to TelephonyUtilitiesSPI.h.
2227         - Add soft-linking code formerly in TUCallSPI.h.
2228
2229 2019-02-01  Alex Christensen  <achristensen@webkit.org>
2230
2231         Move XPCService entry points from mac directory to new Cocoa directory
2232         https://bugs.webkit.org/show_bug.cgi?id=194129
2233
2234         Reviewed by Chris Dumez.
2235
2236         * Configurations/NetworkService.xcconfig:
2237         * Configurations/PluginService.64.xcconfig:
2238         * Configurations/WebContentService.xcconfig:
2239         * NetworkProcess/EntryPoint/Cocoa: Copied from Source/WebKit/NetworkProcess/EntryPoint/mac.
2240         * NetworkProcess/EntryPoint/mac: Removed.
2241         * PluginProcess/EntryPoint/Cocoa: Copied from Source/WebKit/PluginProcess/EntryPoint/mac.
2242         * PluginProcess/EntryPoint/mac: Removed.
2243         * Shared/EntryPointUtilities/Cocoa: Copied from Source/WebKit/Shared/EntryPointUtilities/mac.
2244         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
2245         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
2246         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
2247         * Shared/EntryPointUtilities/mac: Removed.
2248         * SourcesCocoa.txt:
2249         * WebKit.xcodeproj/project.pbxproj:
2250         * WebProcess/EntryPoint/Cocoa: Copied from Source/WebKit/WebProcess/EntryPoint/mac.
2251         * WebProcess/EntryPoint/mac: Removed.
2252
2253 2019-02-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2254
2255         [iOS] Consistent 1 sec hang when triggering modal alerts while handling synchronous touch events
2256         https://bugs.webkit.org/show_bug.cgi?id=194140
2257         <rdar://problem/47728098>
2258
2259         Reviewed by Tim Horton.
2260
2261         Currently, the UI process hangs when attempting to synchronously present modal UI from the web process while the
2262         UI process is waiting for sync IPC in the web process. While we have logic to generally mitigate IPC deadlock in
2263         this scenario by dispatching the web process' sync IPC immediately with the intention of allowing the web
2264         process to finish processing sync IPC (and consequently unblock the UI process), this fails in the case where
2265         the sync IPC message from the web process to the UI process requires main thread execution for an arbitrary
2266         amount of time (for instance, modal alert dialogs). In this case, we'll end up in a state where we've handled
2267         the web process' sync IPC in the UI process, yet we can't resume execution since the web process is still
2268         blocked.
2269
2270         By far the most egregious scenario in which this manifests is during synchronous gesture recognizer IPC, i.e.
2271         grabbing position information from the UI process, and handling touch events synchronously. Luckily, these are
2272         also cases where (1) we know sync IPC may safely time out, and (2) the presentation of modal UI from the web
2273         process should cause the gesture recognizers to fail anyways. As such, we can mitigate these scenarios in the
2274         web process by responding to the these pending sync IPC messages *before* sending our own sync IPC to the UI
2275         process.
2276
2277         Test: fast/events/touch/ios/show-modal-alert-during-touch-start.html
2278
2279         * Shared/ios/InteractionInformationAtPosition.h:
2280         (WebKit::InteractionInformationAtPosition::invalidInformation):
2281         * Shared/ios/InteractionInformationAtPosition.mm:
2282         (WebKit::InteractionInformationAtPosition::encode const):
2283         (WebKit::InteractionInformationAtPosition::decode):
2284
2285         Add a new flag to indicate whether an interaction information response can be valid. Interaction information
2286         cannot be valid in the case where the interaction information request was interrupted by certain sync IPC
2287         messages from the web process.
2288
2289         * UIProcess/API/C/WKContextConfigurationRef.cpp:
2290         (WKContextConfigurationIgnoreSynchronousMessagingTimeoutsForTesting):
2291         (WKContextConfigurationSetIgnoreSynchronousMessagingTimeoutsForTesting):
2292
2293         Add some testing SPI to ignore sync IPC timeouts, for the purposes of testing. Rather than use the existing
2294         Objective-C SPI in WKWebProcessPoolConfiguration, I decided to add C API plumbing for this flag, so that other
2295         non-Cocoa ports may also support the new layout test option to ignore sync IPC timeouts.
2296
2297         * UIProcess/API/C/WKContextConfigurationRef.h:
2298         * UIProcess/ios/WKContentViewInteraction.mm:
2299         (-[WKContentView ensurePositionInformationIsUpToDate:]):
2300         (-[WKContentView _positionInformationDidChange:]):
2301         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2302         (WebKit::WebChromeClient::runBeforeUnloadConfirmPanel):
2303         (WebKit::WebChromeClient::runJavaScriptAlert):
2304         (WebKit::WebChromeClient::runJavaScriptConfirm):
2305         (WebKit::WebChromeClient::runJavaScriptPrompt):
2306         (WebKit::WebChromeClient::print):
2307         (WebKit::WebChromeClient::exceededDatabaseQuota):
2308         (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
2309
2310         Cancel any pending sync IPC replies prior to sending sync IPC messages to the UI process which may result in
2311         sync IPC deadlock, by using the new helper method, sendSyncWithDelayedReply, instead of just sendSync.
2312
2313         * WebProcess/WebPage/WebPage.cpp:
2314         (WebKit::WebPage::cancelGesturesBlockedOnSynchronousReplies):
2315
2316         Add a helper to cancel pending sync messages coming in from the UI process that are being called from within
2317         gesture recognizer delegate hooks.
2318
2319         (WebKit::WebPage::touchEventSync):
2320         * WebProcess/WebPage/WebPage.h:
2321
2322         Add a new helper, sendSyncWithDelayedReply, to be used when sending a sync IPC message to the UI process that
2323         cannot be immediately completed upon arrival. Importantly, this cancels pending sync replies, and also passes
2324         IPC::SendSyncOption::InformPlatformProcessWillSuspend.
2325
2326         * WebProcess/WebPage/WebPage.messages.in:
2327
2328         Change these from LegacySync to Delayed messages.
2329
2330         * WebProcess/WebPage/ios/WebPageIOS.mm:
2331         (WebKit::WebPage::getPositionInformation):
2332
2333         Make this sync IPC handler (as well as WebPage::touchEventSync) store the IPC reply during the scope of the
2334         method, and invoke the stored reply at the end of the method if it wasn't interrupted due to something calling
2335         cancelGesturesBlockedOnSynchronousReplies().
2336
2337         (WebKit::WebPage::positionInformation):
2338
2339         Refactor getPositionInformation by pulling out the logic for building an InteractionInformationAtPosition into
2340         a separate helper.
2341
2342         (WebKit::WebPage::requestPositionInformation):
2343
2344 2019-02-01  David Quesada  <david_quesada@apple.com>
2345
2346         Network Process crash when resuming downloads: '-[__NSDictionaryI setObject:forKey:]: unrecognized selector sent to instance %p'
2347         https://bugs.webkit.org/show_bug.cgi?id=194144
2348         rdar://problem/47553456
2349
2350         Reviewed by Geoffrey Garen.
2351
2352         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
2353         (WebKit::Download::resume):
2354             Make a mutable copy of the root object decoded from the resume data.
2355             It might have been originally encoded as an immutable dictionary.
2356
2357 2019-02-01  Chris Dumez  <cdumez@apple.com>
2358
2359         REGRESSION: Flaky ASSERTION FAILED: m_uncommittedState.state == State::Committed on http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html
2360         https://bugs.webkit.org/show_bug.cgi?id=193740
2361         <rdar://problem/47527267>
2362
2363         Reviewed by Alex Christensen.
2364
2365         The issue was happening when the page is triggering a cross-site navigation while in the middle of parsing. This would cause us to
2366         start a new provisional load in a new process before the previous process sends the DidFinishLoadForFrame() IPC to the UIProcess.
2367         Getting such IPC after a provisional load has started would mess up our state machine and trip assertions.
2368
2369         This patch restores non-PSON behavior which is that the previous load in the old process now gets stopped so that no DidFinishLoadForFrame()
2370         / DidFailLoadForFrame() gets sent. To achieve this behavior, I introduced a new "StopAllLoads" PolicyAction that we now send the old
2371         process when the load is continuing in a new process, instead of sending it "Ignore".
2372
2373         * NetworkProcess/NetworkDataTaskBlob.cpp:
2374         (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
2375         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2376         (toNSURLSessionResponseDisposition):
2377         * UIProcess/WebPageProxy.cpp:
2378         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2379
2380 2019-02-01  Jer Noble  <jer.noble@apple.com>
2381
2382         Unreviewed build fix; Respect the 'condition:' field in the WebPreferences.yaml when generating
2383         WebPreferencesStoreDefaultsMap.cpp.
2384
2385         * page/SettingsBase.h:
2386
2387 2019-02-01  Antoine Quint  <graouts@apple.com>
2388
2389         Dispatch pointercancel events when content is panned or zoomed on iOS
2390         https://bugs.webkit.org/show_bug.cgi?id=193962
2391         <rdar://problem/47629134>
2392
2393         Reviewed by Dean Jackson.
2394
2395         When a user-agent-provided interaction, such as panning or zooming on iOS, uses a set of touches, we should dispatch a pointercancel
2396         event for the pointer ids of the touches involved. To facilitate this, we add a new method on WKContentView to cancel all the pointers
2397         matching active touches for a provided UIGestureRecognizer through an async IPC call into the Web process using the new method
2398         PointerCaptureController::cancelPointer().
2399
2400         * Platform/spi/ios/UIKitSPI.h: Add the necessary forward declaration for a necessary UIKit SPI allowing us to get the set of last-seen
2401         UITouches by the identifier generated for the matching WebKit touch.
2402         * UIProcess/API/Cocoa/WKWebView.mm:
2403         (-[WKWebView scrollViewWillBeginZooming:withView:]): Dispatch touchcancel events for all pointers involved in a pinch gesture on the
2404         top-level UIScrollView.
2405         (-[WKWebView _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]): Dispatch
2406         touchcancel events for all pointers involved in a pan gesture on the top-level UIScrollView. We can infer this by looking at whether the
2407         adjusted content offset, after accounting for the permitted touch actions, is different from the original content offset.
2408         * UIProcess/PageClient.h: Expose a new virtual cancelPointersForGestureRecognizer() method which will allow the iOS implementation to
2409         forward the call to WKContentViewInteraction.
2410         (WebKit::PageClient::cancelPointersForGestureRecognizer):
2411         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: Expose the WebPageProxy such that we may access it to cancel pointers for
2412         a given gesture recognizer from within ScrollingTreeScrollingNodeDelegateIOS.
2413         (WebKit::RemoteScrollingCoordinatorProxy::webPageProxy const):
2414         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
2415         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
2416         (-[WKScrollingNodeScrollViewDelegate _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]):
2417         Dispatch touchcancel events for all pointers involved in a pan gesture on a nested UIScrollView. We can infer this by looking at
2418         whether the adjusted content offset, after accounting for the permitted touch actions, is different from the original content offset.
2419         (-[WKScrollingNodeScrollViewDelegate scrollViewWillBeginZooming:withView:]): Dispatch touchcancel events for all pointers involved in a
2420         pinch gesture on a nested UIScrollView.
2421         (-[WKScrollingNodeScrollViewDelegate cancelPointersForGestureRecognizer:]):
2422         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::cancelPointersForGestureRecognizer):
2423         * UIProcess/WebPageProxy.cpp:
2424         (WebKit::WebPageProxy::cancelPointer):
2425         * UIProcess/WebPageProxy.h:
2426         * UIProcess/ios/PageClientImplIOS.h:
2427         * UIProcess/ios/PageClientImplIOS.mm:
2428         (WebKit::PageClientImpl::cancelPointersForGestureRecognizer):
2429         * UIProcess/ios/WKContentViewInteraction.h:
2430         * UIProcess/ios/WKContentViewInteraction.mm:
2431         (-[WKContentView cancelPointersForGestureRecognizer:]): Obtain all active UITouch objects for the view and dispatch a pointercancel event,
2432         through the WebPageProxy, for all touches associated with the provided gesture recognizer.
2433         * WebProcess/WebPage/WebPage.cpp:
2434         (WebKit::WebPage::cancelPointer):
2435         * WebProcess/WebPage/WebPage.h:
2436         * WebProcess/WebPage/WebPage.messages.in:
2437
2438 2019-02-01  Jer Noble  <jer.noble@apple.com>
2439
2440         Make the WebKit default for media source based on the WebCore default.
2441         https://bugs.webkit.org/show_bug.cgi?id=194172
2442
2443         Reviewed by Eric Carlson.
2444
2445         * Shared/WebPreferences.yaml:
2446         * UIProcess/API/Cocoa/WKPreferences.mm:
2447         (-[WKPreferences _setMediaSourceEnabled:]):
2448         (-[WKPreferences _mediaSourceEnabled]):
2449         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2450
2451 2019-02-01  Simon Fraser  <simon.fraser@apple.com>
2452
2453         Force settings.acceleratedCompositingEnabled() to true for WebKit
2454         https://bugs.webkit.org/show_bug.cgi?id=194166
2455         rdar://problem/47694328
2456
2457         Reviewed by Tim Horton.
2458
2459         WebKit relies on accelerated compositing for its drawing areas to function correctly,
2460         and sometimes clients (*cough* Safari *cough*) have bugs where they clobber the settings,
2461         so force this setting to be always on (and release log if this happens).
2462
2463         * WebProcess/WebPage/WebPage.cpp:
2464         (WebKit::WebPage::updatePreferences):
2465
2466 2019-02-01  Antti Koivisto  <antti@apple.com>
2467
2468         Don't use base layer() as the scroll layer in scrolling tree.
2469         https://bugs.webkit.org/show_bug.cgi?id=194160
2470
2471         Reviewed by Simon Fraser.
2472
2473         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2474         (ArgumentCoder<ScrollingStateNode>::encode):
2475         (ArgumentCoder<ScrollingStateNode>::decode):
2476         (ArgumentCoder<ScrollingStateScrollingNode>::encode):
2477         (ArgumentCoder<ScrollingStateScrollingNode>::decode):
2478         (WebKit::dump):
2479         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2480         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2481         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2482         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2483         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
2484         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateBeforeChildren):
2485         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
2486         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateBeforeChildren):
2487         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
2488         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateBeforeChildren):
2489         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
2490
2491 2019-02-01  Michael Catanzaro  <mcatanzaro@igalia.com>
2492
2493         [SOUP] Improve use of SoupCookiePersistentStorageType
2494         https://bugs.webkit.org/show_bug.cgi?id=194103
2495
2496         Reviewed by Carlos Garcia Campos.
2497
2498         Turn it into an enum class, and stop casting it to and from uint32_t.
2499
2500         * NetworkProcess/Cookies/WebCookieManager.h:
2501         * NetworkProcess/Cookies/WebCookieManager.messages.in:
2502         * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp:
2503         (WebKit::WebCookieManager::setCookiePersistentStorage):
2504         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2505         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
2506         (WebKit::NetworkSessionCreationParameters::decode):
2507         * NetworkProcess/NetworkSessionCreationParameters.h:
2508         * Shared/soup/SoupCookiePersistentStorageType.h:
2509         (): Deleted.
2510         * UIProcess/API/glib/WebKitCookieManager.cpp:
2511         * UIProcess/WebCookieManagerProxy.h:
2512         * UIProcess/soup/WebCookieManagerProxySoup.cpp:
2513         (WebKit::WebCookieManagerProxy::setCookiePersistentStorage):
2514         (WebKit::WebCookieManagerProxy::getCookiePersistentStorage const):
2515
2516 2019-02-01  Per Arne Vollan  <pvollan@apple.com>
2517
2518         [macOS] Revert parts of r240811, since it causes kernel panics.
2519         https://bugs.webkit.org/show_bug.cgi?id=194061
2520
2521         Unreviewed crash fix.
2522
2523         * WebProcess/com.apple.WebProcess.sb.in:
2524
2525 2019-02-01  Michael Catanzaro  <mcatanzaro@igalia.com>
2526
2527         [SOUP] Improve use of PAL::SessionID in WebKitCookieManager
2528         https://bugs.webkit.org/show_bug.cgi?id=194092
2529
2530         Reviewed by Carlos Garcia Campos.
2531
2532         Always get it from the data store instead of assuming the default session ID, and add a
2533         helper function for this.
2534
2535         * UIProcess/API/glib/WebKitCookieManager.cpp:
2536         (_WebKitCookieManagerPrivate::sessionID const):
2537         (_WebKitCookieManagerPrivate::~_WebKitCookieManagerPrivate):
2538         (webkitCookieManagerCreate):
2539         (webkit_cookie_manager_set_persistent_storage):
2540         (webkit_cookie_manager_set_accept_policy):
2541         (webkit_cookie_manager_get_accept_policy):
2542         (webkit_cookie_manager_add_cookie):
2543         (webkit_cookie_manager_get_cookies):
2544         (webkit_cookie_manager_delete_cookie):
2545
2546 2019-01-31  Takashi Komori  <Takashi.Komori@sony.com>
2547
2548         [Curl] Remove unnecessary member from NetworkStorageSession.
2549         https://bugs.webkit.org/show_bug.cgi?id=194137
2550
2551         Reviewed by Don Olmstead.
2552
2553         * NetworkProcess/curl/NetworkProcessCurl.cpp:
2554         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
2555
2556 2019-01-31  Jiewen Tan  <jiewen_tan@apple.com>
2557
2558         Unreviewed, build fix after r240805
2559
2560         This patch reverts the BlockPtr change since it breaks iOS builds.
2561
2562         * UIProcess/Cocoa/NavigationState.mm:
2563         (WebKit::tryInterceptNavigation):
2564
2565 2019-01-31  Chris Dumez  <cdumez@apple.com>
2566
2567         Page zoom level is lost after a process swap or a crash
2568         https://bugs.webkit.org/show_bug.cgi?id=194105
2569         <rdar://problem/47610781>
2570
2571         Reviewed by Alex Christensen.
2572
2573         Previously, when the client would call setPageAndTextZoomFactors() on the WebPageProxy,
2574         we would update the WebPageProxy's corresponding data members and send an IPC to the
2575         WebProcess to apply the zoom factors.
2576
2577         The issue is that on process crash or process-swap, we never communicate those zoom factors
2578         to the new WebProcess. Even if the client were to call setPageAndTextZoomFactors() with
2579         the same factors again, it would be a no-op since the WebPageProxy's data members already
2580         reflect the expected values.
2581
2582         To address the issue, pass both the page zoom and the text zoom factors to the WebProcess
2583         via WebPageCreationParameters. This way, there is no need to send an extra IPC and we're
2584         sure the WebPageProxy's factors are properly applied to the WebPage on WebContent process
2585         side upon creation (whether after a crash or a process swap).
2586
2587         * Shared/WebPageCreationParameters.cpp:
2588         (WebKit::WebPageCreationParameters::encode const):
2589         (WebKit::WebPageCreationParameters::decode):
2590         * Shared/WebPageCreationParameters.h:
2591         * UIProcess/WebPageProxy.cpp:
2592         (WebKit::WebPageProxy::creationParameters):
2593         * WebProcess/WebPage/WebPage.cpp:
2594
2595 2019-01-31  Per Arne Vollan  <pvollan@apple.com>
2596
2597         [macOS] Disable permissive call logging in sandbox
2598         https://bugs.webkit.org/show_bug.cgi?id=194061
2599
2600         Reviewed by Alexey Proskuryakov.
2601
2602         Strict call filtering should be reenabled.
2603
2604         * WebProcess/com.apple.WebProcess.sb.in:
2605
2606 2019-01-31  Per Arne Vollan  <pvollan@apple.com>
2607
2608         [macOS] Crash when control-clicking or copying text rendered with a web font
2609         https://bugs.webkit.org/show_bug.cgi?id=193913
2610         <rdar://problem/47541039>
2611
2612         Reviewed by Brent Fulgham.
2613
2614         On older versions of macOS, allowing mach lookup to com.apple.FontObjectsServer is needed.
2615
2616         * WebProcess/com.apple.WebProcess.sb.in:
2617
2618 2019-01-31  Benjamin Poulain  <benjamin@webkit.org>
2619
2620         Remove WKPageIsWebProcessResponsive
2621         https://bugs.webkit.org/show_bug.cgi?id=194096
2622
2623         Reviewed by Alex Christensen.
2624
2625         It is not used by any client.
2626
2627         It is also bad API. It is better to let WebKit track
2628         responsiveness and tell the client with processDidBecomeResponsive.
2629
2630         * UIProcess/API/C/WKPage.cpp:
2631         (WKPageIsWebProcessResponsive): Deleted.
2632         * UIProcess/API/C/WKPagePrivate.h:
2633         * UIProcess/WebPageProxy.cpp:
2634         (WebKit::WebPageProxy::isWebProcessResponsive): Deleted.
2635         * UIProcess/WebPageProxy.h:
2636
2637 2019-01-31  Alex Christensen  <achristensen@webkit.org>
2638
2639         Revert r238819 which is unneeded and caused a performance regression.
2640         https://bugs.webkit.org/show_bug.cgi?id=192272
2641         <rdar://problem/46664625>
2642
2643         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
2644         (API::InjectedBundle::PageLoaderClient::didStartProvisionalLoadForFrame):
2645         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
2646         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
2647         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2648         (PageLoaderClient::didStartProvisionalLoadForFrame):
2649         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
2650         (WebKit::InjectedBundlePageLoaderClient::didStartProvisionalLoadForFrame):
2651         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
2652         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2653         (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):
2654         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2655
2656 2019-01-31  Jiewen Tan  <jiewen_tan@apple.com>
2657
2658         Formalize WebKitAdditions mechanism of LoadOptimizer
2659         https://bugs.webkit.org/show_bug.cgi?id=193886
2660         <rdar://problem/47696809>
2661
2662         Reviewed by Brent Fulgham.
2663
2664         This patch does the following few things:
2665         1) formalizes WebKitAdditions mechanism of LoadOptimizer;
2666         2) modernizes AppLinks code in tryInterceptNavigation to use BlockPtr;
2667         3) lets AppLinks have higher precedence than LoadOptimizer.
2668
2669         * SourcesCocoa.txt:
2670         * UIProcess/Cocoa/LoadOptimizer.h: Removed.
2671         * UIProcess/Cocoa/LoadOptimizer.mm: Removed.
2672         * UIProcess/Cocoa/NavigationState.mm:
2673         (WebKit::tryOptimizingLoad):
2674         (WebKit::tryInterceptNavigation):
2675         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2676         (WebKit::WebsiteDataStore::WebsiteDataStore):
2677         * UIProcess/WebsiteData/WebsiteDataStore.h:
2678         (WebKit::WebsiteDataStore::loadOptimizer): Deleted.
2679         * WebKit.xcodeproj/project.pbxproj:
2680
2681 2019-01-31  Chris Dumez  <cdumez@apple.com>
2682
2683         Regression(PSON) Crash under WebProcessProxy::canTerminateChildProcess()
2684         https://bugs.webkit.org/show_bug.cgi?id=194094
2685         <rdar://problem/47580753>
2686
2687         Reviewed by Ryosuke Niwa.
2688
2689         If a SuspendedPageProxy gets destroyed while a WebPageProxy is waiting for its to finish to suspend,
2690         call the "failure to suspend" completion handler asynchronously instead of synchronouly to make sure
2691         the completion handler cannot try and use the suspended page proxy while it is being destroyed.
2692
2693         * UIProcess/SuspendedPageProxy.cpp:
2694         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
2695
2696 2019-01-31  Timothy Hatcher  <timothy@apple.com>
2697
2698         Fix LSAppLink deprecation warnings.
2699         https://bugs.webkit.org/show_bug.cgi?id=194097
2700
2701         Unreviewed build fix.
2702
2703         * UIProcess/ios/WKActionSheetAssistant.mm:
2704         (-[WKActionSheetAssistant _appendOpenActionsForURL:actions:elementInfo:]):
2705
2706 2019-01-30  Simon Fraser  <simon.fraser@apple.com>
2707
2708         [Mac] Implement basic hit testing in the scrolling tree
2709         https://bugs.webkit.org/show_bug.cgi?id=172917
2710         <rdar://problem/34215516>
2711
2712         Reviewed by Antti Koivisto.
2713
2714         Changed return types, "using namespace WebCore" in ScrollingTreeFrameScrollingNodeRemoteMac.cpp.
2715
2716         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2717         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
2718         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
2719         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.h:
2720         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm:
2721         (WebKit::ScrollerPairMac::handleWheelEvent):
2722         (WebKit::ScrollerPairMac::handleMouseEvent):
2723         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp:
2724         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleWheelEvent):
2725         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleMouseEvent):
2726         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h:
2727
2728 2019-01-31  Michael Catanzaro  <mcatanzaro@igalia.com>
2729
2730         [SOUP] Move cookiePersistentStoragePath and cookiePersistentStorageType from NetworkProcess to NetworkSession
2731         https://bugs.webkit.org/show_bug.cgi?id=194075
2732
2733         Reviewed by Alex Christensen.
2734
2735         Move cookiePersistentStoragePath and cookiePersistentStorageType from NetworkProcess to
2736         NetworkSession to reduce globals. This removes two of the six soup-specific variables in
2737         NetworkProcessCreationParameters
2738
2739         * NetworkProcess/Cookies/WebCookieManager.h:
2740         * NetworkProcess/Cookies/WebCookieManager.messages.in:
2741         * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp:
2742         (WebKit::WebCookieManager::setCookiePersistentStorage):
2743         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2744         (WebKit::NetworkProcessCreationParameters::encode const):
2745         (WebKit::NetworkProcessCreationParameters::decode):
2746         * NetworkProcess/NetworkProcessCreationParameters.h:
2747         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2748         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
2749         (WebKit::NetworkSessionCreationParameters::encode const):
2750         (WebKit::NetworkSessionCreationParameters::decode):
2751         * NetworkProcess/NetworkSessionCreationParameters.h:
2752         * NetworkProcess/soup/NetworkProcessSoup.cpp:
2753         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
2754         * NetworkProcess/soup/NetworkSessionSoup.cpp:
2755         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
2756         * SourcesGTK.txt:
2757         * SourcesWPE.txt:
2758         * UIProcess/API/glib/WebKitCookieManager.cpp:
2759         (webkit_cookie_manager_set_persistent_storage):
2760         * UIProcess/WebCookieManagerProxy.cpp:
2761         (WebKit::WebCookieManagerProxy::WebCookieManagerProxy):
2762         * UIProcess/WebCookieManagerProxy.h:
2763         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2764         (WebKit::WebsiteDataStore::parameters):
2765         * UIProcess/WebsiteData/WebsiteDataStore.h:
2766         * UIProcess/WebsiteData/curl/WebsiteDataStoreCurl.cpp:
2767         (WebKit::WebsiteDataStore::platformSetNetworkParameters):
2768         (WebKit::WebsiteDataStore::platformSetParameters): Deleted.
2769         * UIProcess/soup/WebCookieManagerProxySoup.cpp:
2770         (WebKit::WebCookieManagerProxy::setCookiePersistentStorage):
2771         (WebKit::WebCookieManagerProxy::getCookiePersistentStorage const):
2772         * UIProcess/soup/WebProcessPoolSoup.cpp:
2773         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2774
2775 2019-01-31  Ryosuke Niwa  <rniwa@webkit.org>
2776
2777         iOS: Crash in InteractiveUpdateHandler set by ViewGestureController::beginSwipeGesture
2778         https://bugs.webkit.org/show_bug.cgi?id=194083
2779
2780         Reviewed by Tim Horton.
2781
2782         We think this crash is a regression from r236966. Prior to r236966, we could only called
2783         removeSwipeSnapshot() only when m_provisionalOrSameDocumentLoadCallback was set but now
2784         we can call it either when m_snapshotRemovalTracker::start was called, or it had been reset.
2785         This can result in m_webPageProxyForBackForwardListForCurrentSwipe getting cleared before
2786         InteractiveUpdateHandler is called by UIGestureRecognizer, resulting in the crash.
2787
2788         This patch tries to restore the behavior prior to r236966 by only invoking removeSwipeSnapshot()
2789         when SnapshotRemovalTracker has a valid removal callback set.
2790
2791         Unfortunately no new tests since there is no reproducible test case, and neither API tests
2792         nor layout tests seem to have the capability to trigger swipe gestures via UIGestureRecognizer,
2793         which is required for this crash to occur. Notably, back-forward swipe tests I enabled in
2794         r240765 bypass UIKit and emulates the action instead.
2795
2796         * UIProcess/Cocoa/ViewGestureController.cpp:
2797         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
2798         * UIProcess/Cocoa/ViewGestureController.h:
2799         (WebKit::ViewGestureController::SnapshotRemovalTracker::hasRemovalCallback const):
2800
2801 2019-01-30  Benjamin Poulain  <benjamin@webkit.org>
2802
2803         <rdar://problem/47570443> Responsiveness timers are too expensive for frequent events
2804         https://bugs.webkit.org/show_bug.cgi?id=194003
2805
2806         Reviewed by Geoffrey Garen.
2807
2808         The problem here is specific to wheel events.
2809
2810         For every wheel event, we start a responsiveness timer and send
2811         a ping to the WebProcess. When the WebProcess respond, we stop the timer.
2812
2813         The cost of setting up the timers adds up since we get many events.
2814
2815         The first step to improve the situation was to switch ResponsivenessTimer
2816         to WebCore::Timer. Since WebCore::Timer reuse the same CFRunLoopTimerRef,
2817         we save the allocation/deallocation, insertion in the event loop, etc.
2818
2819         Using WebCore::Timer saves some instructions but we were still hitting
2820         the kernel at 120hz to set up then kill each timer.
2821         The second improvement of the patch is to avoid that by not killing the timer
2822         when we hear back from the WebProcess.
2823
2824         Instead of killing the timer, we let it run and ignore the result.
2825         When the next event comes, we reschedule the existing timer.
2826         This brings down the timers to 60Hz, the same rate as the events.
2827
2828         The very last event does time out. In that case, we have a bad idle wake up:
2829         we wake up a sleeping CPU do do nothing.
2830         In the case of wheel events, this is fine since we saved a bunch of CPU already.
2831         For all the other cases, I kept the normal operating mode to avoid the idle wake.
2832
2833         * UIProcess/ResponsivenessTimer.cpp:
2834         (WebKit::ResponsivenessTimer::ResponsivenessTimer):
2835         (WebKit::ResponsivenessTimer::invalidate):
2836         (WebKit::ResponsivenessTimer::timerFired):
2837         (WebKit::ResponsivenessTimer::start):
2838         (WebKit::ResponsivenessTimer::startWithLazyStop):
2839         (WebKit::ResponsivenessTimer::stop):
2840         (WebKit::ResponsivenessTimer::processTerminated):
2841         (WebKit::ResponsivenessTimer::~ResponsivenessTimer): Deleted.
2842         * UIProcess/ResponsivenessTimer.h:
2843         * UIProcess/WebPageProxy.cpp:
2844         (WebKit::WebPageProxy::sendWheelEvent):
2845         * UIProcess/WebProcessProxy.cpp:
2846         (WebKit::WebProcessProxy::isResponsiveWithLazyStop):
2847         * UIProcess/WebProcessProxy.h:
2848
2849 2019-01-30  Daniel Bates  <dabates@apple.com>
2850
2851         [iOS] REGRESSION (r238635): Text area fails to re-focus after dismissal of keyboard on support.apple.com
2852         https://bugs.webkit.org/show_bug.cgi?id=193987
2853         <rdar://problem/47230785>
2854
2855         Reviewed by Tim Horton.
2856
2857         It is unnecessary to relinquish first responder status when a user explicitly dismissing
2858         the keyboard. Moreover, doing so prevents key commands from being intercepted when a
2859         hardware keyboard is subsequently attached.
2860         
2861         Following r238635 a page becomes focused (accepting of keyboard input) and defocused
2862         when the WKContentView becomes first responder and resigns first responder, respectively.
2863         When a user explicitly dismisses the keyboard by tapping Done (iPhone) or the hide keyboard
2864         button (iPad) then UIKit tells WKContentView to resign its first responder status only
2865         to make its superview, WKWebView, first responder. When a person subsequently taps on the
2866         page again, the WKContentView requests to become the first responder. However changes to
2867         page focus are not guaranteed to be sent to the WebProcess immediately (WebPageProxy::activityStateDidChange()
2868         will schedule an update). In particular, they are not guaranteed to be sent before the
2869         WebProcess is told about a tap. Therefore, the WebProcess has out-of-date information on
2870         focus state of the page. Instead we should detect when WKWebView is being asked to resign
2871         as a result of the keyboard dismissal and refuse the request, taking care to end the current
2872         editing session, blur the focused element, and dismiss the on-screen keyboard.
2873
2874         * Platform/spi/ios/UIKitSPI.h: Expose some SPI.
2875         * UIProcess/ios/WKContentViewInteraction.h:
2876         * UIProcess/ios/WKContentViewInteraction.mm:
2877         (-[WKContentView setupInteraction]): Register to receive notifications whenever a user
2878         explicitly dismisses the keyboard.
2879         (-[WKContentView resignFirstResponderForWebView]): If we are being asked to resign as a
2880         result of a user explicitly dismissing the keyboard then refuse to resign.
2881         (-[WKContentView _keyboardDidRequestDismissal:]): Update state, if applicable.
2882
2883 2019-01-30  Keith Rollin  <krollin@apple.com>
2884
2885         Add default constructor for NetworkActivityTracker
2886         https://bugs.webkit.org/show_bug.cgi?id=194058
2887         <rdar://problem/47685457>
2888
2889         Reviewed by Chris Dumez.
2890
2891         ResourceNetworkActivityTracker has a default constructor. It also has
2892         a NetworkActivityTracker data member, which does not have a default
2893         constructor. This will cause some compilers to complain -- they can't
2894         default-create a ResourceNetworkActivityTracker because they can't
2895         default-create its data members. Address this by adding a default
2896         constructor for NetworkActivityTracker.
2897
2898         * NetworkProcess/NetworkActivityTracker.h:
2899
2900 2019-01-30  Daniel Steffen  <dsteffen@apple.com>
2901
2902         <rdar://problem/29471922> Safari should switch from the legacy denap SPI to handling vouchers
2903         https://bugs.webkit.org/show_bug.cgi?id=193992
2904
2905         Reviewed by Geoffrey Garen.
2906
2907         The denap SPI is deprecated.
2908         The new way of staying out of AppNap is through a voucher.
2909
2910         * Platform/IPC/mac/ConnectionMac.mm:
2911         (IPC::readFromMachPort):
2912         * Platform/IPC/mac/ImportanceAssertion.h:
2913         (IPC::ImportanceAssertion::ImportanceAssertion):
2914         (IPC::ImportanceAssertion::~ImportanceAssertion):
2915
2916 2019-01-30  Chris Dumez  <cdumez@apple.com>
2917
2918         Fix crashes when trying to ref the CallbackAggregator in NetworkProcess
2919         https://bugs.webkit.org/show_bug.cgi?id=194054
2920
2921         Reviewed by Brent Fulgham.
2922
2923         The callback aggregators should be ThreadSafeRefCounted since they are passed to other threads.
2924
2925         * NetworkProcess/NetworkProcess.cpp:
2926         (WebKit::NetworkProcess::fetchWebsiteData):
2927         (WebKit::NetworkProcess::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
2928         (WebKit::NetworkProcess::topPrivatelyControlledDomainsWithWebsiteData):
2929
2930 2019-01-30  Daniel Bates  <dabates@apple.com>
2931
2932         [iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content-editable element
2933         https://bugs.webkit.org/show_bug.cgi?id=192824
2934         <rdar://problem/47100332>
2935
2936         Reviewed by Wenson Hsieh.
2937
2938         Use the same code path for key events to editable elements and non-editable elements.
2939
2940         Currently we have different code paths for hardware key events depending on whether the active element
2941         is editable or non-editable. Historically to support dispatching DOM keyboard events for hardware key
2942         presses this differentiation was a necessary workaround for UIKit's event processing precedence of
2943         interpreting key events for system text editing commands and app commands before dispatching unhandled
2944         key events to WebKit. This workaround intercepted raw key UIEvents and manually reconstructed a
2945         WebEvent from it. However there is not enough information in an UIEvent to reconstruct a WebEvent that
2946         is identical to the WebEvent that UIKit would have dispatched. In particular, keyup UIEvents always have
2947         empty modified and unmodified input strings. The UIKit keyboard machinery maintains additional state
2948         that is necessary to manufacture the correct WebEvent corresponding to a UIEvent.
2949
2950         As a side benefit of this change, with the exception of modifier flag changes, both hardware and software
2951         key events use the same code path.
2952
2953         * UIProcess/ios/WKContentViewInteraction.h:
2954         * UIProcess/ios/WKContentViewInteraction.mm:
2955         (-[WKContentView shouldShowAutomaticKeyboardUI]): Extracted code from _requiresKeyboardWhenFirstResponder
2956         (-[WKContentView _disableAutomaticKeyboardUI]): Implement UIKit SPI to prevent showing the keyboard UI
2957         when there is no focused element now that we are no longer intercepting key UIEvents. Formerly the
2958         keyboard UI was disabled as a side effect of not becoming first responder when there was no focused
2959         element (by returning NO in -_requiresKeyboardWhenFirstResponder).
2960         (-[WKContentView _requiresKeyboardWhenFirstResponder]): Always return YES when building with USE(UIKIT_KEYBOARD_ADDITIONS)
2961         so that we always accept key events. Instead of selectively replying to create a keyboard as a means of
2962         hiding the automatic keyboard UI we now implement _disableAutomaticKeyboardUI to selectively hide the
2963         automatic keyboard UI.
2964         (-[WKContentView textInputTraits]): Do not update traits when the keyboard is going to be dismissed
2965         now that we require a keyboard when first responder even if the focused element is non-editable.
2966         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): Skip logic for re-sending UIEvents to UIKit
2967         as UIKit now processes the event first. This logic was necessary in order to finally allow UIKit
2968         its chance to interpret the UIEvent, we intercepted, for app key commands.
2969         (-[WKContentView _elementDidBlur]): Call [self _endEditing] so that we dismiss any open form controls
2970         (e.g. a <select> popover menu). Currently this happens either by -_requiresKeyboardWhenFirstResponder
2971         responding NO when switching to another field or pressing Tab or Shift + Tab key command, which we will
2972         no longer use when building with USE(UIKIT_KEYBOARD_ADDITIONS) once I land <https://bugs.webkit.org/show_bug.cgi?id=193048>.
2973         * UIProcess/ios/forms/WKFormSelectPopover.mm:
2974         (-[WKSelectPopover initWithView:hasGroups:]): Do not assign ourself as the keyboard delegate. Otherwise,
2975         type ahead and tab cycling will not work. Currently type ahead and tab cycling work by using the non-
2976         editable code path via -_handleKeyUIEvent. Now that we no longer differentiate between key events for
2977         editable and non-editable elements we need to ensure that the WKContentView is the keyboard delegate
2978         when the popover is presented.
2979
2980 2019-01-30  Per Arne Vollan  <pvollan@apple.com>
2981
2982         [macOS] Sandbox fails to compile on 10.12
2983         https://bugs.webkit.org/show_bug.cgi?id=194035
2984         <rdar://problem/47651260>
2985
2986         Reviewed by Brent Fulgham.
2987
2988         This was caused by the commit <https://trac.webkit.org/changeset/239994>, which is only valid for
2989         10.14 and later.
2990
2991         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2992         * WebProcess/com.apple.WebProcess.sb.in:
2993
2994 2019-01-29  Conrad Shultz  <conrad_shultz@apple.com>
2995
2996         Ensure image picker sourceType is set before cameraDevice
2997         https://bugs.webkit.org/show_bug.cgi?id=193998
2998
2999         Reviewed by Beth Dakin.
3000
3001         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3002         (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]):
3003
3004 2019-01-30  Chris Dumez  <cdumez@apple.com>
3005
3006         Regression(PSON) Load hang can occur on history navigation
3007         https://bugs.webkit.org/show_bug.cgi?id=194030
3008         <rdar://problem/47656939>
3009
3010         Reviewed by Antti Koivisto.
3011
3012         We do not support having more than one WebPage in a WebProcess with the same page ID. As a result,
3013         if we decide to reuse an existing process on process-swap, we need to make sure that we either use
3014         its suspended page (when possible, meaning that it is for the right HistoryItem / page) or we need
3015         make sure we drop the existing suspended page for this process / pagePID combination, so that the
3016         WebPage on WebProcess side gets closed before we attempt to do the new load.
3017
3018         We were doing this correctly in 2 places in WebProcessPool::processForNavigationInternal() but failed
3019         to do so in a third place, when doing back to a HistoryItem which does not have a SuspendedPage but
3020         whose process is still alive (presumably because it is kept alive by another suspended page). This
3021         patch fixes this third place to remove any suspended page in the process for the current page before
3022         reusing the process. An assertion was also added to the call site in
3023         WebPageProxy::receivedNavigationPolicyDecision() to make sure we catch this more easily in the
3024         future.
3025
3026         * UIProcess/WebPageProxy.cpp:
3027         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3028         * UIProcess/WebProcessPool.cpp:
3029         (WebKit::WebProcessPool::processForNavigationInternal):
3030         (WebKit::WebProcessPool::removeAllSuspendedPagesForPage):
3031         (WebKit::WebProcessPool::hasSuspendedPageFor const):
3032         * UIProcess/WebProcessPool.h:
3033
3034 2019-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
3035
3036         [GTK][Wayland] REGRESSION(r240712): Clear the GL context if it's the current one on dispose
3037         https://bugs.webkit.org/show_bug.cgi?id=194024
3038
3039         Reviewed by Michael Catanzaro.
3040
3041         Fixes a crash in gdk_gl_context_dispose().
3042
3043         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
3044         (WebKit::AcceleratedBackingStoreWayland::~AcceleratedBackingStoreWayland):
3045
3046 2019-01-30  Antti Koivisto  <antti@apple.com>
3047
3048         Crash in WebKit::RemoteLayerTreePropertyApplier::updateChildren
3049         https://bugs.webkit.org/show_bug.cgi?id=193897
3050         <rdar://problem/47427750>
3051
3052         Reviewed by Simon Fraser.
3053
3054         There has been some null pointer crashes where we fail to find a remote layer tree node that matches
3055         the transaction properties.
3056
3057         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
3058         (WebKit::RemoteLayerTreePropertyApplier::updateChildren):
3059
3060         Null check the nodes.
3061
3062 2019-01-30  Simon Fraser  <simon.fraser@apple.com>
3063
3064         Add some basic geometry information to the scrolling tree
3065         https://bugs.webkit.org/show_bug.cgi?id=194002
3066
3067         Reviewed by Antti Koivisto.
3068
3069         Add a comment explaining why we don't need to encode/decode ParentRelativeScrollableRect.
3070
3071         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
3072         (ArgumentCoder<ScrollingStateFrameHostingNode>::encode):
3073
3074 2019-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
3075
3076         [GTK] gdk_cairo_draw_from_gl() in AcceleratedBackingStoreWayland fails in GtkInspector's magnifier
3077         https://bugs.webkit.org/show_bug.cgi?id=193903
3078
3079         Reviewed by Michael Catanzaro.
3080
3081         The problem is that the GL context used by WaylandCompositor can't share resources with the one used by GTK+
3082         when painting with gdk_cairo_draw_from_gl(). Accelerated compositing in Wayland works only because
3083         WaylandCompositor makes the context current only once on initialization. So, when we render the first frame on
3084         accelerated compositing mode, GTK+ is rendering in non-GL mode, and switches to the GL mode when
3085         gdk_cairo_draw_from_gl() is called. Since GTK+ didn't have a GL context yet, the first frame is always rendered
3086         by GTK+ using the software fallback (glReadPixels). The thing is that the first time gdk_cairo_draw_from_gl() is
3087         called, GTK+ creates a GL context for painting that is made current, and it will remain the current one
3088         forever. The first frame fails to render with "GL_INVALID_OPERATION in glBindTexture(non-gen name)" because the
3089         texture created in WaylandCompositor GL context can't be accessed from GTK+ GL context. The following frames are
3090         handled with the GTK+ GL context. I would say this works by casuality and it could be the cause of other
3091         accelerated compositing issues in Wayland.
3092
3093         We need to create our own GdkGLContext for the WebView, and use that in the WaylandCompositor. When the
3094         GdkGLContext is created, the GTK+ GL context for painting is used as a shared context, ensuring that resources
3095         created in the new context will be accessible from the painting one.
3096
3097         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3098         (webkitWebViewBaseMakeGLContextCurrent): Call AcceleratedBackingStore::makeContextCurrent().
3099         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
3100         * UIProcess/WebPageProxy.h:
3101         * UIProcess/gtk/AcceleratedBackingStore.h:
3102         (WebKit::AcceleratedBackingStore::makeContextCurrent): New virtual method only implemented by Wayland backend.
3103         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
3104         (WebKit::AcceleratedBackingStoreWayland::tryEnsureGLContext): Try to create a GL context with
3105         gdk_window_create_gl_context(), falling back to a WebCore::GLContext if it fails or GTK+ version is not new enough.
3106         (WebKit::AcceleratedBackingStoreWayland::makeContextCurrent): Make the GL context current.
3107         (WebKit::AcceleratedBackingStoreWayland::paint): Check if we have a GdkGLContext before trying to use gdk_cairo_draw_from_gl().
3108         (WebKit::AcceleratedBackingStoreWayland::canGdkUseGL const): Deleted.
3109         * UIProcess/gtk/AcceleratedBackingStoreWayland.h:
3110         * UIProcess/gtk/WaylandCompositor.cpp:
3111         (WebKit::WaylandCompositor::Surface::Surface): Move the texture creation to setWebPage(), since we need the
3112         WebView GL context.
3113         (WebKit::WaylandCompositor::Surface::~Surface): Move the code to destroy GL resources to setWebPage().
3114         (WebKit::WaylandCompositor::Surface::setWebPage): Create the texture when a new page is set and destroy GL
3115         resources when unset.
3116         (WebKit::WaylandCompositor::Surface::prepareTextureForPainting): Make WebView GL context current.
3117         (WebKit::WaylandCompositor::Surface::commit): Ditto.
3118         (WebKit::WaylandCompositor::initializeEGL): Use a temporary GLContext.
3119         * UIProcess/gtk/WaylandCompositor.h:
3120         * UIProcess/gtk/WebPageProxyGtk.cpp:
3121         (WebKit::WebPageProxy::makeGLContextCurrent): Call webkitWebViewBaseMakeGLContextCurrent().
3122
3123 2019-01-29  Ryosuke Niwa  <rniwa@webkit.org>
3124
3125         iOS: Nullptr crash in WebPage::getPositionInformation dereferencing an input element for data list
3126         https://bugs.webkit.org/show_bug.cgi?id=193996
3127
3128         Reviewed by Wenson Hsieh.
3129
3130         Added a missing nullptr check.
3131
3132         * WebProcess/WebPage/ios/WebPageIOS.mm:
3133         (WebKit::WebPage::getPositionInformation):
3134
3135 2019-01-29  Simon Fraser  <simon.fraser@apple.com>
3136
3137         Add nodes to the scrolling tree in z-index order.
3138         https://bugs.webkit.org/show_bug.cgi?id=192529
3139         <rdar://problem/47402708>
3140
3141         Reviewed by Dean Jackson.
3142
3143         FrameHosting nodes have layers, so need to update them.
3144
3145         * Platform/Logging.cpp:
3146         (WebKit::initializeLogChannelsIfNecessary):
3147         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
3148         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
3149
3150 2019-01-29  Alex Christensen  <achristensen@webkit.org>
3151
3152         Change NetworkConnectionToWebProcess* to NetworkConnectionToWebProcess& where possible
3153         https://bugs.webkit.org/show_bug.cgi?id=193974
3154
3155         Reviewed by Tim Horton.
3156
3157         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
3158         (WebKit::NetworkBlobRegistry::registerFileBlobURL):
3159         (WebKit::NetworkBlobRegistry::registerBlobURL):
3160         (WebKit::NetworkBlobRegistry::registerBlobURLOptionallyFileBacked):
3161         (WebKit::NetworkBlobRegistry::registerBlobURLForSlice):
3162         (WebKit::NetworkBlobRegistry::unregisterBlobURL):
3163         (WebKit::NetworkBlobRegistry::blobSize):
3164         (WebKit::NetworkBlobRegistry::connectionToWebProcessDidClose):
3165         * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
3166         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3167         (WebKit::NetworkConnectionToWebProcess::didClose):
3168         (WebKit::NetworkConnectionToWebProcess::registerFileBlobURL):
3169         (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
3170         (WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
3171         (WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
3172         (WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
3173         (WebKit::NetworkConnectionToWebProcess::unregisterBlobURL):
3174         (WebKit::NetworkConnectionToWebProcess::blobSize):
3175         * NetworkProcess/NetworkProcess.cpp:
3176         (WebKit::NetworkProcess::removeNetworkConnectionToWebProcess):
3177         * NetworkProcess/NetworkProcess.h:
3178
3179 2019-01-29  Youenn Fablet  <youenn@apple.com>
3180
3181         Adopt new SPI to evaluate server certificate trust
3182         https://bugs.webkit.org/show_bug.cgi?id=193355
3183
3184         Reviewed by Alex Christensen.
3185
3186         Use new SPI provided in NSURLSession to evaluate server certificates.
3187         If successful, let loading proceed as usual.
3188         Otherwise, go to the UIProcess to ask for a decision on continuing the load or not.
3189
3190         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
3191         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3192         (canNSURLSessionTrustEvaluate):
3193         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
3194         (WebKit::NetworkSessionCocoa::continueDidReceiveChallenge):
3195
3196 2019-01-29  Tim Horton  <timothy_horton@apple.com>
3197
3198         Fix the build
3199
3200         * UIProcess/ios/WKDrawingCoordinator.h:
3201         * UIProcess/ios/WKDrawingCoordinator.mm:
3202         * UIProcess/ios/WKDrawingView.mm:
3203
3204 2019-01-29  Alex Christensen  <achristensen@webkit.org>
3205
3206         Remove unused NetworkProcessProxy::writeBlobToFilePath
3207         https://bugs.webkit.org/show_bug.cgi?id=193990
3208
3209         Reviewed by Wenson Hsieh.
3210
3211         This code was only used in code that was introduced in r235202
3212         but that has since been refactored to not use blobs.  Its tests still pass.
3213         This removes the only UIProcess-controlled code that uses NetworkBlobRegistry::singleton.
3214
3215         * NetworkProcess/NetworkProcess.cpp:
3216         (WebKit::NetworkProcess::writeBlobToFilePath): Deleted.
3217         * NetworkProcess/NetworkProcess.h:
3218         * NetworkProcess/NetworkProcess.messages.in:
3219         * UIProcess/Cocoa/WebViewImpl.mm:
3220         (WebKit::WebViewImpl::writeToURLForFilePromiseProvider):
3221         * UIProcess/Network/NetworkProcessProxy.cpp:
3222         (WebKit::NetworkProcessProxy::writeBlobToFilePath): Deleted.
3223         * UIProcess/Network/NetworkProcessProxy.h:
3224         * UIProcess/WebPageProxy.cpp:
3225         (WebKit::WebPageProxy::writeBlobToFilePath): Deleted.
3226         * UIProcess/WebPageProxy.h:
3227
3228 2019-01-29  Devin Rousso  <drousso@apple.com>
3229
3230         Web Inspector: expose a way of determining if a detached frontend is for a remote target
3231         https://bugs.webkit.org/show_bug.cgi?id=193951
3232         <rdar://problem/47621366>
3233
3234         Reviewed by Joseph Pecoraro.
3235
3236         * UIProcess/WebInspectorProxy.h:
3237         (WebKit::WebInspectorProxy::InspectionTargetType): Added.
3238         (WebKit::WebInspectorProxy::createFrontendWindow):
3239         * UIProcess/mac/WebInspectorProxyMac.mm:
3240         (WebKit::WebInspectorProxy::createFrontendWindow):
3241         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
3242         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
3243         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
3244
3245         * UIProcess/API/Cocoa/_WKInspectorWindow.h: Moved from UIProcess/mac/WKInspectorWindow.h.
3246         * UIProcess/API/Cocoa/_WKInspectorWindow.mm: Moved from UIProcess/mac/WKInspectorWindow.mm.
3247         (-[WKInspectorWindow isRemote]): Added.
3248
3249         * Shared/API/Cocoa/_WKNSWindowExtras.mm:
3250         (-[NSWindow _web_isWebInspectorWindow]):
3251
3252         * PlatformMac.cmake:
3253         * SourcesCocoa.txt:
3254         * UnifiedSources-input.xcfilelist:
3255         * WebKit.xcodeproj/project.pbxproj:
3256
3257 2019-01-29  Alex Christensen  <achristensen@webkit.org>
3258
3259         Rename ChildProcess to AuxiliaryProcess
3260         https://bugs.webkit.org/show_bug.cgi?id=193943
3261
3262         Reviewed by Andy Estes.
3263
3264         "Child" implies that there is a parent, but I'm about to introduce a type of NetworkProcess that
3265         doesn't always have a parent, and may have many UIProcesses that it is the auxiliary for.
3266
3267         * CMakeLists.txt:
3268         * DerivedSources-input.xcfilelist:
3269         * DerivedSources-output.xcfilelist:
3270         * DerivedSources.make:
3271         * NetworkProcess/Cookies/WebCookieManager.cpp:
3272         * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp:
3273         * NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm:
3274         (WebKit::initializeAuxiliaryProcess<NetworkProcess>):
3275         (WebKit::initializeChildProcess<NetworkProcess>): Deleted.
3276         * NetworkProcess/NetworkProcess.cpp:
3277         (WebKit::callExitSoon):
3278         (WebKit::NetworkProcess::NetworkProcess):
3279         (WebKit::NetworkProcess::didReceiveMessage):
3280         (WebKit::NetworkProcess::initializeConnection):
3281         (WebKit::NetworkProcess::terminate):
3282         (WebKit::NetworkProcess::initializeProcess):
3283         (WebKit::NetworkProcess::initializeProcessName):
3284         (WebKit::NetworkProcess::initializeSandbox):
3285         * NetworkProcess/NetworkProcess.h:
3286         * NetworkProcess/NetworkProcessSupplement.h:
3287         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3288         (WebKit::NetworkCache::Storage::deleteOldVersions):
3289         * NetworkProcess/ios/NetworkProcessIOS.mm:
3290         (WebKit::NetworkProcess::initializeProcess):
3291         (WebKit::NetworkProcess::initializeProcessName):
3292         (WebKit::NetworkProcess::initializeSandbox):
3293         * NetworkProcess/mac/NetworkProcessMac.mm:
3294         (WebKit::NetworkProcess::initializeProcess):
3295         (WebKit::NetworkProcess::initializeProcessName):
3296         (WebKit::NetworkProcess::initializeSandbox):
3297         * NetworkProcess/soup/NetworkProcessMainSoup.cpp:
3298         (WebKit::initializeAuxiliaryProcess<NetworkProcess>):
3299         (WebKit::NetworkProcessMainUnix):
3300         (WebKit::initializeChildProcess<NetworkProcess>): Deleted.
3301         * NetworkProcess/watchos/NetworkProximityManager.h:
3302         * NetworkProcess/watchos/NetworkProximityManager.mm:
3303         (WebKit::NetworkProximityManager::NetworkProximityManager):
3304         * NetworkProcess/win/NetworkProcessMainWin.cpp:
3305         (WebKit::initializeAuxiliaryProcess<NetworkProcess>):
3306         (WebKit::NetworkProcessMainWin):
3307         (WebKit::initializeChildProcess<NetworkProcess>): Deleted.
3308         * PlatformGTK.cmake:
3309         * PlatformMac.cmake:
3310         * PlatformWin.cmake:
3311         * PluginProcess/PluginProcess.cpp:
3312         (WebKit::PluginProcess::initializeProcess):
3313         (WebKit::PluginProcess::initializeConnection):
3314         (WebKit::PluginProcess::didReceiveMessage):
3315         (WebKit::PluginProcess::initializeProcessName):
3316         (WebKit::PluginProcess::initializeSandbox):
3317         * PluginProcess/PluginProcess.h:
3318         * PluginProcess/mac/PluginProcessMac.mm:
3319         (WebKit::PluginProcess::platformInitializeProcess):
3320         (WebKit::PluginProcess::initializeProcessName):
3321         (WebKit::PluginProcess::initializeSandbox):
3322         (WebKit::PluginProcess::stopRunLoop):
3323         * PluginProcess/unix/PluginProcessMainUnix.cpp:
3324         (WebKit::PluginProcessMainUnix):
3325         * PluginProcess/unix/PluginProcessUnix.cpp:
3326         (WebKit::PluginProcess::platformInitializeProcess):
3327         * Shared/Authentication/AuthenticationManager.cpp:
3328         (WebKit::AuthenticationManager::AuthenticationManager):
3329         * Shared/Authentication/AuthenticationManager.h:
3330         * Shared/AuxiliaryProcess.cpp: Copied from Source/WebKit/Shared/ChildProcess.cpp.
3331         (WebKit::AuxiliaryProcess::AuxiliaryProcess):
3332         (WebKit::AuxiliaryProcess::~AuxiliaryProcess):
3333         (WebKit::AuxiliaryProcess::didClose):
3334         (WebKit::AuxiliaryProcess::initialize):
3335         (WebKit::AuxiliaryProcess::setProcessSuppressionEnabled):
3336         (WebKit::AuxiliaryProcess::initializeProcess):
3337         (WebKit::AuxiliaryProcess::initializeProcessName):
3338         (WebKit::AuxiliaryProcess::initializeConnection):
3339         (WebKit::AuxiliaryProcess::addMessageReceiver):
3340         (WebKit::AuxiliaryProcess::removeMessageReceiver):
3341         (WebKit::AuxiliaryProcess::disableTermination):
3342         (WebKit::AuxiliaryProcess::enableTermination):
3343         (WebKit::AuxiliaryProcess::messageSenderConnection):
3344         (WebKit::AuxiliaryProcess::messageSenderDestinationID):
3345         (WebKit::AuxiliaryProcess::terminationTimerFired):
3346         (WebKit::AuxiliaryProcess::stopRunLoop):
3347         (WebKit::AuxiliaryProcess::platformStopRunLoop):
3348         (WebKit::AuxiliaryProcess::terminate):
3349         (WebKit::AuxiliaryProcess::shutDown):
3350         (WebKit::AuxiliaryProcess::registerURLSchemeServiceWorkersCanHandle const):
3351         (WebKit::AuxiliaryProcess::platformInitialize):
3352         (WebKit::AuxiliaryProcess::initializeSandbox):
3353         (WebKit::AuxiliaryProcess::didReceiveInvalidMessage):
3354         (WebKit::AuxiliaryProcess::didReceiveMemoryPressureEvent):
3355         (WebKit::ChildProcess::ChildProcess): Deleted.
3356         (WebKit::ChildProcess::~ChildProcess): Deleted.
3357         (WebKit::ChildProcess::didClose): Deleted.
3358         (WebKit::ChildProcess::initialize): Deleted.
3359         (WebKit::ChildProcess::setProcessSuppressionEnabled): Deleted.
3360         (WebKit::ChildProcess::initializeProcess): Deleted.
3361         (WebKit::ChildProcess::initializeProcessName): Deleted.
3362         (WebKit::ChildProcess::initializeConnection): Deleted.
3363         (WebKit::ChildProcess::addMessageReceiver): Deleted.
3364         (WebKit::ChildProcess::removeMessageReceiver): Deleted.
3365         (WebKit::ChildProcess::disableTermination): Deleted.
3366         (WebKit::ChildProcess::enableTermination): Deleted.
3367         (WebKit::ChildProcess::messageSenderConnection): Deleted.
3368         (WebKit::ChildProcess::messageSenderDestinationID): Deleted.
3369         (WebKit::ChildProcess::terminationTimerFired): Deleted.
3370         (WebKit::ChildProcess::stopRunLoop): Deleted.
3371         (WebKit::ChildProcess::platformStopRunLoop): Deleted.
3372         (WebKit::ChildProcess::terminate): Deleted.
3373         (WebKit::ChildProcess::shutDown): Deleted.
3374         (WebKit::ChildProcess::registerURLSchemeServiceWorkersCanHandle const): Deleted.
3375         (WebKit::ChildProcess::platformInitialize): Deleted.
3376         (WebKit::ChildProcess::initializeSandbox): Deleted.
3377         (WebKit::ChildProcess::didReceiveInvalidMessage): Deleted.
3378         (WebKit::ChildProcess::didReceiveMemoryPressureEvent): Deleted.
3379         * Shared/AuxiliaryProcess.h: Copied from Source/WebKit/Shared/ChildProcess.h.
3380         (WebKit::ChildProcess::parentProcessConnection const): Deleted.
3381         (WebKit::ChildProcess::messageReceiverMap): Deleted.
3382         (WebKit::ChildProcess::setTerminationTimeout): Deleted.
3383         (WebKit::ChildProcess::shouldOverrideQuarantine): Deleted.
3384         * Shared/AuxiliaryProcess.messages.in: Copied from Source/WebKit/Shared/ChildProcess.messages.in.
3385         * Shared/AuxiliaryProcessSupplement.h: Copied from Source/WebKit/Shared/ChildProcessSupplement.h.
3386         (WebKit::AuxiliaryProcessSupplement::~AuxiliaryProcessSupplement):
3387         (WebKit::ChildProcessSupplement::~ChildProcessSupplement): Deleted.
3388         (WebKit::ChildProcessSupplement::initializeConnection): Deleted.
3389         * Shared/ChildProcess.cpp: Removed.
3390         * Shared/ChildProcess.h: Removed.
3391         * Shared/ChildProcess.messages.in: Removed.
3392         * Shared/ChildProcessSupplement.h: Removed.
3393         * Shared/Cocoa/AuxiliaryProcessCocoa.mm: Copied from Source/WebKit/Shared/Cocoa/ChildProcessCocoa.mm.
3394         (WebKit::AuxiliaryProcess::didReceiveInvalidMessage):
3395         (WebKit::ChildProcess::didReceiveInvalidMessage): Deleted.
3396         * Shared/Cocoa/ChildProcessCocoa.mm: Removed.
3397         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
3398         (WebKit::initializeAuxiliaryProcess):
3399         (WebKit::XPCServiceInitializer):
3400         (WebKit::initializeChildProcess): Deleted.
3401         * Shared/WebSQLiteDatabaseTracker.cpp:
3402         (WebKit::WebSQLiteDatabaseTracker::WebSQLiteDatabaseTracker):
3403         (WebKit::WebSQLiteDatabaseTracker::hysteresisUpdated):
3404         (WebKit::m_childProcessType): Deleted.
3405         * Shared/WebSQLiteDatabaseTracker.h:
3406         * Shared/ios/AuxiliaryProcessIOS.mm: Copied from