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