Spew: Unhandled web process message 'VisitedLinkTableController:VisitedLinkStateChanged'
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-03-19  Chris Dumez  <cdumez@apple.com>
2
3         Spew: Unhandled web process message 'VisitedLinkTableController:VisitedLinkStateChanged'
4         https://bugs.webkit.org/show_bug.cgi?id=194787
5         <rdar://problem/48175520>
6
7         Reviewed by Geoffrey Garen.
8
9         The unhandled 'VisitedLinkTableController:VisitedLinkStateChanged' message logging happens
10         when IPC is sent to a WebProcess which does not have a VisitedLinkTableController with the
11         given identifier. VisitedLinkTableController are kept alive by the WebPage in the WebProcess
12         side so this indicates that there is no WebPage using this VisitedLinkTableController anymore.
13
14         In the UIProcess side, our tracking of who is using which VisitedLinkStore was very poor.
15         WebPageProxy objects would ask their process to register itself with the page's visitedLinkStore
16         as soon as the WebPage object has been created on the WebProcess side. This part was fine.
17         However, unregistration from the visitedLinkStores would only happen when either the
18         visitedLinkStore would get destroyed or when the WebProcess would shutdown. This means that
19         WebProcess could stay registered with a visitedLinkStore even after the page that was using it
20         has been closed, which would lead to such logging.
21
22         To address the issue, the WebProcessProxy now keeps track for which pages are using which
23         visitedLinkStore. When a visitedLinkStore is used by a page for the first time, the
24         WebProcessProxy will register itself with the visitedLinkStore. Similarly, when the last page
25         using a given visitedLinkStore is closed, the process unregisters itself from the
26         visitedLinkStore, thus avoiding the bug.
27
28         I also simplified a lot the logic for having a page telling the WebProcessProxy it started
29         using a visitedLinkStore. Previously, it would have to wait until the process is done launching
30         before notifying the WebProcessProxy. Now, the WebPageProxy merely tells the WebProcessProxy
31         that it is starting to use a visitedLinkStore as soon as it sent the CreateWebPage IPC to the
32         WebProcess (no matter if the process is still launching or not). At this point, the
33         WebProcessProxy registers the page as a user of the visitedLinkStore and takes care of waiting
34         until it is done launching before registering itself with the visitedLinkStore.
35
36         * UIProcess/ProvisionalPageProxy.cpp:
37         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
38         (WebKit::ProvisionalPageProxy::initializeWebPage):
39         (WebKit::ProvisionalPageProxy::processDidFinishLaunching): Deleted.
40         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
41         * UIProcess/ProvisionalPageProxy.h:
42         * UIProcess/VisitedLinkStore.cpp:
43         (WebKit::VisitedLinkStore::~VisitedLinkStore):
44         (WebKit::VisitedLinkStore::addProcess):
45         * UIProcess/WebPageProxy.cpp:
46         (WebKit::WebPageProxy::finishAttachingToWebProcess):
47         (WebKit::WebPageProxy::initializeWebPage):
48         (WebKit::WebPageProxy::resetStateAfterProcessExited):
49         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
50         (WebKit::WebPageProxy::processDidFinishLaunching): Deleted.
51         * UIProcess/WebPageProxy.h:
52         * UIProcess/WebProcessProxy.cpp:
53         (WebKit::WebProcessProxy::shutDown):
54         (WebKit::WebProcessProxy::removeWebPage):
55         (WebKit::WebProcessProxy::addVisitedLinkStoreUser):
56         (WebKit::WebProcessProxy::removeVisitedLinkStoreUser):
57         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
58         (WebKit::WebProcessProxy::didFinishLaunching):
59         (WebKit::WebProcessProxy::addVisitedLinkStore): Deleted.
60         (WebKit::WebProcessProxy::didDestroyVisitedLinkStore): Deleted.
61         * UIProcess/WebProcessProxy.h:
62
63 2019-03-19  Alex Christensen  <achristensen@webkit.org>
64
65         Make WTFLogChannelState and WTFLogLevel enum classes
66         https://bugs.webkit.org/show_bug.cgi?id=195904
67
68         Reviewed by Eric Carlson.
69
70         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
71         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
72         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
73         (WebKit::NetworkRTCProvider::NetworkRTCProvider):
74
75 2019-03-19  Michael Catanzaro  <mcatanzaro@igalia.com>
76
77         Unreviewed, rolling out r243132.
78
79         Broke GTK build
80
81         Reverted changeset:
82
83         "Make WTFLogChannelState and WTFLogLevel enum classes"
84         https://bugs.webkit.org/show_bug.cgi?id=195904
85         https://trac.webkit.org/changeset/243132
86
87 2019-03-19  Antti Koivisto  <antti@apple.com>
88
89         Layer with no backing store should still hit-test over a scroller
90         https://bugs.webkit.org/show_bug.cgi?id=195378
91         <rdar://problem/48652078>
92
93         Reviewed by Simon Fraser.
94
95         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
96         (WebKit::RemoteLayerTreeHost::makeNode):
97         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
98         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
99         (WebKit::collectDescendantViewsAtPoint):
100
101         No need for special WKTiledBackingView, tiled views now have correct event regions.
102
103 2019-03-18  Alex Christensen  <achristensen@webkit.org>
104
105         Make WTFLogChannelState and WTFLogLevel enum classes
106         https://bugs.webkit.org/show_bug.cgi?id=195904
107
108         Reviewed by Eric Carlson.
109
110         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
111         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
112         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
113         (WebKit::NetworkRTCProvider::NetworkRTCProvider):
114
115 2019-03-18  Commit Queue  <commit-queue@webkit.org>
116
117         Unreviewed, rolling out r243092 and r243096.
118         https://bugs.webkit.org/show_bug.cgi?id=195926
119
120         Caused assertions in tests (Requested by smfr on #webkit).
121
122         Reverted changesets:
123
124         "Layer with no backing store should still hit-test over a
125         scroller"
126         https://bugs.webkit.org/show_bug.cgi?id=195378
127         https://trac.webkit.org/changeset/243092
128
129         "Try to fix Windows build."
130         https://trac.webkit.org/changeset/243096
131
132 2019-03-18  Timothy Hatcher  <timothy@apple.com>
133
134         WKWebView.GetContentsShouldReturnAttributedString is crashing on iOS Simulator.
135         https://bugs.webkit.org/show_bug.cgi?id=195916
136
137         Reviewed by Tim Horton.
138
139         Add direct support for UIColor so it does not try to use the NSSecureCoding path.
140         This avoids needs to list the classes when decoding the attributes NSDictionary
141         and matches the macOS NSColor encoder/decoder.
142
143         * Shared/Cocoa/ArgumentCodersCocoa.mm:
144         (IPC::typeFromObject):
145         (IPC::encodeColorInternal):
146         (IPC::decodeColorInternal):
147         (IPC::encodeObject):
148         (IPC::decodeObject):
149
150 2019-03-18  Timothy Hatcher  <timothy@apple.com>
151
152         Add new NSAttributedString API for converting HTML.
153         https://bugs.webkit.org/show_bug.cgi?id=195636
154         rdar://problem/45055697
155
156         Reviewed by Tim Horton.
157
158         * Platform/spi/ios/UIKitSPI.h:
159         * SourcesCocoa.txt:
160         * UIProcess/API/Cocoa/NSAttributedString.h: Added.
161         * UIProcess/API/Cocoa/NSAttributedString.mm: Added.
162         (-[_WKAttributedStringNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
163         (-[_WKAttributedStringNavigationDelegate webView:didFailProvisionalNavigation:withError:]):
164         (-[_WKAttributedStringNavigationDelegate webView:didFailNavigation:withError:]):
165         (-[_WKAttributedStringNavigationDelegate webView:didFinishNavigation:]):
166         (+[_WKAttributedStringWebViewCache cache]):
167         (+[_WKAttributedStringWebViewCache configuration]):
168         (+[_WKAttributedStringWebViewCache clearConfiguration]):
169         (+[_WKAttributedStringWebViewCache retrieveOrCreateWebView]):
170         (+[_WKAttributedStringWebViewCache cacheWebView:]):
171         (+[_WKAttributedStringWebViewCache resetPurgeDelay]):
172         (+[_WKAttributedStringWebViewCache purgeSingleWebView]):
173         (+[_WKAttributedStringWebViewCache purgeAllWebViews]):
174         (+[NSAttributedString _loadFromHTMLWithOptions:contentLoader:completionHandler:]):
175         (+[NSAttributedString loadFromHTMLWithRequest:options:completionHandler:]):
176         (+[NSAttributedString loadFromHTMLWithFileURL:options:completionHandler:]):
177         (+[NSAttributedString loadFromHTMLWithString:options:completionHandler:]):
178         (+[NSAttributedString loadFromHTMLWithData:options:completionHandler:]):
179         * UIProcess/API/Cocoa/NSAttributedStringPrivate.h: Copied from Source/WebKit/UIProcess/API/Cocoa/WKErrorInternal.h.
180         * UIProcess/API/Cocoa/WKError.h:
181         * UIProcess/API/Cocoa/WKError.mm:
182         (localizedDescriptionForErrorCode):
183         (createNSError):
184         * UIProcess/API/Cocoa/WKErrorInternal.h:
185         * WebKit.xcodeproj/project.pbxproj:
186         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
187         (WebKit::WebPage::getContentsAsAttributedString):
188
189 2019-03-18  Alex Christensen  <achristensen@webkit.org>
190
191         Implement DownloadMonitor to prevent long-running slow downloads from background apps
192         https://bugs.webkit.org/show_bug.cgi?id=195785
193
194         Reviewed by Geoffrey Garen.
195
196         This is similar to what was updated in <rdar://problem/42677685> but for WebKit Downloads.
197         To test it I implemented a throttled TCP server, SPI to speed up DownloadMonitor's timer,
198         and SPI to synthesize the application going into the background and foreground, which
199         NSNotificationCenter does on iOS.
200
201         * NetworkProcess/Downloads/Download.cpp:
202         (WebKit::Download::didReceiveData):
203         (WebKit::Download::didFinish):
204         (WebKit::Download::didFail):
205         (WebKit::Download::didCancel):
206         * NetworkProcess/Downloads/Download.h:
207         (WebKit::Download::applicationEnteredBackground):
208         (WebKit::Download::applicationEnteredForeground):
209         (WebKit::Download::manager const):
210         * NetworkProcess/Downloads/DownloadManager.cpp:
211         (WebKit::DownloadManager::downloadFinished):
212         (WebKit::DownloadManager::applicationDidEnterBackground):
213         (WebKit::DownloadManager::applicationWillEnterForeground):
214         * NetworkProcess/Downloads/DownloadManager.h:
215         * NetworkProcess/Downloads/DownloadMap.cpp:
216         (WebKit::DownloadMap::values):
217         * NetworkProcess/Downloads/DownloadMap.h:
218         * NetworkProcess/Downloads/DownloadMonitor.cpp: Added.
219         (WebKit::operator _kbps):
220         (WebKit::timeUntilNextInterval):
221         (WebKit::DownloadMonitor::DownloadMonitor):
222         (WebKit::DownloadMonitor::measuredThroughputRate const):
223         (WebKit::DownloadMonitor::downloadReceivedBytes):
224         (WebKit::DownloadMonitor::applicationEnteredForeground):
225         (WebKit::DownloadMonitor::applicationEnteredBackground):
226         (WebKit::DownloadMonitor::speedMultiplier const):
227         (WebKit::DownloadMonitor::timerFired):
228         * NetworkProcess/Downloads/DownloadMonitor.h: Added.
229         * NetworkProcess/NetworkProcess.cpp:
230         (WebKit::NetworkProcess::initializeNetworkProcess):
231         (WebKit::NetworkProcess::applicationDidEnterBackground):
232         (WebKit::NetworkProcess::applicationWillEnterForeground):
233         * NetworkProcess/NetworkProcess.h:
234         * NetworkProcess/NetworkProcess.messages.in:
235         * NetworkProcess/NetworkProcessCreationParameters.cpp:
236         (WebKit::NetworkProcessCreationParameters::encode const):
237         (WebKit::NetworkProcessCreationParameters::decode):
238         * NetworkProcess/NetworkProcessCreationParameters.h:
239         * Sources.txt:
240         * SourcesCocoa.txt:
241         * UIProcess/API/APIProcessPoolConfiguration.cpp:
242         (API::ProcessPoolConfiguration::copy):
243         * UIProcess/API/APIProcessPoolConfiguration.h:
244         * UIProcess/API/C/WKContext.cpp:
245         (WKContextDownloadURLRequest):
246         (WKContextResumeDownload):
247         * UIProcess/API/Cocoa/WKProcessPool.mm:
248         (-[WKProcessPool _synthesizeAppIsBackground:]):
249         (-[WKProcessPool _downloadURLRequest:originatingWebView:]):
250         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
251         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
252         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
253         (-[_WKProcessPoolConfiguration downloadMonitorSpeedMultiplier]):
254         (-[_WKProcessPoolConfiguration setDownloadMonitorSpeedMultiplier:]):
255         * UIProcess/Cocoa/DownloadProxyMapCocoa.mm: Added.
256         (WebKit::DownloadProxyMap::platformCreate):
257         (WebKit::DownloadProxyMap::platformDestroy):
258         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
259         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
260         * UIProcess/Downloads/DownloadProxy.cpp:
261         (WebKit::DownloadProxy::didFinish):
262         (WebKit::DownloadProxy::didFail):
263         (WebKit::DownloadProxy::didCancel):
264         * UIProcess/Downloads/DownloadProxyMap.cpp:
265         (WebKit::DownloadProxyMap::DownloadProxyMap):
266         (WebKit::DownloadProxyMap::~DownloadProxyMap):
267         (WebKit::DownloadProxyMap::platformCreate):
268         (WebKit::DownloadProxyMap::platformDestroy):
269         (WebKit::DownloadProxyMap::applicationDidEnterBackground):
270         (WebKit::DownloadProxyMap::applicationWillEnterForeground):
271         (WebKit::DownloadProxyMap::createDownloadProxy):
272         (WebKit::DownloadProxyMap::downloadFinished):
273         * UIProcess/Downloads/DownloadProxyMap.h:
274         * UIProcess/Network/NetworkProcessProxy.cpp:
275         (WebKit::NetworkProcessProxy::synthesizeAppIsBackground):
276         (WebKit::NetworkProcessProxy::createDownloadProxy):
277         * UIProcess/Network/NetworkProcessProxy.h:
278         * UIProcess/PageClient.h:
279         * UIProcess/WebPageProxy.cpp:
280         (WebKit::WebPageProxy::receivedPolicyDecision):
281         (WebKit::WebPageProxy::handleDownloadRequest):
282         * UIProcess/WebPageProxy.h:
283         * UIProcess/WebProcessPool.cpp:
284         (WebKit::WebProcessPool::download):
285         (WebKit::WebProcessPool::resumeDownload):
286         (WebKit::WebProcessPool::createDownloadProxy):
287         (WebKit::WebProcessPool::synthesizeAppIsBackground):
288         * UIProcess/WebProcessPool.h:
289         * UIProcess/ios/PageClientImplIOS.h:
290         * UIProcess/ios/PageClientImplIOS.mm:
291         (WebKit::PageClientImpl::handleDownloadRequest):
292         * UIProcess/mac/PageClientImplMac.h:
293         * UIProcess/mac/PageClientImplMac.mm:
294         (WebKit::PageClientImpl::handleDownloadRequest):
295         * WebKit.xcodeproj/project.pbxproj:
296
297 2019-03-18  Wenson Hsieh  <wenson_hsieh@apple.com>
298
299         [iOS] Native selection views sometimes appear in hidden editable areas after losing focus
300         https://bugs.webkit.org/show_bug.cgi?id=195894
301         <rdar://problem/48849989>
302
303         Reviewed by Tim Horton.
304
305         On certain websites, focus is moved away from an editable element while maintaining a selection inside the
306         editable element. In the case where the editable element is hidden, this currently breaks our text interaction
307         suppression heuristics, which suppress text selection gestures and overlays inside focused hidden editable
308         elements. To fix this, we refactor our text interaction suppression heuristics, such that they are not dependent
309         on an editable element being focused. See changes below for more details.
310
311         Test: editing/selection/ios/hide-selection-in-non-focused-element.html
312
313         * Shared/EditorState.cpp:
314         (WebKit::EditorState::PostLayoutData::encode const):
315         (WebKit::EditorState::PostLayoutData::decode):
316         * Shared/EditorState.h:
317
318         Rename elementIsTransparentOrFullyClipped to editableRootIsTransparentOrFullyClipped, and additionally compute
319         this flag by checking whether the root editable element containing the selection is transparent or clipped,
320         instead of using the currently focused element.
321
322         * Shared/FocusedElementInformation.cpp:
323         (WebKit::FocusedElementInformation::encode const):
324         (WebKit::FocusedElementInformation::decode):
325         * Shared/FocusedElementInformation.h:
326
327         Remove the elementIsTransparentOrFullyClipped flag from FocusedElementInformation (see below for more detail).
328
329         * UIProcess/ios/WKContentViewInteraction.h:
330
331         Rename FocusedElementIsTransparentOrFullyClipped to EditableRootIsTransparentOrFullyClipped.
332
333         * UIProcess/ios/WKContentViewInteraction.mm:
334         (-[WKContentView _zoomToRevealFocusedElement]):
335         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
336
337         Remove logic that currently uses state on FocusedElementInformation to determine whether to suppress platform
338         text interactions; instead, only use EditorState to make this determination. This logic was originally added in
339         the initial implementation of the text interaction suppression heuristic as a way to begin suppressing text
340         selection state before zooming to reveal the focused element; however, since we now zoom to reveal the text
341         selection when focusing editable elements, zooming is deferred until the next complete EditorState update
342         arrives in the UI process so we don't need to worry about beginning to suppress text interactions prior to this
343         initial editor state update.
344
345         (-[WKContentView _elementDidBlur]):
346         (-[WKContentView _updateSelectionAssistantSuppressionState]):
347
348         Add a helper method that updates text selection suppression state using the current EditorState.
349
350         (-[WKContentView _selectionChanged]):
351         (-[WKContentView _updateChangedSelection:]):
352
353         Always update text suppression state when receiving an EditorState, instead of only doing so when processing a
354         text selection gesture.
355
356         (-[WKContentView _startSuppressingSelectionAssistantForReason:]):
357
358         Renamed from _beginSuppressingSelectionAssistantForReason:, to better match "start/end" terminology of
359         _endSuppressingSelectionAssistantForReason:.
360
361         (-[WKContentView dropInteraction:performDrop:]):
362         (-[WKContentView _beginSuppressingSelectionAssistantForReason:]): Deleted.
363         * UIProcess/ios/WebPageProxyIOS.mm:
364         (WebKit::WebPageProxy::editorStateChanged):
365
366         Ensure that we run logic to zoom to the focused element *after* updating text selection suppression state, so we
367         don't erroneously zoom to reveal hidden editable elements.
368
369         * WebProcess/WebPage/ios/WebPageIOS.mm:
370         (WebKit::WebPage::platformEditorState const):
371         (WebKit::WebPage::getFocusedElementInformation):
372
373 2019-03-18  Chris Dumez  <cdumez@apple.com>
374
375         Delay WebProcess launch until a load is triggered in a Web view
376         https://bugs.webkit.org/show_bug.cgi?id=195758
377         <rdar://problem/48126013>
378
379         Reviewed by Geoff Garen.
380
381         This is achieved by constructing WebPageProxy objects with a WebProcessProxy that is in
382         terminated state (because it never launched its process). This is convenient because
383         it is a state that the WebPageProxy supports, which normally happened by the WebProcess
384         crashes. When trying to do a load, we were already checking if the WebPageProxy's process
385         was running (via an isValid() check) and we would re-launch the WebProcess if necessary
386         by calling reattachToWebProcess(). For clarity, given that this state is no longer
387         indicating that the WebProcess crashed, I renamed isValid() to hasRunningProcess() and
388         reattachToWebProcess() to launchProcess().
389
390         The reason delaying the WebProcess launch until the first load is useful is because it
391         allows us to leverage the WebProcessCache given that we now know which registrable
392         domain is going to be loaded in the process.
393
394         This is a progression from a power usage standpoint. When it comes to page load time,
395         it would be a progression if we found a suitable process in the cache. I do not expect
396         a performance hit when no process is found in the cache because of process prewarming.
397
398         * Shared/API/Cocoa/RemoteObjectRegistry.h:
399         * Shared/API/Cocoa/RemoteObjectRegistry.mm:
400         (WebKit::m_launchInitialProcessIfNecessary):
401         (WebKit::RemoteObjectRegistry::sendInvocation):
402         * UIProcess/API/Cocoa/WKProcessPool.mm:
403         (-[WKProcessPool _processCacheSize]):
404         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
405         * UIProcess/API/Cocoa/WKWebView.mm:
406         (-[WKWebView _isValid]):
407         * UIProcess/Automation/WebAutomationSession.cpp:
408         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
409         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
410         (WebKit::WebPageProxy::performDictionaryLookupAtLocation):
411         (WebKit::WebPageProxy::performDictionaryLookupOfCurrentSelection):
412         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
413         (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState):
414         (WebKit::DrawingAreaProxyCoordinatedGraphics::waitForAndDispatchDidUpdateBackingStoreState):
415         (WebKit::DrawingAreaProxyCoordinatedGraphics::dispatchAfterEnsuringDrawing):
416         * UIProcess/DrawingAreaProxy.cpp:
417         (WebKit::DrawingAreaProxy::setViewExposedRect):
418         (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired):
419         * UIProcess/GeolocationPermissionRequestManagerProxy.cpp:
420         (WebKit::GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision):
421         * UIProcess/InspectorTargetProxy.cpp:
422         (WebKit::InspectorTargetProxy::connect):
423         (WebKit::InspectorTargetProxy::disconnect):
424         (WebKit::InspectorTargetProxy::sendMessageToTargetBackend):
425         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
426         (WebKit::RemoteLayerTreeDrawingAreaProxy::sizeDidChange):
427         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
428         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
429         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
430         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
431         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
432         (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest):
433         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
434         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
435         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
436         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
437         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
438         * UIProcess/ViewGestureController.cpp:
439         (WebKit::ViewGestureController::ViewGestureController):
440         * UIProcess/WebBackForwardList.cpp:
441         (WebKit::WebBackForwardList::~WebBackForwardList):
442         * UIProcess/WebCookieManagerProxy.cpp:
443         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
444         * UIProcess/WebEditCommandProxy.cpp:
445         (WebKit::WebEditCommandProxy::unapply):
446         (WebKit::WebEditCommandProxy::reapply):
447         * UIProcess/WebFrameProxy.cpp:
448         (WebKit::WebFrameProxy::stopLoading const):
449         * UIProcess/WebInspectorProxy.cpp:
450         (WebKit::WebInspectorProxy::WebInspectorProxy):
451         * UIProcess/WebPageProxy.cpp:
452         (WebKit::m_resetRecentCrashCountTimer):
453         (WebKit::WebPageProxy::hasRunningProcess const):
454         (WebKit::WebPageProxy::setUIClient):
455         (WebKit::WebPageProxy::setIconLoadingClient):
456         (WebKit::WebPageProxy::launchProcess):
457         (WebKit::WebPageProxy::swapToWebProcess):
458         (WebKit::WebPageProxy::finishAttachingToWebProcess):
459         (WebKit::WebPageProxy::didAttachToRunningProcess):
460         (WebKit::WebPageProxy::launchProcessForReload):
461         (WebKit::WebPageProxy::launchProcessWithItem):
462         (WebKit::WebPageProxy::initializeWebPage):
463         (WebKit::WebPageProxy::tryClose):
464         (WebKit::WebPageProxy::loadRequest):
465         (WebKit::WebPageProxy::loadFile):
466         (WebKit::WebPageProxy::loadData):
467         (WebKit::WebPageProxy::loadAlternateHTML):
468         (WebKit::WebPageProxy::loadWebArchiveData):
469         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
470         (WebKit::WebPageProxy::stopLoading):
471         (WebKit::WebPageProxy::reload):
472         (WebKit::WebPageProxy::goToBackForwardItem):
473         (WebKit::WebPageProxy::tryRestoreScrollPosition):
474         (WebKit::WebPageProxy::setControlledByAutomation):
475         (WebKit::WebPageProxy::setIndicating):
476         (WebKit::WebPageProxy::setBackgroundColor):
477         (WebKit::WebPageProxy::setTopContentInset):
478         (WebKit::WebPageProxy::setUnderlayColor):
479         (WebKit::WebPageProxy::viewWillStartLiveResize):
480         (WebKit::WebPageProxy::viewWillEndLiveResize):
481         (WebKit::WebPageProxy::dispatchActivityStateChange):
482         (WebKit::WebPageProxy::layerHostingModeDidChange):
483         (WebKit::WebPageProxy::waitForDidUpdateActivityState):
484         (WebKit::WebPageProxy::setInitialFocus):
485         (WebKit::WebPageProxy::clearSelection):
486         (WebKit::WebPageProxy::restoreSelectionInFocusedEditableElement):
487         (WebKit::WebPageProxy::validateCommand):
488         (WebKit::WebPageProxy::increaseListLevel):
489         (WebKit::WebPageProxy::decreaseListLevel):
490         (WebKit::WebPageProxy::changeListType):
491         (WebKit::WebPageProxy::setBaseWritingDirection):
492         (WebKit::WebPageProxy::setNeedsFontAttributes):
493         (WebKit::WebPageProxy::executeEditCommand):
494         (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart):
495         (WebKit::WebPageProxy::setEditable):
496         (WebKit::WebPageProxy::performDragControllerAction):
497         (WebKit::WebPageProxy::dragEnded):
498         (WebKit::WebPageProxy::didStartDrag):
499         (WebKit::WebPageProxy::dragCancelled):
500         (WebKit::WebPageProxy::handleMouseEvent):
501         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
502         (WebKit::WebPageProxy::handleWheelEvent):
503         (WebKit::WebPageProxy::handleKeyboardEvent):
504         (WebKit::WebPageProxy::handleGestureEvent):
505         (WebKit::WebPageProxy::handleTouchEventSynchronously):
506         (WebKit::WebPageProxy::handleTouchEventAsynchronously):
507         (WebKit::WebPageProxy::handleTouchEvent):
508         (WebKit::WebPageProxy::scrollBy):
509         (WebKit::WebPageProxy::centerSelectionInVisibleArea):
510         (WebKit::WebPageProxy::receivedPolicyDecision):
511         (WebKit::WebPageProxy::setUserAgent):
512         (WebKit::WebPageProxy::resumeActiveDOMObjectsAndAnimations):
513         (WebKit::WebPageProxy::suspendActiveDOMObjectsAndAnimations):
514         (WebKit::WebPageProxy::setCustomTextEncodingName):
515         (WebKit::WebPageProxy::setTextZoomFactor):
516         (WebKit::WebPageProxy::setPageZoomFactor):
517         (WebKit::WebPageProxy::setPageAndTextZoomFactors):
518         (WebKit::WebPageProxy::scalePage):
519         (WebKit::WebPageProxy::scalePageInViewCoordinates):
520         (WebKit::WebPageProxy::scaleView):
521         (WebKit::WebPageProxy::windowScreenDidChange):
522         (WebKit::WebPageProxy::setCustomDeviceScaleFactor):
523         (WebKit::WebPageProxy::accessibilitySettingsDidChange):
524         (WebKit::WebPageProxy::updateAccessibilityEventsEnabled):
525         (WebKit::WebPageProxy::setUseFixedLayout):
526         (WebKit::WebPageProxy::setFixedLayoutSize):
527         (WebKit::WebPageProxy::setAlwaysShowsHorizontalScroller):
528         (WebKit::WebPageProxy::setAlwaysShowsVerticalScroller):
529         (WebKit::WebPageProxy::listenForLayoutMilestones):
530         (WebKit::WebPageProxy::setSuppressScrollbarAnimations):
531         (WebKit::WebPageProxy::setEnableVerticalRubberBanding):
532         (WebKit::WebPageProxy::setEnableHorizontalRubberBanding):
533         (WebKit::WebPageProxy::setBackgroundExtendsBeyondPage):
534         (WebKit::WebPageProxy::setPaginationMode):
535         (WebKit::WebPageProxy::setPaginationBehavesLikeColumns):
536         (WebKit::WebPageProxy::setPageLength):
537         (WebKit::WebPageProxy::setGapBetweenPages):
538         (WebKit::WebPageProxy::setPaginationLineGridEnabled):
539         (WebKit::WebPageProxy::countStringMatches):
540         (WebKit::WebPageProxy::replaceMatches):
541         (WebKit::WebPageProxy::launchInitialProcessIfNecessary):
542         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
543         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
544         (WebKit::WebPageProxy::getRenderTreeExternalRepresentation):
545         (WebKit::WebPageProxy::getSourceForFrame):
546         (WebKit::WebPageProxy::getContentsAsString):
547         (WebKit::WebPageProxy::getContentsAsAttributedString):
548         (WebKit::WebPageProxy::getBytecodeProfile):
549         (WebKit::WebPageProxy::getSamplingProfilerOutput):
550         (WebKit::WebPageProxy::getContentsAsMHTMLData):
551         (WebKit::WebPageProxy::getSelectionOrContentsAsString):
552         (WebKit::WebPageProxy::getSelectionAsWebArchiveData):
553         (WebKit::WebPageProxy::getMainResourceDataOfFrame):
554         (WebKit::WebPageProxy::getResourceDataFromFrame):
555         (WebKit::WebPageProxy::getWebArchiveOfFrame):
556         (WebKit::WebPageProxy::forceRepaint):
557         (WebKit::WebPageProxy::preferencesDidChange):
558         (WebKit::WebPageProxy::setMediaVolume):
559         (WebKit::WebPageProxy::setMuted):
560         (WebKit::WebPageProxy::setMediaCaptureEnabled):
561         (WebKit::WebPageProxy::stopMediaCapture):
562         (WebKit::WebPageProxy::stopAllMediaPlayback):
563         (WebKit::WebPageProxy::suspendAllMediaPlayback):
564         (WebKit::WebPageProxy::resumeAllMediaPlayback):
565         (WebKit::WebPageProxy::handleMediaEvent):
566         (WebKit::WebPageProxy::setVolumeOfMediaElement):
567         (WebKit::WebPageProxy::setMayStartMediaWhenInWindow):
568         (WebKit::WebPageProxy::didChooseColor):
569         (WebKit::WebPageProxy::didEndColorPicker):
570         (WebKit::WebPageProxy::didSelectOption):
571         (WebKit::WebPageProxy::inspector const):
572         (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
573         (WebKit::WebPageProxy::didChooseFilesForOpenPanel):
574         (WebKit::WebPageProxy::didCancelForOpenPanel):
575         (WebKit::WebPageProxy::removeEditCommand):
576         (WebKit::WebPageProxy::processDidBecomeUnresponsive):
577         (WebKit::WebPageProxy::processDidBecomeResponsive):
578         (WebKit::WebPageProxy::processDidTerminate):
579         (WebKit::WebPageProxy::processWillBecomeSuspended):
580         (WebKit::WebPageProxy::processWillBecomeForeground):
581         (WebKit::WebPageProxy::resetStateAfterProcessExited):
582         (WebKit::WebPageProxy::setCanRunModal):
583         (WebKit::WebPageProxy::canRunModal):
584         (WebKit::WebPageProxy::computePagesForPrinting):
585         (WebKit::WebPageProxy::drawRectToImage):
586         (WebKit::WebPageProxy::drawPagesToPDF):
587         (WebKit::WebPageProxy::drawPagesForPrinting):
588         (WebKit::WebPageProxy::updateBackingStoreDiscardableState):
589         (WebKit::WebPageProxy::setViewLayoutSize):
590         (WebKit::WebPageProxy::setAutoSizingShouldExpandToViewHeight):
591         (WebKit::WebPageProxy::setViewportSizeForCSSViewportUnits):
592         (WebKit::WebPageProxy::setComposition):
593         (WebKit::WebPageProxy::confirmComposition):
594         (WebKit::WebPageProxy::cancelComposition):
595         (WebKit::WebPageProxy::setScrollPinningBehavior):
596         (WebKit::WebPageProxy::setOverlayScrollbarStyle):
597         (WebKit::WebPageProxy::changeFontAttributes):
598         (WebKit::WebPageProxy::changeFont):
599         (WebKit::WebPageProxy::setTextAsync):
600         (WebKit::WebPageProxy::insertTextAsync):
601         (WebKit::WebPageProxy::getMarkedRangeAsync):
602         (WebKit::WebPageProxy::getSelectedRangeAsync):
603         (WebKit::WebPageProxy::characterIndexForPointAsync):
604         (WebKit::WebPageProxy::firstRectForCharacterRangeAsync):
605         (WebKit::WebPageProxy::setCompositionAsync):
606         (WebKit::WebPageProxy::confirmCompositionAsync):
607         (WebKit::WebPageProxy::takeSnapshot):
608         (WebKit::WebPageProxy::requestActiveNowPlayingSessionInfo):
609         (WebKit::WebPageProxy::setUseSystemAppearance):
610         (WebKit::WebPageProxy::installActivityStateChangeCompletionHandler):
611         (WebKit::WebPageProxy::setPlaybackTarget):
612         (WebKit::WebPageProxy::externalOutputDeviceAvailableDidChange):
613         (WebKit::WebPageProxy::setShouldPlayToPlaybackTarget):
614         (WebKit::WebPageProxy::clearWheelEventTestTrigger):
615         (WebKit::WebPageProxy::callAfterNextPresentationUpdate):
616         (WebKit::WebPageProxy::setShouldScaleViewToFitDocument):
617         (WebKit::WebPageProxy::getLoadDecisionForIcon):
618         (WebKit::WebPageProxy::setResourceCachingDisabled):
619         (WebKit::WebPageProxy::setUserInterfaceLayoutDirection):
620         (WebKit::WebPageProxy::effectiveAppearanceDidChange):
621         (WebKit::WebPageProxy::insertAttachment):
622         (WebKit::WebPageProxy::updateAttachmentAttributes):
623         (WebKit::WebPageProxy::getApplicationManifest):
624         (WebKit::WebPageProxy::textInputContextsInRect):
625         (WebKit::WebPageProxy::focusTextInputContext):
626         * UIProcess/WebPageProxy.h:
627         * UIProcess/WebProcessPool.cpp:
628         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
629         (WebKit::WebProcessPool::initializeNewWebProcess):
630         (WebKit::WebProcessPool::disconnectProcess):
631         (WebKit::WebProcessPool::createWebPage):
632         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
633         * UIProcess/WebProcessPool.h:
634         * UIProcess/WebProcessProxy.cpp:
635         (WebKit::WebProcessProxy::create):
636         (WebKit::WebProcessProxy::addExistingWebPage):
637         (WebKit::WebProcessProxy::maybeShutDown):
638         * UIProcess/WebProcessProxy.h:
639         * UIProcess/gstreamer/InstallMissingMediaPluginsPermissionRequest.cpp:
640         (WebKit::InstallMissingMediaPluginsPermissionRequest::allow):
641         (WebKit::InstallMissingMediaPluginsPermissionRequest::didEndRequestInstallMissingMediaPlugins):
642         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
643         (WebKit::WebInspectorProxy::platformDetach):
644         * UIProcess/ios/WKContentViewInteraction.mm:
645         (-[WKContentView setupInteraction]):
646         (-[WKContentView _webTouchEventsRecognized:]):
647         (-[WKContentView _hoverGestureRecognizerChanged:]):
648         * UIProcess/ios/WebPageProxyIOS.mm:
649         (WebKit::WebPageProxy::requestFocusedElementInformation):
650         (WebKit::WebPageProxy::updateVisibleContentRects):
651         (WebKit::WebPageProxy::updateStringForFind):
652         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
653         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize):
654         (WebKit::WebPageProxy::setForceAlwaysUserScalable):
655         (WebKit::WebPageProxy::setMaximumUnobscuredSize):
656         (WebKit::WebPageProxy::setDeviceOrientation):
657         (WebKit::WebPageProxy::setOverrideViewportArguments):
658         (WebKit::WebPageProxy::selectWithGesture):
659         (WebKit::WebPageProxy::updateSelectionWithTouches):
660         (WebKit::WebPageProxy::requestAutocorrectionData):
661         (WebKit::WebPageProxy::applyAutocorrection):
662         (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
663         (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
664         (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection):
665         (WebKit::WebPageProxy::selectPositionAtPoint):
666         (WebKit::WebPageProxy::beginSelectionInDirection):
667         (WebKit::WebPageProxy::updateSelectionWithExtentPoint):
668         (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
669         (WebKit::WebPageProxy::requestDictationContext):
670         (WebKit::WebPageProxy::getSelectionContext):
671         (WebKit::WebPageProxy::selectWithTwoTouches):
672         (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
673         (WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText):
674         (WebKit::WebPageProxy::moveSelectionByOffset):
675         (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens):
676         (WebKit::WebPageProxy::focusNextFocusedElement):
677         (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
678         (WebKit::WebPageProxy::requestEvasionRectsAboveSelection):
679         (WebKit::WebPageProxy::requestDragStart):
680         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
681         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
682         (WebKit::TiledCoreAnimationDrawingAreaProxy::sizeDidChange):
683         (WebKit::TiledCoreAnimationDrawingAreaProxy::viewLayoutSizeDidChange):
684         (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence):
685         (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing):
686         * UIProcess/mac/WebPageProxyMac.mm:
687         (WebKit::WebPageProxy::windowAndViewFramesChanged):
688         (WebKit::WebPageProxy::setMainFrameIsScrollable):
689         (WebKit::WebPageProxy::insertDictatedTextAsync):
690         (WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync):
691         (WebKit::WebPageProxy::fontAtSelection):
692         (WebKit::WebPageProxy::stringSelectionForPasteboard):
693         (WebKit::WebPageProxy::dataSelectionForPasteboard):
694         (WebKit::WebPageProxy::readSelectionFromPasteboard):
695         (WebKit::WebPageProxy::sendComplexTextInputToPlugin):
696         (WebKit::WebPageProxy::registerWebProcessAccessibilityToken):
697         (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens):
698         (WebKit::WebPageProxy::acceptsFirstMouse):
699         * UIProcess/win/WebInspectorProxyWin.cpp:
700         (WebKit::WebInspectorProxy::platformDetach):
701         * UIProcess/win/WebView.cpp:
702         (WebKit::WebView::cursorToShow const):
703         * WebProcess/WebPage/WebPage.cpp:
704         (WebKit::m_hostFileDescriptor):
705
706 2019-03-18  Antti Koivisto  <antti@apple.com>
707
708         Layer with no backing store should still hit-test over a scroller
709         https://bugs.webkit.org/show_bug.cgi?id=195378
710         <rdar://problem/48652078>
711
712         Reviewed by Simon Fraser.
713
714         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
715         (WebKit::RemoteLayerTreeHost::makeNode):
716         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
717         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
718         (WebKit::collectDescendantViewsAtPoint):
719
720         No need for special WKTiledBackingView, tiled views now have correct event regions.
721
722 2019-03-18  Daniel Bates  <dabates@apple.com>
723
724         [iOS] No DOM keypress event emitted for cursor key commands when non-editable element is focused
725         https://bugs.webkit.org/show_bug.cgi?id=195626
726         <rdar://problem/48810626>
727
728         Reviewed by Wenson Hsieh.
729
730         Following the UIKit fix <rdar://problem/47333786> WebKit will be asked whether it can perform some
731         more actions, including cursor movements and more editing actions. All such actions are only applicable
732         to editable elements. By responding NO to UIKit for such actions when we are not in an editable element
733         we avoid the need to do such bookkeeping ourselves as UIKit will forward our response back to us
734         on return from -handleKeyTextCommandForCurrentEvent, called from -[WKContentView _interpretKeyEvent].
735         WebKit is then in a position to try to handle the event or in the case of all standard text editing
736         key commands at the time of writing (e.g. Control + a) tell WebCore that it did not handle the event
737         so that WebCore can continue the DOM key event dispatch algorithm. For standard text editing key
738         commands, such as Control + a, we will emit a DOM keypress event for the 'a'.
739
740         * UIProcess/ios/WKContentViewInteraction.mm:
741         (-[WKContentView canPerformAction:withSender:]):
742
743 2019-03-18  Adrian Perez de Castro  <aperez@igalia.com>
744
745         [WPE] Bump public API to wpe-1.0
746         https://bugs.webkit.org/show_bug.cgi?id=195887
747
748         Reviewed by Philippe Normand.
749
750         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: Renamed from Source/WebKit/UIProcess/API/wpe/docs/wpe-0.1-sections.txt.
751         * WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-1.0-sections.txt: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/wpe/docs/wpe-webextensions-0.1-sections.txt.
752
753 2019-03-18  Adrian Perez de Castro  <aperez@igalia.com>
754
755         [WPE] Bump dependencies to wpe-1.0 and wpebackend-fdo-1.0
756         https://bugs.webkit.org/show_bug.cgi?id=195786
757
758         Reviewed by Philippe Normand.
759
760         * wpe/wpe-web-extension.pc.in: Change dependency to wpe-1.0
761         * wpe/wpe-webkit.pc.in: Ditto.
762
763 2019-03-17  Fujii Hironori  <Hironori.Fujii@sony.com>
764
765         [iOS] Block the accessibility server when accessibility is not enabled.
766         https://bugs.webkit.org/show_bug.cgi?id=195342
767         <rdar://problem/48615720>
768
769         Unreviewed build fix for WinCairo.
770
771         * Shared/SandboxExtension.h: Use ProcessID instead of pid_t.
772
773 2019-03-16  Dean Jackson  <dino@apple.com>
774
775         ASSERT(gestureRecognizer == _doubleTapGestureRecognizer) in _doubleTapDidFail:
776         https://bugs.webkit.org/show_bug.cgi?id=195857
777         <rdar://problem/48954679>
778
779         Reviewed by Wenson Hsieh.
780
781         Reset an existing gesture recognizer before creating a new one.
782
783         * UIProcess/ios/WKContentViewInteraction.mm:
784         (-[WKContentView _createAndConfigureDoubleTapGestureRecognizer]):
785         (-[WKContentView _setDoubleTapGesturesEnabled:]):
786
787 2019-03-16  Jer Noble  <jer.noble@apple.com>
788
789         Add a new MediaCapabilitiesExtensionsEnabled setting
790         https://bugs.webkit.org/show_bug.cgi?id=195843
791
792         Reviewed by Geoffrey Garen.
793
794         * Shared/WebPreferences.yaml:
795
796 2019-03-16  Wenson Hsieh  <wenson_hsieh@apple.com>
797
798         [iOS] Software keyboard never appears when editing on some websites
799         https://bugs.webkit.org/show_bug.cgi?id=195824
800         <rdar://problem/48020610>
801
802         Reviewed by Ryosuke Niwa.
803
804         In the scenario where an element has already been programmatically focused but the UI process isn't showing an
805         input view for it, there are a couple of different ways in which an input view may still be shown for that
806         element:
807
808         1. If the page attempts to programmatically focus the element, we'll invoke elementDidRefocus to recompute
809         information about the focused element and propagate it to the UI process. By default, if programmatic focus was
810         triggered under the scope of user interaction, we'll allow the input view to appear.
811
812         2. In the case where page does not attempt to programmatically focus the element but a click is dispatched,
813         there is logic in WebPage::completeSyntheticClick to send information about the already-focused element.
814
815         On the web page relevant to this bug, focus is programmatically moved to hidden contenteditable areas upon page
816         load, and touchstart is also prevented; furthermore, the page does not attempt to programmatically refocus the
817         hidden editable area upon receiving touchstart. This means that the user will never be able to bring up the
818         keyboard, since the editable area is already programmatically focused and subsequent attempts to tap in the
819         page do nothing, because the page has already focused the hidden editable area (with the expectation that the
820         software keyboard should already be present).
821
822         To fix this, we bring some of the same logic in completeSyntheticClick over to dispatchTouchEvent, by sending
823         focused element information to the UI process if the focused element did not change over the course of
824         dispatching the touch event. Similar code was introduced in r167774 to fix the same type of issue (i.e.
825         inability to bring up the software keyboard), but this was later reverted in r188405 due to causing bugs such as
826         <rdar://problem/22204108>, wherein this logic to bring up the keyboard in dispatchTouchEvent would scroll and
827         zoom the page, such that the click event fired after touchend would be dispatched in the wrong location and (in
828         the case of <rdar://problem/22204108>) caused the focused element to immediately blur again.
829
830         To mitigate this issue, we add the additional constraint that we only send focused element info in the case
831         where the touch won't also generate a click later down the road, by requiring that the dispatched event was
832         handled by the page (i.e. prevented).
833
834         Test: fast/events/touch/ios/show-keyboard-after-preventing-touchstart.html
835
836         * WebProcess/WebPage/WebPage.cpp:
837         (WebKit::WebPage::dispatchTouchEvent):
838
839 2019-03-16  Zalan Bujtas  <zalan@apple.com>
840
841         Unable to close trending window on naver.com.
842         https://bugs.webkit.org/show_bug.cgi?id=195842
843         <rdar://problem/48067338>
844
845         Reviewed by Simon Fraser.
846
847         * WebProcess/WebPage/ios/WebPageIOS.mm:
848         (WebKit::dispatchSyntheticMouseMove):
849         (WebKit::WebPage::handleSyntheticClick):
850         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
851
852 2019-03-16  Timothy Hatcher  <timothy@apple.com>
853
854         REGRESSION (r242807): Unified sources build failure from missing imports.
855         https://bugs.webkit.org/show_bug.cgi?id=195852
856
857         Unreviewed speculative build fix.
858
859         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
860         Include <wtf/SoftLinking.h> and "UIKitSPI.h" on iOS.
861
862 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
863
864         [iOS] Block the accessibility server when accessibility is not enabled.
865         https://bugs.webkit.org/show_bug.cgi?id=195342
866
867         Reviewed by Brent Fulgham.
868
869         By default, block the iOS accessibility server in the sandbox. If accessibility is enabled,
870         let the UI process issue a mach extension to the WebContent process. The UI process will
871         issue the mach extension the the WebContent process by its process identifier. The sandbox
872         extension handle is sent to the WebContent process to be consumed. The message will be sent
873         when the WebProcess has finished launching, and also when accessibility is turned on.
874
875         * Platform/spi/ios/AccessibilitySupportSPI.h:
876         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
877         * Shared/SandboxExtension.h:
878         * Shared/mac/SandboxExtensionMac.mm:
879         (WebKit::SandboxExtensionImpl::create):
880         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
881         (WebKit::SandboxExtensionImpl::SandboxExtensionImpl):
882         (WebKit::SandboxExtension::createHandleForMachLookupByPid):
883         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
884         (WebKit::WebProcessPool::registerNotificationObservers):
885         (WebKit::WebProcessPool::unregisterNotificationObservers):
886         * UIProcess/WebProcessPool.h:
887         * UIProcess/WebProcessProxy.cpp:
888         (WebKit::WebProcessProxy::didFinishLaunching):
889         * UIProcess/WebProcessProxy.h:
890         * UIProcess/ios/WebProcessProxyIOS.mm:
891         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
892         * WebProcess/WebProcess.cpp:
893         (WebKit::WebProcess::unblockAccessibilityServer):
894         * WebProcess/WebProcess.h:
895         * WebProcess/WebProcess.messages.in:
896
897 2019-03-15  Timothy Hatcher  <timothy@apple.com>
898
899         Unreviewed speculative build fix for non-Cocoa ports after r243012.
900
901         * UIProcess/WebPageProxy.cpp:
902         (WebKit::WebPageProxy::getContentsAsAttributedString):
903         * UIProcess/WebPageProxy.h:
904
905 2019-03-15  Truitt Savell  <tsavell@apple.com>
906
907         Unreviewed, rolling out r243008.
908
909         This revision broke High Sierra builders
910
911         Reverted changeset:
912
913         "[iOS] Block the accessibility server when accessibility is
914         not enabled."
915         https://bugs.webkit.org/show_bug.cgi?id=195342
916         https://trac.webkit.org/changeset/243008
917
918 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
919
920         All networking from WebKit.Networking fails when Network Extension content filter is enabled
921         https://bugs.webkit.org/show_bug.cgi?id=195815
922         <rdar://problem/47598758>
923
924         Reviewed by Brent Fulgham.
925
926         The sandbox needs to allow an associated mach lookup.
927
928         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
929         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
930
931 2019-03-15  Sihui Liu  <sihui_liu@apple.com>
932
933         [ Mojave WK1 ] Layout Test storage/indexeddb/database-odd-names.html is failing
934         https://bugs.webkit.org/show_bug.cgi?id=190350
935         <rdar://problem/45089503>
936
937         Reviewed by Geoffrey Garen.
938
939         * NetworkProcess/NetworkProcess.cpp:
940         (WebKit::NetworkProcess::collectIndexedDatabaseOriginsForVersion):
941         (WebKit::NetworkProcess::indexedDatabaseOrigins):
942         * NetworkProcess/NetworkProcess.h:
943         * UIProcess/Network/NetworkProcessProxy.cpp:
944         (WebKit::NetworkProcessProxy::addSession):
945         (WebKit::NetworkProcessProxy::createSymLinkForFileUpgrade): For efficientcy and atomicity, we choose to use
946         symlink to create v0 folder. Because network process does not have the permission to create a symlink, we need 
947         to do this in UI process. UI process would create v0 folder inside the IndexedDB directory if there isn't one.
948         Also if there is a v0 directory but it doesn't have content, it means it's not a correct symlink and we need to 
949         delete it and create again.
950
951         * UIProcess/Network/NetworkProcessProxy.h:
952         * UIProcess/WebProcessPool.cpp:
953         (WebKit::WebProcessPool::ensureNetworkProcess):
954
955 2019-03-15  Sihui Liu  <sihui_liu@apple.com>
956
957         [ Mojave WK1 ] Layout Test storage/indexeddb/database-odd-names.html is failing
958         https://bugs.webkit.org/show_bug.cgi?id=190350
959         <rdar://problem/45089503>
960
961         Reviewed by Geoffrey Garen.
962
963         * NetworkProcess/NetworkProcess.cpp:
964         (WebKit::NetworkProcess::collectIndexedDatabaseOriginsForVersion):
965         (WebKit::NetworkProcess::indexedDatabaseOrigins):
966         * NetworkProcess/NetworkProcess.h:
967         * UIProcess/Network/NetworkProcessProxy.cpp:
968         (WebKit::NetworkProcessProxy::addSession):
969         (WebKit::NetworkProcessProxy::createSymLinkForFileUpgrade):
970         * UIProcess/Network/NetworkProcessProxy.h:
971         * UIProcess/WebProcessPool.cpp:
972         (WebKit::WebProcessPool::ensureNetworkProcess):
973
974 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
975
976         [iOS] Restrict iokit-user-client-class "IOHIDLibUserClient" from WebKit
977         https://bugs.webkit.org/show_bug.cgi?id=195821
978         <rdar://problem/47606250>
979
980         Reviewed by Brent Fulgham.
981
982         This should be removed from the WebContent sandbox on iOS.
983
984         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
985
986 2019-03-15  Alex Christensen  <achristensen@webkit.org>
987
988         _WKDownload should conform to NSCopying protocol
989         https://bugs.webkit.org/show_bug.cgi?id=195718
990
991         Reviewed by Tim Horton.
992
993         This will allow us to use it as keys in NSMutableDictionaries, which Safari already kind of does.
994
995         * UIProcess/API/Cocoa/_WKDownload.h:
996         * UIProcess/API/Cocoa/_WKDownload.mm:
997         (-[_WKDownload copyWithZone:]):
998
999 2019-03-15  Dean Jackson  <dino@apple.com>
1000
1001         Provide an option for an always-on fast click mode in iOS
1002         https://bugs.webkit.org/show_bug.cgi?id=195822
1003         <rdar://problem/48939357>
1004
1005         Reviewed by Sam Weinig.
1006
1007         Add an option that will always trigger a click and never
1008         wait for a double tap to zoom. It is disabled by default.
1009
1010         * Shared/WebPreferences.yaml:
1011         * UIProcess/ios/WKContentViewInteraction.mm:
1012         (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:]):
1013
1014 2019-03-15  Timothy Hatcher  <timothy@apple.com>
1015
1016         Add support to WebPage for getting the contents as an attributed string.
1017         https://bugs.webkit.org/show_bug.cgi?id=195636
1018         rdar://problem/45055697
1019
1020         Reviewed by Tim Horton.
1021
1022         * Shared/mac/AttributedString.h:
1023         (WebKit::AttributedString::AttributedString):
1024         * Shared/mac/AttributedString.mm:
1025         (IPC::ArgumentCoder<WebKit::AttributedString>::encode):
1026         (IPC::ArgumentCoder<WebKit::AttributedString>::decode):
1027         * UIProcess/API/Cocoa/WKWebView.mm:
1028         (-[WKWebView _getContentsAsAttributedStringWithCompletionHandler:]):
1029         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1030         * UIProcess/WebPageProxy.cpp:
1031         (WebKit::WebPageProxy::getContentsAsAttributedString):
1032         * UIProcess/WebPageProxy.h:
1033         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1034         (WebKit::WebPage::getContentsAsAttributedString):
1035         * WebProcess/WebPage/WebPage.h:
1036         * WebProcess/WebPage/WebPage.messages.in:
1037
1038 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
1039
1040         [iOS] Fix sandbox violation
1041         https://bugs.webkit.org/show_bug.cgi?id=195387
1042         <rdar://problem/48442387>
1043
1044         Reviewed by Brent Fulgham.
1045
1046         The sandbox on iOS and macOS needs to allow mach lookup to the "com.apple.nesessionmanager.content-filter"
1047         mach service. Also, mach lookups to "com.apple.nehelper" should be allowed.
1048
1049         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1050         * WebProcess/com.apple.WebProcess.sb.in:
1051
1052 2019-03-15  Chris Dumez  <cdumez@apple.com>
1053
1054         [PSON] Make sure the WebProcessCache is leverage when relaunching a process after termination
1055         https://bugs.webkit.org/show_bug.cgi?id=195747
1056
1057         Reviewed by Geoff Garen.
1058
1059         Make sure the WebProcessCache and the prewarmed process are used when relaunching a process
1060         after termination (e.g. crash).
1061
1062         * UIProcess/WebPageProxy.cpp:
1063         (WebKit::WebPageProxy::reattachToWebProcess):
1064         (WebKit::WebPageProxy::reattachToWebProcessForReload):
1065         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
1066         (WebKit::WebPageProxy::loadRequest):
1067         (WebKit::WebPageProxy::loadFile):
1068         (WebKit::WebPageProxy::loadData):
1069         (WebKit::WebPageProxy::loadAlternateHTML):
1070         (WebKit::WebPageProxy::loadWebArchiveData):
1071         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
1072         * UIProcess/WebPageProxy.h:
1073         * UIProcess/WebProcessPool.cpp:
1074         (WebKit::WebProcessPool::processForRegistrableDomain):
1075         (WebKit::WebProcessPool::createWebPage):
1076         (WebKit::WebProcessPool::processForNavigationInternal):
1077         (WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
1078         * UIProcess/WebProcessPool.h:
1079
1080 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
1081
1082         [iOS] Block the accessibility server when accessibility is not enabled.
1083         https://bugs.webkit.org/show_bug.cgi?id=195342
1084
1085         Reviewed by Brent Fulgham.
1086
1087         By default, block the iOS accessibility server in the sandbox. If accessibility is enabled,
1088         let the UI process issue a mach extension to the WebContent process. The UI process will
1089         issue the mach extension the the WebContent process by its process identifier. The sandbox
1090         extension handle is sent to the WebContent process to be consumed. The message will be sent
1091         when the WebProcess has finished launching, and also when accessibility is turned on.
1092
1093         * Platform/spi/ios/AccessibilitySupportSPI.h:
1094         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1095         * Shared/SandboxExtension.h:
1096         * Shared/mac/SandboxExtensionMac.mm:
1097         (WebKit::SandboxExtensionImpl::create):
1098         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
1099         (WebKit::SandboxExtensionImpl::SandboxExtensionImpl):
1100         (WebKit::SandboxExtension::createHandleForMachLookupByPid):
1101         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1102         (WebKit::WebProcessPool::registerNotificationObservers):
1103         (WebKit::WebProcessPool::unregisterNotificationObservers):
1104         * UIProcess/WebProcessPool.h:
1105         * UIProcess/WebProcessProxy.cpp:
1106         (WebKit::WebProcessProxy::didFinishLaunching):
1107         * UIProcess/WebProcessProxy.h:
1108         * UIProcess/ios/WebProcessProxyIOS.mm:
1109         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
1110         * WebProcess/WebProcess.cpp:
1111         (WebKit::WebProcess::unblockAccessibilityServer):
1112         * WebProcess/WebProcess.h:
1113         * WebProcess/WebProcess.messages.in:
1114
1115 2019-03-15  Antti Koivisto  <antti@apple.com>
1116
1117         Use Region for event region even when it is a rectangle
1118         https://bugs.webkit.org/show_bug.cgi?id=195803
1119
1120         Reviewed by Simon Fraser.
1121
1122         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
1123         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
1124         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
1125         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1126         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
1127         (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const):
1128         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
1129         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
1130         (WebKit::RemoteLayerTreeNode::eventRegion const):
1131         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
1132         (WebKit::RemoteLayerTreeNode::setEventRegion):
1133         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1134         (WebKit::collectDescendantViewsAtPoint):
1135         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
1136         (WebKit::PlatformCALayerRemote::setEventRegion):
1137         (WebKit::PlatformCALayerRemote::eventRegion const): Deleted.
1138         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
1139
1140 2019-03-15  Shawn Roberts  <sroberts@apple.com>
1141
1142         Unreviewed, rolling out r242952.
1143
1144         Causing API failures on iOS Simulator
1145
1146         Reverted changeset:
1147
1148         "[PSON] Make sure the WebProcessCache is leverage when
1149         relaunching a process after termination"
1150         https://bugs.webkit.org/show_bug.cgi?id=195747
1151         https://trac.webkit.org/changeset/242952
1152
1153 2019-03-15  Per Arne Vollan  <pvollan@apple.com>
1154
1155         [macOS] Broker access to Speech Synthesis
1156         https://bugs.webkit.org/show_bug.cgi?id=195645
1157         <rdar://problem/35369026>
1158
1159         Reviewed by Brent Fulgham.
1160
1161         To be able to close the connection to the speech synthesis daemon in the WebContent process,
1162         speech synthesis should be performed in the UI process. This patch forwards speech synthesis
1163         requests to the UI process by sending messages. On the UI process side, the speech synthesis
1164         is performed by simply using the existing platform speech synthesizer. Speech synthesis
1165         events are sent back to the WebContent process. All messages are async, except for the
1166         message to get the list of available voices.
1167
1168         * Sources.txt:
1169         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1170         (WebKit::WebPageProxy::didStartSpeaking):
1171         (WebKit::WebPageProxy::didFinishSpeaking):
1172         (WebKit::WebPageProxy::didPauseSpeaking):
1173         (WebKit::WebPageProxy::didResumeSpeaking):
1174         (WebKit::WebPageProxy::speakingErrorOccurred):
1175         (WebKit::WebPageProxy::boundaryEventOccurred):
1176         (WebKit::WebPageProxy::voicesDidChange):
1177         * UIProcess/WebPageProxy.cpp:
1178         (WebKit::WebPageProxy::ensureSpeechSynthesisData):
1179         (WebKit::WebPageProxy::speechSynthesisVoiceList):
1180         (WebKit::WebPageProxy::speechSynthesisSpeak):
1181         (WebKit::WebPageProxy::speechSynthesisCancel):
1182         (WebKit::WebPageProxy::speechSynthesisPause):
1183         (WebKit::WebPageProxy::speechSynthesisResume):
1184         * UIProcess/WebPageProxy.h:
1185         * UIProcess/WebPageProxy.messages.in:
1186         * WebKit.xcodeproj/project.pbxproj:
1187         * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp: Added.
1188         (WebKit::WebSpeechSynthesisClient::voiceList):
1189         (WebKit::WebSpeechSynthesisClient::speak):
1190         (WebKit::WebSpeechSynthesisClient::cancel):
1191         (WebKit::WebSpeechSynthesisClient::pause):
1192         (WebKit::WebSpeechSynthesisClient::resume):
1193         * WebProcess/WebCoreSupport/WebSpeechSynthesisClient.h: Added.
1194         (WebKit::WebSpeechSynthesisClient::WebSpeechSynthesisClient):
1195         (WebKit::WebSpeechSynthesisClient::~WebSpeechSynthesisClient):
1196         * WebProcess/WebCoreSupport/WebSpeechSynthesisVoice.h: Added.
1197         (WebKit::WebSpeechSynthesisVoice::encode const):
1198         (WebKit::WebSpeechSynthesisVoice::decode):
1199         * WebProcess/WebPage/WebPage.cpp:
1200         (WebKit::m_hostFileDescriptor):
1201         (WebKit::WebPage::speakingErrorOccurred):
1202         (WebKit::WebPage::boundaryEventOccurred):
1203         (WebKit::WebPage::voicesDidChange):
1204         * WebProcess/WebPage/WebPage.h:
1205         * WebProcess/WebPage/WebPage.messages.in:
1206         * WebProcess/com.apple.WebProcess.sb.in:
1207         * WebProcess/glib/WebProcessGLib.cpp:
1208
1209 2019-03-15  Antti Koivisto  <antti@apple.com>
1210
1211         Optimize Region for single rectangle case
1212         https://bugs.webkit.org/show_bug.cgi?id=195743
1213
1214         Reviewed by Simon Fraser.
1215
1216         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1217         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
1218         * Shared/WebCoreArgumentCoders.cpp:
1219         (IPC::ArgumentCoder<EventTrackingRegions>::decode):
1220         (IPC::ArgumentCoder<Region::Span>::encode): Deleted.
1221         (IPC::ArgumentCoder<Region::Span>::decode): Deleted.
1222         (IPC::ArgumentCoder<Region>::encode): Deleted.
1223         (IPC::ArgumentCoder<Region>::decode): Deleted.
1224         * Shared/WebCoreArgumentCoders.h:
1225
1226 2019-03-14  Per Arne Vollan  <pvollan@apple.com>
1227
1228         [iOS] WebKit crashes when opening pages documents
1229         https://bugs.webkit.org/show_bug.cgi?id=195784
1230         <rdar://problem/48904334>
1231
1232         Reviewed by Brent Fulgham.
1233
1234         The sandbox needs to allow additional syscalls.
1235
1236         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1237
1238 2019-03-14  Simon Fraser  <simon.fraser@apple.com>
1239
1240         Make it possible to test scrolling tree layer manipulation more easily
1241         https://bugs.webkit.org/show_bug.cgi?id=195780
1242
1243         Reviewed by Tim Horton.
1244
1245         Add a boolean attribute 'scrollUpdatesDisabled' on UIScriptController that
1246         cuts off communication of scrolling tree scrolls back to the web process
1247         (in RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll()). This
1248         allows tests to trigger scrolls which run the scrolling tree layer positioning
1249         logic, but never get another commit from the web process that might mask
1250         scrolling tree bugs.
1251         
1252         WKWebView's testing protocol get @property _scrollingUpdatesDisabledForTesting,
1253         whose getters and setters are overridden by TestRunnerWKWebView. Plumbing
1254         via PageClient and WebPageProxy makes this flag reachable by RemoteScrollingCoordinatorProxy.
1255
1256         * UIProcess/API/Cocoa/WKWebView.mm:
1257         (-[WKWebView _scrollingUpdatesDisabledForTesting]):
1258         (-[WKWebView _setScrollingUpdatesDisabledForTesting:]):
1259         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1260         * UIProcess/Cocoa/PageClientImplCocoa.h:
1261         * UIProcess/Cocoa/PageClientImplCocoa.mm:
1262         (WebKit::PageClientImplCocoa::scrollingUpdatesDisabledForTesting):
1263         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1264         (WebKit::WebPageProxy::scrollingUpdatesDisabledForTesting):
1265         * UIProcess/PageClient.h:
1266         (WebKit::PageClient::scrollingUpdatesDisabledForTesting):
1267         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1268         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
1269         * UIProcess/WebPageProxy.h:
1270
1271 2019-03-14  Youenn Fablet  <youenn@apple.com>
1272
1273         Move IDB storage in private browsing mode to NetworkProcess
1274         https://bugs.webkit.org/show_bug.cgi?id=195602
1275
1276         Reviewed by Brady Eidson.
1277
1278         Covered by existing IDB tests and added API test.
1279
1280         * NetworkProcess/NetworkProcess.cpp:
1281         (WebKit::NetworkProcess::createIDBServer):
1282         Make sure that path is empty for private sessions.
1283         This will make IDB use a memory backing store.
1284         * WebProcess/Databases/WebDatabaseProvider.cpp:
1285         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
1286         Use NetworkProcess IDB server instead of InProcessIDBServer.
1287
1288 2019-03-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1289
1290         REGRESSION (r242801): [iOS] preventDefault() on touchstart in a subframe does not prevent focusing the subframe
1291         https://bugs.webkit.org/show_bug.cgi?id=195749
1292         <rdar://problem/48892367>
1293
1294         Reviewed by Tim Horton.
1295
1296         r242801 added logic to fetch interaction information at the touch location upon touch start. However this,
1297         combined with an existing behavior where the process of computing InteractionInformationAtPosition in WebPage
1298         moves focus into the frame of the hit-tested node below the touch location, means that we'll always trigger a
1299         blur event on the window and move focus into the subframe when performing a touch inside a subframe, even if the
1300         page prevents default on touchstart.
1301
1302         To fix this, add a "readonly" flag to InteractionInformationRequest, and only change focus when requesting
1303         position information in the case where the request is not readonly. For now, this readonly flag is false by
1304         default; in a future patch, we should identify the (hopefully few) places that rely on position information
1305         requests to move focus, explicitly turn this bit off in those places, and otherwise send readonly position
1306         information requests by default.
1307
1308         * Shared/ios/InteractionInformationRequest.cpp:
1309         (WebKit::InteractionInformationRequest::encode const):
1310         (WebKit::InteractionInformationRequest::decode):
1311         (WebKit::InteractionInformationRequest::isValidForRequest):
1312         (WebKit::InteractionInformationRequest::isApproximatelyValidForRequest):
1313
1314         Ensure that a readonly request is not valid for a non-readonly request.
1315
1316         * Shared/ios/InteractionInformationRequest.h:
1317         * UIProcess/API/Cocoa/WKWebView.mm:
1318         (-[WKWebView _requestActivatedElementAtPosition:completionBlock:]):
1319
1320         Send a readonly position information request in the case where a WebKit SPI client is querying for element
1321         information at the given location.
1322
1323         * UIProcess/ios/WKContentViewInteraction.mm:
1324         (-[WKContentView _webTouchEventsRecognized:]):
1325
1326         Send a readonly position information request on touchstart.
1327
1328         * WebProcess/WebPage/ios/WebPageIOS.mm:
1329         (WebKit::WebPage::positionInformation):
1330
1331 2019-03-14  Chris Dumez  <cdumez@apple.com>
1332
1333         Add WebsitePolicy for the client to specify the device orientation & motion access policy
1334         https://bugs.webkit.org/show_bug.cgi?id=195750
1335
1336         Reviewed by Geoffrey Garen.
1337
1338         Add WebsitePolicy for the client to specify the device orientation & motion access policy. If
1339         the client already knows access to the device motion & orientation API will be granted / denied,
1340         it can let WebKit know via WebsitePolicies so that WebKit will not ask the client when the
1341         permission is requested by JS.
1342
1343         * Shared/WebsitePoliciesData.cpp:
1344         (WebKit::WebsitePoliciesData::encode const):
1345         (WebKit::WebsitePoliciesData::decode):
1346         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
1347         * Shared/WebsitePoliciesData.h:
1348         * UIProcess/API/APIWebsitePolicies.cpp:
1349         (API::WebsitePolicies::data):
1350         * UIProcess/API/APIWebsitePolicies.h:
1351         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
1352         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
1353         (-[_WKWebsitePolicies setDeviceOrientationAndMotionAccessPolicy:]):
1354         (-[_WKWebsitePolicies deviceOrientationAndMotionAccessPolicy]):
1355
1356 2019-03-14  Timothy Hatcher  <timothy@apple.com>
1357
1358         REGRESSION (r242908): TestWebKitAPI.WebKit.AddAndRemoveDataDetectors Crashed
1359         https://bugs.webkit.org/show_bug.cgi?id=195751
1360
1361         Reviewed by Wenson Hsieh.
1362
1363         * Shared/Cocoa/ArgumentCodersCocoa.mm:
1364         (IPC::decodeArrayInternal): Added allowedClasses, pass to internal decodeObject for values.
1365         (IPC::decodeDictionaryInternal): Ditto for keys and values.
1366         (IPC::decodeObject): Pass allowedClasses to array and dictionary decoders.
1367
1368 2019-03-14  Chris Dumez  <cdumez@apple.com>
1369
1370         [PSON] Make sure the WebProcessCache is leverage when relaunching a process after termination
1371         https://bugs.webkit.org/show_bug.cgi?id=195747
1372
1373         Reviewed by Geoff Garen.
1374
1375         Make sure the WebProcessCache and the prewarmed process are used when relaunching a process
1376         after termination (e.g. crash).
1377
1378         * UIProcess/WebPageProxy.cpp:
1379         (WebKit::WebPageProxy::reattachToWebProcess):
1380         (WebKit::WebPageProxy::reattachToWebProcessForReload):
1381         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
1382         (WebKit::WebPageProxy::loadRequest):
1383         (WebKit::WebPageProxy::loadFile):
1384         (WebKit::WebPageProxy::loadData):
1385         (WebKit::WebPageProxy::loadAlternateHTML):
1386         (WebKit::WebPageProxy::loadWebArchiveData):
1387         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
1388         * UIProcess/WebPageProxy.h:
1389         * UIProcess/WebProcessPool.cpp:
1390         (WebKit::WebProcessPool::processForRegistrableDomain):
1391         (WebKit::WebProcessPool::createWebPage):
1392         (WebKit::WebProcessPool::processForNavigationInternal):
1393         (WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
1394         * UIProcess/WebProcessPool.h:
1395
1396 2019-03-14  Timothy Hatcher  <timothy@apple.com>
1397
1398         Unreviewed speculative build fix for watchOS after r242908.
1399
1400         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1401
1402 2019-03-14  Youenn Fablet  <youenn@apple.com>
1403
1404         Reset storage quota when clearing IDB/Cache API entries
1405         https://bugs.webkit.org/show_bug.cgi?id=195716
1406
1407         Reviewed by Chris Dumez.
1408
1409         On clearing DOMCache or IDB data, reset quota value to the default value.
1410         This ensures consistent layout test runs.
1411
1412         * NetworkProcess/NetworkProcess.cpp:
1413         (WebKit::NetworkProcess::deleteWebsiteData):
1414         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1415         (WebKit::NetworkProcess::clearStorageQuota):
1416         * NetworkProcess/NetworkProcess.h:
1417
1418 2019-03-13  Zalan Bujtas  <zalan@apple.com>
1419
1420         [ContentChangeObserver] Stop content observation when content calls preventDefault() on touch events
1421         https://bugs.webkit.org/show_bug.cgi?id=195724
1422         <rdar://problem/48873456>
1423
1424         Reviewed by Simon Fraser.
1425
1426         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
1427         (WebKit::WebChromeClient::didPreventDefaultForEvent):
1428
1429 2019-03-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1430
1431         Make -[_WKAttachment setFileWrapper:contentType:completion:] robust when given a nil completion handler
1432         https://bugs.webkit.org/show_bug.cgi?id=195725
1433         <rdar://problem/48545062>
1434
1435         Reviewed by Tim Horton.
1436
1437         Add a missing nil check before invoking the given completionHandler in the case where the attachment is invalid.
1438         Tested by augmenting WKAttachmentTests.SetFileWrapperForPDFImageAttachment to exercise this scenario.
1439
1440         * UIProcess/API/APIAttachment.cpp:
1441         (API::Attachment::invalidate):
1442
1443         Additionally make sure that an invalidated _WKAttachment is also considered to be disconnected.
1444
1445         * UIProcess/API/Cocoa/_WKAttachment.mm:
1446         (-[_WKAttachment setFileWrapper:contentType:completion:]):
1447
1448 2019-03-13  Timothy Hatcher  <timothy@apple.com>
1449
1450         REGRESSION (r242908):  'NSInvalidArgumentException', reason: '+[PKPaymentMerchantSession count]: unrecognized selector sent to class 0x1c0fae060'
1451         https://bugs.webkit.org/show_bug.cgi?id=195720
1452
1453         Reviewed by Andy Estes.
1454
1455         Add back decode(Decoder& decoder, Class allowedClass) for Apple Pay code.
1456
1457         * Shared/Cocoa/ArgumentCodersCocoa.h:
1458         (IPC::decode): Added.
1459
1460 2019-03-13  Tim Horton  <timothy_horton@apple.com>
1461
1462         Stop using some deprecated SPI in WKDrawingView
1463         https://bugs.webkit.org/show_bug.cgi?id=195706
1464         <rdar://problem/48062599>
1465
1466         Reviewed by Wenson Hsieh.
1467
1468         * UIProcess/ios/WKDrawingView.mm:
1469         (-[WKDrawingView renderedDrawing]):
1470         (-[WKDrawingView PNGRepresentation]):
1471         (-[WKDrawingView loadDrawingFromPNGRepresentation:]):
1472
1473 2019-03-13  Timothy Hatcher  <timothy@apple.com>
1474
1475         Unreviewed speculative build fix for watchOS after r242908.
1476
1477         * Shared/Cocoa/ArgumentCodersCocoa.mm:
1478         (IPC::decodeObject):
1479
1480 2019-03-13  Dean Jackson  <dino@apple.com>
1481
1482         Block all plugins smaller than 5x5px
1483         https://bugs.webkit.org/show_bug.cgi?id=195702
1484         <rdar://problem/28435204>
1485
1486         Reviewed by Sam Weinig.
1487
1488         Block all plugins that are smaller than a threshold, in this case
1489         5x5px. Other browsers have implemented this for a while, and now
1490         that we have Intersection Observers, small plugins are no longer
1491         necessary.
1492
1493         * Shared/WebPreferences.yaml: New setting for this feature.
1494
1495         * UIProcess/WebPageProxy.cpp: Handle new unavailability type.
1496         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
1497         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1498         (WebKit::WebChromeClient::shouldUnavailablePluginMessageBeButton const):
1499
1500         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: Removed this function
1501         as it was never being called.
1502         (WebKit::WebFrameLoaderClient::recreatePlugin): Deleted.
1503         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1504
1505         * WebProcess/WebPage/WebPage.cpp:
1506         (WebKit::pluginIsSmall): Checks the size of the plugin.
1507         (WebKit::WebPage::createPlugin): If the plugin is too small, stop it from
1508         launching.
1509
1510 2019-03-13  Keith Rollin  <krollin@apple.com>
1511
1512         Add support for new StagedFrameworks layout
1513         https://bugs.webkit.org/show_bug.cgi?id=195543
1514
1515         Reviewed by Alexey Proskuryakov.
1516
1517         When creating the WebKit layout for out-of-band Safari/WebKit updates,
1518         use an optional path prefix when called for.
1519
1520         Update the dyld_env path in OTHER_LDFLAGS_VERSIONED_FRAMEWORK_PATH to
1521         also understand about this layout.
1522
1523         * Configurations/BaseTarget.xcconfig:
1524
1525 2019-03-13  Simon Fraser  <simon.fraser@apple.com>
1526
1527         Scrolling tree should reposition non-stacking order descendents of overflow:scroll.
1528         https://bugs.webkit.org/show_bug.cgi?id=195608
1529
1530         Reviewed by Zalan Bujtas.
1531
1532         Step 1: add scrolling tree positioning nodes classes (but don't create them yet).
1533
1534         Add Scrolling{State,Tree}PositionedNode to track composited layers that have to be repositioned when
1535         an async overflow:scroll scrolls. There are two instances in which this is necessary, reflected by
1536         the values of ScrollPositioningBehavior:
1537
1538         ScrollPositioningBehavior::Moves - a composited layer whose containing block chain includes an
1539             async overflow scroller, but whose composited (i.e. z-order) parent is outside of the overflow.
1540             When the overflow scrolls, this layer has to move along with the overflow.
1541
1542         ScrollPositioningBehavior::Stationary - a composited layer whose containing block chain skips the
1543             overflow scroller, but whose compositing (z-order) parent is the scroller, or inside the scroller.
1544             This only applies to position:absolute, on, for example, an overflow:scroll ith opacity.
1545
1546         PositionedNodes are modeled after Fixed/Sticky nodes, with a new type of layout constraint just called LayoutConstraints.
1547         
1548         This patch adds support for PositionedNodes in the scrolling trees, but RenderLayerCompositor::computeCoordinatedPositioningForLayer()
1549         is just a stub so the new node types aren't created yet.
1550         
1551         RenderLayerBacking stores a ScrollingNodeID for the positioning role (just like the other roles). Since the Positioning
1552         role is about position relative to ancestors, a node with both Positioning and FrameHosting or Scrolling roles treats
1553         the Positioning node as the parent of the other types. A node should never have both Positioning and ViewportConstrained roles.
1554
1555         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1556         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
1557         (ArgumentCoder<ScrollingStatePositionedNode>::encode):
1558         (ArgumentCoder<ScrollingStatePositionedNode>::decode):
1559         (WebKit::encodeNodeAndDescendants):
1560         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
1561         (WebKit::dump):
1562         * Shared/WebCoreArgumentCoders.cpp:
1563         (IPC::ArgumentCoder<LayoutConstraints>::encode):
1564         (IPC::ArgumentCoder<LayoutConstraints>::decode):
1565         (IPC::ArgumentCoder<StickyPositionViewportConstraints>::decode):
1566         * Shared/WebCoreArgumentCoders.h:
1567         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1568         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1569         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
1570         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
1571         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1572         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1573
1574 2019-03-13  Youenn Fablet  <youenn@apple.com>
1575
1576         Check IDB quota usage through QuotaManager
1577         https://bugs.webkit.org/show_bug.cgi?id=195302
1578
1579         Reviewed by Chris Dumez.
1580
1581         Set the quota manager getter for IDBServer at creation time.
1582
1583         * NetworkProcess/NetworkProcess.cpp:
1584         (WebKit::NetworkProcess::createIDBServer):
1585         (WebKit::NetworkProcess::idbServer):
1586         * NetworkProcess/NetworkProcess.h:
1587         * WebProcess/Databases/WebDatabaseProvider.cpp:
1588         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
1589
1590 2019-03-13  Timothy Hatcher  <timothy@apple.com>
1591
1592         Consolidate ArgumentCodersMac and ArgumentCodersCocoa.
1593         https://bugs.webkit.org/show_bug.cgi?id=195636
1594         rdar://problem/45055697
1595
1596         Reviewed by Ryosuke Niwa.
1597
1598         Merge the two similar encoders and decoders. This avoids issues where
1599         one encoder could be used and the other decoder, which caused a crash.
1600         It also stops handling NSAttributedString specifically and just uses
1601         the NSSecureCoding path to handle more complex attributes.
1602
1603         Some WebCore encoders code needed to move to platform files, since
1604         ArgumentCodersCocoa.h requires an ObjectiveC++ implementation to work.
1605
1606         * Shared/Cocoa/ArgumentCodersCocoa.h:
1607         (IPC::encode):
1608         (IPC::decode):
1609         (IPC::ArgumentCoder<RetainPtr<T>>::encode):
1610         (IPC::ArgumentCoder<RetainPtr<T>>::decode):
1611         * Shared/Cocoa/ArgumentCodersCocoa.mm:
1612         (IPC::typeFromObject):
1613         (IPC::isSerializableFont):
1614         (IPC::isSerializableValue):
1615         (IPC::encodeObject):
1616         (IPC::decodeObject):
1617         * Shared/Cocoa/LoadParametersCocoa.mm:
1618         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1619         (IPC::ArgumentCoder<WebCore::DictionaryPopupInfo>::encodePlatformData):
1620         (IPC::ArgumentCoder<WebCore::DictionaryPopupInfo>::decodePlatformData):
1621         (IPC::ArgumentCoder<WebCore::FontAttributes>::encodePlatformData):
1622         (IPC::ArgumentCoder<WebCore::FontAttributes>::decodePlatformData):
1623         * Shared/WebCoreArgumentCoders.cpp:
1624         (IPC::ArgumentCoder<DictionaryPopupInfo>::encode):
1625         (IPC::ArgumentCoder<DictionaryPopupInfo>::decode):
1626         (IPC::ArgumentCoder<FontAttributes>::encode):
1627         (IPC::ArgumentCoder<FontAttributes>::decode):
1628         * Shared/WebCoreArgumentCoders.h:
1629         * Shared/mac/ArgumentCodersMac.h: Removed.
1630         * Shared/mac/ArgumentCodersMac.mm: Removed.
1631         * Shared/mac/AttributedString.mm:
1632         (WebKit::AttributedString::encode const):
1633         * Shared/mac/ObjCObjectGraph.mm:
1634         * SourcesCocoa.txt:
1635         * WebKit.xcodeproj/project.pbxproj:
1636
1637 2019-03-13  Chris Dumez  <cdumez@apple.com>
1638
1639         Use a ServiceWorker process per registrable domain
1640         https://bugs.webkit.org/show_bug.cgi?id=195649
1641
1642         Reviewed by Youenn Fablet.
1643
1644         Use a ServiceWorker process per registrable domain instead of one per security origin. This is
1645         more in line with PSON and avoids launching too many processes.
1646
1647         * NetworkProcess/NetworkProcess.cpp:
1648         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
1649         (WebKit::NetworkProcess::connectionToContextProcessWasClosed):
1650         (WebKit::NetworkProcess::needsServerToContextConnectionForRegistrableDomain const):
1651         (WebKit::NetworkProcess::serverToContextConnectionForRegistrableDomain):
1652         (WebKit::NetworkProcess::createServerToContextConnection):
1653         (WebKit::NetworkProcess::swContextConnectionMayNoLongerBeNeeded):
1654         * NetworkProcess/NetworkProcess.h:
1655         * NetworkProcess/NetworkProcess.messages.in:
1656         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1657         (WebKit::WebSWServerConnection::scheduleJobInServer):
1658         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1659         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
1660         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
1661         * UIProcess/Network/NetworkProcessProxy.cpp:
1662         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
1663         (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess):
1664         (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcessForExplicitSession):
1665         * UIProcess/Network/NetworkProcessProxy.h:
1666         * UIProcess/Network/NetworkProcessProxy.messages.in:
1667         * UIProcess/ServiceWorkerProcessProxy.cpp:
1668         (WebKit::ServiceWorkerProcessProxy::create):
1669         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
1670         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
1671         * UIProcess/ServiceWorkerProcessProxy.h:
1672         * UIProcess/WebProcessPool.cpp:
1673         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
1674         (WebKit::WebProcessPool::disconnectProcess):
1675         (WebKit::WebProcessPool::updateProcessAssertions):
1676         * UIProcess/WebProcessPool.h:
1677
1678 2019-03-13  Chris Dumez  <cdumez@apple.com>
1679
1680         REGRESSION(PSON, r240660): Navigation over process boundary is flashy when using Cmd-left/right arrow to navigate
1681         https://bugs.webkit.org/show_bug.cgi?id=195684
1682         <rdar://problem/48294714>
1683
1684         Reviewed by Antti Koivisto.
1685
1686         * Shared/NavigationActionData.cpp:
1687         (WebKit::NavigationActionData::encode const):
1688         (WebKit::NavigationActionData::decode):
1689         * Shared/NavigationActionData.h:
1690         * UIProcess/WebPageProxy.cpp:
1691         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1692         (WebKit::WebPageProxy::backForwardAddItem):
1693         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1694         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1695
1696 2019-03-13  Chris Dumez  <cdumez@apple.com>
1697
1698         Drop legacy WebCore::toRegistrableDomain() utility function
1699         https://bugs.webkit.org/show_bug.cgi?id=195637
1700
1701         Reviewed by Geoffrey Garen.
1702
1703         Drop legacy toRegistrableDomain() / registrableDomainAreEqual() utility functions.
1704         Update call sites to use modern RegistrableDomain type instead.
1705
1706         * UIProcess/WebProcessPool.cpp:
1707         (WebKit::WebProcessPool::processForNavigationInternal):
1708
1709 2019-03-12  Brady Eidson  <beidson@apple.com>
1710
1711         Take UnboundedNetworking assertion when a file upload is in progress.
1712         https://bugs.webkit.org/show_bug.cgi?id=195497
1713
1714         Reviewed by Geoff Garen.
1715
1716         This patch implements whole bunch of bookkeeping in both the Networking and UI processes.
1717
1718         The TLDR of that bookkeeping is:
1719         - Whenever any uploads are in progress, take an assertion for both Networking and UI processes.
1720         - Whenever a particular WebProcess has an upload in progress, take an assertion for it.
1721
1722         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1723         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
1724         (WebKit::NetworkConnectionToWebProcess::setProcessIdentifier):
1725         (WebKit::NetworkConnectionToWebProcess::setConnectionHasUploads):
1726         (WebKit::NetworkConnectionToWebProcess::clearConnectionHasUploads):
1727         * NetworkProcess/NetworkConnectionToWebProcess.h:
1728         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1729
1730         * NetworkProcess/NetworkResourceLoadMap.cpp: Added.
1731         (WebKit::NetworkResourceLoadMap::add):
1732         (WebKit::NetworkResourceLoadMap::remove):
1733         (WebKit::NetworkResourceLoadMap::get const):
1734         * NetworkProcess/NetworkResourceLoadMap.h: Added.
1735         (WebKit::NetworkResourceLoadMap::NetworkResourceLoadMap):
1736         (WebKit::NetworkResourceLoadMap::isEmpty const):
1737         (WebKit::NetworkResourceLoadMap::contains const):
1738         (WebKit::NetworkResourceLoadMap::begin):
1739         (WebKit::NetworkResourceLoadMap::values):
1740
1741         * NetworkProcess/NetworkSession.cpp:
1742  
1743        * Scripts/webkit/messages.py:
1744
1745         * Sources.txt:
1746
1747         * UIProcess/Network/NetworkProcessProxy.cpp:
1748         (WebKit::NetworkProcessProxy::takeUploadAssertion):
1749         (WebKit::NetworkProcessProxy::clearUploadAssertion):
1750         * UIProcess/Network/NetworkProcessProxy.h:
1751
1752         * UIProcess/WebProcessPool.cpp:
1753         (WebKit::WebProcessPool::setWebProcessHasUploads):
1754         (WebKit::WebProcessPool::clearWebProcessHasUploads):
1755         * UIProcess/WebProcessPool.h:
1756         * UIProcess/WebProcessPool.messages.in:
1757  
1758        * WebKit.xcodeproj/project.pbxproj:
1759
1760         * WebProcess/WebProcess.cpp:
1761         (WebKit::WebProcess::ensureNetworkProcessConnection):
1762
1763 2019-03-13  Chris Dumez  <cdumez@apple.com>
1764
1765         Use new RegistrableDomain type in PSON code
1766         https://bugs.webkit.org/show_bug.cgi?id=195634
1767
1768         Reviewed by Youenn Fablet.
1769
1770         Use new RegistrableDomain type in PSON code instead of more error-prone String type.
1771
1772         * UIProcess/SuspendedPageProxy.cpp:
1773         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
1774         * UIProcess/SuspendedPageProxy.h:
1775         * UIProcess/WebProcessCache.cpp:
1776         (WebKit::WebProcessCache::canCacheProcess const):
1777         (WebKit::WebProcessCache::addProcessIfPossible):
1778         (WebKit::WebProcessCache::takeProcess):
1779         (WebKit::WebProcessCache::clearAllProcessesForSession):
1780         * UIProcess/WebProcessCache.h:
1781         * UIProcess/WebProcessPool.cpp:
1782         (WebKit::WebProcessPool::addProcessToOriginCacheSet):
1783         (WebKit::WebProcessPool::removeProcessFromOriginCacheSet):
1784         (WebKit::WebProcessPool::processForNavigationInternal):
1785         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
1786         (WebKit::WebProcessPool::didCollectPrewarmInformation):
1787         (WebKit::WebProcessPool::tryPrewarmWithDomainInformation):
1788         * UIProcess/WebProcessPool.h:
1789         * UIProcess/WebProcessProxy.cpp:
1790         (WebKit::WebProcessProxy::canBeAddedToWebProcessCache const):
1791         (WebKit::WebProcessProxy::maybeShutDown):
1792         (WebKit::WebProcessProxy::didCollectPrewarmInformation):
1793         (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
1794         * UIProcess/WebProcessProxy.h:
1795         (WebKit::WebProcessProxy::registrableDomain const):
1796         * UIProcess/WebProcessProxy.messages.in:
1797         * WebProcess/WebProcess.cpp:
1798         (WebKit::WebProcess::sendPrewarmInformation):
1799
1800 2019-03-13  Fujii Hironori  <Hironori.Fujii@sony.com>
1801
1802         [Win][PlayStation] Remove WebCore::standardUserAgentForURL
1803         https://bugs.webkit.org/show_bug.cgi?id=195662
1804
1805         Reviewed by Ryosuke Niwa.
1806
1807         * WebProcess/WebPage/win/WebPageWin.cpp:
1808         (WebKit::WebPage::platformUserAgent const): Return an empty string as well as mac/ios ports.
1809
1810 2019-03-12  Ross Kirsling  <ross.kirsling@sony.com>
1811
1812         [Win] Fix a slew of simple clang-cl warnings.
1813         https://bugs.webkit.org/show_bug.cgi?id=195652
1814
1815         Reviewed by Don Olmstead.
1816
1817         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1818         (WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse): -Wswitch
1819         * Platform/IPC/win/ConnectionWin.cpp:
1820         (IPC::Connection::readEventHandler): -Wunused-variable
1821         * Platform/win/LoggingWin.cpp:
1822         (WebKit::logLevelString): -Wwritable-strings
1823         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
1824         (WebKit::ProcessLauncher::launchProcess): -Wunused-variable
1825
1826 2019-03-12  Ryosuke Niwa  <rniwa@webkit.org>
1827
1828         Move the code for determining the need for touch bar quirks to Quirks class
1829         https://bugs.webkit.org/show_bug.cgi?id=195654
1830
1831         Reviewed by Brent Fulgham.
1832
1833         Moved the code to determine whether touch bar quirks are needed or not to WebCore.
1834
1835         Also renamed HiddenContentEditableQuirk to IsTouchBarUpdateSupressedForHiddenContentEditable
1836         and PlainTextQuirk to NeverRichlyEditableForTouchBar.
1837
1838         * UIProcess/Cocoa/WebViewImpl.h:
1839         (WebKit::WebViewImpl::isRichlyEditableForTouchBar): Renamed.
1840         * UIProcess/Cocoa/WebViewImpl.mm:
1841         (WebKit::WebViewImpl::updateTouchBar):
1842         (WebKit::WebViewImpl::candidateListTouchBarItem const):
1843         (WebKit::WebViewImpl::isRichlyEditableForTouchBar const): Renamed from isRichlyEditable.
1844         (WebKit::WebViewImpl::textTouchBar const):
1845         (WebKit::WebViewImpl::updateTextTouchBar):
1846         * UIProcess/WebPageProxy.cpp:
1847         (WebKit::WebPageProxy::setIsTouchBarUpdateSupressedForHiddenContentEditable): Renamed from
1848         setNeedsHiddenContentEditableQuirk.
1849         (WebKit::WebPageProxy::setIsNeverRichlyEditableForTouchBar): Renamed from setNeedsPlainTextQuirk.
1850         * UIProcess/WebPageProxy.h:
1851         (WebKit::WebPageProxy::isTouchBarUpdateSupressedForHiddenContentEditable const): Renamed from
1852         needsHiddenContentEditableQuirk.
1853         (WebKit::WebPageProxy::isNeverRichlyEditableForTouchBar const): Renamed from needsPlainTextQuirk.
1854         * UIProcess/WebPageProxy.messages.in: Renamed the IPC messages.
1855         * WebProcess/WebPage/WebPage.cpp:
1856         (WebKit::needsHiddenContentEditableQuirk): Deleted. Moved to WebCore.
1857         (WebKit::needsPlainTextQuirk): Deleted. Moved to WebCore.
1858         (WebKit::WebPage::didStartPageTransition):
1859         (WebKit::WebPage::didChangeSelection):
1860         * WebProcess/WebPage/WebPage.h:
1861         (WebKit::WebPage):
1862
1863 2019-03-12  Jiewen Tan  <jiewen_tan@apple.com>
1864
1865         Add WebFrameProxy::loadData
1866         https://bugs.webkit.org/show_bug.cgi?id=195647
1867         <rdar://problem/48826856>
1868
1869         Reviewed by Youenn Fablet.
1870
1871         This patch adds WebFrameProxy::loadData which is a simplified version of WebPageProxy::loadData that
1872         loads substitute data to an iframe. This is needed by the Load Optimizer.
1873
1874         * UIProcess/WebFrameProxy.cpp:
1875         (WebKit::WebFrameProxy::loadData):
1876         * UIProcess/WebFrameProxy.h:
1877         * WebProcess/WebPage/WebPage.cpp:
1878         (WebKit::WebPage::loadDataInFrame):
1879         * WebProcess/WebPage/WebPage.h:
1880         * WebProcess/WebPage/WebPage.messages.in:
1881
1882 2019-03-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1883
1884         [iOS] Input view sometimes flickers when blurring and refocusing an element
1885         https://bugs.webkit.org/show_bug.cgi?id=195639
1886         <rdar://problem/48735337>
1887
1888         Reviewed by Tim Horton.
1889
1890         On iOS, if a focused element is blurred and immediately refocused in the scope of user interaction, we will end
1891         up reloading interaction state (input views, autocorrection contexts, etc.) in the UI process. On certain well-
1892         trafficked websites, this results in the input view and input accessory view flickering (or more egregiously,
1893         scrolling to re-reveal the focused element) when changing selection.
1894
1895         To fix the issue, this patch refactors some focus management logic to suppress sending focused element updates
1896         to the UI process in the case where the same element is being blurred and immediately refocused. To do this, we
1897         track the most recently blurred element and bail when the recently blurred element is identical to the newly
1898         focused element. See below for more detail.
1899
1900         Test: fast/forms/ios/keyboard-stability-when-refocusing-element.html
1901
1902         * UIProcess/WebPageProxy.h:
1903         * UIProcess/ios/WKContentViewInteraction.mm:
1904         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1905         (-[WKContentView _elementDidBlur]):
1906
1907         Update the web process' notion of whether an input view is showing. Importantly, this accounts for decisions
1908         made by _WKUIDelegate. See below for more details.
1909
1910         (isAssistableInputType): Deleted.
1911
1912         Removed this helper function; this was only used in one place as a sanity check that the focused element's type
1913         is not none, right before attempting to show an input view. Instead, we can just check the focused element's
1914         type directly against InputType::None in the if statement of the early return.
1915
1916         * UIProcess/ios/WebPageProxyIOS.mm:
1917         (WebKit::WebPageProxy::setIsShowingInputViewForFocusedElement):
1918
1919         Add a hook to notify the web process when an input view is showing or not (see below for more detail).
1920
1921         * WebProcess/WebPage/WebPage.cpp:
1922         (WebKit::WebPage::didStartPageTransition):
1923         (WebKit::WebPage::elementDidRefocus):
1924         (WebKit::WebPage::shouldDispatchUpdateAfterFocusingElement const):
1925
1926         Add a helper to determine whether we notify the UI process about a newly focused element. On macOS, this is true
1927         only when the new focused element is neither the currently focused element, nor the focused element that was
1928         just blurred. On iOS, we have an additional constraint that when the input view is not showing, we still need to
1929         notify the UI process, since the UI process might want to begin showing the keyboard for an element that has
1930         only been programmatically focused, for which we aren't currently showing the input view.
1931
1932         (WebKit::WebPage::elementDidFocus):
1933         (WebKit::WebPage::elementDidBlur):
1934
1935         Replace a couple of existing member variables in WebPage used for focus management:
1936         -   Replace m_hasPendingBlurNotification with m_recentlyBlurredElement, a RefPtr to the Element that is being
1937             blurred. Behavior here is the same as before (i.e. having a pending blur notification is equivalent to
1938             having recently blurred a focused element). However, this allows us to check newly focused elements against
1939             the recently blurred element in WebPage::elementDidFocus().
1940         -   Replace m_isFocusingElementDueToUserInteraction with m_isShowingInputViewForFocusedElement. The flag
1941             m_isFocusingElementDueToUserInteraction was originally added to fix <webkit.org/b/146735>, by ensuring that
1942             we don't send redundant ElementDidFocus (formerly, StartAssistingNode) messages to the UI process even when
1943             the keyboard is already up. In these simpler times, user interaction when focusing an element was equivalent
1944             to showing an input view for the focused element. However, in today's world, there are a variety of reasons
1945             why we might or might not show an input view for a given element (including, but not limited to activity
1946             state changes and decisions made by _WKInputDelegate). As such, it doesn't make sense to continue relying on
1947             m_isFocusingElementDueToUserInteraction in this early return. Instead, have the UI process propagate a
1948             message back to the web process, to let it know whether there is a keyboard showing, and use this flag
1949             instead.
1950
1951         * WebProcess/WebPage/WebPage.h:
1952         * WebProcess/WebPage/WebPage.messages.in:
1953         * WebProcess/WebPage/ios/WebPageIOS.mm:
1954         (WebKit::WebPage::setIsShowingInputViewForFocusedElement):
1955
1956 2019-03-12  Tim Horton  <timothy_horton@apple.com>
1957
1958         More attempts at build fixing.
1959
1960         * UIProcess/ios/WKActionSheetAssistant.mm:
1961         Yet more.
1962
1963 2019-03-12  Chris Dumez  <cdumez@apple.com>
1964
1965         Device Orientation access permission should be denied unless explicitly granted by the client
1966         https://bugs.webkit.org/show_bug.cgi?id=195625
1967
1968         Reviewed by Youenn Fablet.
1969
1970         Device Orientation access permission should be denied unless explicitly granted by the client.
1971         Previously, it was granted by default.
1972
1973         * UIProcess/API/APIUIClient.h:
1974         (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
1975         * UIProcess/API/C/WKPage.cpp:
1976         (WKPageSetPageUIClient):
1977         * UIProcess/Cocoa/UIDelegate.mm:
1978         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
1979
1980 2019-03-12  Antti Koivisto  <antti@apple.com>
1981
1982         [iOS] Enable asynchronous frame scrolling by default
1983         https://bugs.webkit.org/show_bug.cgi?id=195622
1984         <rdar://problem/48658028>
1985
1986         Reviewed by Simon Fraser
1987
1988         * Shared/WebPreferences.yaml:
1989         * Shared/WebPreferencesDefaultValues.h:
1990
1991 2019-03-12  Per Arne Vollan  <pvollan@apple.com>
1992
1993         [iOS] Block access to backboardd service
1994         https://bugs.webkit.org/show_bug.cgi?id=195484
1995
1996         Reviewed by Brent Fulgham.
1997
1998         This patch is addressing blocking the backboardd service "com.apple.backboard.hid.services". Getting the
1999         backlight level in the WebContent process will initiate a connection with this service. To be able to
2000         block the service, the backlight level is queried in the UI process and sent to the WebContent process
2001         when the WebContent process is started, and when the backlight level is changed. On the WebContent side,
2002         the method getting the backlight level is swizzled to return the value sent from the UI process.
2003
2004         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2005         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2006         (WebKit::WebProcessPool::displayBrightness):
2007         (WebKit::WebProcessPool::backlightLevelDidChangeCallback):
2008         (WebKit::WebProcessPool::registerNotificationObservers):
2009         (WebKit::WebProcessPool::unregisterNotificationObservers):
2010         * UIProcess/WebProcessPool.cpp:
2011         (WebKit::WebProcessPool::initializeNewWebProcess):
2012         * UIProcess/WebProcessPool.h:
2013         * WebProcess/WebProcess.h:
2014         * WebProcess/WebProcess.messages.in:
2015         * WebProcess/cocoa/WebProcessCocoa.mm:
2016         (WebKit::currentBacklightLevel):
2017         (WebKit::WebProcess::backlightLevelDidChange):
2018
2019 2019-03-12  Tim Horton  <timothy_horton@apple.com>
2020
2021         Fix the build after 242801
2022
2023         * UIProcess/ios/WKActionSheetAssistant.mm:
2024         (-[WKActionSheetAssistant _elementActionForDDAction:]):
2025         More.
2026
2027 2019-03-12  Tim Horton  <timothy_horton@apple.com>
2028
2029         Fix the build after 242801
2030
2031         * UIProcess/ios/WKActionSheetAssistant.mm:
2032         (-[WKActionSheetAssistant _elementActionForDDAction:]):
2033
2034 2019-03-12  Eric Carlson  <eric.carlson@apple.com>
2035
2036         [iOS] Sandbox must allow mach lookup required to compress video
2037         https://bugs.webkit.org/show_bug.cgi?id=195627
2038         <rdar://problem/48811072>
2039
2040         Reviewed by Youenn Fablet.
2041
2042         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2043
2044 2019-03-12  Jennifer Moore  <jennifer.moore@apple.com>
2045
2046         Check whether to launch a default action instead of action sheet
2047         https://bugs.webkit.org/show_bug.cgi?id=195225
2048         <rdar://problem/47715544>
2049
2050         Reviewed by Daniel Bates and Tim Horton.
2051
2052         Notify DataDetectors at the start of a touch on a link, and check whether to immediately
2053         launch the default action instead of an action sheet.
2054
2055         * UIProcess/ios/WKActionSheetAssistant.h:
2056         * UIProcess/ios/WKActionSheetAssistant.mm:
2057         (-[WKActionSheetAssistant interactionDidStart]):
2058         (-[WKActionSheetAssistant _createSheetWithElementActions:defaultTitle:showLinkTitle:]):
2059         (-[WKActionSheetAssistant showImageSheet]):
2060         (-[WKActionSheetAssistant showLinkSheet]):
2061         (-[WKActionSheetAssistant showDataDetectorsSheet]):
2062         (-[WKActionSheetAssistant _createSheetWithElementActions:showLinkTitle:]): Deleted.
2063         * UIProcess/ios/WKContentViewInteraction.mm:
2064         (-[WKContentView _webTouchEventsRecognized:]):
2065 :
2066 2019-03-12  Zalan Bujtas  <zalan@apple.com>
2067
2068         [Synthetic Click] Dispatch mouseout soon after mouseup
2069         https://bugs.webkit.org/show_bug.cgi?id=195575
2070         <rdar://problem/47093049>
2071
2072         Reviewed by Simon Fraser.
2073
2074         * WebProcess/WebPage/ios/WebPageIOS.mm:
2075         (WebKit::WebPage::completeSyntheticClick):
2076
2077 2019-03-12  Zalan Bujtas  <zalan@apple.com>
2078
2079         [ContentChangeObserver] Stop content change observation when the touch event turns into long press
2080         https://bugs.webkit.org/show_bug.cgi?id=195601
2081         <rdar://problem/48796324>
2082
2083         Reviewed by Wenson Hsieh.
2084
2085         Add didRecognizeLongPress() message to be able to cancel content observation (started at touchStart).
2086
2087         * UIProcess/WebPageProxy.h:
2088         * UIProcess/ios/WKContentViewInteraction.mm:
2089         (-[WKContentView _longPressRecognized:]):
2090         * UIProcess/ios/WebPageProxyIOS.mm:
2091         (WebKit::WebPageProxy::didRecognizeLongPress):
2092         * WebProcess/WebPage/WebPage.h:
2093         * WebProcess/WebPage/WebPage.messages.in:
2094         * WebProcess/WebPage/ios/WebPageIOS.mm:
2095         (WebKit::WebPage::didRecognizeLongPress):
2096
2097 2019-03-11  Andy Estes  <aestes@apple.com>
2098
2099         [Mac] Ensure Apple Pay is unavailable when PassKit.framework is missing
2100         https://bugs.webkit.org/show_bug.cgi?id=195583
2101         <rdar://problem/48420224>
2102
2103         Reviewed by Daniel Bates.
2104
2105         PassKit.framework is optionally soft-linked on Mac because it is missing from the Recovery
2106         Partition. We need to check if the framework is available before calling into it.
2107
2108         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2109         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
2110         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
2111         (WebKit::WebPaymentCoordinatorProxy::platformOpenPaymentSetup):
2112         (WebKit::WebPaymentCoordinatorProxy::platformAvailablePaymentNetworks):
2113         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
2114         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
2115
2116 2019-03-12  Antti Koivisto  <antti@apple.com>
2117
2118         Compositing layer that renders two positioned elements should not hit test
2119         https://bugs.webkit.org/show_bug.cgi?id=195371
2120         <rdar://problem/48649586>
2121
2122         Reviewed by Simon Fraser.
2123
2124         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
2125         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
2126         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
2127         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2128         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
2129         (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const):
2130         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
2131
2132         Pass event region to UI process.
2133
2134         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
2135         (WebKit::RemoteLayerTreeNode::layerID const):
2136         (WebKit::RemoteLayerTreeNode::eventRegion const):
2137         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
2138         (WebKit::RemoteLayerTreeNode::RemoteLayerTreeNode):
2139         (WebKit::RemoteLayerTreeNode::~RemoteLayerTreeNode):
2140         (WebKit::RemoteLayerTreeNode::setEventRegion):
2141
2142         Maintain event region in RemoteLayerTreeNodes.
2143
2144         (WebKit::RemoteLayerTreeNode::initializeLayer):
2145         (WebKit::RemoteLayerTreeNode::layerID):
2146         (WebKit::RemoteLayerTreeNode::forCALayer):
2147
2148         Move layerID to RemoteLayerTreeNode and store RemoteLayerTreeNode pointer to CALayers instead.
2149         This makes it easy to find the matching RemoteLayerTreeNode from a layer, globally.
2150
2151         (WebKit::RemoteLayerTreeNode::setLayerID): Deleted.
2152         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
2153         (WebKit::collectDescendantViewsAtPoint):
2154
2155         If we have event region, use it for hit testing.
2156
2157         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
2158         (collectDescendantViewsAtPoint): Deleted.
2159         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
2160         (WebKit::PlatformCALayerRemote::eventRegion const):
2161         (WebKit::PlatformCALayerRemote::setEventRegion):
2162         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
2163
2164 2019-03-12  Carlos Garcia Campos  <cgarcia@igalia.com>
2165
2166         [WPE][GTK] Load events may occur in unexpected order when JS redirects page before subresource load finishes
2167         https://bugs.webkit.org/show_bug.cgi?id=194131
2168
2169         Reviewed by Michael Catanzaro.
2170
2171         Ensure we emit the load-failed and load-changed with finished event when there's still an ongoing load when a
2172         new provisional load strarts. Previous load fails with cancelled error.
2173
2174         * UIProcess/API/glib/WebKitWebView.cpp:
2175         (webkitWebViewWillStartLoad): Call webkitWebViewLoadFailed() if current page load state is not finished.
2176         * UIProcess/API/glib/WebKitWebViewPrivate.h:
2177         * UIProcess/API/gtk/PageClientImpl.cpp:
2178         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame): Call webkitWebViewWillStartLoad().
2179         * UIProcess/API/wpe/APIViewClient.h:
2180         (API::ViewClient::willStartLoad): Add willStartLoad() to API::ViewClient
2181         * UIProcess/API/wpe/PageClientImpl.cpp:
2182         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame): Call WPEView::willStartLoad().
2183         * UIProcess/API/wpe/PageClientImpl.h:
2184         * UIProcess/API/wpe/WPEView.cpp:
2185         (WKWPE::View::willStartLoad): Call API::ViewClient::willStartLoad().
2186         * UIProcess/API/wpe/WPEView.h:
2187         * UIProcess/PageLoadState.h:
2188         (WebKit::PageLoadState::isProvisional const):
2189         (WebKit::PageLoadState::isCommitted const):
2190         (WebKit::PageLoadState::isFinished const):
2191
2192 2019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
2193
2194         Unreviewed, rolling out r242763.
2195
2196         Causes layout test crashes on iOS simulator
2197
2198         Reverted changeset:
2199
2200         "[Synthetic Click] Dispatch mouseout soon after mouseup"
2201         https://bugs.webkit.org/show_bug.cgi?id=195575
2202         https://trac.webkit.org/changeset/242763
2203
2204 2019-03-11  Ross Kirsling  <ross.kirsling@sony.com>
2205
2206         Add Optional to Forward.h.
2207         https://bugs.webkit.org/show_bug.cgi?id=195586
2208
2209         Reviewed by Darin Adler.
2210
2211         * Shared/RTCNetwork.cpp:
2212         * Shared/RTCNetwork.h:
2213         * Shared/RTCPacketOptions.cpp:
2214         * Shared/RTCPacketOptions.h:
2215         * UIProcess/API/APIWebsitePolicies.h:
2216         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
2217         Remove unnecessary includes from headers.
2218
2219 2019-03-11  Commit Queue  <commit-queue@webkit.org>
2220
2221         Unreviewed, rolling out r242745 and r242756.
2222         https://bugs.webkit.org/show_bug.cgi?id=195606
2223
2224         Breaks internal builds (Requested by ryanhaddad on #webkit).
2225
2226         Reverted changesets:
2227
2228         "[iOS] Block access to backboardd service"
2229         https://bugs.webkit.org/show_bug.cgi?id=195484
2230         https://trac.webkit.org/changeset/242745
2231
2232         "Unreviewed build fix after r242745."
2233         https://trac.webkit.org/changeset/242756
2234
2235 2019-03-11  Fujii Hironori  <Hironori.Fujii@sony.com>
2236
2237         [CoordinatedGraphics] ASSERTION FAILED: !m_state.isSuspended
2238         https://bugs.webkit.org/show_bug.cgi?id=195550
2239
2240         Reviewed by Carlos Garcia Campos.
2241
2242         CompositingRunLoop::suspend() locks a mutex and stops the update
2243         timer. But, the timer can be fired after the lock was acquired and
2244         before the timer is stopped.
2245
2246         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2247         (WebKit::CompositingRunLoop::updateTimerFired): Removed the
2248         assertion. Return early if m_state.isSuspended.
2249
2250 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
2251
2252         [macOS] Remove the Kerberos rules from the WebContent sandbox
2253         https://bugs.webkit.org/show_bug.cgi?id=195464
2254         <rdar://problem/35369230>
2255
2256         Reviewed by Brent Fulgham.
2257
2258         Kerberos auth is done in the UIProcess or NetworkProcess now.
2259
2260         * WebProcess/com.apple.WebProcess.sb.in:
2261
2262 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
2263
2264         [iOS] Add entitlement to enable use of graphics endpoint with limited capabilities
2265         https://bugs.webkit.org/show_bug.cgi?id=195582
2266         <rdar://problem/36082379>
2267
2268         Reviewed by Brent Fulgham.
2269
2270         This is a QuartzCore endpoint with a minimal set of capabilities.
2271
2272         * Configurations/WebContent-iOS.entitlements:
2273
2274 2019-03-11  John Wilander  <wilander@apple.com>
2275
2276         Move NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm functionality into UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
2277         https://bugs.webkit.org/show_bug.cgi?id=195117
2278         <rdar://problem/48448715>
2279
2280         Reviewed by Brent Fulgham.
2281
2282         Reading of user defaults on Cocoa platforms should be done in the UI process and
2283         forwarded to Resource Load Statistics in the network process through the
2284         WebKit::NetworkSessionCreationParameters struct.
2285
2286         This patch does away with some old user defaults we don't use anymore. It also
2287         changes the developer-facing default name to ITPManualPrevalentResource.
2288
2289         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2290         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
2291             Removed the call to the old registerUserDefaultsIfNeeded().
2292         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2293         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
2294             Removed the call to the old registerUserDefaultsIfNeeded().
2295         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
2296             Removed the declaration of the old registerUserDefaultsIfNeeded().
2297         * NetworkProcess/Classifier/ResourceLoadStatisticsStoreCocoa.mm: Removed.
2298         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2299             Added an enum class EnableResourceLoadStatisticsDebugMode.
2300         * NetworkProcess/NetworkSession.cpp:
2301         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
2302         * NetworkProcess/NetworkSession.h:
2303         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2304         (WebKit::NetworkSessionCreationParameters::encode const):
2305         (WebKit::NetworkSessionCreationParameters::decode):
2306         * NetworkProcess/NetworkSessionCreationParameters.h:
2307            The struct now has two new fields:
2308            - enableResourceLoadStatisticsDebugMode
2309            - resourceLoadStatisticsManualPrevalentResource
2310         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2311         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2312             Forwarding of the parameters.
2313         * SourcesCocoa.txt:
2314         * UIProcess/WebProcessPool.cpp:
2315         (WebKit::WebProcessPool::ensureNetworkProcess):
2316             Forwarding of the parameters.
2317         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2318         (WebKit::WebsiteDataStore::parameters):
2319             This is where user defaults for Resource Load Statistics are now read.
2320         * WebKit.xcodeproj/project.pbxproj:
2321
2322 2019-03-11  Zalan Bujtas  <zalan@apple.com>
2323
2324         [Synthetic Click] Dispatch mouseout soon after mouseup
2325         https://bugs.webkit.org/show_bug.cgi?id=195575
2326         <rdar://problem/47093049>
2327
2328         Reviewed by Simon Fraser.
2329
2330         * WebProcess/WebPage/ios/WebPageIOS.mm:
2331         (WebKit::WebPage::completeSyntheticClick):
2332
2333 2019-03-11  Tim Horton  <timothy_horton@apple.com>
2334
2335         API test WebKit.RequestTextInputContext fails on iOS
2336         https://bugs.webkit.org/show_bug.cgi?id=195585
2337
2338         Reviewed by Wenson Hsieh and Simon Fraser.
2339
2340         * UIProcess/API/Cocoa/WKWebView.mm:
2341         (-[WKWebView _convertRectFromRootViewCoordinates:]):
2342         (-[WKWebView _convertRectToRootViewCoordinates:]):
2343         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
2344         (-[WKWebView _focusTextInputContext:completionHandler:]):
2345         * WebProcess/WebPage/WebPage.cpp:
2346         (WebKit::elementRectInRootViewCoordinates):
2347         (WebKit::WebPage::textInputContextsInRect):
2348         (WebKit::elementRectInWindowCoordinates): Deleted.
2349         Text input context SPI should be in terms of WKWebView coordinates,
2350         for consistency's sake. This is a bit irritating; WebPage(Proxy) continue
2351         to operate in "root view" coordinates, which means different things
2352         depending on if delegatesScrolling is true or not. So, WKWebView does
2353         the conversion, re-creating objects as needed.
2354
2355 2019-03-09  Jiewen Tan  <jiewen_tan@apple.com>
2356
2357         Optimizing loads when creating new pages
2358         https://bugs.webkit.org/show_bug.cgi?id=195516
2359         <rdar://problem/48738086>
2360
2361         Reviewed by Darin Adler.
2362
2363         This patch adds hooks in WebPageProxy::createNewPage to optimize loads, and moves the creationParameters
2364         of API::NavigationAction from UI clients to WebPageProxy::createNewPage. Also, we now pass the whole
2365         API::NavigationAction to the load optimizer instead of the request within.
2366
2367         * UIProcess/API/APINavigationAction.h:
2368         * UIProcess/API/APIUIClient.h:
2369         (API::UIClient::createNewPage):
2370         * UIProcess/API/C/WKPage.cpp:
2371         (WKPageSetPageUIClient):
2372         * UIProcess/API/glib/WebKitUIClient.cpp:
2373         * UIProcess/Cocoa/NavigationState.mm:
2374         (WebKit::tryOptimizingLoad):
2375         (WebKit::tryInterceptNavigation):
2376         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2377         * UIProcess/Cocoa/UIDelegate.h:
2378         * UIProcess/Cocoa/UIDelegate.mm:
2379         (WebKit::UIDelegate::UIClient::createNewPage):
2380         * UIProcess/WebPageProxy.cpp:
2381         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2382         (WebKit::tryOptimizingLoad):
2383         (WebKit::WebPageProxy::createNewPage):
2384         * UIProcess/WebPageProxy.h:
2385
2386 2019-03-11  Dean Jackson  <dino@apple.com>
2387
2388         [iOS] Implement a faster click detection that intercepts double-tap-to-zoom if possible
2389         https://bugs.webkit.org/show_bug.cgi?id=195473
2390         <rdar://problem/48718396>
2391
2392         Reviewed by Wenson Hsieh (with some help from Dan Bates).
2393
2394         Adds a new algorithm, behind a flag FasterClicksEnabled, that can trigger a click
2395         event without waiting to see if a double tap will occur. It does this by examining
2396         the amount of zoom that would be triggered if it was a double tap, and if that value
2397         doesn't exceed a set threshold, commits to the click event instead.
2398
2399         This is implemented by having the Web Process respond to the potential click with
2400         some geometry information. If the UI Process receives the information before the
2401         second tap in a double tap, it can decide to trigger a click.
2402
2403         * Shared/WebPreferences.yaml: New internal feature so this can be toggled in
2404             a UI for testing.
2405
2406         * SourcesCocoa.txt: Renamed WKSyntheticTapGestureRecognizer.
2407         * WebKit.xcodeproj/project.pbxproj: Ditto.
2408
2409         * UIProcess/ios/WKSyntheticTapGestureRecognizer.h:
2410         * UIProcess/ios/WKSyntheticTapGestureRecognizer.m:
2411         (-[WKSyntheticTapGestureRecognizer setGestureIdentifiedTarget:action:]):
2412         (-[WKSyntheticTapGestureRecognizer setGestureFailedTarget:action:]):
2413         (-[WKSyntheticTapGestureRecognizer setResetTarget:action:]):
2414         (-[WKSyntheticTapGestureRecognizer setState:]):
2415         (-[WKSyntheticTapGestureRecognizer reset]):  Renamed WKSyntheticClickTapGestureRecognizer to
2416             WKSyntheticTapGestureRecognizer, changed the signature of the main function to be a bit
2417             more clear about what it does, and added a gesture failed target.
2418
2419         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2420         * UIProcess/API/Cocoa/WKWebView.mm:
2421         (-[WKWebView _initialScaleFactor]):
2422         (-[WKWebView _contentZoomScale]):
2423         (-[WKWebView _targetContentZoomScaleForRect:currentScale:fitEntireRect:minimumScale:maximumScale:]):
2424             Exposed the initial content scale, the current scale and added a declaration that
2425             was missing from the .h.
2426
2427         * UIProcess/WebPageProxy.messages.in: Add a new message,
2428             HandleSmartMagnificationInformationForPotentialTap, to
2429             communicate the geometry of the clicked node to the UI Process.
2430
2431         * UIProcess/PageClient.h: Pure virtual function for the geometry message response.
2432         * UIProcess/WebPageProxy.h: Ditto.
2433
2434         * UIProcess/ios/PageClientImplIOS.h: Calls into the WKContentView.
2435         * UIProcess/ios/PageClientImplIOS.mm:
2436         (WebKit::PageClientImpl::handleSmartMagnificationInformationForPotentialTap):
2437
2438         * UIProcess/ios/SmartMagnificationController.h:
2439         * UIProcess/ios/SmartMagnificationController.mm:
2440         (WebKit::SmartMagnificationController::calculatePotentialZoomParameters): A new method that
2441             asks the WKContentView to work out what the zoom factor will be for a potential double
2442             tap at a location.
2443         (WebKit::SmartMagnificationController::smartMagnificationTargetRectAndZoomScales): New implementation
2444             of this function to avoid multiple out-arguments.
2445
2446         * UIProcess/ios/WKContentView.h:
2447         * UIProcess/ios/WKContentView.mm:
2448         (-[WKContentView _initialScaleFactor]):
2449         (-[WKContentView _contentZoomScale]):
2450         (-[WKContentView _targetContentZoomScaleForRect:currentScale:fitEntireRect:minimumScale:maximumScale:]):
2451             Exposed the initial content scale, the current scale and the target zoom scale. These
2452             all just call into the WKWebView implementation.
2453
2454         * UIProcess/ios/WKContentViewInteraction.h:
2455         * UIProcess/ios/WKContentViewInteraction.mm:
2456         (-[WKContentView _createAndConfigureDoubleTapGestureRecognizer]): Use a WKSyntheticTapGestureRecognizer instead
2457             of a generic one, so we can capture the failure.
2458         (-[WKContentView setupInteraction]):
2459         (-[WKContentView cleanupInteraction]):
2460         (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:origin:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:]):
2461             New method that responds to the incoming Web Process message, and decides if any
2462             potential zoom would be "significant".
2463         (-[WKContentView _singleTapIdentified:]):
2464         (-[WKContentView _doubleTapDidFail:]):
2465         (-[WKContentView _didCompleteSyntheticClick]):
2466         (-[WKContentView _singleTapRecognized:]):
2467         (-[WKContentView _doubleTapRecognized:]):
2468             Add some release logging.
2469         (-[WKContentView _singleTapCommited:]): Deleted.
2470
2471         * UIProcess/ios/WebPageProxyIOS.mm:
2472         (WebKit::WebPageProxy::potentialTapAtPosition):
2473         (WebKit::WebPageProxy::handleSmartMagnificationInformationForPotentialTap):
2474         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
2475         * WebProcess/WebPage/WebPage.h:
2476         * WebProcess/WebPage/WebPage.messages.in:
2477             Removed an unused parameter from the existing message.
2478
2479         * WebProcess/WebPage/ios/WebPageIOS.mm:
2480         (WebKit::WebPage::potentialTapAtPosition): Calculates the geometry of the element
2481         if requested, and sends it to the UIProcess.
2482
2483 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
2484
2485         Unreviewed build fix after r242745.
2486
2487         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2488         (WebKit::WebProcessPool::registerNotificationObservers):
2489         (WebKit::WebProcessPool::unregisterNotificationObservers):
2490
2491 2019-03-11  Chris Dumez  <cdumez@apple.com>
2492
2493         Assert in WebPageProxy::suspendCurrentPageIfPossible()
2494         https://bugs.webkit.org/show_bug.cgi?id=195506
2495         <rdar://problem/48733477>
2496
2497         Reviewed by Alex Christensen.
2498
2499         The crash was caused by the top-hit preloading logic in MobileSafari which creates a new Web view that is *related*
2500         to the previous one, restores the session state onto it and then triggers a load in this new Web view.
2501
2502         Initially, the 2 Web views use the same process as they are related. However, if the new load's URL is cross-site
2503         with regards to the first view's URL, then we decide to process swap in the new view. This process swap makes
2504         sense from a security standpoint. However, when we commit the load in the new process and call
2505         suspendCurrentPageIfPossible() we end up in an unexpected state because we have a fromItem (due to the session
2506         state having been restored on the new view) but we haven't committed any load yet in this new view.
2507
2508         To address the issue, suspendCurrentPageIfPossible() now returns early and does not attempt to suspend anything
2509         if we have not committed any load yet.
2510
2511         * UIProcess/WebPageProxy.cpp:
2512         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
2513         Do not attempt to suspend to current page if we have not committed any provisional load yet.
2514
2515 2019-03-11  Chris Dumez  <cdumez@apple.com>
2516
2517         Update device orientation & motion permission native SPI as per latest proposal
2518         https://bugs.webkit.org/show_bug.cgi?id=195567
2519
2520         Reviewed by Youenn Fablet.
2521
2522         The native SPI is now:
2523         +- (void)_webView:(WKWebView *)webView shouldAllowDeviceOrientationAndMotionAccessRequestedByFrame:(WKFrameInfo *)frameInfo decisionHandler:(void (^)(BOOL))decisionHandler;
2524
2525         * UIProcess/API/APIUIClient.h:
2526         (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
2527         * UIProcess/API/C/WKPage.cpp:
2528         (WKPageSetPageUIClient):
2529         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2530         * UIProcess/Cocoa/UIDelegate.h:
2531         * UIProcess/Cocoa/UIDelegate.mm:
2532         (WebKit::UIDelegate::setDelegate):
2533         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
2534         * UIProcess/WebPageProxy.cpp:
2535         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
2536         * UIProcess/WebPageProxy.h:
2537         * UIProcess/WebPageProxy.messages.in:
2538         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2539         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
2540         * WebProcess/WebCoreSupport/WebChromeClient.h:
2541         * WebProcess/WebPage/WebPage.cpp:
2542         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
2543         * WebProcess/WebPage/WebPage.h:
2544
2545 2019-03-11  Andy Estes  <aestes@apple.com>
2546
2547         [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
2548         https://bugs.webkit.org/show_bug.cgi?id=195530
2549         <rdar://problem/48747164>
2550
2551         Reviewed by Alex Christensen.
2552
2553         * Configurations/Network-iOS.entitlements: Added the 'com.apple.payment.all-access'
2554         entitlement and reordered the others.
2555
2556         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2557         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage): Forwarded
2558         WebPaymentCoordinatorProxy messages to the payment coordinator.
2559         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage): Ditto.
2560         (WebKit::NetworkConnectionToWebProcess::didClose): Set m_paymentCoordinator to nullptr.
2561         * NetworkProcess/NetworkConnectionToWebProcess.h: Inherited from
2562         WebPaymentCoordinatorProxy::Client and added a unique_ptr<WebPaymentCoordinatorProxy> member.
2563
2564         * NetworkProcess/cocoa/NetworkSessionCocoa.h: Declared getters for source application bundle
2565         and secondary identifiers, and CTDataConnectionServiceType on iOS.
2566         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2567         (WebKit::NetworkSessionCocoa::sourceApplicationBundleIdentifier const): Defined getter.
2568         (WebKit::NetworkSessionCocoa::sourceApplicationSecondaryIdentifier const): Ditto.
2569         (WebKit::NetworkSessionCocoa::ctDataConnectionServiceType const): Ditto.
2570         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Initialized
2571         m_sourceApplicationBundleIdentifier and m_sourceApplicationSecondaryIdentifier with
2572         corresponding NetworkSessionCreationParameters.
2573
2574         * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm: Added.
2575         (WebKit::NetworkConnectionToWebProcess::paymentCoordinator): Added. Returns
2576         m_paymentCoordinator after lazily initializing it.
2577         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorConnection): Added. Returns the
2578         connection to the web process.
2579         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorPresentingViewController): Added.
2580         Returns nil.
2581         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType):
2582         Added. Returns the value from the network session identified by sessionID.
2583         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationBundleIdentifier):
2584         Ditto.
2585         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorSourceApplicationSecondaryIdentifier):
2586         Ditto.
2587         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAuthorizationPresenter): Added.
2588         Returns a new PaymentAuthorizationController.
2589         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorAddMessageReceiver): Added empty
2590         definition. NetworkConnectionToWebProcess explicitly forwards WebPaymentCoordinatorProxy
2591         messages to its payment coordinator, so there's no need to register with a MessageReceiverMap.
2592         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorRemoveMessageReceiver): Ditto.
2593
2594         * Platform/ios/PaymentAuthorizationController.h: Added. Declares a
2595         PaymentAuthorizationPresenter subclass based on PKPaymentAuthorizationController.
2596         * Platform/ios/PaymentAuthorizationController.mm: Added.
2597         (-[WKPaymentAuthorizationControllerDelegate initWithRequest:presenter:]):
2598         Initialized WKPaymentAuthorizationDelegate with request and presenter.
2599         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationControllerDidFinish:]):
2600         Forwarded call to WKPaymentAuthorizationDelegate.
2601         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didAuthorizePayment:handler:]):
2602         Ditto.
2603         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingMethod:handler:]):
2604         Ditto.
2605         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectShippingContact:handler:]):
2606         Ditto.
2607         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didSelectPaymentMethod:handler:]):
2608         Ditto.
2609         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:willFinishWithError:]):
2610         Ditto.
2611         (-[WKPaymentAuthorizationControllerDelegate paymentAuthorizationController:didRequestMerchantSession:]):
2612         Ditto.
2613         (WebKit::PaymentAuthorizationController::PaymentAuthorizationController):
2614         Initialized m_controller with a new PKPaymentAuthorizationController and m_delegate with a
2615         new WKPaymentAuthorizationControllerDelegate.
2616         (WebKit::PaymentAuthorizationController::platformDelegate): Returned m_delegate.
2617         (WebKit::PaymentAuthorizationController::dismiss): Dismissed the controller, set its
2618         delegates to nil, set m_controller to nil, invalidated the delegate, and set m_delegate to
2619         nil.
2620         (WebKit::PaymentAuthorizationController::present): Called -presentWithCompletion: on the
2621         controller, forwarding the passed-in completion handler.
2622         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Allowed PassKit to look up
2623         the "com.apple.passd.in-app-payment" and "com.apple.passd.library" service endpoints.
2624
2625         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
2626         (WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy): Changed to call
2627         paymentCoordinatorAddMessageReceiver.
2628         (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy): Changed to call
2629         paymentCoordinatorRemoveMessageReceiver.
2630         (WebKit::WebPaymentCoordinatorProxy::messageSenderDestinationID const): Deleted.
2631         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard): Passed sessionID to
2632         platformCanMakePaymentsWithActiveCard.
2633         (WebKit::WebPaymentCoordinatorProxy::showPaymentUI): Stored destinationID and passed
2634         sessionID to platformShowPaymentUI.
2635         (WebKit::WebPaymentCoordinatorProxy::cancelPaymentSession): Changed to account for new
2636         behavior of didCancelPaymentSession.
2637         (WebKit::WebPaymentCoordinatorProxy::didCancelPaymentSession): Changed to call hidePaymentUI.
2638         (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Changed to only call hidePaymentUI
2639         when didReachFinalState is true, since didCancelPaymentSession is called otherwise.
2640         (WebKit::WebPaymentCoordinatorProxy::didReachFinalState): Cleared m_destinationID.
2641         * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Added m_destionationID member.
2642         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: Changed
2643         CanMakePaymentsWithActiveCard and ShowPaymentUI messages to take destinationID and sessionID
2644         arguments.
2645
2646         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2647         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard): Passed
2648         sessionID to paymentCoordinatorSourceApplicationSecondaryIdentifier.
2649         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Passed sessionID to various
2650         m_client call sites.
2651
2652         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
2653         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
2654         platformPaymentRequest.
2655         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
2656         before calling dismiss.
2657
2658         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
2659         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Passed sessionID to
2660         platformPaymentRequest.
2661         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Null-checked m_authorizationPresenter
2662         before calling dismiss.
2663
2664         * Shared/WebPreferences.yaml: Added ApplePayRemoteUIEnabled as an internal preference.
2665
2666         * SourcesCocoa.txt: Added NetworkConnectionToWebProcessIOS.mm and
2667         PaymentAuthorizationController.mm.
2668
2669         * UIProcess/AuxiliaryProcessProxy.h:
2670         (WebKit::AuxiliaryProcessProxy::messageReceiverMap): Deleted.
2671
2672         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2673         (WebKit::WebPageProxy::paymentCoordinatorConnection): Moved from WebPageProxy.cpp.
2674         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
2675         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
2676         (WebKit::WebPageProxy::paymentCoordinatorAddMessageReceiver): Ditto.
2677         (WebKit::WebPageProxy::paymentCoordinatorRemoveMessageReceiver): Ditto.
2678
2679         * UIProcess/WebPageProxy.cpp:
2680         (WebKit::WebPageProxy::paymentCoordinatorConnection): Moved to WebPageProxyCocoa.mm.
2681         (WebKit::WebPageProxy::paymentCoordinatorMessageReceiver): Ditto.
2682         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Ditto.
2683         (WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Ditto.
2684         (WebKit::WebPageProxy::paymentCoordinatorDestinationID): Ditto.
2685         * UIProcess/WebPageProxy.h:
2686
2687         * UIProcess/ios/WebPageProxyIOS.mm:
2688         (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType): Asserted that
2689         sessionID equals the website data store's sessionID.
2690
2691         * WebKit.xcodeproj/project.pbxproj:
2692
2693         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
2694         (WebKit::WebPaymentCoordinator::networkProcessConnectionClosed): Added. Cancels the current
2695         session if Apple Pay Remote UI is enabled and the network process connection closes.
2696         (WebKit::WebPaymentCoordinator::availablePaymentNetworks): Changed to account for
2697         WebPaymentCoordinator being an IPC::MessageSender.
2698         (WebKit::WebPaymentCoordinator::canMakePayments): Ditto.
2699         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard): Ditto.
2700         (WebKit::WebPaymentCoordinator::openPaymentSetup): Ditto.
2701         (WebKit::WebPaymentCoordinator::showPaymentUI): Ditto.
2702         (WebKit::WebPaymentCoordinator::completeMerchantValidation): Ditto.
2703         (WebKit::WebPaymentCoordinator::completeShippingMethodSelection): Ditto.
2704         (WebKit::WebPaymentCoordinator::completeShippingContactSelection): Ditto.
2705         (WebKit::WebPaymentCoordinator::completePaymentMethodSelection): Ditto.
2706         (WebKit::WebPaymentCoordinator::completePaymentSession): Ditto.
2707         (WebKit::WebPaymentCoordinator::abortPaymentSession): Ditto.
2708         (WebKit::WebPaymentCoordinator::cancelPaymentSession): Ditto.
2709         (WebKit::WebPaymentCoordinator::messageSenderConnection const): Added. Returns a connection
2710         to the network process if Apple Pay Remote UI is enabled. Otherwise, returned the web
2711         process's parent connection.
2712         (WebKit::WebPaymentCoordinator::messageSenderDestinationID const): Added. Returns the web
2713         page's ID.
2714         (WebKit::WebPaymentCoordinator::remoteUIEnabled const): Added. Calls Settings::applePayRemoteUIEnabled.
2715         * WebProcess/ApplePay/WebPaymentCoordinator.h: Inherited from IPC::MessageSender.
2716
2717         * WebProcess/Network/NetworkProcessConnection.cpp:
2718         (WebKit::NetworkProcessConnection::didReceiveMessage): Forwarded WebPaymentCoordinator
2719         messages to the payment coordinator of the web page matching the decoder's destination ID.
2720         (WebKit::NetworkProcessConnection::didReceiveSyncMessage): Ditto for sync messages.
2721
2722         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
2723         (WebKit::WebPage::paymentCoordinator): Added a payment coordinator getter.
2724         * WebProcess/WebPage/WebPage.h: Ditto.
2725
2726         * WebProcess/WebProcess.cpp:
2727         (WebKit::WebProcess::networkProcessConnectionClosed): Called
2728         WebPaymentCoordinator::networkProcessConnectionClosed when the network process connection
2729         closes.
2730
2731 2019-03-11  Per Arne Vollan  <pvollan@apple.com>
2732
2733         [iOS] Block access to backboardd service
2734         https://bugs.webkit.org/show_bug.cgi?id=195484
2735
2736         Reviewed by Brent Fulgham.
2737
2738         This patch is addressing blocking the backboardd service "com.apple.backboard.hid.services". Getting the
2739         backlight level in the WebContent process will initiate a connection with this service. To be able to
2740         block the service, the backlight level is queried in the UI process and sent to the WebContent process
2741         when the WebContent process is started, and when the backlight level is changed. On the WebContent side,
2742         the method getting the backlight level is swizzled to return the value sent from the UI process.
2743
2744         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2745         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2746         (WebKit::WebProcessPool::displayBrightness):
2747         (WebKit::WebProcessPool::backlightLevelDidChangeCallback):
2748         (WebKit::WebProcessPool::registerNotificationObservers):
2749         (WebKit::WebProcessPool::unregisterNotificationObservers):
2750         * UIProcess/WebProcessPool.cpp:
2751         (WebKit::WebProcessPool::initializeNewWebProcess):
2752         * UIProcess/WebProcessPool.h:
2753         * WebProcess/WebProcess.h:
2754         * WebProcess/WebProcess.messages.in:
2755         * WebProcess/cocoa/WebProcessCocoa.mm:
2756         (WebKit::currentBacklightLevel):
2757         (WebKit::WebProcess::backlightLevelDidChange):
2758
2759 2019-03-11  Brent Fulgham  <bfulgham@apple.com>
2760
2761         Remove obsolete runtime flag for StorageAccess API Prompt
2762         https://bugs.webkit.org/show_bug.cgi?id=195564
2763         <rdar://problem/37279014>
2764
2765         Reviewed by Chris Dumez.
2766
2767         This bug tracks the work of removing the obsolete flag that had been used to optionally
2768         prevent display of the StorageAccess API prompt. We have since shipped the final version
2769         of this feature with an always-on prompt, and should have removed this runtime flag.
2770
2771         No test changes because this has no change in behavior. Tests already assume the prompt
2772         behavior, and did not test turning the flag off.
2773
2774         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2775         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
2776         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
2777         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
2778         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2779         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
2780         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
2781         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
2782         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
2783         (WebKit::ResourceLoadStatisticsStore::debugModeEnabled const):
2784         (WebKit::ResourceLoadStatisticsStore::storageAccessPromptsEnabled const): Deleted.
2785         (WebKit::ResourceLoadStatisticsStore::setStorageAccessPromptsEnabled): Deleted.
2786         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2787         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted):
2788         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
2789         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2790         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2791         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
2792         * NetworkProcess/NetworkConnectionToWebProcess.h:
2793         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2794         * NetworkProcess/NetworkProcess.cpp:
2795         (WebKit::NetworkProcess::requestStorageAccess):
2796         (WebKit::NetworkProcess::requestStorageAccessGranted):
2797         * NetworkProcess/NetworkProcess.h:
2798         * NetworkProcess/NetworkProcess.messages.in:
2799         * Shared/WebPreferences.yaml:
2800         * UIProcess/API/C/WKPreferences.cpp:
2801         (WKPreferencesSetStorageAccessPromptsEnabled): Deleted.
2802         (WKPreferencesGetStorageAccessPromptsEnabled): Deleted.
2803         * UIProcess/API/C/WKPreferencesRef.h:
2804         * UIProcess/API/Cocoa/WKPreferences.mm:
2805         (-[WKPreferences _storageAccessPromptsEnabled]): Deleted.
2806         (-[WKPreferences _setStorageAccessPromptsEnabled:]): Deleted.
2807         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2808         * UIProcess/Network/NetworkProcessProxy.cpp:
2809         (WebKit::NetworkProcessProxy::requestStorageAccess):
2810         * UIProcess/Network/NetworkProcessProxy.h:
2811         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2812         (WebKit::WebsiteDataStore::requestStorageAccess):
2813         * UIProcess/WebsiteData/WebsiteDataStore.h:
2814         * WebProcess/WebPage/WebPage.cpp:
2815         (WebKit::WebPage::requestStorageAccess):
2816
2817 2019-03-11  Alex Christensen  <achristensen@webkit.org>
2818
2819         Add a WKContentRuleList variant that uses copied memory instead of mmap'd shared memory for class A containerized apps
2820         https://bugs.webkit.org/show_bug.cgi?id=195511
2821         <rdar://problem/44873269>
2822
2823         Reviewed by Darin Adler.
2824
2825         * NetworkProcess/NetworkContentRuleListManager.cpp:
2826         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
2827         * NetworkProcess/NetworkContentRuleListManager.h:
2828         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
2829         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting):
2830         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting):
2831         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
2832         * NetworkProcess/cache/NetworkCacheFileSystem.h:
2833         * Shared/WebCompiledContentRuleList.cpp:
2834         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const):
2835         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
2836         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
2837         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
2838         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
2839         (WebKit::WebCompiledContentRuleList::actions const):
2840         * Shared/WebCompiledContentRuleList.h:
2841         * Shared/WebCompiledContentRuleListData.cpp:
2842         (WebKit::WebCompiledContentRuleListData::size const):
2843         (WebKit::WebCompiledContentRuleListData::dataPointer const):
2844         (WebKit::WebCompiledContentRuleListData::encode const):
2845         (WebKit::WebCompiledContentRuleListData::decode):
2846         * Shared/WebCompiledContentRuleListData.h:
2847         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
2848         * UIProcess/API/APIContentRuleList.cpp:
2849         (API::ContentRuleList::usesCopiedMemory const):
2850         * UIProcess/API/APIContentRuleList.h:
2851         * UIProcess/API/APIContentRuleListStore.cpp:
2852         (API::getData):
2853         (API::decodeContentRuleListMetaData):
2854         (API::ContentRuleListStore::readContentsOfFile):
2855         (API::MappedOrCopiedData::dataPointer const):
2856         (API::openAndMapOrCopyContentRuleList):
2857         (API::compiledToFile):
2858         (API::createExtension):
2859         (API::ContentRuleListStore::lookupContentRuleList):
2860         (API::ContentRuleListStore::compileContentRuleList):
2861         (API::ContentRuleListStore::getContentRuleListSource):
2862         (API::openAndMapContentRuleList): Deleted.
2863         * UIProcess/API/APIContentRuleListStore.h:
2864         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
2865         (API::ContentRuleListStore::readContentsOfFile):
2866         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
2867         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]):
2868         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
2869         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
2870         (-[_WKUserContentFilter usesCopiedMemory]):
2871         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
2872         * WebProcess/UserContent/WebUserContentController.cpp:
2873         (WebKit::WebUserContentController::addContentRuleLists):
2874         * WebProcess/UserContent/WebUserContentController.h:
2875         * WebProcess/WebPage/WebPage.cpp:
2876         (WebKit::m_hostFileDescriptor):
2877
2878 2019-03-11  Chris Dumez  <cdumez@apple.com>
2879
2880         Unreviewed, fix assertions in layout tests on iOS Simulator after r242666.
2881
2882         Log an error but do not crash if we fail to acquire a ProcessAssertion.
2883
2884         * UIProcess/ios/ProcessAssertionIOS.mm:
2885         (WebKit::ProcessAssertion::ProcessAssertion):
2886
2887 2019-03-11  Chris Dumez  <cdumez@apple.com>
2888
2889         WebProcessCache should keep track of processes being added
2890         https://bugs.webkit.org/show_bug.cgi?id=195538
2891
2892         Reviewed by Geoffrey Garen.
2893
2894         WebProcessCache should keep track of processes being added, while they are being
2895         checked for responsiveness. This is useful so that:
2896         - Requests to clear the cache also clear processes being added
2897         - Requests to remove a given process from the cache (either because it crashed
2898           or because it is being used for a history navigation) actually remove the
2899           process if it is still being checked for responsiveness.
2900         - The cached process eviction timer applies to such processes in case something
2901           goes wrong with the code and the pending request does not get processed.
2902
2903         * UIProcess/WebProcessCache.cpp:
2904         (WebKit::generateAddRequestIdentifier):
2905         (WebKit::WebProcessCache::addProcessIfPossible):
2906         (WebKit::WebProcessCache::addProcess):
2907         (WebKit::WebProcessCache::clear):
2908         (WebKit::WebProcessCache::clearAllProcessesForSession):
2909         (WebKit::WebProcessCache::removeProcess):
2910         (WebKit::WebProcessCache::CachedProcess::evictionTimerFired):
2911         (WebKit::WebProcessCache::evictProcess): Deleted.
2912         * UIProcess/WebProcessCache.h:
2913         (WebKit::WebProcessCache::size const):
2914         * UIProcess/WebProcessPool.cpp:
2915         (WebKit::WebProcessPool::processForNavigationInternal):
2916         * UIProcess/WebProcessProxy.cpp:
2917         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
2918
2919 2019-03-11  Alex Christensen  <achristensen@webkit.org>
2920
2921         REGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm is crashing
2922         https://bugs.webkit.org/show_bug.cgi?id=194523
2923
2924         Reviewed by Alexey Proskuryakov.
2925
2926         Attempt another workaround to prevent crashes.
2927
2928         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2929         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2930         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
2931         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2932         (-[WKNetworkSessionDelegate URLSession:task:needNewBodyStream:]):
2933
2934 2019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
2935
2936         Unreviewed, rolling out r242688, r242643, r242624.
2937
2938         Caused multiple layout test failures and crashes on iOS and macOS.
2939
2940         Reverted changeset:
2941
2942         "requestAnimationFrame should execute before the next frame"
2943         https://bugs.webkit.org/show_bug.cgi?id=177484
2944         https://trac.webkit.org/changeset/242624/webkit
2945
2946         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
2947         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
2948         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
2949         (WebKit::DrawingAreaCoordinatedGraphics::display):
2950         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
2951         (WebKit::LayerTreeHost::layerFlushTimerFired):
2952         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2953         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2954         * WebProcess/WebPage/WebPage.cpp:
2955         (WebKit::WebPage::layoutIfNeeded):
2956         (WebKit::WebPage::willDisplayPage):
2957         (WebKit::WebPage::renderingUpdate): Deleted.
2958         * WebProcess/WebPage/WebPage.h:
2959         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2960         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
2961
2962 2019-03-11  Darin Adler  <darin@apple.com>
2963
2964         Specify fixed precision explicitly to prepare to change String::number and StringBuilder::appendNumber floating point behavior
2965         https://bugs.webkit.org/show_bug.cgi?id=195533
2966
2967         Reviewed by Brent Fulgham.
2968
2969         * NetworkProcess/cache/NetworkCache.cpp:
2970         (WebKit::NetworkCache::Cache::dumpContentsToFile): Use appendFixedPrecisionNumber.
2971         * NetworkProcess/cache/NetworkCacheEntry.cpp:
2972         (WebKit::NetworkCache::Entry::asJSON const): Ditto.
2973         * Shared/Gamepad/GamepadData.cpp:
2974         (WebKit::GamepadData::loggingString const): Ditto.
2975         * UIProcess/WebPageProxy.cpp:
2976         (WebKit::WebPageProxy::logDiagnosticMessageWithValue): Use numberToStringFixedPrecision.
2977
2978 2019-03-11  John Wilander  <wilander@apple.com>
2979
2980         Resource Load Statistics: Make it possible exclude localhost from classification
2981         https://bugs.webkit.org/show_bug.cgi?id=195474
2982         <rdar://problem/47520577>
2983
2984         Reviewed by Brent Fulgham.
2985
2986         This patch allows for localhost to be excluded from classification and
2987         treatment as a prevalent resource.
2988
2989         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2990         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
2991         (WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
2992             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
2993         (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
2994             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
2995         (WebKit::ResourceLoadStatisticsDatabaseStore::isPrevalentResource const):
2996             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
2997         (WebKit::ResourceLoadStatisticsDatabaseStore::isVeryPrevalentResource const):
2998             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
2999         (WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource):
3000             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
3001         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
3002         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3003         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
3004         (WebKit::ResourceLoadStatisticsMemoryStore::classifyPrevalentResources):
3005             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
3006         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResource):
3007             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
3008         (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentResource const):
3009             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
3010         (WebKit::ResourceLoadStatisticsMemoryStore::isVeryPrevalentResource const):
3011             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
3012         (WebKit::ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource):
3013             Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
3014         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
3015         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
3016         (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
3017             Now takes a ShouldIncludeLocalhost parameter.
3018         (WebKit::ResourceLoadStatisticsStore::shouldSkip const):
3019             Convenience function, currently supporting the localhost exclusion.
3020         (WebKit::ResourceLoadStatisticsStore::setIsRunningTest):
3021             Test infrastructure.
3022         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
3023         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3024         (WebKit::WebResourceLoadStatisticsStore::setIsRunningTest):
3025             Test infrastructure.
3026         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3027             Now takes a ShouldIncludeLocalhost parameter.
3028         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3029             Defines the new ShouldIncludeLocalhost boolean enum.
3030         * NetworkProcess/NetworkProcess.cpp:
3031         (WebKit::NetworkProcess::setIsRunningResourceLoadStatisticsTest):
3032             Test infrastructure.
3033         * NetworkProcess/NetworkProcess.h:
3034         * NetworkProcess/NetworkProcess.messages.in:
3035         * NetworkProcess/NetworkSession.cpp:
3036         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
3037             Forwards the localhost setting to the create function.
3038         * NetworkProcess/NetworkSession.h:
3039         * NetworkProcess/NetworkSessionCreationParameters.cpp:
3040         (WebKit::NetworkSessionCreationParameters::encode const):
3041         (WebKit::NetworkSessionCreationParameters::decode):
3042         * NetworkProcess/NetworkSessionCreationParameters.h:
3043             New parameter called shouldIncludeLocalhostInResourceLoadStatistics.
3044         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3045         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3046             Picks up the localhost setting from the parameters.
3047         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3048         (WKWebsiteDataStoreSetStatisticsIsRunningTest):
3049             Test infrastructure.
3050         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3051         * UIProcess/Network/NetworkProcessProxy.cpp:
3052         (WebKit::NetworkProcessProxy::setIsRunningResourceLoadStatisticsTest):
3053             Test infrastructure.
3054         * UIProcess/Network/NetworkProcessProxy.h:
3055         * UIProcess/WebProcessPool.cpp:
3056         (WebKit::WebProcessPool::ensureNetworkProcess):
3057             Picks up the localhost setting from the WebsiteDataStore parameters.
3058         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3059         (WebKit::WebsiteDataStore::parameters):
3060             Makes sure Safari does not exclude localhost.
3061         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3062         (WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest):
3063             Test infrastructure.
3064         * UIProcess/WebsiteData/WebsiteDataStore.h:
3065
3066 2019-03-11  Alex Christensen  <achristensen@webkit.org>
3067
3068         Unreviewed, rolling out r242698.
3069
3070         API test crashes on bots.
3071
3072         Reverted changeset:
3073
3074         "Add a WKContentRuleList variant that uses copied memory
3075         instead of mmap'd shared memory for class A containerized
3076         apps"
3077         https://bugs.webkit.org/show_bug.cgi?id=195511
3078         https://trac.webkit.org/changeset/242698
3079
3080 2019-03-11  Michael Catanzaro  <mcatanzaro@igalia.com>
3081
3082         [WPE] Enable web process sandbox
3083         https://bugs.webkit.org/show_bug.cgi?id=195169
3084
3085         Reviewed by Daniel Bates.
3086
3087         * PlatformWPE.cmake:
3088         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
3089         (WebKit::bubblewrapSpawn):
3090
3091 2019-03-11  Truitt Savell  <tsavell@apple.com>
3092
3093         Unreviewed, rolling out r242697.
3094
3095         Broke internal builders.
3096
3097         Reverted changeset:
3098
3099         "Optimizing loads when creating new pages"
3100         https://bugs.webkit.org/show_bug.cgi?id=195516
3101         https://trac.webkit.org/changeset/242697
3102
3103 2019-03-10  Alex Christensen  <achristensen@webkit.org>
3104
3105         Add a WKContentRuleList variant that uses copied memory instead of mmap'd shared memory for class A containerized apps
3106         https://bugs.webkit.org/show_bug.cgi?id=195511
3107         <rdar://problem/44873269>
3108
3109         Reviewed by Darin Adler.
3110
3111         * NetworkProcess/NetworkContentRuleListManager.cpp:
3112         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
3113         * NetworkProcess/NetworkContentRuleListManager.h:
3114         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
3115         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting):
3116         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting):
3117         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
3118         * NetworkProcess/cache/NetworkCacheFileSystem.h:
3119         * Shared/WebCompiledContentRuleList.cpp:
3120         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const):
3121         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
3122         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
3123         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
3124         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
3125         (WebKit::WebCompiledContentRuleList::actions const):
3126         * Shared/WebCompiledContentRuleList.h:
3127         * Shared/WebCompiledContentRuleListData.cpp:
3128         (WebKit::WebCompiledContentRuleListData::size const):
3129         (WebKit::WebCompiledContentRuleListData::dataPointer const):
3130         (WebKit::WebCompiledContentRuleListData::encode const):
3131         (WebKit::WebCompiledContentRuleListData::decode):
3132         * Shared/WebCompiledContentRuleListData.h:
3133         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
3134         * UIProcess/API/APIContentRuleList.cpp:
3135         (API::ContentRuleList::usesCopiedMemory const):
3136         * UIProcess/API/APIContentRuleList.h:
3137         * UIProcess/API/APIContentRuleListStore.cpp:
3138         (API::getData):
3139         (API::decodeContentRuleListMetaData):
3140         (API::ContentRuleListStore::readContentsOfFile):
3141         (API::MappedOrCopiedData::dataPointer const):
3142         (API::openAndMapOrCopyContentRuleList):
3143         (API::compiledToFile):
3144         (API::createExtension):
3145         (API::ContentRuleListStore::lookupContentRuleList):
3146         (API::ContentRuleListStore::compileContentRuleList):
3147         (API::ContentRuleListStore::getContentRuleListSource):
3148         (API::openAndMapContentRuleList): Deleted.
3149         * UIProcess/API/APIContentRuleListStore.h:
3150         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
3151         (API::ContentRuleListStore::readContentsOfFile):
3152         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
3153         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]):
3154         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
3155         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
3156         (-[_WKUserContentFilter usesCopiedMemory]):
3157         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
3158         * WebProcess/UserContent/WebUserContentController.cpp:
3159         (WebKit::WebUserContentController::addContentRuleLists):
3160         * WebProcess/UserContent/WebUserContentController.h:
3161         * WebProcess/WebPage/WebPage.cpp:
3162         (WebKit::m_hostFileDescriptor):
3163
3164 2019-03-10  Jiewen Tan  <jiewen_tan@apple.com>
3165
3166         Optimizing loads when creating new pages
3167         https://bugs.webkit.org/show_bug.cgi?id=195516
3168         <rdar://problem/48738086>
3169
3170         Reviewed by Darin Adler.
3171
3172         This patch adds hooks in WebPageProxy::createNewPage to optimize loads, and moves the creationParameters
3173         of API::NavigationAction from UI clients to WebPageProxy::createNewPage. Also, we now pass the whole
3174         API::NavigationAction to the load optimizer instead of the request within.
3175
3176         * UIProcess/API/APINavigationAction.h:
3177         * UIProcess/API/APIUIClient.h:
3178         (API::UIClient::createNewPage):
3179         * UIProcess/API/C/WKPage.cpp:
3180         (WKPageSetPageUIClient):
3181         * UIProcess/API/glib/WebKitUIClient.cpp:
3182         * UIProcess/Cocoa/NavigationState.mm:
3183         (WebKit::tryOptimizingLoad):
3184         (WebKit::tryInterceptNavigation):
3185         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3186         * UIProcess/Cocoa/UIDelegate.h:
3187         * UIProcess/Cocoa/UIDelegate.mm:
3188         (WebKit::UIDelegate::UIClient::createNewPage):
3189         * UIProcess/WebPageProxy.cpp:
3190         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3191         (WebKit::tryOptimizingLoad):
3192         (WebKit::WebPageProxy::createNewPage):
3193         * UIProcess/WebPageProxy.h:
3194
3195 2019-03-10  Tim Horton  <timothy_horton@apple.com>
3196
3197         Add SPI to retrieve the set of text inputs in a given rect, and later focus one
3198         https://bugs.webkit.org/show_bug.cgi?id=195499
3199
3200         Reviewed by Darin Adler.
3201
3202         * Scripts/webkit/messages.py:
3203         * Shared/TextInputContext.cpp: Added.
3204         (IPC::ArgumentCoder<WebKit::TextInputContext>::encode):
3205         (IPC::ArgumentCoder<WebKit::TextInputContext>::decode):
3206         * Shared/TextInputContext.h: Added.
3207         (WebKit::TextInputContext::operator== const):
3208         Add TextInputContext, which represents a minimal set of information
3209         about a text field.
3210
3211         * Sources.txt:
3212         * SourcesCocoa.txt:
3213         * UIProcess/API/Cocoa/WKWebView.mm:
3214         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
3215         (-[WKWebView _focusTextInputContext:completionHandler:]):
3216         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3217         Add SPI that allows clients to asynchronously request text input
3218         contexts for a given rect, and later focus a given context.
3219
3220         * UIProcess/API/Cocoa/_WKTextInputContext.h: Added.
3221         * UIProcess/API/Cocoa/_WKTextInputContext.mm: Added.
3222         (-[_WKTextInputContext _initWithTextInputContext:]):
3223         (-[_WKTextInputContext boundingRect]):
3224         (-[_WKTextInputContext _textInputContext]):
3225         (-[_WKTextInputContext isEqual:]):
3226         (-[_WKTextInputContext hash]):
3227         (-[_WKTextInputContext copyWithZone:]):
3228         * UIProcess/API/Cocoa/_WKTextInputContextInternal.h: Added.
3229         Add an SPI object that exposes a read-only window on a TextInputContext to clients.
3230
3231         * UIProcess/WebPageProxy.cpp:
3232         (WebKit::WebPageProxy::textInputContextsInRect):
3233         (WebKit::WebPageProxy::focusTextInputContext):
3234         * UIProcess/WebPageProxy.h:
3235         Plumbing from WKWebView<->WebPage.
3236
3237         * WebKit.xcodeproj/project.pbxproj:
3238         * WebProcess/WebPage/WebPage.cpp:
3239         (WebKit::elementRectInWindowCoordinates):
3240         (WebKit::isEditableTextInputElement):
3241         (WebKit::WebPage::textInputContextsInRect):
3242         Search the DOM for text input contexts: <input type='text'> (or other
3243         form fields that fall back on text field behavior), <textarea>, and
3244         contenteditable roots. Store the WebPage, Document, and Element identifiers
3245         so that we can find the element again later.
3246
3247         (WebKit::WebPage::focusTextInputContext):
3248         Find the element for a given (web page, document, element) triple and focus it,
3249         if it's still available.
3250
3251         * WebProcess/WebPage/WebPage.h:
3252         * WebProcess/WebPage/WebPage.messages.in:
3253
3254 2019-03-10  Tim Horton  <timothy_horton@apple.com>
3255
3256         iOS: Using ⌥ to scroll horizontally is no different than arrow key
3257         https://bugs.webkit.org/show_bug.cgi?id=195268
3258         <rdar://problem/48326682>
3259
3260         Reviewed by Brent Fulgham.
3261
3262         * UIProcess/ios/WKContentViewInteraction.mm:
3263         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:inDirection:]):
3264         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:]): Deleted.
3265         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
3266         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
3267         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
3268         (-[WKKeyboardScrollViewAnimator setDelegate:]):
3269         (-[WKKeyboardScrollViewAnimator distanceForIncrement:inDirection:]):
3270         (-[WKKeyboardScrollViewAnimator distanceForIncrement:]): Deleted.
3271         Add a direction parameter to -distanceForIncrement:, so the client
3272         can return a different page/document size based on the scrolling axis.
3273         Adopt it both in the default implementation and in WKContentViewInteraction.
3274         Make the option key scroll by page when scrolling horizontally, like it
3275         does when scrolling vertically.
3276
3277 2019-03-10  David Quesada  <david_quesada@apple.com>
3278
3279         ASSERT(m_downloads.isEmpty()) fails in DownloadProxyMap::~DownloadProxyMap()
3280         https://bugs.webkit.org/show_bug.cgi?id=152480
3281
3282         Reviewed by Chris Dumez.
3283
3284         * UIProcess/Downloads/DownloadProxyMap.cpp:
3285         (WebKit::DownloadProxyMap::downloadFinished):
3286             If the DownloadProxy is holding the last reference to the process pool, then
3287             invalidating the proxy will cause the process pool, the network process proxy,
3288             and this DownloadProxyMap to deallocate. Ensure that doesn't happen until this
3289             method has done everything it wants to do to clean up.
3290
3291 2019-03-10  Wenson Hsieh  <wenson_hsieh@apple.com>
3292
3293         Fix some misleading function and variable names in WKContentViewInteraction.mm
3294         https://bugs.webkit.org/show_bug.cgi?id=195536
3295
3296         Reviewed by Tim Horton.
3297
3298         * UIProcess/ios/WKContentViewInteraction.mm:
3299         (shouldDeferZoomingToSelectionWhenRevealingFocusedElement):
3300
3301         Rename shouldZoomToRevealSelectionRect to shouldDeferZoomingToSelectionWhenRevealingFocusedElement; this
3302         function is used to determine whether we should zoom to the selection rect when revealing the focused element,
3303         and therefore affects whether we need to defer zooming until we get selection information.
3304
3305         (rectToRevealWhenZoomingToFocusedElement):
3306         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3307
3308         Rename shouldShowKeyboard to shouldShowInputView; this boolean indicates whether we should show not only the
3309         keyboard, but other UI for user input such as date and select pickers.
3310
3311         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
3312         (shouldZoomToRevealSelectionRect): Deleted.
3313
3314 2019-03-10  Simon Fraser  <simon.fraser@apple.com>
3315
3316         ScrollingTree should have the final say on where layers go
3317         https://bugs.webkit.org/show_bug.cgi?id=195507
3318
3319         Reviewed by Antti Koivisto.
3320
3321         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
3322         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
3323         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
3324         (WebKit::RemoteScrollingCoordinatorProxy::applyScrollingTreeLayerPositions):
3325         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
3326         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3327         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3328
3329 2019-03-09  Darin Adler  <darin@apple.com>
3330
3331         [Cocoa] Code signing fails because services are copied into XPCServices after the framework is signed
3332         https://bugs.webkit.org/show_bug.cgi?id=195523
3333
3334         Reviewed by Dan Bernstein.
3335
3336         * WebKit.xcodeproj/project.pbxproj: Make symbolic links while building the WebKit
3337         framework instead of copying in the services after the framework is built.
3338
3339 2019-03-09  Wenson Hsieh  <wenson_hsieh@apple.com>
3340
3341         REGRESSION (r242551): Sporadic hangs when tapping to change selection on iOS
3342         https://bugs.webkit.org/show_bug.cgi?id=195475
3343         <rdar://problem/48721153>
3344
3345         Reviewed by Chris Dumez.
3346
3347         r242551 refactored synchronous autocorrection context requests to send an async IPC message and then use
3348         waitForAndDispatchImmediately, instead of calling sendSync. However, this exposes a couple of existing issues in
3349         the implementation of waitForAndDispatchImmediately that causes sporadic IPC deadlocks when changing selection.
3350
3351         First, passing in InterruptWaitingIfSyncMessageArrives when synchronously waiting for an IPC message currently
3352         does not fulfill its intended behavior of interrupting waiting when a sync message arrives. This is because sync
3353         IPC messages, by default, may be dispatched while the receiver is waiting for a sync reply. This means that the
3354         logic in Connection::SyncMessageState::processIncomingMessage to dispatch an incoming sync message on the main
3355         thread will attempt to handle the incoming message by enqueueing it on the main thread, and then waking up the
3356         client runloop (i.e. signaling m_waitForSyncReplySemaphore). This works in the case of sendSync since the sync
3357         reply semaphore is used to block the main thread, but in the case of waitForAndDispatchImmediately, a different
3358         m_waitForMessageCondition is used instead, so SyncMessageState::processIncomingMessage will only enqueue the
3359         incoming sync message on the main thread, and not actually invoke it.
3360
3361         To fix this first issue, observe that there is pre-existing logic to enqueue the incoming message and signal
3362         m_waitForMessageCondition in Connection::processIncomingMessage. This codepath is currently not taken because we
3363         end up bailing early in the call to SyncMessageState::processIncomingMessage. Instead, we can move this early
3364         return further down in the function, such that if there is an incoming sync message and we're waiting with the
3365         InterruptWaitingIfSyncMessageArrives option, we will correctly enqueue the incoming message, wake the runloop,
3366         and proceed to handle the incoming message.
3367
3368         The second issue is more subtle; consider the scenario in which we send a sync message A from the web process to
3369         the UI process, and simultaneously, in the UI process, we schedule some work to be done on the main thread.
3370         Let's additionally suppose that this scheduled work will send an IPC message B to the web process and
3371         synchronously wait for a reply (in the case of this particular bug, this is the sync autocorrection context
3372         request). What happens upon receiving sync message A is that the IPC thread in the UI process will schedule A on
3373         the main thread; however, before the scheduled response to A is invoked, we will first invoke previously
3374         scheduled work that attempts to block synchronously until a message B is received. In summary:
3375
3376         1. (Web process)    sends sync IPC message A to UI process.
3377         2. (UI process)     schedules some main runloop task that will block synchronously on IPC message B.
3378         3. (UI process)     receives sync IPC message A and schedules A on the main runloop.
3379         4. (UI process)     carry out the task scheduled in (2) and block on B.
3380
3381         ...and then, the UI process and web process are now deadlocked because the UI process is waiting for B to
3382         arrive, but the web process can't send B because it's waiting for a reply for IPC message A! To fix this second
3383         deadlock, we first make an important observation: when using sendSync, we don't run into this problem because
3384         immediately before sending sync IPC, we will attempt to handle any incoming sync IPC messages that have been
3385         queued up. However, when calling waitForAndDispatchImmediately, we don't have this extra step, so a deadlock may
3386         occur in the manner described above. To fix this, we make waitForAndDispatchImmediately behave more like
3387         sendSync, by handling all incoming sync messages prior to blocking on an IPC response.
3388
3389         Test: editing/selection/ios/change-selection-by-tapping.html
3390
3391         * Platform/IPC/Connection.cpp:
3392         (IPC::Connection::waitForMessage):
3393         (IPC::Connection::processIncomingMessage):
3394
3395 2019-03-09  Andy Estes  <aestes@apple.com>
3396
3397         [Apple Pay] CanMakePaymentsWithActiveCard and OpenPaymentSetup should be async messages
3398         https://bugs.webkit.org/show_bug.cgi?id=195526
3399         <rdar://problem/48745636>
3400
3401         Reviewed by Chris Dumez.
3402
3403         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
3404         (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard):
3405         (WebKit::WebPaymentCoordinatorProxy::openPaymentSetup):
3406         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
3407         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
3408         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
3409         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCard):
3410         (WebKit::WebPaymentCoordinator::openPaymentSetup):
3411         (WebKit::generateCanMakePaymentsWithActiveCardReplyID): Deleted.
3412         (WebKit::generateOpenPaymentSetupReplyID): Deleted.
3413         (WebKit::WebPaymentCoordinator::canMakePaymentsWithActiveCardReply): Deleted.
3414         (WebKit::WebPaymentCoordinator::openPaymentSetupReply): Deleted.
3415         * WebProcess/ApplePay/WebPaymentCoordinator.h:
3416         * WebProcess/ApplePay/WebPaymentCoordinator.messages.in:
3417
3418 2019-03-09  Andy Estes  <aestes@apple.com>
3419
3420         [iOS] Remove unneeded entitlements and sandbox allowances from the Networking service
3421         https://bugs.webkit.org/show_bug.cgi?id=195527
3422
3423         Reviewed by Eric Carlson.
3424
3425         * Configurations/Network-iOS.entitlements:
3426         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
3427
3428 2019-03-09  Chris Dumez  <cdumez@apple.com>
3429
3430         Use modern async IPC with reply for device orientation permission
3431         https://bugs.webkit.org/show_bug.cgi?id=195529
3432
3433         Reviewed by Ryosuke Niwa.
3434
3435         * UIProcess/WebPageProxy.cpp:
3436         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
3437         * UIProcess/WebPageProxy.h:
3438         * UIProcess/WebPageProxy.messages.in:
3439         * WebProcess/WebPage/WebPage.cpp:
3440         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
3441         (WebKit::nextDeviceOrientationAndMotionPermissionCallbackID): Deleted.
3442         (WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision): Deleted.
3443         * WebProcess/WebPage/WebPage.h:
3444         * WebProcess/WebPage/WebPage.messages.in:
3445
3446 2019-03-09  Zalan Bujtas  <zalan@apple.com>
3447
3448         [ContentChangeObserver] Start observing for content change between touchEnd and mouseMoved start
3449         https://bugs.webkit.org/show_bug.cgi?id=195510
3450         <rdar://problem/48735695>
3451
3452         Reviewed by Simon Fraser.
3453
3454         * WebProcess/WebPage/ios/WebPageIOS.mm:
3455         (WebKit::WebPage::cancelPotentialTapInFrame):
3456
3457 2019-03-08  Chris Dumez  <cdumez@apple.com>
3458
3459         Enable ProcessAssertions on iOS Simulator
3460         https://bugs.webkit.org/show_bug.cgi?id=195479
3461
3462         Reviewed by Alexey Proskuryakov.
3463
3464         Enable ProcessAssertions on iOS Simulator. We have some layout tests timing out in the
3465         iOS Simulator due to the WebContent process suspending. Turning on ProcessAssertions in
3466         the iOS Simulator seems to make those tests pass.
3467
3468         * UIProcess/ProcessAssertion.cpp:
3469         * UIProcess/ProcessAssertion.h:
3470         * UIProcess/ios/ProcessAssertionIOS.mm:
3471
3472 2019-03-08  Chris Dumez  <cdumez@apple.com>
3473
3474         Add support for Device Orientation / Motion permission API
3475         https://bugs.webkit.org/show_bug.cgi?id=195329
3476         <rdar://problem/47645367>
3477
3478         Reviewed by Geoffrey Garen.
3479
3480         Add support for Device Orientation / Motion permission API:
3481         - https://github.com/w3c/deviceorientation/issues/57
3482
3483         This adds new SPI to WKUIDelegatePrivate, until we can make this API.
3484
3485         * Shared/WebPreferences.yaml:
3486         * UIProcess/API/APIUIClient.h:
3487         (API::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
3488         * UIProcess/API/C/WKPage.cpp:
3489         (WKPageSetPageUIClient):
3490         * UIProcess/API/C/WKPageUIClient.h:
3491         * UIProcess/API/Cocoa/WKUIDelegate.h:
3492         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3493         * UIProcess/Cocoa/UIDelegate.h:
3494         * UIProcess/Cocoa/UIDelegate.mm:
3495         (WebKit::UIDelegate::setDelegate):
3496         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
3497         * UIProcess/WebPageProxy.cpp:
3498         (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
3499         * UIProcess/WebPageProxy.h:
3500         * UIProcess/WebPageProxy.messages.in:
3501         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3502         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
3503         * WebProcess/WebCoreSupport/WebChromeClient.h:
3504         * WebProcess/WebPage/WebPage.cpp:
3505         (WebKit::nextDeviceOrientationAndMotionPermissionCallbackID):
3506         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
3507         (WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision):
3508         * WebProcess/WebPage/WebPage.h:
3509         * WebProcess/WebPage/WebPage.messages.in:
3510
3511 2019-03-08  Brady Eidson  <beidson@apple.com>
3512
3513         Have the UIProcess take the UnboundedNetworking assertion when downloads are in progress.
3514         https://bugs.webkit.org/show_bug.cgi?id=195468
3515
3516         Reviewed by Andy Estes.
3517
3518         * UIProcess/Downloads/DownloadProxyMap.cpp:
3519         (WebKit::DownloadProxyMap::DownloadProxyMap):
3520         (WebKit::DownloadProxyMap::createDownloadProxy): If this is the first download, and the process has the entitlement,
3521           take the assertion.
3522         (WebKit::DownloadProxyMap::downloadFinished):
3523         (WebKit::DownloadProxyMap::processDidClose):
3524         * UIProcess/Downloads/DownloadProxyMap.h:
3525
3526 2019-03-08  Chris Dumez  <cdumez@apple.com>
3527
3528         Add assertions to help debug a WebProcessCache crash
3529         https://bugs.webkit.org/show_bug.cgi?id=195469
3530
3531         Reviewed by Brady Eidson.
3532
3533         I suspect the process's registrableDomain in null when evictProcess() gets
3534         called, thus crashing when lookup it up in the HashMap. Confirm this and
3535         how this could happen via assertions.
3536
3537         * UIProcess/WebProcessCache.cpp:
3538         (WebKit::WebProcessCache::evictProcess):
3539         * UIProcess/WebProcessProxy.cpp:
3540         (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
3541
3542 2019-03-08  Brady Eidson  <beidson@apple.com>
3543
3544         Rename AssertionState::Download.
3545         https://bugs.webkit.org/show_bug.cgi?id=195465
3546
3547         Reviewed by Andy Estes.
3548
3549         It's (currently) about uploads and downloads.
3550         Let's call it "UnboundedNetworking"
3551
3552         * NetworkProcess/Downloads/DownloadMap.cpp:
3553         (WebKit::DownloadMap::add):
3554
3555         * UIProcess/ProcessAssertion.h:
3556
3557         * UIProcess/WebProcessProxy.cpp:
3558         (WebKit::WebProcessProxy::didSetAssertionState):
3559
3560         * UIProcess/ios/ProcessAssertionIOS.mm:
3561         (WebKit::flagsForState):
3562         (WebKit::reasonForState):
3563
3564 2019-03-08  Simon Fraser  <simon.fraser@apple.com>
3565
3566         [macOS UI-side compositing] Mouse handling can trigger a crash before we have a scrolling tree root
3567         https://bugs.webkit.org/show_bug.cgi?id=195467
3568
3569         Reviewed by Antti Koivisto.
3570         
3571         When launching MiniBrowser with UI-side compositing enabled in a state where the window
3572         appears under the mouse, we can hit RemoteScrollingTree::handleMouseEvent() for a mouseEnter
3573         event before we have a scrolling tree root node, so add a null check.
3574
3575         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
3576         (WebKit::RemoteScrollingTree::handleMouseEvent):
3577
3578 2019-03-08  Carlos Garcia Campos  <cgarcia@igalia.com>
3579
3580         REGRESSION(r242624): [GTK] New rAF code path assumes AC mode
3581         https://bugs.webkit.org/show_bug.cgi?id=195459
3582
3583         Reviewed by Žan Doberšek.
3584
3585         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
3586         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
3587         The refresh monitor now calls scheduleLayerFlush() but when AC
3588         mode is disabled this method does nothing, so setNeedsDisplay()
3589         needs to be called instead.
3590
3591 2019-03-07  Tim Horton  <timothy_horton@apple.com>
3592
3593         Crash under RemoteLayerTreePropertyApplier::applyProperties
3594         https://bugs.webkit.org/show_bug.cgi?id=195448
3595         <rdar://problem/48588226>
3596
3597         Reviewed by Simon Fraser.
3598
3599         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
3600         (WebKit::RemoteLayerTreeHost::updateLayerTree):
3601         Under some currently-unknown circumstances, the UI process is receiving
3602         commits referring to layers that it does not know about.
3603         One understood case of this was fixed in r241899, but there seem to be
3604         cases remaining that are not understood.
3605         Also, add a release log so that we can identify any downstream effects.
3606
3607 2019-03-07  Zalan Bujtas  <zalan@apple.com>
3608
3609         [ContentChangeObserver] Introduce fixed duration content observation
3610         https://bugs.webkit.org/show_bug.cgi?id=195295
3611         <rdar://problem/48579913>
3612
3613         Reviewed by Simon Fraser.
3614
3615         * WebProcess/WebPage/ios/WebPageIOS.mm:
3616         (WebKit::WebPage::handleSyntheticClick):
3617         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
3618
3619 2019-03-07  Fujii Hironori  <Hironori.Fujii@sony.com>
3620
3621         [WinCairo][WebKit] Nothing is drawn after Web process crashed
3622         https://bugs.webkit.org/show_bug.cgi?id=195399
3623
3624         Reviewed by Alex Christensen.
3625
3626         PageClientImpl::viewSize returned 0x0 size after Web process
3627         crashed. Restored the original implementation using GetClientRect
3628         (Bug 52175).
3629
3630         * UIProcess/win/PageClientImpl.cpp:
3631         (WebKit::PageClientImpl::viewSize):
3632
3633 2019-03-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
3634
3635         requestAnimationFrame should execute before the next frame
3636         https://bugs.webkit.org/show_bug.cgi?id=177484
3637
3638         Reviewed by Simon Fraser.
3639
3640         Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
3641         a single call to Page::renderingUpdate(). This new function implements 
3642         "Update the rendering" step of the HTML Event Loop specification
3643         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
3644
3645         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
3646         (WebKit::AcceleratedDrawingArea::updateBackingStoreState):
3647         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
3648         (WebKit::LayerTreeHost::layerFlushTimerFired):
3649         * WebProcess/WebPage/DrawingAreaImpl.cpp:
3650         (WebKit::DrawingAreaImpl::display):
3651         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
3652         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
3653         * WebProcess/WebPage/WebPage.cpp:
3654         (WebKit::WebPage::layoutIfNeeded):
3655         (WebKit::WebPage::renderingUpdate):
3656         (WebKit::WebPage::willDisplayPage): Deleted.
3657         * WebProcess/WebPage/WebPage.h:
3658         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3659         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3660
3661 2019-03-07  Zalan Bujtas  <zalan@apple.com>
3662
3663         [ContentChangeObserver] Add a setting to be able to turn content change observation on/off
3664         https://bugs.webkit.org/show_bug.cgi?id=195353
3665         <rdar://problem/48626394>
3666
3667         Reviewed by Simon Fraser.
3668
3669         * Shared/WebPreferences.yaml:
3670         * UIProcess/API/C/WKPreferences.cpp:
3671         (WKPreferencesSetContentChangeObserverEnabled):
3672         (WKPreferencesGetContentChangeObserverEnabled):
3673         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3674         * UIProcess/API/Cocoa/WKPreferences.mm:
3675         (-[WKPreferences _contentChangeObserverEnabled]):
3676         (-[WKPreferences _setContentChangeObserverEnabled:]):
3677         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3678         * WebProcess/WebPage/ios/WebPageIOS.mm:
3679         (WebKit::WebPage::handleSyntheticClick):
3680
3681 2019-03-07  Andy Estes  <aestes@apple.com>
3682
3683         [Apple Pay] Untangle PKPaymentAuthorizationViewController from WebPaymentCoordinatorProxy
3684         https://bugs.webkit.org/show_bug.cgi?id=195349
3685         <rdar://problem/48625510>
3686
3687         Reviewed by Alex Christensen.
3688
3689         Introduced PaymentAuthorizationPresenter and WKPaymentAuthorizationDelegate to encapsulate
3690         PKPaymentAuthorizationViewController and its delegate. Taught WebPaymentCoordinatorProxy to
3691         interact with PaymentAuthorizationPresenter rather than PKPAVC directly.
3692
3693         These changes will allow us to swap out PKPaymentAuthorizationViewController with PKPaymentAuthorizationController in a follow-on patch.
3694
3695         * Platform/cocoa/PaymentAuthorizationPresenter.h: Added. Defined the abstract interface for
3696         payment authorization presenters that use PKPA(V)C.
3697         * Platform/cocoa/PaymentAuthorizationPresenter.mm: Added.
3698         (WebKit::toPKPaymentAuthorizationStatus): Moved from WebPaymentCoordinatorProxyCocoa.mm.
3699         (WebKit::toPKPaymentErrorCode): Ditto.
3700         (WebKit::toNSError): Ditto.
3701         (WebKit::toNSErrors): Ditto.
3702         (WebKit::toPKShippingMethods): Ditto.
3703         (WebKit::PaymentAuthorizationPresenter::completeMerchantValidation): Added. Implements the
3704         logic previously in WebPaymentCoordinatorProxy::platformCompleteMerchantValidation.
3705         (WebKit::PaymentAuthorizationPresenter::completePaymentMethodSelection): Ditto for
3706         WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection.
3707         (WebKit::PaymentAuthorizationPresenter::completePaymentSession): Ditto for 
3708         (WebKit::PaymentAuthorizationPresenter::completeShippingContactSelection): Ditto for
3709         WebPaymentCoordinatorProxy::platformCompletePaymentSession.
3710         (WebKit::PaymentAuthorizationPresenter::completeShippingMethodSelection): Ditto for
3711         WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection.
3712         * Platform/cocoa/PaymentAuthorizationViewController.h: Added. Defined a subclass of PaymentAuthorizationPresenter for PKPaymentAuthorizationViewController.
3713         * Platform/cocoa/PaymentAuthorizationViewController.mm: Added.
3714         (-[WKPaymentAuthorizationViewControllerDelegate initWithPresenter:]): Added a PKPAVC
3715         delegate that's a subclass of WKPaymentAuthorizationDelegate.
3716         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]):
3717         Called -[WKPaymentAuthorizationDelegate _didFinish].
3718         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]): Called
3719         -[WKPaymentAuthorizationDelegate _didAuthorizePayment:completion:].
3720         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]): Called
3721         -[WKPaymentAuthorizationDelegate _didSelectShippingMethod:completion:].
3722         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]): Called
3723         -[WKPaymentAuthorizationDelegate _didSelectShippingContact:completion:].
3724         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]): Called
3725         -[WKPaymentAuthorizationDelegate _didSelectPaymentMethod:completion:].
3726         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:willFinishWithError:]):
3727         Called -[WKPaymentAuthorizationDelegate _willFinishWithError:].
3728         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didRequestMerchantSession:]): Called
3729         -[WKPaymentAuthorizationDelegate _didRequestMerchantSession:].
3730         * Platform/cocoa/WKPaymentAuthorizationDelegate.h: Added.
3731         * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: Added.
3732         (-[WKPaymentAuthorizationDelegate summaryItems]): Added a summaryItems getter.
3733         (-[WKPaymentAuthorizationDelegate shippingMethods]): Ditto for shippingMethods.
3734         (-[WKPaymentAuthorizationDelegate completeMerchantValidation:error:]): Called
3735         _didRequestMerchantSessionCompletion then set it to nil.
3736         (-[WKPaymentAuthorizationDelegate completePaymentMethodSelection:]): Ditto for
3737         _didSelectPaymentMethodCompletion.
3738         (-[WKPaymentAuthorizationDelegate completePaymentSession:errors:didReachFinalState:]): Ditto
3739         for _didAuthorizePaymentCompletion.
3740         (-[WKPaymentAuthorizationDelegate completeShippingContactSelection:summaryItems:shippingMethods:errors:]):
3741         Ditto for _didSelectShippingContactCompletion.
3742         (-[WKPaymentAuthorizationDelegate completeShippingMethodSelection:]): Ditto for
3743         _didSelectShippingMethodCompletion.
3744         (-[WKPaymentAuthorizationDelegate invalidate]): If there's an outstanding authorization
3745         callback, called -completePaymentSession:errors:didReachFinalState: with a state of
3746         PKPaymentAuthorizationStatusFailure.
3747         (-[WKPaymentAuthorizationDelegate _initWithPresenter:]):
3748         (-[WKPaymentAuthorizationDelegate _didAuthorizePayment:completion:]): Added. Implements the
3749         logic previously in WKPaymentAuthorizationViewControllerDelegate.
3750         (-[WKPaymentAuthorizationDelegate _didFinish]): Ditto.
3751         (-[WKPaymentAuthorizationDelegate _didRequestMerchantSession:]): Ditto.
3752         (-[WKPaymentAuthorizationDelegate _didSelectPaymentMethod:completion:]): Ditto.
3753         (-[WKPaymentAuthorizationDelegate _didSelectShippingContact:completion:]): Ditto.
3754         (toShippingMethod): Moved from WebPaymentCoordinatorProxyCocoa.mm.
3755         (-[WKPaymentAuthorizationDelegate _didSelectShippingMethod:completion:]): Added. Implements
3756         the logic previously in WKPaymentAuthorizationViewControllerDelegate.
3757         (-[WKPaymentAuthorizationDelegate _willFinishWithError:]): Ditto.
3758         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
3759         (WebKit::WebPaymentCoordinatorProxy::presenterWillValidateMerchant): To conform to
3760         PaymentAuthorizationPresenter::Client, renamed from validateMerchant.
3761         (WebKit::WebPaymentCoordinatorProxy::presenterDidAuthorizePayment): Renamed from
3762         didAuthorizePayment.
3763         (WebKit::WebPaymentCoordinatorProxy::presenterDidFinish): Moved logic here that previously
3764         existed in WKPaymentAuthorizationViewControllerDelegate.
3765         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectShippingMethod): Renamed from
3766         didSelectShippingMethod.
3767         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectShippingContact): Renamed from
3768         didSelectShippingContact.
3769         (WebKit::WebPaymentCoordinatorProxy::presenterDidSelectPaymentMethod): Renamed from
3770         didSelectPaymentMethod.
3771         (WebKit::WebPaymentCoordinatorProxy::validateMerchant): Renamed to
3772         presenterWillValidateMerchant.
3773         (WebKit::WebPaymentCoordinatorProxy::didAuthorizePayment): Renamed to
3774         presenterDidAuthorizePayment.
3775         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingMethod): Renamed to
3776         presenterDidSelectShippingMethod.
3777         (WebKit::WebPaymentCoordinatorProxy::didSelectShippingContact): Renamed to
3778         presenterDidSelectShippingContact.
3779         (WebKit::WebPaymentCoordinatorProxy::didSelectPaymentMethod): Renamed to
3780         didSelectPaymentMethod.
3781         * Shared/ApplePay/WebPaymentCoordinatorProxy.h: Changed WebPaymentCoordinatorProxy to
3782         subclass PaymentAuthorizationPresenter::Client.
3783         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h: Removed WKPaymentAuthorizationViewControllerDelegate interface and declared some helper functions
3784         needed by PaymentAuthorizationPresenter.
3785         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3786         (WebKit::toPKPaymentSummaryItemType): Removed static keyword.
3787         (WebKit::toDecimalNumber): Ditto.
3788         (WebKit::toPKPaymentSummaryItem): Ditto.
3789         (WebKit::toPKPaymentSummaryItems): Ditto.
3790         (WebKit::toPKShippingMethod): Ditto.
3791         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Changed to call
3792         m_authorizationPresenter.
3793         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession): Ditto.
3794         (WebKit::WebPaymentCoordinatorProxy::platformCompleteMerchantValidation): Ditto.
3795         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection): Ditto.
3796         (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection): Ditto.
3797         (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection): Ditto.
3798         (-[WKPaymentAuthorizationViewControllerDelegate initWithPaymentCoordinatorProxy:]): Deleted.
3799         (-[WKPaymentAuthorizationViewControllerDelegate invalidate]): Deleted.
3800         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:willFinishWithError:]): Deleted.
3801         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didRequestMerchantSession:]): Deleted.
3802         (toShippingMethod): Deleted.
3803         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]): Deleted.
3804         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]): Deleted.
3805         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]): Deleted.
3806         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]): Deleted.
3807         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:completion:]): Deleted.
3808         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:completion:]): Deleted.
3809         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:completion:]): Deleted.
3810         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:completion:]): Deleted.
3811         (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]): Deleted.
3812         (WebKit::toPKPaymentAuthorizationStatus): Moved to PaymentAuthorizationPresenter.mm.
3813         (WebKit::toPKPaymentErrorCode): Ditto.
3814         (WebKit::toNSError): Ditto.
3815         (WebKit::toNSErrors): Ditto.
3816         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
3817         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Changed to present a
3818         PaymentAuthorizationPresenter rather than a PKPAVC.
3819         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Changed to dismiss a
3820         PaymentAuthorizationPresenter rather than a PKPAVC.
3821         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
3822         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Ditto.
3823         (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI): Ditto.
3824         * SourcesCocoa.txt:
3825         * UIProcess/WebPageProxy.h:
3826         * UIProcess/ios/WebPageProxyIOS.mm:
3827         (WebKit::WebPageProxy::paymentCoordinatorAuthorizationPresenter): Added. Returns a new
3828         PaymentAuthorizationViewController.
3829         * WebKit.xcodeproj/project.pbxproj:
3830
3831 2019-03-07  Chris Dumez  <cdumez@apple.com>
3832
3833         Regression(r242580) WebKit.NetworkProcessCrashWithPendingConnection API is crashing on iOS debug
3834         https://bugs.webkit.org/show_bug.cgi?id=195416
3835
3836         Reviewed by Antti Koivisto.
3837
3838         Drop ASSERT_NOT_REACHED() in WebPage::didCompletePageTransition() when the tree is still frozen due to
3839         LayerTreeFreezeReason::ProcessSuspended. As demonstrated by this API test, nothing prevents a load from
3840         completing and WebPage::didCompletePageTransition() to get called *after* WebProcess::prepareToSuspend()
3841         has been called. From the logging during the test, I can tell that WebProcess::processDidResume() gets
3842         called later on and the LayerTreeFreezeReason::ProcessSuspended freezing reason gets dropped, as expected.
3843
3844         * WebProcess/WebPage/WebPage.cpp:
3845         (WebKit::WebPage::didCompletePageTransition):
3846
3847 2019-03-07  Chris Dumez  <cdumez@apple.com>
3848
3849         Clean up / simplify ProcessAssertion code
3850         https://bugs.webkit.org/show_bug.cgi?id=195394
3851
3852         Reviewed by Geoffrey Garen.
3853
3854         Clean up / simplify ProcessAssertion code to facilitate its maintenance and make it
3855         less error-prone.
3856
3857         * Platform/IPC/mac/ConnectionMac.mm:
3858         (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
3859         * UIProcess/ProcessAssertion.cpp:
3860         (WebKit::ProcessAssertion::ProcessAssertion):
3861         (WebKit::ProcessAssertion::setState):
3862         * UIProcess/ProcessAssertion.h:
3863         (WebKit::ProcessAssertion::Client::~Client):
3864         (WebKit::ProcessAssertion::setClient):
3865         (WebKit::ProcessAssertion::client):
3866         * UIProcess/ProcessThrottler.cpp:
3867         (WebKit::ProcessThrottler::didConnectToProcess):
3868         * UIProcess/ProcessThrottler.h:
3869         * UIProcess/ios/ProcessAssertionIOS.mm:
3870         (-[WKProcessAssertionBackgroundTaskManager dealloc]):
3871         (-[WKProcessAssertionBackgroundTaskManager addAssertionNeedingBackgroundTask:]):
3872         (-[WKProcessAssertionBackgroundTaskManager removeAssertionNeedingBackgroundTask:]):
3873         (-[WKProcessAssertionBackgroundTaskManager _notifyAssertionsOfImminentSuspension]):
3874         (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]):
3875         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
3876         (WebKit::ProcessAssertion::ProcessAssertion):
3877         (WebKit::ProcessAssertion::processAssertionWasInvalidated):
3878         (WebKit::ProcessAssertion::setState):
3879         (WebKit::ProcessAndUIAssertion::updateRunInBackgroundCount):
3880         (WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
3881         (WebKit::ProcessAndUIAssertion::~ProcessAndUIAssertion):
3882         (WebKit::ProcessAndUIAssertion::processAssertionWasInvalidated):
3883         (WebKit::ProcessAndUIAssertion::setState):
3884         (WebKit::ProcessAndUIAssertion::uiAssertionWillExpireImminently):
3885
3886 2019-03-07  Commit Queue  <commit-queue@webkit.org>
3887
3888         Unreviewed, rolling out r242297.
3889         https://bugs.webkit.org/show_bug.cgi?id=195430
3890
3891         Broke Microsoft Visio. (Requested by dydz on #webkit).
3892
3893         Reverted changeset:
3894
3895         "[iOS] Turn mouse event simulation on by default"
3896         https://bugs.webkit.org/show_bug.cgi?id=195218
3897         https://trac.webkit.org/changeset/242297
3898
3899 2019-03-07  John Wilander  <wilander@apple.com>
3900
3901         Resource Load Statistics: Log first-party navigations with link decoration
3902         https://bugs.webkit.org/show_bug.cgi?id=195301
3903         <rdar://problem/48569971>
3904
3905         Reviewed by Brent Fulgham.
3906
3907         This patch adds a call to the network process' resource load statistics to
3908         log cross-site navigations with link decoration. The logging checks if the
3909         source of the navigation is a prevalent resource and if so, sets the
3910         appropriate flag for the destination.
3911
3912         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3913         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
3914         (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
3915         (WebKit::ResourceLoadStatisticsDatabaseStore::logSubresourceRedirect):
3916         (WebKit::ResourceLoadStatisticsDatabaseStore::logCrossSiteLoadWithLinkDecoration):
3917         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
3918         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3919         (WebKit::ResourceLoadStatisticsMemoryStore::logCrossSiteLoadWithLinkDecoration):
3920         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
3921         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
3922         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3923         (WebKit::WebResourceLoadStatisticsStore::logCrossSiteLoadWithLinkDecoration):
3924         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3925         * NetworkProcess/NetworkProcess.cpp: