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