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