fb4784c9244b08c18e34e33f94574f51c988f1a6
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-01-28  Commit Queue  <commit-queue@webkit.org>
2
3         Unreviewed, rolling out r240630.
4         https://bugs.webkit.org/show_bug.cgi?id=193958
5
6         Broke Apple internal builds (Requested by rniwa on #webkit).
7
8         Reverted changeset:
9
10         "Add back some includes that got removed at some point."
11         https://bugs.webkit.org/show_bug.cgi?id=193942
12         https://trac.webkit.org/changeset/240630
13
14 2019-01-28  Devin Rousso  <drousso@apple.com>
15
16         Web Inspector: provide a way to edit page WebRTC settings on a remote target
17         https://bugs.webkit.org/show_bug.cgi?id=193863
18         <rdar://problem/47572764>
19
20         Reviewed by Joseph Pecoraro.
21
22         * Shared/WebPreferences.yaml:
23         Add page-level settings for WebRTC preferences.
24
25 2019-01-28  Ross Kirsling  <ross.kirsling@sony.com>
26
27         Remove unnecessary `using namespace WTF`s (or at least restrict their scope).
28         https://bugs.webkit.org/show_bug.cgi?id=193941
29
30         Reviewed by Alex Christensen.
31
32         * Shared/linux/WebMemorySamplerLinux.cpp:
33
34 2019-01-28  Fujii Hironori  <Hironori.Fujii@sony.com>
35
36         [Win] WebCore/platform/Process.h is conflicting with process.h
37         https://bugs.webkit.org/show_bug.cgi?id=193944
38
39         Reviewed by Ross Kirsling.
40
41         * Shared/ChildProcess.h:
42         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
43         * Shared/unix/ChildProcessMain.cpp:
44         * UIProcess/API/APINavigation.h:
45         * UIProcess/ChildProcessProxy.h:
46         * UIProcess/Launcher/ProcessLauncher.h:
47         * UIProcess/WebProcessPool.cpp:
48         * UIProcess/WebProcessProxy.h:
49
50 2019-01-28  Jon Lee  <jonlee@apple.com>
51
52         Update Screen Capture preference
53         https://bugs.webkit.org/show_bug.cgi?id=193947
54         rdar://problem/47620199
55
56         Reviewed by Youenn Fablet.
57
58         * Shared/WebPreferences.yaml:
59
60 2019-01-28  Andy Estes  <aestes@apple.com>
61
62         [watchOS] Enable Parental Controls content filtering
63         https://bugs.webkit.org/show_bug.cgi?id=193939
64         <rdar://problem/46641912>
65
66         Reviewed by Ryosuke Niwa.
67
68         * Configurations/FeatureDefines.xcconfig:
69
70 2019-01-28  David Kilzer  <ddkilzer@apple.com>
71
72         REGRESSION (r236481): Move soft-linking of LocalAuthentication.framework out of LocalAuthenticationSoftLink.h
73         <https://webkit.org/b/193884>
74
75         Reviewed by Jiewen Tan.
76
77         * SourcesCocoa.txt:
78         * UnifiedSources-input.xcfilelist:
79         * WebKit.xcodeproj/project.pbxproj:
80         - Add LocalAuthenticationSoftLink.mm to the project.
81
82         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h:
83         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.mm: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h.
84         - Move soft-linking implementation to
85           LocalAuthenticationSoftLink.mm.
86
87 2019-01-28  Timothy Hatcher  <timothy@apple.com>
88
89         Add back some includes that got removed at some point.
90         https://bugs.webkit.org/show_bug.cgi?id=193942
91
92         Reviewed by Tim Horton.
93
94         * UIProcess/API/Cocoa/WKWebView.mm:
95         * UIProcess/API/Cocoa/WKWebViewInternal.h:
96         * UIProcess/ios/PageClientImplIOS.h:
97         * UIProcess/ios/PageClientImplIOS.mm:
98
99 2019-01-28  Timothy Hatcher  <timothy@apple.com>
100
101         Make it easier for non-Apple ports to enable dark mode CSS support.
102         https://bugs.webkit.org/show_bug.cgi?id=193882
103
104         Reviewed by Megan Gardner.
105
106         Make modern WebKit code for dark mode usable by other ports, to match
107         the WebCore parts that have been cross-platform all along.
108
109         * Shared/WebPageCreationParameters.cpp:
110         (WebKit::WebPageCreationParameters::encode const):
111         (WebKit::WebPageCreationParameters::decode):
112         * Shared/WebPageCreationParameters.h:
113         * UIProcess/PageClient.h:
114         (WebKit::PageClient::effectiveAppearanceIsDark const):
115         * UIProcess/WebPageProxy.cpp:
116         (WebKit::WebPageProxy::creationParameters):
117         (WebKit::WebPageProxy::useDarkAppearance const):
118         (WebKit::WebPageProxy::effectiveAppearanceDidChange):
119         * UIProcess/WebPageProxy.h:
120         * WebProcess/WebPage/WebPage.cpp:
121         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
122         (WebKit::WebPage::setUseDarkAppearance):
123         * WebProcess/WebPage/WebPage.h:
124         * WebProcess/WebPage/WebPage.messages.in:
125
126 2019-01-28  Andy Estes  <aestes@apple.com>
127
128         [Cocoa] Add SPI to _WKUserContentExtensionStore to retrieve its underlying WKContentRuleListStore
129         https://bugs.webkit.org/show_bug.cgi?id=193927
130
131         Reviewed by Tim Horton.
132
133         This is useful for clients migrating from _WKUserContentExtensionStore to the modern
134         WKContentRuleList* APIs.
135
136         * UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:
137         (-[_WKUserContentExtensionStore _contentRuleListStore]):
138         * UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
139
140 2019-01-28  David Kilzer  <ddkilzer@apple.com>
141
142         Move soft-linking of ManagedConfiguration.framework out of ManagedConfigurationSPI.h
143         <https://webkit.org/b/193868>
144
145         Reviewed by Daniel Bates.
146
147         * Platform/spi/ios/ManagedConfigurationSPI.h:
148         - Remove soft-linking code from header.
149         - Add PLATFORM(IOS_FAMILY) && !PLATFORM(IOSMAC) guard.
150
151         * UIProcess/ios/WKContentViewInteraction.mm:
152         (-[WKContentView canPerformActionForWebView:withSender:]):
153         (-[WKContentView _defineForWebView:]):
154         - Add soft-linking code formerly in ManagedConfigurationSPI.h.
155         - Change MCFeatureDefinitionLookupAllowed to use soft-link
156           function getMCFeatureDefinitionLookupAllowed() to remove the
157           #define.
158
159 2019-01-28  Per Arne Vollan  <pvollan@apple.com>
160
161         REGRESSION (r240348): Loading netflix home page panics device
162         https://bugs.webkit.org/show_bug.cgi?id=193936
163
164         Reviewed by Alexey Proskuryakov.
165
166         Temporarily enable permissive call filtering.
167
168         * WebProcess/com.apple.WebProcess.sb.in:
169
170 2019-01-28  Joseph Pecoraro  <pecoraro@apple.com>
171
172         [iOS] Attempting to open a Keynote document to iCloud.com from iCloud Files causes crash
173         https://bugs.webkit.org/show_bug.cgi?id=193456
174         <rdar://problem/47275642>
175
176         Reviewed by Brent Fulgham.
177
178         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
179         Allow access to iconservices.
180
181 2019-01-28  Daniel Bates  <dabates@apple.com>
182
183         [iOS] Make Window virtual key code computation match Mac
184         https://bugs.webkit.org/show_bug.cgi?id=193452
185
186         Reviewed by Ryosuke Niwa.
187
188         Compute the Windows virtual key code from the WebEvent.
189
190         * Shared/ios/WebIOSEventFactory.mm:
191         (WebIOSEventFactory::createWebKeyboardEvent):
192
193 2019-01-28  Brent Fulgham  <bfulgham@apple.com>
194
195         REGRESSION (r240498): Storage Access API prompts result is not remembered
196         https://bugs.webkit.org/show_bug.cgi?id=193922
197         <rdar://problem/47608767>
198
199         Reviewed by Chris Dumez.
200
201         The refactoring in r240498 bypassed bookkeeping in ResourceLoadStatisticsMemoryStore
202         that kept track of whether a successful user prompt had been encountered. This
203         patch corrects this codepath so the user is not prompted repeatedly after approving
204         use of the Storage Access API.
205
206         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
207         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess): Switch from Move operator to
208         const reference to allow the method to be called by the NetworkProcess.
209         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
210         * NetworkProcess/NetworkProcess.cpp:
211         (WebKit::NetworkProcess::grantStorageAccess): Request access through the WebResourceLoadStatistics
212         object, rather than jumping directly to the NetworkStorageSession.
213
214 2019-01-28  Chris Dumez  <cdumez@apple.com>
215
216         Regression(PSON) Crash under WebPageProxy::didStartProgress()
217         https://bugs.webkit.org/show_bug.cgi?id=193915
218         <rdar://problem/47560907>
219
220         Reviewed by Alex Christensen.
221
222         * UIProcess/WebPageProxy.cpp:
223         (WebKit::WebPageProxy::close):
224         Make sure we destroy the ProvisionalPageProxy if the page gets closed as we do not want to keep receiving
225         IPC after this or even worse, commit the provisional page.
226
227         (WebKit::WebPageProxy::didStartProgress):
228         Add an assertion in didStartProgress() to make sure we do not receive this IPC after the page has been
229         closed.
230
231 2019-01-28  Antoine Quint  <graouts@apple.com>
232
233         Limit user-agent interactions based on the touch-action property on iOS
234         https://bugs.webkit.org/show_bug.cgi?id=193447
235
236         Unreviewed build fix.
237
238         * UIProcess/API/Cocoa/WKWebView.mm:
239
240 2019-01-28  Antoine Quint  <graouts@apple.com>
241
242         Limit user-agent interactions based on the touch-action property on iOS
243         https://bugs.webkit.org/show_bug.cgi?id=193447
244
245         Unreviewed build fix.
246
247         * UIProcess/ios/WKContentViewInteraction.mm:
248
249 2019-01-28  Brent Fulgham  <bfulgham@apple.com>
250
251         Remove the UIProcess components of the ResourceLoadStatistics code
252         https://bugs.webkit.org/show_bug.cgi?id=193303
253         <rdar://problem/47160073>
254
255         Reviewed by Chris Dumez.
256
257         Now that the ResourceLoadStatistics code is running in the NetworkProcess, we can get rid
258         of the UIProcess copies of these routines.
259
260         Tested by existing ResourceLoadStatistics and StorageAccess tests.
261
262         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
263         (WebKit::ResourceLoadStatisticsMemoryStore::updateClientSideCookiesAgeCap):
264         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
265         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
266         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
267         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
268         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
269         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
270         (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler):
271         (WebKit::WebResourceLoadStatisticsStore::logTestingEvent):
272         (WebKit::WebResourceLoadStatisticsStore::notifyResourceLoadStatisticsProcessed):
273         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
274         (WebKit::WebResourceLoadStatisticsStore::topPrivatelyControlledDomainsWithWebsiteData):
275         (WebKit::WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue const):
276         (WebKit::WebResourceLoadStatisticsStore::notifyPageStatisticsTelemetryFinished const):
277         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
278         * UIProcess/WebProcessProxy.cpp:
279         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): Deleted.
280         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData): Deleted.
281         * UIProcess/WebProcessProxy.h:
282         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
283         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
284         (WebKit::WebsiteDataStore::removeData):
285         (WebKit::WebsiteDataStore::setMaxStatisticsEntries):
286         (WebKit::WebsiteDataStore::setPruneEntriesDownTo):
287         (WebKit::WebsiteDataStore::setGrandfatheringTime):
288         (WebKit::WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval):
289         (WebKit::WebsiteDataStore::dumpResourceLoadStatistics):
290         (WebKit::WebsiteDataStore::isPrevalentResource):
291         (WebKit::WebsiteDataStore::setPrevalentResource):
292         (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode):
293         (WebKit::WebsiteDataStore::isVeryPrevalentResource):
294         (WebKit::WebsiteDataStore::setVeryPrevalentResource):
295         (WebKit::WebsiteDataStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
296         (WebKit::WebsiteDataStore::setSubframeUnderTopFrameOrigin):
297         (WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder):
298         (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameOrigin):
299         (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder):
300         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo):
301         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom):
302         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo):
303         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom):
304         (WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo):
305         (WebKit::WebsiteDataStore::clearPrevalentResource):
306         (WebKit::WebsiteDataStore::resetParametersToDefaultValues):
307         (WebKit::WebsiteDataStore::submitTelemetry):
308         (WebKit::WebsiteDataStore::scheduleClearInMemoryAndPersistent):
309         (WebKit::WebsiteDataStore::scheduleCookieBlockingUpdate):
310         (WebKit::WebsiteDataStore::scheduleStatisticsAndDataRecordsProcessing):
311         (WebKit::WebsiteDataStore::setLastSeen):
312         (WebKit::WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned):
313         (WebKit::WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured):
314         (WebKit::WebsiteDataStore::hasStorageAccess):
315         (WebKit::WebsiteDataStore::requestStorageAccess):
316         (WebKit::WebsiteDataStore::grantStorageAccess):
317         (WebKit::WebsiteDataStore::setTimeToLiveUserInteraction):
318         (WebKit::WebsiteDataStore::logUserInteraction):
319         (WebKit::WebsiteDataStore::hasHadUserInteraction):
320         (WebKit::WebsiteDataStore::clearUserInteraction):
321         (WebKit::WebsiteDataStore::setGrandfathered):
322         (WebKit::WebsiteDataStore::webProcessWillOpenConnection):
323         (WebKit::WebsiteDataStore::webProcessDidCloseConnection):
324         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
325         (WebKit::WebsiteDataStore::didCreateNetworkProcess):
326         (WebKit::WebsiteDataStore::topPrivatelyControlledDomainsWithWebsiteData): Deleted.
327         (WebKit::WebsiteDataStore::removeDataForTopPrivatelyControlledDomains): Deleted.
328         (WebKit::WebsiteDataStore::setCacheMaxAgeCap): Deleted.
329         (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor): Deleted.
330         (WebKit::WebsiteDataStore::setAgeCapForClientSideCookies): Deleted.
331         (WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler): Deleted.
332         (WebKit::WebsiteDataStore::grantStorageAccessHandler): Deleted.
333         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler): Deleted.
334         (WebKit::WebsiteDataStore::removePrevalentDomains): Deleted.
335         (WebKit::WebsiteDataStore::isGrandfathered): Deleted.
336         * UIProcess/WebsiteData/WebsiteDataStore.h:
337
338 2019-01-28  Antoine Quint  <graouts@apple.com>
339
340         Limit user-agent interactions based on the touch-action property on iOS
341         https://bugs.webkit.org/show_bug.cgi?id=193447
342         <rdar://problem/47283874>
343
344         Reviewed by Antti Koivisto and Simon Fraser.
345
346         Handle the "none", "pan-x", "pan-y" and "pinch-zoom" values for the touch-action property by querying the scrolling tree whenever a touch begins
347         to identify whether its point is contained within the region of an element with a non-auto touch-action property. If it is, we use the list of
348         permitted touch actions such to then customize the behavior of the nearest scroll view to pan or zoom only as instructed.
349
350         * Shared/WebCoreArgumentCoders.cpp:
351         (IPC::ArgumentCoder<TouchActionData>::encode):
352         (IPC::ArgumentCoder<TouchActionData>::decode):
353         (IPC::ArgumentCoder<EventTrackingRegions>::encode):
354         (IPC::ArgumentCoder<EventTrackingRegions>::decode):
355         (IPC::ArgumentCoder<Region>::decode):
356         * Shared/WebCoreArgumentCoders.h:
357         * UIProcess/API/Cocoa/WKWebView.mm:
358         (-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Account for panning constraints set on the content view to prevent deceleration
359         to pan the view if it ought not.
360         (-[WKWebView _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]): Implement an additional
361         UIScrollView delegation method to apply the panning constraints set on the content view while panning.
362         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
363         (WebKit::RemoteScrollingCoordinatorProxy::touchActionDataAtPoint const):
364         (WebKit::RemoteScrollingCoordinatorProxy::touchActionDataForScrollNodeID const):
365         (WebKit::RemoteScrollingCoordinatorProxy::setTouchDataForTouchIdentifier):
366         (WebKit::RemoteScrollingCoordinatorProxy::clearTouchDataForTouchIdentifier):
367         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
368         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
369         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
370         (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Apply the same logic as in WKWebView.
371         (-[WKScrollingNodeScrollViewDelegate _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]): Apply
372         the same logic as in WKWebView.
373         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::touchActionData const):
374         * UIProcess/WebPageProxy.h:
375         (WebKit::WebPageProxy::isScrollingOrZooming const):
376         * UIProcess/ios/WKContentViewInteraction.h:
377         * UIProcess/ios/WKContentViewInteraction.mm:
378         (-[WKContentView preventsPanningInXAxis]):
379         (-[WKContentView preventsPanningInYAxis]):
380         (-[WKContentView cleanupInteraction]):
381         (-[WKContentView _webTouchEventsRecognized:]):
382         (-[WKContentView _handleTouchActionsForTouchEvent:]): As we process touches, check whether there are touch actions set for this touch's points' locations. Based
383         on those touch actions, either setDefaultPrevented on the _touchEventGestureRecognizer if the touch action is "none" or selectively disable panning and zooming.
384         (-[WKContentView _resetPanningPreventionFlags]):
385         (-[WKContentView _didEndScrollingOrZooming]):
386
387 2019-01-28  Antti Koivisto  <antti@apple.com>
388
389         WebUserContentController::removeUserScriptMessageHandlerInternal may deref and delete itself
390         https://bugs.webkit.org/show_bug.cgi?id=193901
391         <rdar://problem/47338669>
392
393         Reviewed by David Kilzer.
394
395         Don't know how to repro.
396
397         * WebProcess/UserContent/WebUserContentController.cpp:
398         (WebKit::WebUserContentController::removeUserScriptMessageHandlerInternal):
399
400         Calling userMessageHandlers.removeFirstMatching() may remove the last ref to this
401         (because WebUserMessageHandlerDescriptorProxy refs WebUserContentController).
402         Fix by protecting this over the function.
403
404 2018-12-15  Darin Adler  <darin@apple.com>
405
406         Replace many uses of String::format with more type-safe alternatives
407         https://bugs.webkit.org/show_bug.cgi?id=192742
408
409         Reviewed by Mark Lam.
410
411         * Shared/WebMemorySampler.cpp:
412         (WebKit::WebMemorySampler::writeHeaders): Use makeString.
413
414         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
415         (WebKit::LocalAuthenticator::makeCredential): Use string concatentation.
416
417         * UIProcess/WebInspectorUtilities.cpp:
418         (WebKit::inspectorPageGroupIdentifierForPage): Use makeString.
419         * UIProcess/WebProcessPool.cpp:
420         (WebKit::WebProcessPool::processDidFinishLaunching): Ditto.
421         (WebKit::WebProcessPool::startMemorySampler): Ditto.
422
423 2019-01-27  Jiewen Tan  <jiewen_tan@apple.com>
424
425         Use a load optimizer for some sites
426         https://bugs.webkit.org/show_bug.cgi?id=193881
427         <rdar://problem/46325455>
428
429         Reviewed by Brent Fulgham.
430
431         We will try to speed up some sites with a dedicated load optimizer. The load optimizer lives
432         within the WebsiteDataStore as one client instance should have only one and it should live
433         as long as the client lives. How does the load optimizer work? It intercepts every load in
434         the navigation state. If a request meets some requirements, it will then fetch the request
435         from its own cache. Once the fetch succeeds, the original load will be ignored and the
436         optimizer will display the cached content.
437
438         Covered by API tests.
439
440         * SourcesCocoa.txt:
441         * UIProcess/Cocoa/LoadOptimizer.h: Added.
442         * UIProcess/Cocoa/LoadOptimizer.mm: Added.
443         * UIProcess/Cocoa/MediaCaptureUtilities.h:
444         * UIProcess/Cocoa/NavigationState.mm:
445         (WebKit::tryInterceptNavigation):
446         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
447         (WebKit::tryAppLink): Deleted.
448         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
449         (WebKit::WebsiteDataStore::WebsiteDataStore):
450         * UIProcess/WebsiteData/WebsiteDataStore.h:
451         (WebKit::WebsiteDataStore::loadOptimizer):
452         * WebKit.xcodeproj/project.pbxproj:
453
454 2019-01-25  Brian Burg  <bburg@apple.com>
455
456         Web Automation: add support for simulating single touches to Automation.performInteractionSequence
457         https://bugs.webkit.org/show_bug.cgi?id=193852
458         <rdar://problem/28360781>
459
460         Reviewed by Joseph Pecoraro and Simon Fraser.
461
462         This patch makes it possible to simulate touches via the Actions API. The approach is to
463         use a stripped down version of HIDEventGenerator to send HID events to the UIWindow.
464         The initial version supports a single touch point; this may be expanded if needed, but
465         so far it hasn't been an impediment when running desktop-oriented WebDriver test suites.
466
467         As part of implementing this support, I went through and added [somewhat obnoxious] ENABLE()
468         guards so that we don't mistakenly compile mouse support on iOS and touch on Mac,
469         and vice versa. Each of the interaction methods---touch, mouse, keyboard---can be independently
470         compiled out. If none is supported (i.e., Windows), then we don't even try to compile
471         platformSimulate*Interaction methods or SimulatedInputDispatcher. This allows WebAutomationSession
472         to not include members and code that are never going to be used on a particular platform.
473
474         This functionality is covered by existing WebDriver test suites that use Element Click command.
475         Additional tests that explicitly include 'touch' pointerType will be submitted to WPT later.
476
477         * UIProcess/Automation/Automation.json: Update comment.
478
479         * UIProcess/Automation/SimulatedInputDispatcher.h:
480         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
481         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
482         - Add appropriate guards for code specific to each interaction type.
483         - Handle SimulatedInputSourceType::Touch and call out to dispatch events.
484
485         * UIProcess/Automation/WebAutomationSession.h:
486         * UIProcess/Automation/WebAutomationSession.cpp:
487         (WebKit::WebAutomationSession::WebAutomationSession):
488         (WebKit::WebAutomationSession::terminate):
489         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
490         (WebKit::WebAutomationSession::mouseEventsFlushedForPage):
491         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
492         (WebKit::WebAutomationSession::willClosePage):
493         Add appropriate guards for code specific to each interaction type.
494
495         (WebKit::WebAutomationSession::isSimulatingUserInteraction const):
496         Add new hook so that we can detect when a touch simulation is in progress.
497         We don't rely on checking WebKit's event queue, so use a flag.
498
499         (WebKit::WebAutomationSession::simulateTouchInteraction):
500         (WebKit::WebAutomationSession::performMouseInteraction):
501         (WebKit::WebAutomationSession::performKeyboardInteractions):
502         (WebKit::WebAutomationSession::cancelInteractionSequence):
503         (WebKit::WebAutomationSession::performInteractionSequence):
504         - Add appropriate guards for code specific to each interaction type.
505         - Bail out immediately if a requested interaction type is not supported.
506         - Shim Touch input type to Mouse if mouse is not supported but touches are.
507         Nearly all WebDriver tests in the wild will be requesting a 'mouse' pointerType,
508         so this is necessary for compatibility. It's easier to shim at this level than try
509         to implement platformSimulateMouseInteraction for iOS because
510         platformSimulateMouseinteraction does not use a completion handler but the iOS
511         implementation would require that.
512
513         (WebKit::WebAutomationSession::platformSimulateMouseInteraction): Deleted.
514         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): Deleted.
515         - Remove these stubs. Platform methods of this class are no longer being filled
516         with stubs on unsupported platforms because we expect the command to fail earlier.
517
518         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
519         (WebKit::WebAutomationSession::platformSimulateTouchInteraction):
520         - Add appropriate guards for code specific to each interaction type.
521         - Implement new platform method to simulate touches. This uses _WKTouchEventGenerator.
522
523         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
524         Add appropriate guards for code specific to each interaction type.
525
526         * UIProcess/_WKTouchEventGenerator.h: Added.
527         * UIProcess/_WKTouchEventGenerator.mm: Added.
528         (simpleCurveInterpolation):
529         (calculateNextCurveLocation):
530         (delayBetweenMove):
531         (+[_WKTouchEventGenerator sharedTouchEventGenerator]):
532         (+[_WKTouchEventGenerator nextEventCallbackID]):
533         (-[_WKTouchEventGenerator init]):
534         (-[_WKTouchEventGenerator dealloc]):
535         (-[_WKTouchEventGenerator _createIOHIDEventType:]):
536         (-[_WKTouchEventGenerator _sendHIDEvent:]):
537         (-[_WKTouchEventGenerator _sendMarkerHIDEventWithCompletionBlock:]):
538         (-[_WKTouchEventGenerator _updateTouchPoints:count:]):
539         (-[_WKTouchEventGenerator touchDownAtPoints:touchCount:]):
540         (-[_WKTouchEventGenerator touchDown:touchCount:]):
541         (-[_WKTouchEventGenerator touchDown:]):
542         (-[_WKTouchEventGenerator liftUpAtPoints:touchCount:]):
543         (-[_WKTouchEventGenerator liftUp:touchCount:]):
544         (-[_WKTouchEventGenerator liftUp:]):
545         (-[_WKTouchEventGenerator moveToPoints:touchCount:duration:]):
546         (-[_WKTouchEventGenerator touchDown:completionBlock:]):
547         (-[_WKTouchEventGenerator liftUp:completionBlock:]):
548         (-[_WKTouchEventGenerator moveToPoint:duration:completionBlock:]):
549         (-[_WKTouchEventGenerator receivedHIDEvent:]):
550         Copied and simplified from HIDEventGenerator in WebKitTestRunner.
551
552         * WebKit.xcodeproj/project.pbxproj:
553         Add _WKTouchEventGenerator.{h,mm} and make it a private header. The client needs to
554         route received HID events to -receivedHIDEvent: in order to detect when the marker
555         HID event has been processed (and thus the interaction is completed).
556
557         * config.h: Add ENABLE(WEBDRIVER_*_INTERACTIONS) macros here.
558
559 2019-01-26  Simon Fraser  <simon.fraser@apple.com>
560
561         Have composited RenderIFrame layers make FrameHosting scrolling tree nodes to parent the iframe's scrolling node
562         https://bugs.webkit.org/show_bug.cgi?id=193879
563
564         Reviewed by Antti Koivisto.
565
566         Need a specialization of dump() for ScrollingStateFrameHostingNode to avoid infinite recursion.
567
568         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
569         (WebKit::dump):
570
571 2019-01-27  Chris Fleizach  <cfleizach@apple.com>
572
573         AX: Introduce a static accessibility tree
574         https://bugs.webkit.org/show_bug.cgi?id=193348
575         <rdar://problem/47203295>
576
577         Reviewed by Ryosuke Niwa.
578
579         * Configurations/FeatureDefines.xcconfig:
580         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
581         (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
582
583 2019-01-26  Simon Fraser  <simon.fraser@apple.com>
584
585         Allow scrolling tree nodes to exist in a detached state
586         https://bugs.webkit.org/show_bug.cgi?id=193754
587
588         Reviewed by Zalan Bujtas.
589
590         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
591         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
592
593 2019-01-25  Tim Horton  <timothy_horton@apple.com>
594
595         REGRESSION (r238818): Snapshot is removed too late after swiping back on Twitter
596         https://bugs.webkit.org/show_bug.cgi?id=193860
597         <rdar://problem/47535022>
598
599         Reviewed by Antti Koivisto.
600
601         * UIProcess/Cocoa/ViewGestureController.cpp:
602         (WebKit::ViewGestureController::didStartProvisionalOrSameDocumentLoadForMainFrame):
603         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
604         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
605         * UIProcess/Cocoa/ViewGestureController.h:
606         Treat provisional load and same document load the same: they already both
607         unpause the snapshot removal tracker, request render tree size notifications,
608         but same-document navigation was missing the call to dispatchAfterEnsuringDrawing
609         and thus would get stuck waiting for RepaintAfterNavigation.
610
611 2019-01-25  Ryosuke Niwa  <rniwa@webkit.org>
612
613         Need a mechanism to override navigator.userAgent
614         https://bugs.webkit.org/show_bug.cgi?id=193762
615         <rdar://problem/47504939>
616
617         Reviewed by Brent Fulgham.
618
619         This patch adds a new _WKWebsitePolicies SPI to specify the user agent string returned by
620         navigator.userAgent without affecting the user agent string used to send network requests.
621
622         Tests: WebKit.WebsitePoliciesCustomJavaScriptUserAgent
623                WebKit.WebsitePoliciesCustomUserAgents
624
625         * Shared/WebsitePoliciesData.cpp:
626         (WebKit::WebsitePoliciesData::encode const):
627         (WebKit::WebsitePoliciesData::decode):
628         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
629         * Shared/WebsitePoliciesData.h:
630         * UIProcess/API/APIWebsitePolicies.cpp:
631         (API::WebsitePolicies::data):
632         * UIProcess/API/APIWebsitePolicies.h:
633         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
634         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
635         (-[_WKWebsitePolicies setCustomJavaScriptUserAgent:]):
636         (-[_WKWebsitePolicies customJavaScriptUserAgent]):
637
638 2019-01-25  Devin Rousso  <drousso@apple.com>
639
640         Web Inspector: provide a way to edit page settings on a remote target
641         https://bugs.webkit.org/show_bug.cgi?id=193813
642         <rdar://problem/47359510>
643
644         Reviewed by Joseph Pecoraro.
645
646         * WebProcess/WebPage/WebInspectorUI.h:
647         (WebKit::WebInspectorUI::isRemote() const): Added.
648         * WebProcess/WebPage/RemoteWebInspectorUI.h:
649         (WebKit::RemoteWebInspectorUI::isRemote() const): Added.
650
651 2019-01-25  Dean Jackson  <dino@apple.com>
652
653         REGRESSION: Some USDz from 3rd party websites don't go directly to AR QL
654         https://bugs.webkit.org/show_bug.cgi?id=193831
655         <rdar://problem/47399263>
656
657         Reviewed by Chris Dumez.
658
659         A System Preview (<a rel="ar">) displays in a modal and doesn't trigger
660         a navigation. If the link was cross origin, it was causing a process swap,
661         which meant that the response defaulted back to a navigation.
662
663         The fix is to not cause a PSON when the navigation is a system preview.
664
665         * UIProcess/API/APINavigation.h:
666         (API::Navigation::shouldForceDownload const): This is now just tracking
667         the "download" attribute, and not including System Preview.
668         (API::Navigation::isSystemPreview const): New method to check for a
669         navigation triggered as a System Preview.
670         * UIProcess/WebPageProxy.cpp: Move the code from receivedPolicyDecision to
671         receivedNavigationPolicyDecision, so that downloads and System Previews are
672         detected before we decide to change process.
673         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
674         (WebKit::WebPageProxy::receivedPolicyDecision):
675
676 2019-01-25  Tim Horton  <timothy_horton@apple.com>
677
678         Find-in-page on nyt.com scrolls around without touching the screen when find holes are visible
679         https://bugs.webkit.org/show_bug.cgi?id=193853
680
681         Reviewed by Simon Fraser.
682
683         * WebProcess/WebPage/ios/FindControllerIOS.mm:
684         (WebKit::FindController::updateFindIndicator):
685         There is no reason to scroll/zoom to the find indicator just because the
686         holes are up, we should only do it on initial indicator presentation.
687         This was a mistake in r178755 that was previously never exercised because
688         isShowingOverlay was always false.
689
690 2019-01-25  Keith Rollin  <krollin@apple.com>
691
692         Update Xcode projects with "Check .xcfilelists" build phase
693         https://bugs.webkit.org/show_bug.cgi?id=193790
694         <rdar://problem/47201374>
695
696         Reviewed by Alex Christensen.
697
698         Support for XCBuild includes specifying inputs and outputs to various
699         Run Script build phases. These inputs and outputs are specified as
700         .xcfilelist files. Once created, these .xcfilelist files need to be
701         kept up-to-date. In order to check that they are up-to-date or not,
702         add an Xcode build step that invokes an external script that performs
703         the checking. If the .xcfilelists are found to be out-of-date, update
704         them, halt the build, and instruct the developer to restart the build
705         with up-to-date files.
706
707         At this time, the checking and regenerating is performed only if the
708         WK_ENABLE_CHECK_XCFILELISTS environment variable is set to 1. People
709         who want to use this facility can set this variable and test out the
710         checking/regenerating. Once it seems like there are no egregious
711         issues that upset a developer's workflow, we'll unconditionally enable
712         this facility.
713
714         * Scripts/check-xcfilelists.sh: Added.
715         * WebKit.xcodeproj/project.pbxproj:
716
717 2019-01-25  Alex Christensen  <achristensen@webkit.org>
718
719         Move logic from ChildProcess::setApplicationIsDaemon to NetworkProcess::initializeProcess
720         https://bugs.webkit.org/show_bug.cgi?id=193844
721
722         Reviewed by Andy Estes.
723
724         This simplifies ChildProcess and removes NetworkProcess-specific code from this generic abstraction.
725
726         * NetworkProcess/mac/NetworkProcessMac.mm:
727         (WebKit::NetworkProcess::initializeProcess):
728         * Shared/ios/ChildProcessIOS.mm:
729         (WebKit::ChildProcess::setApplicationIsDaemon): Deleted.
730         * Shared/mac/ChildProcessMac.mm:
731         (WebKit::ChildProcess::setApplicationIsDaemon): Deleted.
732
733 2019-01-25  Keith Rollin  <krollin@apple.com>
734
735         Update Xcode projects with "Apply Configuration to XCFileLists" build target
736         https://bugs.webkit.org/show_bug.cgi?id=193781
737         <rdar://problem/47201153>
738
739         Reviewed by Alex Christensen.
740
741         Part of generating the .xcfilelists used as part of adopting XCBuild
742         includes running `make DerivedSources.make` from a standalone script.
743         It’s important for this invocation to have the same environment as
744         when the actual build invokes `make DerivedSources.make`. If the
745         environments are different, then the two invocations will provide
746         different results. In order to get the same environment in the
747         standalone script, have the script launch xcodebuild targeting the
748         "Apply Configuration to XCFileLists" build target, which will then
749         re-invoke our standalone script. The script is now running again, this
750         time in an environment with all workspace, project, target, xcconfig
751         and other environment variables established.
752
753         The "Apply Configuration to XCFileLists" build target accomplishes
754         this task via a small embedded shell script that consists only of:
755
756             eval "${WK_SUBLAUNCH_SCRIPT_PARAMETERS[@]}"
757
758         The process that invokes "Apply Configuration to XCFileLists" first
759         sets WK_SUBLAUNCH_SCRIPT_PARAMETERS to an array of commands to be
760         evaluated and exports it into the shell environment. When xcodebuild
761         is invoked, it inherits the value of this variable and can `eval` the
762         contents of that variable. Our external standalone script can then set
763         WK_SUBLAUNCH_SCRIPT_PARAMETERS to the path to itself, along with a set
764         of command-line parameters needed to restart itself in the appropriate
765         state.
766
767         * WebKit.xcodeproj/project.pbxproj:
768
769 2019-01-25  Alex Christensen  <achristensen@webkit.org>
770
771         Add SPI to inform an application that "Go Back" has been clicked from a safe browsing warning
772         https://bugs.webkit.org/show_bug.cgi?id=193802
773         <rdar://problem/46010580>
774
775         Reviewed by Andy Estes.
776
777         * UIProcess/API/APIUIClient.h:
778         (API::UIClient::didClickGoBackFromSafeBrowsingWarning):
779         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
780         * UIProcess/Cocoa/UIDelegate.h:
781         * UIProcess/Cocoa/UIDelegate.mm:
782         (WebKit::UIDelegate::setDelegate):
783         (WebKit::UIDelegate::UIClient::didClickGoBackFromSafeBrowsingWarning):
784         * UIProcess/WebPageProxy.cpp:
785         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
786
787 2019-01-25  Daniel Bates  <dabates@apple.com>
788
789         [iOS] Pressing Tab key doesn't move to next cell with Google Sheets
790         https://bugs.webkit.org/show_bug.cgi?id=193048
791         <rdar://problem/46433836>
792
793         Reviewed by Brent Fulgham.
794
795         WebCore knows how interpret the Tab and Shift + Tab keys. When building with UIKit keyboard additions
796         we do not need to register key commands for handling them from the UIProcess code. Instead UIKit will
797         sends key events for these commands to us. This will make the behavior of these key commands when executed
798         in an editable field match the behavior of these command when executed in a non-editable field since
799         both code paths will now go through WebCore.
800
801         * UIProcess/ios/WKContentViewInteraction.mm:
802         (-[WKContentView keyCommands]): Only compile when building with !USE(UIKIT_KEYBOARD_ADDITIONS).
803
804 2019-01-25  Alex Christensen  <achristensen@webkit.org>
805
806         Fix Linux build.
807
808         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
809         (WebKit::NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate):
810
811 2019-01-25  Keith Rollin  <krollin@apple.com>
812
813         Update WebKitAdditions.xcconfig with correct order of variable definitions
814         https://bugs.webkit.org/show_bug.cgi?id=193793
815         <rdar://problem/47532439>
816
817         Reviewed by Alex Christensen.
818
819         XCBuild changes the way xcconfig variables are evaluated. In short,
820         all config file assignments are now considered in part of the
821         evaluation. When using the new build system and an .xcconfig file
822         contains multiple assignments of the same build setting:
823
824         - Later assignments using $(inherited) will inherit from earlier
825           assignments in the xcconfig file.
826         - Later assignments not using $(inherited) will take precedence over
827           earlier assignments. An assignment to a more general setting will
828           mask an earlier assignment to a less general setting. For example,
829           an assignment without a condition ('FOO = bar') will completely mask
830           an earlier assignment with a condition ('FOO[sdk=macos*] = quux').
831
832         This affects some of our .xcconfig files, in that sometimes platform-
833         or sdk-specific definitions appear before the general definitions.
834         Under the new evaluations rules, the general definitions alway take
835         effect because they always overwrite the more-specific definitions. The
836         solution is to swap the order, so that the general definitions are
837         established first, and then conditionally overwritten by the
838         more-specific definitions.
839
840         * Configurations/BaseTarget.xcconfig:
841         * Configurations/Version.xcconfig:
842         * Configurations/WebKit.xcconfig:
843
844 2019-01-25  Keith Rollin  <krollin@apple.com>
845
846         Update existing .xcfilelists
847         https://bugs.webkit.org/show_bug.cgi?id=193791
848         <rdar://problem/47201706>
849
850         Reviewed by Alex Christensen.
851
852         Many .xcfilelist files were added in r238824 in order to support
853         XCBuild. Update these with recent changes to the set of build files
854         and with the current generate-xcfilelist script.
855
856         * DerivedSources-input.xcfilelist:
857         * DerivedSources-output.xcfilelist:
858         * UnifiedSources-input.xcfilelist:
859         * UnifiedSources-output.xcfilelist:
860
861 2019-01-25  Per Arne Vollan  <pvollan@apple.com>
862
863         [iOS] Deny mach lookups to services not used.
864         https://bugs.webkit.org/show_bug.cgi?id=193828
865
866         Reviewed by Brent Fulgham.
867
868         Start denying mach lookups to iOS services, which were previously allowed with reporting.
869         Living-on has indicated that these services are not used.
870
871         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
872
873 2019-01-25  Brent Fulgham  <bfulgham@apple.com>
874
875         Activate the WebResourceLoadStatisticsStore in the NetworkProcess and deactivate it in the UIProcess.
876         https://bugs.webkit.org/show_bug.cgi?id=193297
877         <rdar://problem/47158841>
878
879         Reviewed by Alex Christensen.
880
881         This patch activates the ResourceLoadStatistics code in the NetworkProcess, and turns
882         it off in the UIProcess. It also updates test infrastructure to work with this change
883         in architecture.
884
885         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
886         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceLoading): Added.
887         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceRedirect): Added.
888         (WebKit::ResourceLoadStatisticsMemoryStore::logWebSocketLoading): Added.
889         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
890         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading): Added.
891         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect): Added.
892         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading): Added.
893         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
894         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
895         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCapForPrevalentResources): Deleted.
896         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
897         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
898         (WebKit::NetworkConnectionToWebProcess::logSubresourceLoading): Added.
899         (WebKit::NetworkConnectionToWebProcess::logSubresourceRedirect): Added.
900         (WebKit::NetworkConnectionToWebProcess::logWebSocketLoading): Added.
901         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
902         * NetworkProcess/NetworkSession.cpp:
903         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
904         * UIProcess/WebProcessPool.cpp:
905         (WebKit::WebProcessPool::ensureNetworkProcess):
906         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
907         (WebKit::WebsiteDataStore::parameters):
908         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
909         (WebKit::WebsiteDataStore::removeData):
910         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
911         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
912         * Webprocess/WebProcess.cpp:
913         (WebKit::WebProcess::initializeWebProcess): Register new ResourceLoadObserver callbacks.
914
915 2019-01-25  Ryosuke Niwa  <rniwa@webkit.org>
916
917         iOS: inputmode="none" disables hardware keyboard's globe key
918         https://bugs.webkit.org/show_bug.cgi?id=193811
919         <rdar://problem/47406553>
920
921         Reviewed by Wenson Hsieh.
922
923         Removed the support for inputmode="none" for now since we need a new SPI from UIKit
924         to properly implement this feature some time in the future.
925
926         * UIProcess/ios/WKContentViewInteraction.mm:
927         (-[WKContentView _zoomToRevealFocusedElement]):
928         (-[WKContentView inputView]):
929         (-[WKContentView requiresAccessoryView]):
930         (-[WKContentView textInputTraits]):
931
932 2019-01-25  David Kilzer  <ddkilzer@apple.com>
933
934         Move soft-linking of Lookup.framework out of LookupSPI.h
935         <https://webkit.org/b/193815>
936
937         Reviewed by Tim Horton.
938
939         * UIProcess/Cocoa/WebViewImpl.mm:
940         (-[WKWindowVisibilityObserver dealloc]):
941         (-[WKWindowVisibilityObserver startObservingLookupDismissalIfNeeded]):
942         - Move soft-linking to LookupSoftLink.{h,mm}.
943
944 2019-01-25  Antti Koivisto  <antti@apple.com>
945
946         REGRESSION (PSON): After swipe back, first few attempts to swipe forward not recognized as swipe gestures
947         https://bugs.webkit.org/show_bug.cgi?id=193818
948         <rdar://problem/47456584>
949
950         Reviewed by Tim Horton.
951
952         We don't hit the RenderTreeSizeThreshold milestone to remove the snapshot and allow interaction because we request it
953         from a wrong process (the one we are leaving behind).
954
955         * UIProcess/Cocoa/ViewGestureController.cpp:
956         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
957
958         Request the RenderTreeSizeThreshold notification when the load has started and we know the process to use.
959
960         (WebKit::ViewGestureController::SnapshotRemovalTracker::hasOutstandingEvent):
961         * UIProcess/Cocoa/ViewGestureController.h:
962         (WebKit::ViewGestureController::SnapshotRemovalTracker::renderTreeSizeThreshold const):
963         (WebKit::ViewGestureController::SnapshotRemovalTracker::setRenderTreeSizeThreshold):
964         * UIProcess/mac/ViewGestureControllerMac.mm:
965         (WebKit::ViewGestureController::endSwipeGesture):
966
967         Don't request immediately, save the threshold to SnapshotRemovalTracker.
968
969         (WebKit::ViewGestureController::requestRenderTreeSizeNotificationIfNeeded):
970
971         Do the request to the right process.
972
973         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
974         (WebKit::ViewGestureGeometryCollector::setRenderTreeSizeNotificationThreshold):
975
976         Ensure we send the notification even if we reached the threshold before it was requested.
977
978         (WebKit::ViewGestureGeometryCollector::sendDidHitRenderTreeSizeThresholdIfNeeded):
979         (WebKit::ViewGestureGeometryCollector::mainFrameDidLayout):
980         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
981         (WebKit::ViewGestureGeometryCollector::setRenderTreeSizeNotificationThreshold): Deleted.
982
983 2019-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
984
985         [iOS] Rename some WebKit-internal functions and variables that reference "data interaction"
986         https://bugs.webkit.org/show_bug.cgi?id=193829
987
988         Reviewed by Tim Horton.
989
990         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
991         (WebKit::WebPageProxy::setDragCaretRect):
992         * UIProcess/PageClient.h:
993         * UIProcess/WebPageProxy.h:
994         * UIProcess/WebPageProxy.messages.in:
995         * UIProcess/ios/PageClientImplIOS.h:
996         * UIProcess/ios/PageClientImplIOS.mm:
997         (WebKit::PageClientImpl::didHandleDragStartRequest):
998         (WebKit::PageClientImpl::didConcludeEditDrag):
999         (WebKit::PageClientImpl::didChangeDragCaretRect):
1000         (WebKit::PageClientImpl::didHandleStartDataInteractionRequest): Deleted.
1001         (WebKit::PageClientImpl::didConcludeEditDataInteraction): Deleted.
1002         (WebKit::PageClientImpl::didChangeDataInteractionCaretRect): Deleted.
1003         * UIProcess/ios/WKContentViewInteraction.h:
1004         * UIProcess/ios/WKContentViewInteraction.mm:
1005         (-[WKContentView setupInteraction]):
1006         (-[WKContentView cleanupInteraction]):
1007         (-[WKContentView setupDragAndDropInteractions]):
1008         (-[WKContentView teardownDragAndDropInteractions]):
1009         (-[WKContentView _didHandleDragStartRequest:]):
1010         (-[WKContentView _didConcludeEditDrag:]):
1011         (-[WKContentView _didChangeDragCaretRect:currentRect:]):
1012         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
1013         (-[WKContentView setupDataInteractionDelegates]): Deleted.
1014         (-[WKContentView teardownDataInteractionDelegates]): Deleted.
1015         (-[WKContentView _didHandleStartDataInteractionRequest:]): Deleted.
1016         (-[WKContentView _didConcludeEditDataInteraction:]): Deleted.
1017         (-[WKContentView _didChangeDataInteractionCaretRect:currentRect:]): Deleted.
1018         * UIProcess/ios/WebPageProxyIOS.mm:
1019         (WebKit::WebPageProxy::didHandleDragStartRequest):
1020         (WebKit::WebPageProxy::requestDragStart):
1021         (WebKit::WebPageProxy::didConcludeEditDrag):
1022         (WebKit::WebPageProxy::didHandleStartDataInteractionRequest): Deleted.
1023         (WebKit::WebPageProxy::requestStartDataInteraction): Deleted.
1024         (WebKit::WebPageProxy::didConcludeEditDataInteraction): Deleted.
1025         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1026         (WebKit::WebDragClient::didConcludeEditDrag):
1027         * WebProcess/WebPage/WebPage.h:
1028         * WebProcess/WebPage/WebPage.messages.in:
1029         * WebProcess/WebPage/ios/WebPageIOS.mm:
1030         (WebKit::WebPage::requestDragStart):
1031         (WebKit::WebPage::requestAdditionalItemsForDragSession):
1032         (WebKit::WebPage::didConcludeEditDrag):
1033         (WebKit::WebPage::requestStartDataInteraction): Deleted.
1034         (WebKit::WebPage::didConcludeEditDataInteraction): Deleted.
1035
1036 2019-01-25  Alex Christensen  <achristensen@webkit.org>
1037
1038         WKWebView.goBack should reload if there is a safe browsing warning
1039         https://bugs.webkit.org/show_bug.cgi?id=193805
1040         <rdar://problem/46908216>
1041
1042         Reviewed by Geoff Garen.
1043
1044         If a WKWebView is showing a safe browsing warning and the user clicks a back button
1045         in the app which calls WKWebView.goBack, the WKWebView is in a state where it has not navigated yet,
1046         so actually going back will appear to the user to go back twice.  We can't just do nothing because the
1047         app is in a state where it is expecting a navigation to happen.  Reloading achieves what the user expects
1048         and makes the app work like the app expects.
1049
1050         * UIProcess/API/C/WKPage.cpp:
1051         (WKPageGoBack):
1052         * UIProcess/API/Cocoa/WKWebView.mm:
1053         (-[WKWebView goBack]):
1054         * UIProcess/PageClient.h:
1055         (WebKit::PageClient::hasSafeBrowsingWarning const):
1056         * UIProcess/mac/PageClientImplMac.h:
1057         * UIProcess/mac/PageClientImplMac.mm:
1058         (WebKit::PageClientImpl::hasSafeBrowsingWarning const):
1059
1060 2019-01-25  Chris Dumez  <cdumez@apple.com>
1061
1062         Regression(PSON) cross-site provisional page is not canceled if a new same-site one is started
1063         https://bugs.webkit.org/show_bug.cgi?id=193788
1064         <rdar://problem/47531231>
1065
1066         Reviewed by Alex Christensen.
1067
1068         When the page starts a new provisional load, make sure we cancel any pending one in the provisional
1069         process, as it would have happened in the first provisional load happened in the same process.
1070         Without this, we could have 2 parallel loads happening, one in the committed process and another
1071         in the provisional one, leading to assertion failures in debug.
1072
1073         * UIProcess/WebPageProxy.cpp:
1074         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
1075
1076 2019-01-25  Chris Dumez  <cdumez@apple.com>
1077
1078         Drop WebKit::WebKitPolicyAction type as it is no longer needed
1079         https://bugs.webkit.org/show_bug.cgi?id=193827
1080
1081         Reviewed by Antti Koivisto.
1082
1083         Drop WebKit::WebKitPolicyAction type as it is no longer needed. It is now identical to
1084         WebCore::PolicyAction.
1085
1086         * Shared/WebPolicyAction.h: Removed.
1087         * UIProcess/WebFramePolicyListenerProxy.cpp:
1088         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
1089         (WebKit::WebFramePolicyListenerProxy::use):
1090         (WebKit::WebFramePolicyListenerProxy::download):
1091         (WebKit::WebFramePolicyListenerProxy::ignore):
1092         * UIProcess/WebFramePolicyListenerProxy.h:
1093         * UIProcess/WebFrameProxy.cpp:
1094         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
1095         * UIProcess/WebFrameProxy.h:
1096         * UIProcess/WebPageProxy.cpp:
1097         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1098         (WebKit::WebPageProxy::receivedPolicyDecision):
1099         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1100         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
1101         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1102         (WebKit::WebPageProxy::decidePolicyForResponseShared):
1103         * UIProcess/WebPageProxy.h:
1104         * WebKit.xcodeproj/project.pbxproj:
1105         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1106         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
1107         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1108         * WebProcess/WebPage/WebFrame.cpp:
1109         (WebKit::WebFrame::didReceivePolicyDecision):
1110         (WebKit::toPolicyAction): Deleted.
1111         * WebProcess/WebPage/WebFrame.h:
1112         * WebProcess/WebPage/WebPage.cpp:
1113         (WebKit::WebPage::didReceivePolicyDecision):
1114         * WebProcess/WebPage/WebPage.h:
1115
1116 2019-01-25  Per Arne Vollan  <pvollan@apple.com>
1117
1118         [iOS] Add logging of calls
1119         https://bugs.webkit.org/show_bug.cgi?id=193784
1120
1121         Reviewed by Brent Fulgham.
1122
1123         Add permissive logging of calls on iOS.
1124
1125         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1126
1127 2019-01-25  Chris Dumez  <cdumez@apple.com>
1128
1129         Regression(PSON?) Crash under NavigationState::NavigationClient::decidePolicyForNavigationAction()
1130         https://bugs.webkit.org/show_bug.cgi?id=193779
1131         <rdar://problem/46170903>
1132
1133         Reviewed by Antti Koivisto.
1134
1135         * UIProcess/Cocoa/NavigationState.mm:
1136         (WebKit::tryAppLink):
1137         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1138         We were crashing when trying to get the URL of the main frame, which was sad because we never
1139         ended up using the main frame URL. Therefore, this patch drops the code in question.
1140
1141         * UIProcess/ProvisionalPageProxy.cpp:
1142         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
1143         Add assertion to make sure that the DecidePolicyForNavigationActionAsync IPC it is getting
1144         from the process is related to its main frame.
1145
1146 2019-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
1147
1148         Need a way for JavaScript (or bundle) code to participate in undo
1149         https://bugs.webkit.org/show_bug.cgi?id=190009
1150         <rdar://problem/44807048>
1151
1152         Reviewed by Ryosuke Niwa.
1153
1154         Invalidate undo steps when removing them from WebPage. Invalidation is a no-op for editing actions that come
1155         from the UA, but for custom undo steps backed by an UndoItem, we clear out the custom undo step's pointer to its
1156         UndoItem and additionally disconnect the UndoItem from its UndoManager.
1157
1158         * WebProcess/WebPage/WebPage.cpp:
1159         (WebKit::WebPage::addWebUndoStep):
1160         (WebKit::WebPage::removeWebEditCommand):
1161         * WebProcess/WebPage/WebUndoStep.h:
1162         (WebKit::WebUndoStep::invalidate):
1163
1164 2019-01-25  Patrick Griffis  <pgriffis@igalia.com>
1165
1166         [GTK][WPE] Add API to add paths to sandbox
1167         https://bugs.webkit.org/show_bug.cgi?id=193571
1168
1169         This allows applications to add paths to the web process
1170         if required by web extensions.
1171
1172         Reviewed by Michael Catanzaro.
1173
1174         * UIProcess/API/glib/WebKitWebContext.cpp:
1175         (webkit_web_context_add_path_to_sandbox):
1176         * UIProcess/API/gtk/WebKitWebContext.h:
1177         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1178         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
1179         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
1180         (WebKit::bubblewrapSpawn):
1181         * UIProcess/WebProcessPool.h:
1182         * UIProcess/glib/WebProcessProxyGLib.cpp:
1183         (WebKit::WebProcessProxy::platformGetLaunchOptions):
1184
1185 2019-01-24  Ryosuke Niwa  <rniwa@webkit.org>
1186
1187         iOS: Split keyboard should not shrink visualViewport.height
1188         https://bugs.webkit.org/show_bug.cgi?id=193798
1189
1190         Reviewed by Tim Horton.
1191
1192         Treat a split keyboard like a floating keyboard and don't consider its input view bounds in computing the visible content rects.
1193
1194         No new tests since while it's possible to transition between split and merged keyboard using some SPI,
1195         there isn't a reliable mechanism to reset the keyboard state. e.g. we need to wait for a hard-coded amount of time.
1196
1197         * Platform/spi/ios/UIKitSPI.h:
1198         * UIProcess/API/Cocoa/WKWebView.mm:
1199         (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
1200
1201 2019-01-24  Eric Carlson  <eric.carlson@apple.com>
1202
1203         [iOS] Silence MediaPlayer compile warnings
1204         https://bugs.webkit.org/show_bug.cgi?id=193780
1205         <rdar://problem/47518428>
1206
1207         Reviewed by Jer Noble.
1208
1209         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
1210
1211 2019-01-24  Truitt Savell  <tsavell@apple.com>
1212
1213         Unreviewed, rolling out r240446.
1214
1215         Casued 5 API failures
1216
1217         Reverted changeset:
1218
1219         "Activate the WebResourceLoadStatisticsStore in the
1220         NetworkProcess and deactivate it in the UIProcess."
1221         https://bugs.webkit.org/show_bug.cgi?id=193297
1222         https://trac.webkit.org/changeset/240446
1223
1224 2019-01-24  Brent Fulgham  <bfulgham@apple.com>
1225
1226         Activate the WebResourceLoadStatisticsStore in the NetworkProcess and deactivate it in the UIProcess.
1227         https://bugs.webkit.org/show_bug.cgi?id=193297
1228         <rdar://problem/47158841>
1229
1230         Reviewed by Alex Christensen.
1231
1232         This patch activates the ResourceLoadStatistics code in the NetworkProcess, and turns
1233         it off in the UIProcess. It also updates test infrastructure to work with this change
1234         in architecture.
1235
1236         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1237         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceLoading): Added.
1238         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceRedirect): Added.
1239         (WebKit::ResourceLoadStatisticsMemoryStore::logWebSocketLoading): Added.
1240         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1241         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading): Added.
1242         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect): Added.
1243         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading): Added.
1244         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
1245         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
1246         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCapForPrevalentResources): Deleted.
1247         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1248         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1249         (WebKit::NetworkConnectionToWebProcess::logSubresourceLoading): Added.
1250         (WebKit::NetworkConnectionToWebProcess::logSubresourceRedirect): Added.
1251         (WebKit::NetworkConnectionToWebProcess::logWebSocketLoading): Added.
1252         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1253         * NetworkProcess/NetworkSession.cpp:
1254         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
1255         * UIProcess/WebProcessPool.cpp:
1256         (WebKit::WebProcessPool::ensureNetworkProcess):
1257         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1258         (WebKit::WebsiteDataStore::parameters):
1259         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1260         (WebKit::WebsiteDataStore::removeData):
1261         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
1262         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
1263         * Webprocess/WebProcess.cpp:
1264         (WebKit::WebProcess::initializeWebProcess): Register new ResourceLoadObserver callbacks.
1265
1266 2019-01-24  John Wilander  <wilander@apple.com>
1267
1268         Add Ad Click Attribution as an internal/experimental feature
1269         https://bugs.webkit.org/show_bug.cgi?id=193685
1270         <rdar://problem/47450399>
1271
1272         Reviewed by Brent Fulgham.
1273
1274         * Shared/WebPreferences.yaml:
1275             Added AdClickAttributionEnabled as a runtime enabled feature, off by default.
1276
1277 2019-01-24  Antti Koivisto  <antti@apple.com>
1278
1279         [PSON] Flash on back navigation on Mac
1280         https://bugs.webkit.org/show_bug.cgi?id=193716
1281         <rdar://problem/47148458>
1282
1283         Reviewed by Chris Dumez.
1284
1285         We close the page immediately if we fail to suspend. Layers disappear and we get a flash.
1286
1287         * UIProcess/SuspendedPageProxy.cpp:
1288         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
1289         (WebKit::SuspendedPageProxy::close):
1290
1291         Track closed state so we don't send the message twice, causing unhandled message errors in web process.
1292
1293         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
1294
1295         Close the suspended page if the suspension fails.
1296         Skip this if we are using web process side compositing on Mac.
1297
1298         * UIProcess/SuspendedPageProxy.h:
1299         * UIProcess/WebPageProxy.cpp:
1300         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
1301
1302         On Mac, close the failed SuspendedPageProxy when entering compositing mode. At this point we don't need it to keep layers alive.
1303
1304         * UIProcess/WebProcessPool.cpp:
1305         (WebKit::WebProcessPool::closeFailedSuspendedPagesForPage):
1306         * UIProcess/WebProcessPool.h:
1307         * WebProcess/WebPage/WebPage.cpp:
1308         (WebKit::WebPage::suspendForProcessSwap):
1309
1310         Don't close the page on suspension failure. This is now managed by the UI process.
1311
1312 2019-01-24  Chris Dumez  <cdumez@apple.com>
1313
1314         Regression(PSON) Back/Forward list items' URL sometimes gets replaced with the URL of a subframe
1315         https://bugs.webkit.org/show_bug.cgi?id=193761
1316         <rdar://problem/47456405>
1317
1318         Reviewed by Alex Christensen.
1319
1320         When doing a history navigation cross-process, the UIProcess would first send the back/forward list items
1321         to the destination WebProcess via WebPage::updateBackForwardListForReattach(), then ask the process to
1322         navigate to the expected back/forward list item.
1323
1324         WebPage::updateBackForwardListForReattach() would call restoreSessionInternal(), which would call
1325         toHistoryItem() on each BackForwardListItem. This may end up creating more than one HistoryItem for each
1326         BackForwardListItem because HistoryItems are part of a tree (each frame has its own list of history items).
1327
1328         Note that BackForwardListItems and HistoryItem share a BackForwardItemIdentifier which is a
1329         (processIdentifier, itemIdentifier) pair. We normally generate the HistoryItem's identifier from inside
1330         its constructor like so:
1331         `{ Process::identifier(), generateObjectIdentifier<BackForwardItemIdentifier::ItemIdentifierType>() }`
1332
1333         However, when calling updateBackForwardListForReattach() and constructing children HistoryItem,
1334         applyFrameState() would generate the identifier by itself and passing it to the HistoryItem constructor.
1335         Its genegates the ID the exact same way so this would in theory not be a problem. Unfortunately, both
1336         calls to generateObjectIdentifier() get inlined and both call sites end up with their own static counter
1337         to generate ids. As a result, we may end up with conflicts as HistoryItems for child frames (restored
1338         by restoreSessionInternal()) can end up with the same identifier as HistoryItems for top frames.
1339
1340         This confusion would lead to the WebContent process sending the UIProcess bad information and the URL
1341         of subframes could end up as the WebBackForwardListItem's mainframe URL.
1342
1343         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
1344         (WebKit::applyFrameState):
1345         Stop calling generateObjectIdentifier() explicitly and let the HistoryItem constructor take care of it.
1346         Calling generateObjectIdentifier() for the same type from different places is not safe due to inlining.
1347
1348 2019-01-24  Ross Kirsling  <ross.kirsling@sony.com>
1349
1350         Move FileSystem to WTF
1351         https://bugs.webkit.org/show_bug.cgi?id=193602
1352
1353         Reviewed by Yusuke Suzuki.
1354
1355         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp:
1356         * NetworkProcess/NetworkDataTaskBlob.h:
1357         * NetworkProcess/NetworkProcess.cpp:
1358         * NetworkProcess/cache/CacheStorageEngine.cpp:
1359         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1360         * NetworkProcess/cache/NetworkCache.cpp:
1361         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
1362         * NetworkProcess/cache/NetworkCacheData.cpp:
1363         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
1364         * NetworkProcess/cache/NetworkCacheFileSystem.h:
1365         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
1366         * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
1367         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
1368         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1369         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1370         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1371         * NetworkProcess/mac/NetworkProcessMac.mm:
1372         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1373         * PluginProcess/unix/PluginProcessMainUnix.cpp:
1374         * Shared/PersistencyUtils.cpp:
1375         * Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp:
1376         * Shared/Plugins/unix/PluginSearchPath.cpp:
1377         * Shared/WebMemorySampler.h:
1378         * Shared/glib/ProcessExecutablePathGLib.cpp:
1379         * Shared/ios/ChildProcessIOS.mm:
1380         * Shared/mac/ChildProcessMac.mm:
1381         * Shared/mac/SandboxExtensionMac.mm:
1382         * UIProcess/API/APIContentRuleListStore.cpp:
1383         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
1384         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
1385         * UIProcess/API/glib/IconDatabase.cpp:
1386         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
1387         * UIProcess/API/glib/WebKitFileChooserRequest.cpp:
1388         * UIProcess/API/glib/WebKitWebContext.cpp:
1389         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
1390         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp:
1391         * UIProcess/Automation/WebAutomationSession.cpp:
1392         * UIProcess/Cocoa/DownloadClient.mm:
1393         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1394         * UIProcess/Cocoa/WebViewImpl.mm:
1395         * UIProcess/DeviceIdHashSaltStorage.cpp:
1396         * UIProcess/Downloads/DownloadProxy.cpp:
1397         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
1398         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
1399         * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
1400         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
1401         * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:
1402         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
1403         * UIProcess/ServiceWorkerProcessProxy.cpp:
1404         * UIProcess/WebStorage/LocalStorageDatabase.cpp:
1405         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
1406         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1407         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1408         * UIProcess/glib/WebProcessProxyGLib.cpp:
1409         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
1410         * UIProcess/gtk/WebProcessPoolGtk.cpp:
1411         * UIProcess/ios/WKContentViewInteraction.mm:
1412         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1413         * UIProcess/mac/WebPageProxyMac.mm:
1414         * UIProcess/win/WebProcessPoolWin.cpp:
1415         * UIProcess/win/WebView.cpp:
1416         * UIProcess/wpe/WebProcessPoolWPE.cpp:
1417         * WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.cpp:
1418         * WebProcess/InjectedBundle/glib/InjectedBundleGlib.cpp:
1419         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
1420         * WebProcess/Plugins/Netscape/NetscapePluginStream.h:
1421         * WebProcess/Plugins/PluginProcessConnection.cpp:
1422         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
1423         * WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp:
1424         * WebProcess/WebPage/win/WebInspectorUIWin.cpp:
1425         * WebProcess/cocoa/WebProcessCocoa.mm:
1426
1427 2019-01-23  Simon Fraser  <simon.fraser@apple.com>
1428
1429         Create "frame hosting" nodes for the scrolling tree
1430         https://bugs.webkit.org/show_bug.cgi?id=193753
1431
1432         Reviewed by Antti Koivisto.
1433
1434         When the scrolling tree crosses frame boundaries, mutations in the parent frame currently
1435         require the iframe's scrolling node to get reparented in a new ancestor, which requires
1436         a layer tree walk of the parent frame. This is error-prone, and not very future-proof.
1437
1438         Fix this by introducing "frame hosting" scrolling tree nodes. These are mostly inert
1439         nodes that are owned by the RenderIFrame's layer backing in the parent frame, and exist
1440         to provide a consistent parent node for the subframe's scrolling node.
1441
1442         This patch adds the node types, but does not instantiate them yet.
1443
1444         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1445         (ArgumentCoder<ScrollingStateFrameHostingNode>::encode):
1446         (ArgumentCoder<ScrollingStateFrameHostingNode>::decode):
1447         (WebKit::encodeNodeAndDescendants):
1448         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
1449         (WebKit::dump):
1450         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1451         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1452         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
1453         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
1454         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1455         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1456
1457 2019-01-23  Ross Kirsling  <ross.kirsling@sony.com>
1458
1459         [Curl] Unreviewed build fix for r240292 and friends.
1460
1461         WinCairo test stability must be restored in subsequent patch.
1462
1463         * NetworkProcess/curl/NetworkProcessCurl.cpp:
1464         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
1465         (WebKit::NetworkProcess::setNetworkProxySettings):
1466
1467 2019-01-23  Commit Queue  <commit-queue@webkit.org>
1468
1469         Unreviewed, rolling out r240403.
1470         https://bugs.webkit.org/show_bug.cgi?id=193757
1471
1472         "Causes multiple crashes on macOS port (probably used wrong
1473         ENABLE macro)" (Requested by ddkilzer on #webkit).
1474
1475         Reverted changeset:
1476
1477         "[Curl] Unreviewed build fix for r240292 and friends."
1478         https://trac.webkit.org/changeset/240403
1479
1480 2019-01-23  Ross Kirsling  <ross.kirsling@sony.com>
1481
1482         [Curl] Unreviewed build fix for r240292 and friends.
1483
1484         WinCairo test stability must be restored in subsequent patch.
1485
1486         * NetworkProcess/curl/NetworkProcessCurl.cpp:
1487         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
1488         (WebKit::NetworkProcess::setNetworkProxySettings):
1489
1490 2019-01-23  Alex Christensen  <achristensen@webkit.org>
1491
1492         Stop using NetworkProcess::singleton
1493         https://bugs.webkit.org/show_bug.cgi?id=193700
1494
1495         Reviewed by Don Olmstead.
1496
1497         This replaces it with a NeverDestroyed<NetworkProcess> and paves the way for more interesting things.
1498
1499         * NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp:
1500         * NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm:
1501         (WebKit::initializeChildProcess<WebKit::NetworkProcess>):
1502         * NetworkProcess/NetworkProcess.cpp:
1503         (WebKit::NetworkProcess::NetworkProcess):
1504         (WebKit::NetworkProcess::singleton): Deleted.
1505         * NetworkProcess/NetworkProcess.h:
1506         * NetworkProcess/soup/NetworkProcessMainSoup.cpp:
1507         (WebKit::initializeChildProcess<WebKit::NetworkProcess>):
1508         * NetworkProcess/win/NetworkProcessMainWin.cpp:
1509         (WebKit::initializeChildProcess<WebKit::NetworkProcess>):
1510         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
1511         (WebKit::initializeChildProcess):
1512         (WebKit::XPCServiceInitializer):
1513
1514 2019-01-23  Ryan Haddad  <ryanhaddad@apple.com>
1515
1516         Unreviewed, rolling out r240343.
1517
1518         Caused 4 PSON API test failures.
1519
1520         Reverted changeset:
1521
1522         "[PSON] Flash on back navigation on Mac"
1523         https://bugs.webkit.org/show_bug.cgi?id=193716
1524         https://trac.webkit.org/changeset/240343
1525
1526 2019-01-23  Chris Dumez  <cdumez@apple.com>
1527
1528         Deprecate API to limit the maximum number of WebProcesses
1529         https://bugs.webkit.org/show_bug.cgi?id=193725
1530         <rdar://problem/47464879>
1531
1532         Reviewed by Geoff Garen.
1533
1534         Deprecate API to limit the maximum number of WebProcesses and make it a no-op. It adds
1535         complexity and is not safe (conflicts with PSON).
1536
1537         Add a new usesSingleWebProcess SPI to _WKProcessPoolConfiguration to be used by
1538         Minibrowser / Safari in order to disable process per tab (can be useful for debugging).
1539         Note that enabling the single WebProcess mode will disable PSON and process prewarming.
1540
1541         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1542         (API::ProcessPoolConfiguration::createWithLegacyOptions):
1543         (API::ProcessPoolConfiguration::copy):
1544         * UIProcess/API/APIProcessPoolConfiguration.h:
1545         * UIProcess/API/C/WKContext.cpp:
1546         (WKContextSetMaximumNumberOfProcesses):
1547         (WKContextGetMaximumNumberOfProcesses):
1548         * UIProcess/API/C/WKContext.h:
1549         * UIProcess/API/Cocoa/WKProcessPool.mm:
1550         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1551         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1552         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1553         (-[_WKProcessPoolConfiguration maximumProcessCount]):
1554         (-[_WKProcessPoolConfiguration setMaximumProcessCount:]):
1555         (-[_WKProcessPoolConfiguration usesSingleWebProcess]):
1556         (-[_WKProcessPoolConfiguration setUsesSingleWebProcess:]):
1557         (-[_WKProcessPoolConfiguration description]):
1558         * UIProcess/API/glib/WebKitWebContext.cpp:
1559         (webkitWebContextConstructed):
1560         (webkit_web_context_set_process_model):
1561         (webkit_web_context_set_web_process_count_limit):
1562         * UIProcess/WebProcessPool.cpp:
1563         (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
1564         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
1565         (WebKit::WebProcessPool::processForNavigationInternal):
1566         * UIProcess/WebProcessPool.h:
1567
1568 2019-01-23  Brent Fulgham  <bfulgham@apple.com>
1569
1570         Switch NetworkStorageSession portions of ResourceLoadStatistics to Async message passing style
1571         https://bugs.webkit.org/show_bug.cgi?id=193659
1572         <rdar://problem/47433290>
1573
1574         Reviewed by Alex Christensen.
1575
1576         Change the implementations of ResourceLoadStatistics code in NetworkStorageSession to use the
1577         'sendWithAsyncReply' so that more of the code is autogenerated. This should make test runs more
1578         consistent, and should reduce the possibility of bookkeeping errors in the message handling
1579         implementations.
1580
1581         Fix the implementation of NetworkProcessProxy::clearCallbackStates to remove the manually constructed
1582         (and incomplete) message callbacks. These errors are a big reason to move to the auto-generated
1583         'sendWithAsyncReply' implementatoin. Ditto for NetworkProcessProxy::didClose.
1584
1585         This patch also moves an initializaton call (WebsiteDataStore::didCreateNetworkProcess) from
1586         'ensureNetworkProcess' to 'processDidFinishLaunching'. In current code, the call happens before
1587         a connection is established to the network process, causing initialization messages to get dropped
1588         leading to test system flakiness.
1589
1590         Finally: The WK API test code was updated to ensure that completion handlers are always called, even
1591         when built without ENABLE_RESOURCE_LOAD_STATISTICS defined.
1592
1593         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1594         * NetworkProcess/Classifier/ShouldGrandfatherStatistics.h: Added.
1595         * NetworkProcess/Classifier/StorageAccessStatus.h: Added.
1596         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1597         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
1598         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1599         * NetworkProcess/NetworkProcess.cpp:
1600         (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
1601         (WebKit::NetworkProcess::setAgeCapForClientSideCookies):
1602         (WebKit::NetworkProcess::scheduleClearInMemoryAndPersistent):
1603         (WebKit::NetworkProcess::hasStorageAccessForFrame):
1604         (WebKit::NetworkProcess::requestStorageAccess):
1605         (WebKit::NetworkProcess::grantStorageAccess):
1606         (WebKit::NetworkProcess::removeAllStorageAccess):
1607         (WebKit::NetworkProcess::setCacheMaxAgeCapForPrevalentResources):
1608         (WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources):
1609         (WebKit::NetworkProcess::deleteWebsiteData):
1610         * NetworkProcess/NetworkProcess.h:
1611         * NetworkProcess/NetworkProcess.messages.in:
1612         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1613         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
1614         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
1615         (WKWebsiteDataStoreStatisticsResetToConsistentState):
1616         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1617         * UIProcess/Network/NetworkProcessProxy.cpp:
1618         (WebKit::NetworkProcessProxy::clearCallbackStates): Remove incomplete clean-up code that
1619         is now autogenerated.
1620         (WebKit::NetworkProcessProxy::didClose): Ditto.
1621         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
1622         (WebKit::NetworkProcessProxy::scheduleClearInMemoryAndPersistent):
1623         (WebKit::NetworkProcessProxy::setAgeCapForClientSideCookies):
1624         (WebKit::NetworkProcessProxy::hasStorageAccessForFrame):
1625         (WebKit::NetworkProcessProxy::requestStorageAccess):
1626         (WebKit::NetworkProcessProxy::grantStorageAccess):
1627         (WebKit::NetworkProcessProxy::removeAllStorageAccess):
1628         (WebKit::NetworkProcessProxy::setCacheMaxAgeCapForPrevalentResources):
1629         (WebKit::NetworkProcessProxy::setCacheMaxAgeCap):
1630         (WebKit::NetworkProcessProxy::resetCacheMaxAgeCapForPrevalentResources):
1631         (WebKit::NetworkProcessProxy::didUpdateBlockCookies): Deleted.
1632         (WebKit::NetworkProcessProxy::didSetAgeCapForClientSideCookies): Deleted.
1633         (WebKit::NetworkProcessProxy::didUpdateRuntimeSettings): Deleted.
1634         (WebKit::NetworkProcessProxy::storageAccessRequestResult): Deleted.
1635         (WebKit::NetworkProcessProxy::storageAccessOperationResult): Deleted.
1636         (WebKit::NetworkProcessProxy::didRemoveAllStorageAccess): Deleted.
1637         (WebKit::NetworkProcessProxy::didSetCacheMaxAgeCapForPrevalentResources): Deleted.
1638         * UIProcess/Network/NetworkProcessProxy.h:
1639         * UIProcess/Network/NetworkProcessProxy.messages.in:
1640         * UIProcess/WebPageProxy.cpp:
1641         * UIProcess/WebProcessPool.cpp:
1642         (WebKit::WebProcessPool::ensureNetworkProcess): Move WebsiteDataStore 'didCreateNetworkProcess'
1643         to 'processDidFinishLaunching'. Currently the call happens before a connection is established,
1644         causing initialization messages to get dropped.
1645         (WebKit::WebProcessPool::processDidFinishLaunching): Ditto.
1646         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1647         (WebKit::WebsiteDataStore::removeData):
1648         (WebKit::WebsiteDataStore::setMaxStatisticsEntries):
1649         (WebKit::WebsiteDataStore::setPruneEntriesDownTo):
1650         (WebKit::WebsiteDataStore::setGrandfatheringTime):
1651         (WebKit::WebsiteDataStore::setCacheMaxAgeCap):
1652         (WebKit::WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval):
1653         (WebKit::WebsiteDataStore::setPrevalentResource):
1654         (WebKit::WebsiteDataStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
1655         (WebKit::WebsiteDataStore::scheduleClearInMemoryAndPersistent):
1656         (WebKit::WebsiteDataStore::setAgeCapForClientSideCookies):
1657         (WebKit::WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned):
1658         (WebKit::WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured):
1659         (WebKit::WebsiteDataStore::setTimeToLiveUserInteraction):
1660         (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
1661         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
1662         * UIProcess/WebsiteData/WebsiteDataStore.h:
1663         * WebKit.xcodeproj/project.pbxproj:
1664
1665 2019-01-23  Sihui Liu  <sihui_liu@apple.com>
1666
1667         Clean up IndexedDB files between tests
1668         https://bugs.webkit.org/show_bug.cgi?id=192796
1669         <rdar://problem/46824999>
1670
1671         Reviewed by Geoffrey Garen.
1672
1673         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1674         (WKWebsiteDataStoreRemoveAllIndexedDatabases):
1675         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1676
1677 2019-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1678
1679         [iOS] fast/events/touch/ios/hover-when-style-change-is-async.html times out
1680         https://bugs.webkit.org/show_bug.cgi?id=193182
1681         <rdar://problem/47452154>
1682
1683         Reviewed by Tim Horton.
1684
1685         Fix an existing bug where blurring an element doesn't always un-suppress text interactions.
1686
1687         * UIProcess/ios/WKContentViewInteraction.mm:
1688         (-[WKContentView _elementDidBlur]):
1689
1690 2019-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
1691
1692         Minor improvements to NetworkProcess
1693         https://bugs.webkit.org/show_bug.cgi?id=193708
1694
1695         Reviewed by Alex Christensen.
1696
1697         * NetworkProcess/NetworkProcess.cpp:
1698         (WebKit::NetworkProcess::switchToNewTestingSession): Fix a spelling error.
1699         (WebKit::NetworkProcess::ensureSession): Add useful assertion.
1700         (WebKit::NetworkProcess::defaultStorageSession const): Split into platform functions.
1701         (WebKit::NetworkProcess::destroySession): Add useful assertion.
1702         * NetworkProcess/NetworkProcess.h:
1703         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1704         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
1705         * NetworkProcess/curl/NetworkProcessCurl.cpp:
1706         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
1707         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1708         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
1709
1710 2019-01-23  Daniel Bates  <dabates@apple.com>
1711
1712         Fix the Apple Internal build. See <rdar://problem/47486758>.
1713
1714         * UIProcess/ios/WKContentViewInteraction.mm:
1715         (-[WKContentView dropInteraction:previewForDroppingItem:withDefault:]):
1716
1717 2019-01-23  Per Arne Vollan  <pvollan@apple.com>
1718
1719         [macOS] Sandbox fails to compile
1720         https://bugs.webkit.org/show_bug.cgi?id=193727
1721         <rdar://problem/47476903>
1722
1723         Reviewed by Brent Fulgham.
1724
1725         Use '(with send-signal SIGKILL)' instead of '(with termination)'.
1726
1727         * WebProcess/com.apple.WebProcess.sb.in:
1728
1729 2019-01-23  Brent Fulgham  <bfulgham@apple.com>
1730
1731         REGRESSION (r240243): CrashTracer: WebKitTestRunnerApp at com.apple.WebKit: WebKit::WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue const + 32
1732         https://bugs.webkit.org/show_bug.cgi?id=193723
1733         <rdar://problem/47476802>
1734
1735         Reviewed by David Kilzer.
1736
1737         The new code added in r240243 could attempt to submit telemetry after the relevant
1738         WebResourceLoadStatisticsStore was destroyed. We should guard against this possibility.
1739
1740         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
1741         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
1742
1743 2019-01-23  Antti Koivisto  <antti@apple.com>
1744
1745         [PSON] Flash on back navigation on Mac
1746         https://bugs.webkit.org/show_bug.cgi?id=193716
1747         <rdar://problem/47148458>
1748
1749         Reviewed by Chris Dumez.
1750
1751         We close the page immediately if we fail to suspend. Layers disappear and we get a flash.
1752
1753         * UIProcess/SuspendedPageProxy.cpp:
1754         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
1755
1756         Remove the suspended page (so closing it on web process side) if the suspension fails.
1757         Skip this if we are using web process side compositing on Mac.
1758
1759         * UIProcess/WebPageProxy.cpp:
1760         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
1761
1762         On Mac, remove failed SuspendedPageProxy when entering compositing mode. At this point we don't need it to keep layers alive.
1763
1764         * UIProcess/WebProcessPool.cpp:
1765         (WebKit::WebProcessPool::removeFailedSuspendedPagesForPage):
1766         * UIProcess/WebProcessPool.h:
1767         * WebProcess/WebPage/WebPage.cpp:
1768         (WebKit::WebPage::suspendForProcessSwap):
1769
1770         Don't close the page on suspension failure.
1771
1772 2019-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1773
1774         Introduce UndoStep::label() and adopt it in WebKitLegacy and WebKit
1775         https://bugs.webkit.org/show_bug.cgi?id=193706
1776         <rdar://problem/44807048>
1777
1778         Reviewed by Ryosuke Niwa.
1779
1780         * UIProcess/Cocoa/WebViewImpl.mm:
1781         (WebKit::WebViewImpl::registerEditCommand):
1782         * UIProcess/WebEditCommandProxy.cpp:
1783         (WebKit::WebEditCommandProxy::WebEditCommandProxy):
1784         * UIProcess/WebEditCommandProxy.h:
1785
1786         Drive-by tweak: make WebEditCommandProxy's backpointer to its WebPageProxy a WeakPtr instead of a raw pointer.
1787         Additionally, call clear() instead of setting m_page to 0 upon invalidation. Also, turn the WebPageProxy*
1788         argument into a WebPageProxy&, since the WebPageProxy must exist when it creates a new WebEditCommandProxy.
1789
1790         (WebKit::WebEditCommandProxy::create):
1791         (WebKit::WebEditCommandProxy::label const):
1792         (WebKit::WebEditCommandProxy::invalidate):
1793         (WebKit::WebEditCommandProxy::editAction const): Deleted.
1794
1795         Adjust UI-side logic to just handle the undo/redo label, rather than map the edit action to a localized string.
1796
1797         * UIProcess/WebPageProxy.cpp:
1798         (WebKit::WebPageProxy::registerEditCommandForUndo):
1799         (WebKit::WebPageProxy::resetState):
1800
1801         Tweak this to use std::exchange instead of copying all the WebEditCommandProxy RefPtrs into a separate Vector
1802         and then iterating over the Vector.
1803
1804         * UIProcess/WebPageProxy.h:
1805         * UIProcess/WebPageProxy.messages.in:
1806
1807         Adjust this so that we only send the undo/redo label over IPC, rather than the edit action type.
1808
1809         * UIProcess/ios/PageClientImplIOS.mm:
1810         (WebKit::PageClientImpl::registerEditCommand):
1811         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1812         (WebKit::WebEditorClient::registerUndoStep):
1813
1814 2019-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
1815
1816         [SOUP] Remove libsoup cruft from WebProcess
1817         https://bugs.webkit.org/show_bug.cgi?id=193710
1818
1819         Reviewed by Carlos Garcia Campos.
1820
1821         SoupNetworkSession is no longer accessible from the web process because it's owned
1822         (indirectly) by NetworkProcess after r240292. It doesn't make sense to have any libsoup
1823         code under WebProcess anymore. The current libsoup code consists of (a) unused stuff to be
1824         removed, (b) stuff unrelated to libsoup, which should move to a WebProcessGLib.cpp, and (c)
1825         WebKitSoupRequestInputStream, which is only used by NetworkProcess and should move there
1826
1827         * NetworkProcess/soup/WebKitSoupRequestInputStream.cpp: Renamed from Source/WebKit/WebProcess/soup/WebKitSoupRequestInputStream.cpp.
1828         (AsyncReadData::AsyncReadData):
1829         (webkitSoupRequestInputStreamReadAsyncResultComplete):
1830         (webkitSoupRequestInputStreamPendingReadAsyncComplete):
1831         (webkitSoupRequestInputStreamHasDataToRead):
1832         (webkitSoupRequestInputStreamIsWaitingForData):
1833         (webkitSoupRequestInputStreamReadAsync):
1834         (webkitSoupRequestInputStreamReadFinish):
1835         (webkitSoupRequestInputStreamFinalize):
1836         (webkit_soup_request_input_stream_init):
1837         (webkit_soup_request_input_stream_class_init):
1838         (webkitSoupRequestInputStreamNew):
1839         (webkitSoupRequestInputStreamAddData):
1840         (webkitSoupRequestInputStreamDidFailWithError):
1841         (webkitSoupRequestInputStreamFinished):
1842         * NetworkProcess/soup/WebKitSoupRequestInputStream.h: Renamed from Source/WebKit/WebProcess/soup/WebKitSoupRequestInputStream.h.
1843         * SourcesGTK.txt:
1844         * SourcesWPE.txt:
1845         * UIProcess/soup/WebProcessPoolSoup.cpp:
1846         (WebKit::WebProcessPool::setNetworkProxySettings): Don't send message to web processes.
1847         * WebProcess/WebProcess.h:
1848         * WebProcess/WebProcess.messages.in:
1849         * WebProcess/glib/WebProcessGLib.cpp: Renamed from Source/WebKit/WebProcess/soup/WebProcessSoup.cpp.
1850         (WebKit::WebProcess::platformSetCacheModel):
1851         (WebKit::WebProcess::platformInitializeWebProcess):
1852         (WebKit::WebProcess::platformTerminate):
1853
1854 2019-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
1855
1856         [SOUP] Clean up NetworkStorageSession
1857         https://bugs.webkit.org/show_bug.cgi?id=193707
1858
1859         Reviewed by Carlos Garcia Campos.
1860
1861         Restore an important call to clearSoupNetworkSession that was removed in r240292. Also,
1862         adapt to NetworkStorageSessions API changes.
1863
1864         * NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp:
1865         (WebKit::LegacyCustomProtocolManager::registerScheme):
1866         * NetworkProcess/soup/NetworkProcessMainSoup.cpp:
1867         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1868         (WebKit::NetworkProcess::userPreferredLanguagesChanged):
1869         (WebKit::NetworkProcess::setNetworkProxySettings):
1870         * NetworkProcess/soup/NetworkSessionSoup.cpp:
1871         (WebKit::NetworkSessionSoup::soupSession const):
1872
1873 2019-01-23  Philippe Normand  <pnormand@igalia.com>
1874
1875         [GTK] Crash when browsing inspector:// uri without port set
1876         https://bugs.webkit.org/show_bug.cgi?id=193721
1877
1878         Reviewed by Michael Catanzaro.
1879
1880         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
1881         (WebKit::RemoteInspectorProtocolHandler::handleRequest): Return
1882         back to caller after setting the error, if no port was provided
1883         along with the inspector URL.
1884
1885 2019-01-23  David Kilzer  <ddkilzer@apple.com>
1886
1887         Switch remaining CoreMedia soft-linking in WebKit over to CoreMediaSoftLink.{cpp,h}
1888         <https://webkit.org/b/193694>
1889         <rdar://problem/47464025>
1890
1891         Reviewed by Tim Horton.
1892
1893         * Shared/ios/WebIconUtilities.mm:
1894         - Switch to using CoreMediaSoftLink.{h,mm} in PAL.
1895
1896 2019-01-22  Chris Dumez  <cdumez@apple.com>
1897
1898         Regression(r240178) Some API tests are crashing
1899         https://bugs.webkit.org/show_bug.cgi?id=193680
1900
1901         Reviewed by Alex Christensen.
1902
1903         r240178 made sure that userScripts / scriptMessageHandlers / contentExtensions are always
1904         properly populated in the WebPageCreationParameters. This was needed in case we need to
1905         reconstruct the WebUserContentController on the WebProcess side. However, this caused a
1906         regression in the case we reuse a process where the WebUserContentController still exists
1907         (because it was kept alive, e.g. by the WebPageGroup). In that case, we would add duplicate
1908         entries to the existing WebUserContentController instance because its "add" methods did not
1909         have duplicate checks. To address the issue, this patch adds duplicate checks to the
1910         WebUserContentController "add" methods.
1911
1912         * WebProcess/UserContent/WebUserContentController.cpp:
1913         (WebKit::WebUserContentController::addUserScriptMessageHandlerInternal):
1914         (WebKit::WebUserContentController::removeUserScriptMessageHandlerInternal):
1915         (WebKit::WebUserContentController::addUserScriptInternal):
1916         (WebKit::WebUserContentController::removeUserScriptInternal):
1917         (WebKit::WebUserContentController::addUserStyleSheetInternal):
1918         (WebKit::WebUserContentController::removeUserStyleSheetInternal):
1919         (WebKit::WebUserContentController::forEachUserMessageHandler const):
1920         * WebProcess/UserContent/WebUserContentController.h:
1921
1922 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1923
1924         Unreviewed attempt to fix GTK/WPE bots
1925         https://bugs.webkit.org/show_bug.cgi?id=193580
1926         <rdar://problem/47457742>
1927
1928         Doesn't make sense to clear the storage session right after creating it. This should fix
1929         network process crash on startup under G_DEBUG=fatal-criticals due to the storage session
1930         not having a cookie jar.
1931
1932         * NetworkProcess/NetworkProcess.cpp:
1933         (WebKit::NetworkProcess::NetworkProcess):
1934
1935 2019-01-22  Megan Gardner  <megan_gardner@apple.com>
1936
1937         Cancel Web Touches Properly so that long presses on YouTube links do not incorrectly trigger a load
1938         https://bugs.webkit.org/show_bug.cgi?id=193687
1939         <rdar://problem/47056717>
1940
1941         Reviewed by Tim Horton.
1942
1943         Cancel web gestures when a long press is recognized.
1944
1945         * Platform/spi/ios/UIKitSPI.h:
1946         * UIProcess/ios/WKContentViewInteraction.mm:
1947         (-[WKContentView _cancelWebGestureRecognizer]):
1948         (-[WKContentView _longPressRecognized:]):
1949
1950 2019-01-22  Alex Christensen  <achristensen@webkit.org>
1951
1952         Fix an internal build failure after r240292
1953         https://bugs.webkit.org/show_bug.cgi?id=193580
1954
1955         Rubber-stamped by Wenson Hsieh.
1956
1957         * SourcesCocoa.txt:
1958         * UIProcess/mac/WebContextMenuProxyMac.mm:
1959         (-[WKMenuTarget forwardContextMenuAction:]):
1960         * WebKit.xcodeproj/project.pbxproj:
1961         It was apparently unclear to the compiler sometimes which "state" selector to use, and this apparently mattered.
1962         Tell the compiler to use the NSMenuItem selector, but at runtime it doesn't matter.
1963
1964 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1965
1966         Unreviewed, fix -Wunused-but-set-variable warning
1967         https://bugs.webkit.org/show_bug.cgi?id=193660
1968         <rdar://problem/47433602>
1969
1970         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1971         (WebKit::WebsiteDataStore::removeData):
1972
1973 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1974
1975         Unreviewed, further build fixes after r240292
1976         https://bugs.webkit.org/show_bug.cgi?id=193580
1977         <rdar://problem/47457742>
1978
1979         Oops.
1980
1981         * NetworkProcess/NetworkProcess.cpp:
1982         (WebKit::NetworkProcess::defaultStorageSession const):
1983
1984 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1985
1986         Unreviewed, further build fixes after r240292
1987         https://bugs.webkit.org/show_bug.cgi?id=193580
1988         <rdar://problem/47457742>
1989
1990         This builds for libsoup. Doesn't work, but at least builds.
1991
1992         Also, speculative fixes for curl.
1993
1994         * NetworkProcess/NetworkProcess.cpp:
1995         (WebKit::NetworkProcess::defaultStorageSession const):
1996
1997 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1998
1999         Unreviewed, further build fixes after r240292
2000         https://bugs.webkit.org/show_bug.cgi?id=193580
2001         <rdar://problem/47457742>
2002
2003         Still not working yet.
2004
2005         * NetworkProcess/NetworkProcess.cpp:
2006         (WebKit::NetworkProcess::NetworkProcess):
2007         * UIProcess/API/APIHTTPCookieStore.h:
2008
2009 2019-01-22  Antti Koivisto  <antti@apple.com>
2010
2011         [iOS] Flash when swiping back to Google search result page
2012         https://bugs.webkit.org/show_bug.cgi?id=193668
2013         <rdar://problem/47071684>
2014
2015         Reviewed by Simon Fraser.
2016
2017         If the google page is scrolled, there is sometimes a short flash.
2018
2019         When restoring the page state we also restore exposedContentRect which is used to determine
2020         which part of the page to create layers for. Scroll position is restored by the UI process
2021         later so we rely on this to get the right layers for the initial view update.
2022
2023         A viewport configuration update may sometimes trample over the restored exposedContentRect,
2024         moving it to top left. In this case the initial layer tree unfreeze commit may not have
2025         layers to cover the actual visible view position.
2026
2027         * WebProcess/WebPage/WebPage.cpp:
2028         (WebKit::WebPage::didCommitLoad):
2029         * WebProcess/WebPage/WebPage.h:
2030         * WebProcess/WebPage/ios/WebPageIOS.mm:
2031         (WebKit::WebPage::restorePageState):
2032
2033         Set a bit to indicate we have already restored the exposedContentRect.
2034
2035         (WebKit::WebPage::viewportConfigurationChanged):
2036
2037         Only reset exposedContentRect if wasn't already set by restorePageState.
2038
2039 2019-01-22  Alex Christensen  <achristensen@webkit.org>
2040
2041         Fix more builds.
2042
2043         * SourcesCocoa.txt:
2044         * WebKit.xcodeproj/project.pbxproj:
2045
2046 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
2047
2048         Another build fix after r240292
2049         https://bugs.webkit.org/show_bug.cgi?id=193580
2050         <rdar://problem/47457742>
2051
2052         Unreviewed, still not enough to fix soup builds, but closer.
2053
2054         * UIProcess/API/APIHTTPCookieStore.h:
2055
2056 2019-01-22  Alex Christensen  <achristensen@webkit.org>
2057
2058         Fix some builds after r240292
2059         https://bugs.webkit.org/show_bug.cgi?id=193580
2060
2061         * NetworkProcess/NetworkProcess.cpp:
2062         (WebKit::NetworkProcess::switchToNewTestingSession):
2063         * NetworkProcess/cache/NetworkCache.cpp:
2064         (WebKit::NetworkCache::Cache::retrieve):
2065
2066 2019-01-22  Brian Burg  <bburg@apple.com>
2067
2068         Automation.computeElementLayout should return visual viewport-aware coordinates
2069         https://bugs.webkit.org/show_bug.cgi?id=193598
2070         <rdar://problem/35325644>
2071
2072         Unreviewed, restore a mistakenly-deleted line whose absence causes hangs.
2073
2074         * Shared/CoordinateSystem.h:
2075
2076 2019-01-22  Alex Christensen  <achristensen@webkit.org>
2077
2078         Move NetworkStorageSession ownership to NetworkProcess
2079         https://bugs.webkit.org/show_bug.cgi?id=193580
2080
2081         Reviewed by Geoff Garen.
2082
2083         * NetworkProcess/Cookies/WebCookieManager.cpp:
2084         (WebKit::WebCookieManager::WebCookieManager):
2085         (WebKit::WebCookieManager::getHostnamesWithCookies):
2086         (WebKit::WebCookieManager::deleteCookiesForHostname):
2087         (WebKit::WebCookieManager::deleteAllCookies):
2088         (WebKit::WebCookieManager::deleteCookie):
2089         (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
2090         (WebKit::WebCookieManager::getAllCookies):
2091         (WebKit::WebCookieManager::getCookies):
2092         (WebKit::WebCookieManager::setCookie):
2093         (WebKit::WebCookieManager::setCookies):
2094         (WebKit::WebCookieManager::startObservingCookieChanges):
2095         (WebKit::WebCookieManager::stopObservingCookieChanges):
2096         * NetworkProcess/Cookies/WebCookieManager.h:
2097         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
2098         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
2099         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2100         (WebKit::storageSession):
2101         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
2102         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
2103         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
2104         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
2105         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
2106         (WebKit::NetworkConnectionToWebProcess::deleteCookie):
2107         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
2108         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage):
2109         * NetworkProcess/NetworkProcess.cpp:
2110         (WebKit::NetworkProcess::initializeNetworkProcess):
2111         (WebKit::NetworkProcess::clearCachedCredentials):
2112         (WebKit::NetworkProcess::switchToNewTestingSession):
2113         (WebKit::NetworkProcess::ensureSession):
2114         (WebKit::NetworkProcess::storageSession const):
2115         (WebKit::NetworkProcess::defaultStorageSession const):
2116         (WebKit::NetworkProcess::forEachNetworkStorageSession):
2117         (WebKit::NetworkProcess::destroySession):
2118         (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
2119         (WebKit::NetworkProcess::setAgeCapForClientSideCookies):
2120         (WebKit::NetworkProcess::hasStorageAccessForFrame):
2121         (WebKit::NetworkProcess::getAllStorageAccessEntries):
2122         (WebKit::NetworkProcess::grantStorageAccess):
2123         (WebKit::NetworkProcess::removeAllStorageAccess):
2124         (WebKit::NetworkProcess::removePrevalentDomains):
2125         (WebKit::NetworkProcess::setCacheMaxAgeCapForPrevalentResources):
2126         (WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources):
2127         (WebKit::NetworkProcess::fetchWebsiteData):
2128         (WebKit::NetworkProcess::deleteWebsiteData):
2129         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2130         * NetworkProcess/NetworkProcess.h:
2131         * NetworkProcess/NetworkResourceLoader.cpp:
2132         (WebKit::NetworkResourceLoader::validateCacheEntryForMaxAgeCapValidation):
2133         (WebKit::NetworkResourceLoader::logCookieInformation const):
2134         * NetworkProcess/NetworkSession.cpp:
2135         (WebKit::NetworkSession::networkStorageSession const):
2136         * NetworkProcess/NetworkStorageSessionProvider.h:
2137         * NetworkProcess/cache/NetworkCache.cpp:
2138         (WebKit::NetworkCache::makeUseDecision):
2139         (WebKit::NetworkCache::Cache::retrieve):
2140         (WebKit::NetworkCache::Cache::makeEntry):
2141         (WebKit::NetworkCache::Cache::makeRedirectEntry):
2142         (WebKit::NetworkCache::Cache::update):
2143         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2144         (WebKit::NetworkCache::SpeculativeLoad::willSendRedirectedRequest):
2145         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2146         (WebKit::NetworkProcess::platformSyncAllCookies):
2147         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2148         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
2149         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
2150         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
2151         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2152         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2153         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2154         * SourcesCocoa.txt:
2155         * UIProcess/API/APIHTTPCookieStore.cpp:
2156         (API::HTTPCookieStore::~HTTPCookieStore):
2157         (API::HTTPCookieStore::cookies):
2158         (API::HTTPCookieStore::setCookie):
2159         (API::HTTPCookieStore::deleteCookie):
2160         (API::HTTPCookieStore::registerObserver):
2161         (API::HTTPCookieStore::unregisterObserver):
2162         (API::HTTPCookieStore::registerForNewProcessPoolNotifications):
2163         (API::HTTPCookieStore::flushDefaultUIProcessCookieStore):
2164         (API::HTTPCookieStore::getAllDefaultUIProcessCookieStoreCookies):
2165         (API::HTTPCookieStore::setCookieInDefaultUIProcessCookieStore):
2166         (API::HTTPCookieStore::deleteCookieFromDefaultUIProcessCookieStore):
2167         (API::HTTPCookieStore::startObservingChangesToDefaultUIProcessCookieStore):
2168         (API::HTTPCookieStore::stopObservingChangesToDefaultUIProcessCookieStore):
2169         * UIProcess/API/APIHTTPCookieStore.h:
2170         * UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm: Added.
2171         (API::HTTPCookieStore::flushDefaultUIProcessCookieStore):
2172         (API::HTTPCookieStore::getAllDefaultUIProcessCookieStoreCookies):
2173         (API::HTTPCookieStore::setCookieInDefaultUIProcessCookieStore):
2174         (API::HTTPCookieStore::deleteCookieFromDefaultUIProcessCookieStore):
2175         (API::HTTPCookieStore::startObservingChangesToDefaultUIProcessCookieStore):
2176         (API::HTTPCookieStore::stopObservingChangesToDefaultUIProcessCookieStore):
2177         * UIProcess/WebProcessPool.cpp:
2178         (WebKit::WebProcessPool::clearCachedCredentials):
2179         * WebKit.xcodeproj/project.pbxproj:
2180         * WebProcess/Plugins/PluginView.cpp:
2181         (WebKit::PluginView::getAuthenticationInfo):
2182         * WebProcess/WebProcess.cpp:
2183         (WebKit::WebProcess::deleteWebsiteData):
2184         (WebKit::WebProcess::clearCachedCredentials): Deleted.
2185         * WebProcess/WebProcess.h:
2186         * WebProcess/WebProcess.messages.in:
2187
2188 2019-01-22  Per Arne Vollan  <pvollan@apple.com>
2189
2190         [macOS] Adjust logging policy in WebKit's sandbox
2191         https://bugs.webkit.org/show_bug.cgi?id=193454
2192
2193         Reviewed by Brent Fulgham.
2194
2195         Add a rule to initially deny all calls, since the default is to allow every call.
2196         Later rules allow syscalls that we determined are needed for proper WebKit function.
2197         This reduces the API surface available to attackers.
2198
2199         * WebProcess/com.apple.WebProcess.sb.in:
2200
2201 2019-01-22  Daniel Bates  <dabates@apple.com>
2202
2203         [iOS] WebKit should handle shift state changes when using the software keyboard
2204         https://bugs.webkit.org/show_bug.cgi?id=191475
2205         <rdar://problem/45949246>
2206
2207         Reviewed by Brent Fulgham.
2208
2209         Implement UIKit SPI to be notified of shift state changes to the software keyboard
2210         and dispatch a synthetic keydown or keyup event for either the Shift key or Caps Lock
2211         key.
2212
2213         A side benefit of this change is that we now show and hide the caps lock indicator
2214         in a focused password field when caps lock is enabled or disabled using the software
2215         keyboard, respectively.
2216
2217         * Platform/spi/ios/UIKitSPI.h: Expose more SPI.
2218         * SourcesCocoa.txt:
2219         * UIProcess/ios/WKContentViewInteraction.mm:
2220         (-[WKContentView modifierFlagsDidChangeFrom:to:]): Create a synthetic flags changed
2221         web event based on the state change and dispatch it.
2222         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): Early return if the event
2223         was a synethic flags change event so that we do not notify UIKit about this event
2224         as it does not know anything about such synthetic events.
2225         * UIProcess/ios/WKSyntheticFlagsChangedWebEvent.h: Added.
2226         * UIProcess/ios/WKSyntheticFlagsChangedWebEvent.mm: Added.
2227         (-[WKSyntheticFlagsChangedWebEvent initWithKeyCode:modifiers:keyDown:]):
2228         (-[WKSyntheticFlagsChangedWebEvent initWithCapsLockState:]):
2229         (-[WKSyntheticFlagsChangedWebEvent initWithShiftState:]):
2230         * WebKit.xcodeproj/project.pbxproj:
2231
2232 2019-01-22  Daniel Bates  <dabates@apple.com>
2233
2234         [iOS] Interpret text key commands on keydown and app key commands on keypress
2235         https://bugs.webkit.org/show_bug.cgi?id=192897
2236         <rdar://problem/46857378>
2237
2238         Reviewed by Brent Fulgham.
2239
2240         Adopt SPI to interpret text key commands and app key commands independently on keydown (isCharEvent
2241         is false) and keypress (isCharEvent is true), respectively.
2242
2243         * Platform/spi/ios/UIKitSPI.h: Add more SPI.
2244         * UIProcess/ios/WKContentViewInteraction.mm:
2245         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
2246
2247 2019-01-22  David Kilzer  <ddkilzer@apple.com>
2248
2249         C strings in ClientCertificateAuthenticationXPCConstants.h are duplicated
2250         <https://webkit.org/b/193607>
2251         <rdar://problem/47334613>
2252
2253         Reviewed by Alex Christensen.
2254
2255         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
2256         (WebKit::AuthenticationManager::initializeConnection):
2257         * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:
2258         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc):
2259         - Update name of constants.
2260
2261         * Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.cpp: Copied from Source/WebKit/Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.h.
2262         * Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.h:
2263         - Put constant values in a namespace, and move values to
2264           ClientCertificateAuthenticationXPCConstants.cpp.
2265
2266         * SourcesCocoa.txt:
2267         * UnifiedSources-input.xcfilelist:
2268         * WebKit.xcodeproj/project.pbxproj:
2269         - Add ClientCertificateAuthenticationXPCConstants.cpp.
2270
2271 2019-01-22  David Kilzer  <ddkilzer@apple.com>
2272
2273         Switch remaining QuickLook soft-linking in WebCore, WebKit over to QuickLookSoftLink.{cpp,h}
2274         <https://webkit.org/b/193654>
2275         <rdar://problem/47430290>
2276
2277         Reviewed by Alex Christensen.
2278
2279         - Moves QuickLookSoftLink.{h,mm} to PAL.
2280         - Adds soft-link to 3 classes to consolidate QuickLook.framework
2281           soft-linking.
2282         - Updates existing source to work with above changes.
2283
2284         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2285         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
2286         (WebKit::SystemPreviewController::start):
2287         * UIProcess/ios/WKSystemPreviewView.mm:
2288         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
2289         - Switch to using QuickLookSoftLink.{h,mm} in PAL.
2290
2291 2019-01-22  Oriol Brufau  <obrufau@igalia.com>
2292
2293         [css-logical] Implement flow-relative margin, padding and border shorthands
2294         https://bugs.webkit.org/show_bug.cgi?id=188697
2295
2296         Reviewed by Simon Fraser and Antti Koivisto.
2297
2298         Add a CSSLogicalEnabled runtime flag.
2299
2300         * Shared/WebPreferences.yaml:
2301
2302 2019-01-22  Frederic Wang  <fwang@igalia.com>
2303
2304         Enable CSSOMViewScrollingAPI
2305         https://bugs.webkit.org/show_bug.cgi?id=189472
2306
2307         Reviewed by Simon Fraser.
2308
2309         This patch enables the CSSOMViewScrollingAPI option by default. This feature has already been
2310         enabled in tests since r235855. Basically, this change fixes an old compatibility issue
2311         regarding which scrolling element correspond to the viewport in standard mode (WebKit uses
2312         document.body while Gecko/Edge/Chromium use document.documentElement as described in the
2313         CSSOM View specification). WebKit developers writing tests can use document.scrollingElement
2314         for that purpose, so that they work independently of whether the option is enabled.
2315
2316         [1] https://lists.webkit.org/pipermail/webkit-dev/2018-January/029857.html
2317
2318         * Shared/WebPreferences.yaml: Enable by default and remove "experimental" category in
2319         accordance with the new policy. Instead, keep an internal flag only for developers.
2320
2321 2019-01-21  Antti Koivisto  <antti@apple.com>
2322
2323         [iOS] Handle hit testing for subframes
2324         https://bugs.webkit.org/show_bug.cgi?id=192303
2325
2326         Reviewed by Frédéric Wang.
2327
2328         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2329         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
2330
2331         Only set delegatesScrolling for the main frame.
2332
2333 2019-01-21  Brent Fulgham  <bfulgham@apple.com>
2334
2335         Unreviewed test fix after r240243
2336         Nhttps://bugs.webkit.org/show_bug.cgi?id=193660
2337         <rdar://problem/47433602>
2338
2339         The new ResourceLoadStatistics section of 'removeData' was incrementing the
2340         pending callback count before deciding whether to send a message to delete
2341         data. This left the count out-of-balance leading to the operation never
2342         completing.
2343
2344         This patch also prevents sending a second message to the NetworkProcess
2345         requesting data be deleted if the message was already sent in an earlier
2346         section of the method (e.g., as typically happens when all website data
2347         is being deleted).
2348
2349         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2350         (WebKit::WebsiteDataStore::removeData):
2351
2352 2019-01-21  Brent Fulgham  <bfulgham@apple.com>
2353
2354         Implement message handlers for NetworkProcess-based ResourceLoadStatistics
2355         https://bugs.webkit.org/show_bug.cgi?id=193556
2356         <rdar://problem/47368501>
2357
2358         Reviewed by Alex Christensen.
2359
2360         This patch adds a number of sibling methods for tracking ResourceLoadStatistics when the
2361         observations are being handled in the NetworkProcess, rather than the UIProcess. The
2362         original versions of these methods will be removed as part of Bug 193303.
2363
2364         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2365         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
2366         (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords):
2367         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData):
2368         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
2369         (WebKit::ResourceLoadStatisticsMemoryStore::store const):
2370         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2371         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
2372         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenTelemetryWasCaptured):
2373         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2374         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
2375         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
2376         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
2377         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
2378         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
2379         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
2380         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
2381         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
2382         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
2383         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
2384         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
2385         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
2386         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
2387         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder):
2388         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
2389         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
2390         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
2391         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
2392         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
2393         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
2394         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
2395         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
2396         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
2397         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
2398         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
2399         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
2400         (WebKit::WebResourceLoadStatisticsStore::logTestingEvent):
2401         (WebKit::WebResourceLoadStatisticsStore::notifyResourceLoadStatisticsProcessed):
2402         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
2403         (WebKit::WebResourceLoadStatisticsStore::topPrivatelyControlledDomainsWithWebsiteData):
2404         (WebKit::WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue const):
2405         (WebKit::WebResourceLoadStatisticsStore::notifyPageStatisticsTelemetryFinished const):
2406         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2407         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
2408         (WebKit::submitTopList):
2409         (WebKit::submitTopLists):
2410         (WebKit::notifyPages):
2411         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
2412         (WebKit::nonEphemeralWebPageProxy): Deleted.
2413         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2414         (WebKit::NetworkConnectionToWebProcess::logUserInteraction):
2415         * NetworkProcess/NetworkConnectionToWebProcess.h:
2416         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2417         * NetworkProcess/NetworkProcess.cpp:
2418         (WebKit::NetworkProcess::dumpResourceLoadStatistics):
2419         (WebKit::NetworkProcess::isGrandfathered):
2420         (WebKit::NetworkProcess::isPrevalentResource):
2421         (WebKit::NetworkProcess::isVeryPrevalentResource):
2422         (WebKit::NetworkProcess::setGrandfathered):
2423         (WebKit::NetworkProcess::setPrevalentResource):
2424         (WebKit::NetworkProcess::setPrevalentResourceForDebugMode):
2425         (WebKit::NetworkProcess::setVeryPrevalentResource):
2426         (WebKit::NetworkProcess::clearPrevalentResource):
2427         (WebKit::NetworkProcess::submitTelemetry):
2428         (WebKit::NetworkProcess::scheduleCookieBlockingUpdate):
2429         (WebKit::NetworkProcess::scheduleClearInMemoryAndPersistent):
2430         (WebKit::NetworkProcess::resetParametersToDefaultValues):
2431         (WebKit::NetworkProcess::scheduleStatisticsAndDataRecordsProcessing):
2432         (WebKit::NetworkProcess::setNotifyPagesWhenDataRecordsWereScanned):
2433         (WebKit::NetworkProcess::setNotifyPagesWhenTelemetryWasCaptured):
2434         (WebKit::NetworkProcess::setSubframeUnderTopFrameOrigin):
2435         (WebKit::NetworkProcess::isRegisteredAsRedirectingTo):
2436         (WebKit::NetworkProcess::isRegisteredAsSubFrameUnder):
2437         (WebKit::NetworkProcess::setSubresourceUnderTopFrameOrigin):
2438         (WebKit::NetworkProcess::setSubresourceUniqueRedirectTo):
2439         (WebKit::NetworkProcess::setSubresourceUniqueRedirectFrom):
2440         (WebKit::NetworkProcess::isRegisteredAsSubresourceUnder):
2441         (WebKit::NetworkProcess::setTopFrameUniqueRedirectTo):
2442         (WebKit::NetworkProcess::setTopFrameUniqueRedirectFrom):
2443         (WebKit::NetworkProcess::setLastSeen):
2444         (WebKit::NetworkProcess::hasStorageAccess):
2445         (WebKit::NetworkProcess::requestStorageAccess):
2446         (WebKit::NetworkProcess::grantStorageAccess):
2447         (WebKit::NetworkProcess::logUserInteraction):
2448         (WebKit::NetworkProcess::hadUserInteraction):
2449         (WebKit::NetworkProcess::clearUserInteraction):
2450         (WebKit::NetworkProcess::setGrandfatheringTime):
2451         (WebKit::NetworkProcess::setMaxStatisticsEntries):
2452         (WebKit::NetworkProcess::setMinimumTimeBetweenDataRecordsRemoval):
2453         (WebKit::NetworkProcess::setPruneEntriesDownTo):
2454         (WebKit::NetworkProcess::setTimeToLiveUserInteraction):
2455         (WebKit::NetworkProcess::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2456         (WebKit::NetworkProcess::setResourceLoadStatisticsEnabled):
2457         (WebKit::NetworkProcess::setResourceLoadStatisticsDebugMode):
2458         (WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources):
2459         (WebKit::NetworkProcess::deleteWebsiteData):
2460         (WebKit::filterForTopLevelDomains):
2461         (WebKit::NetworkProcess::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
2462         (WebKit::NetworkProcess::topPrivatelyControlledDomainsWithWebsiteData):
2463         * NetworkProcess/NetworkProcess.h:
2464         * NetworkProcess/NetworkProcess.messages.in:
2465         * NetworkProcess/NetworkSession.cpp:
2466         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
2467         (WebKit::NetworkSession::notifyResourceLoadStatisticsProcessed):
2468         (WebKit::NetworkSession::logDiagnosticMessageWithValue):
2469         (WebKit::NetworkSession::notifyPageStatisticsTelemetryFinished):
2470         (WebKit::NetworkSession::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
2471         (WebKit::NetworkSession::topPrivatelyControlledDomainsWithWebsiteData):
2472         (WebKit::NetworkSession::enableResourceLoadStatistics): Deleted.
2473         * NetworkProcess/NetworkSession.h:
2474         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2475         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2476         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2477         (WKWebsiteDataStoreSetResourceLoadStatisticsDebugModeWithCompletionHandler):
2478         (WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode):
2479         (WKWebsiteDataStoreSetStatisticsLastSeen):
2480         (WKWebsiteDataStoreSetStatisticsPrevalentResource):
2481         (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource):
2482         (WKWebsiteDataStoreDumpResourceLoadStatistics):
2483         (WKWebsiteDataStoreIsStatisticsPrevalentResource):
2484         (WKWebsiteDataStoreIsStatisticsVeryPrevalentResource):
2485         (WKWebsiteDataStoreIsStatisticsRegisteredAsSubresourceUnder):
2486         (WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder):
2487         (WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo):
2488         (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction):
2489         (WKWebsiteDataStoreIsStatisticsHasHadUserInteraction):
2490         (WKWebsiteDataStoreSetStatisticsGrandfathered):
2491         (WKWebsiteDataStoreIsStatisticsGrandfathered):
2492         (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin):
2493         (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin):
2494         (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectTo):
2495         (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectFrom):
2496         (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectTo):
2497         (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectFrom):
2498         (WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction):
2499         (WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords):
2500         (WKWebsiteDataStoreStatisticsUpdateCookieBlocking):
2501         (WKWebsiteDataStoreStatisticsSubmitTelemetry):
2502         (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenDataRecordsWereScanned):
2503         (WKWebsiteDataStoreSetStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval):
2504         (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenTelemetryWasCaptured):
2505         (WKWebsiteDataStoreSetStatisticsMinimumTimeBetweenDataRecordsRemoval):
2506         (WKWebsiteDataStoreSetStatisticsGrandfatheringTime):
2507         (WKWebsiteDataStoreSetStatisticsMaxStatisticsEntries):
2508         (WKWebsiteDataStoreSetStatisticsPruneEntriesDownTo):
2509         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
2510         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
2511         (WKWebsiteDataStoreStatisticsResetToConsistentState):
2512         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2513         (-[WKWebsiteDataStore _setResourceLoadStatisticsTestingCallback:]):
2514         * UIProcess/Network/NetworkProcessProxy.cpp:
2515         (WebKit::NetworkProcessProxy::clearCallbackStates):
2516         (WebKit::NetworkProcessProxy::didClose):
2517         (WebKit::nonEphemeralWebPageProxy):
2518         (WebKit::NetworkProcessProxy::logGlobalDiagnosticMessageWithValue):
2519         (WebKit::NetworkProcessProxy::dumpResourceLoadStatistics):
2520         (WebKit::NetworkProcessProxy::didDumpResourceLoadStatistics):
2521         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
2522         (WebKit::NetworkProcessProxy::didUpdateBlockCookies):
2523         (WebKit::NetworkProcessProxy::isPrevalentResource):
2524         (WebKit::NetworkProcessProxy::isPrevalentResourceResult):
2525         (WebKit::NetworkProcessProxy::isVeryPrevalentResource):
2526         (WebKit::NetworkProcessProxy::setPrevalentResource):
2527         (WebKit::NetworkProcessProxy::setPrevalentResourceForDebugMode):
2528         (WebKit::NetworkProcessProxy::setVeryPrevalentResource):
2529         (WebKit::NetworkProcessProxy::didSetResourceLoadStatisticData):
2530         (WebKit::NetworkProcessProxy::setLastSeen):
2531         (WebKit::NetworkProcessProxy::clearPrevalentResource):
2532         (WebKit::NetworkProcessProxy::scheduleCookieBlockingUpdate):
2533         (WebKit::NetworkProcessProxy::didScheduleCookieBlockingUpdate):
2534         (WebKit::NetworkProcessProxy::scheduleClearInMemoryAndPersistent):
2535         (WebKit::NetworkProcessProxy::didScheduleStatisticsProcessing):
2536         (WebKit::NetworkProcessProxy::scheduleStatisticsAndDataRecordsProcessing):
2537         (WebKit::NetworkProcessProxy::logUserInteraction):
2538         (WebKit::NetworkProcessProxy::hasHadUserInteraction):
2539         (WebKit::NetworkProcessProxy::didHaveUserInteraction):
2540         (WebKit::NetworkProcessProxy::clearUserInteraction):
2541         (WebKit::NetworkProcessProxy::setAgeCapForClientSideCookies):
2542         (WebKit::NetworkProcessProxy::didSetAgeCapForClientSideCookies):
2543         (WebKit::NetworkProcessProxy::setTimeToLiveUserInteraction):
2544         (WebKit::NetworkProcessProxy::didUpdateRuntimeSettings):
2545         (WebKit::NetworkProcessProxy::setNotifyPagesWhenTelemetryWasCaptured):
2546         (WebKit::NetworkProcessProxy::setNotifyPagesWhenDataRecordsWereScanned):
2547         (WebKit::NetworkProcessProxy::setSubframeUnderTopFrameOrigin):
2548         (WebKit::NetworkProcessProxy::isRegisteredAsRedirectingTo):
2549         (WebKit::NetworkProcessProxy::didIsRegisteredAsRedirectingTo):
2550         (WebKit::NetworkProcessProxy::isRegisteredAsSubFrameUnder):
2551         (WebKit::NetworkProcessProxy::didIsRegisteredAsSubFrameUnder):
2552         (WebKit::NetworkProcessProxy::setSubresourceUnderTopFrameOrigin):
2553         (WebKit::NetworkProcessProxy::isRegisteredAsSubresourceUnder):
2554         (WebKit::NetworkProcessProxy::didIsRegisteredAsSubresourceUnder):
2555         (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectTo):
2556         (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectFrom):
2557         (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectTo):
2558         (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectFrom):
2559         (WebKit::NetworkProcessProxy::isGrandfathered):
2560         (WebKit::NetworkProcessProxy::didIsGrandfathered):
2561         (WebKit::NetworkProcessProxy::setGrandfathered):
2562         (WebKit::NetworkProcessProxy::hasStorageAccess):
2563         (WebKit::NetworkProcessProxy::requestStorageAccess):
2564         (WebKit::NetworkProcessProxy::grantStorageAccess):
2565         (WebKit::NetworkProcessProxy::storageAccessRequestResult):
2566         (WebKit::NetworkProcessProxy::storageAccessOperationResult):
2567         (WebKit::NetworkProcessProxy::didRemoveAllStorageAccess):
2568         (WebKit::NetworkProcessProxy::didSetCacheMaxAgeCapForPrevalentResources):
2569         (WebKit::NetworkProcessProxy::setCacheMaxAgeCap):
2570         (WebKit::NetworkProcessProxy::setGrandfatheringTime):
2571         (WebKit::NetworkProcessProxy::setMaxStatisticsEntries):
2572         (WebKit::NetworkProcessProxy::setMinimumTimeBetweenDataRecordsRemoval):
2573         (WebKit::NetworkProcessProxy::setPruneEntriesDownTo):
2574         (WebKit::NetworkProcessProxy::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2575         (WebKit::NetworkProcessProxy::setResourceLoadStatisticsDebugMode):
2576         (WebKit::NetworkProcessProxy::resetParametersToDefaultValues):
2577         (WebKit::NetworkProcessProxy::submitTelemetry):
2578         (WebKit::NetworkProcessProxy::notifyResourceLoadStatisticsProcessed):
2579         (WebKit::NetworkProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished):
2580         (WebKit::NetworkProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished):
2581         (WebKit::NetworkProcessProxy::notifyResourceLoadStatisticsTelemetryFinished):
2582         (WebKit::NetworkProcessProxy::didLogUserInteraction): Deleted.
2583         (WebKit::NetworkProcessProxy::didResetCacheMaxAgeCapForPrevalentResources): Deleted.
2584         * UIProcess/Network/NetworkProcessProxy.h:
2585         * UIProcess/Network/NetworkProcessProxy.messages.in:
2586         * UIProcess/WebPageProxy.cpp:
2587         (WebKit::WebPageProxy::nonEphemeralWebPageProxy):
2588         * UIProcess/WebPageProxy.h:
2589         * UIProcess/WebProcessPool.cpp:
2590         (WebKit::WebProcessPool::ensureNetworkProcess):
2591         * UIProcess/WebProcessProxy.cpp:
2592         (WebKit::WebProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished):
2593         (WebKit::WebProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished):
2594         * UIProcess/WebProcessProxy.h:
2595         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2596         (WebKit::WebsiteDataStore::parameters):
2597         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2598         (WebKit::WebsiteDataStore::removeData):
2599         (WebKit::WebsiteDataStore::setMaxStatisticsEntries):
2600         (WebKit::WebsiteDataStore::setPruneEntriesDownTo):
2601         (WebKit::WebsiteDataStore::setGrandfatheringTime):
2602         (WebKit::WebsiteDataStore::setCacheMaxAgeCap):
2603         (WebKit::WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval):
2604         (WebKit::WebsiteDataStore::dumpResourceLoadStatistics):
2605         (WebKit::WebsiteDataStore::isPrevalentResource):
2606         (WebKit::WebsiteDataStore::setPrevalentResource):
2607         (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode):
2608         (WebKit::WebsiteDataStore::isVeryPrevalentResource):
2609         (WebKit::WebsiteDataStore::setVeryPrevalentResource):
2610         (WebKit::WebsiteDataStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2611         (WebKit::WebsiteDataStore::setSubframeUnderTopFrameOrigin):
2612         (WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder):
2613         (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameOrigin):
2614         (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder):
2615         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo):
2616         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom):
2617         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo):
2618         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom):
2619         (WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo):
2620         (WebKit::WebsiteDataStore::clearPrevalentResource):
2621         (WebKit::WebsiteDataStore::resetParametersToDefaultValues):
2622         (WebKit::WebsiteDataStore::submitTelemetry):
2623         (WebKit::WebsiteDataStore::scheduleClearInMemoryAndPersistent):
2624         (WebKit::WebsiteDataStore::scheduleCookieBlockingUpdate):
2625         (WebKit::WebsiteDataStore::scheduleStatisticsAndDataRecordsProcessing):
2626         (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor):
2627         (WebKit::WebsiteDataStore::setAgeCapForClientSideCookies):
2628         (WebKit::WebsiteDataStore::setLastSeen):
2629         (WebKit::WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned):
2630         (WebKit::WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured):
2631         (WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler):
2632         (WebKit::WebsiteDataStore::getAllStorageAccessEntries):
2633         (WebKit::WebsiteDataStore::grantStorageAccessHandler):
2634         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
2635         (WebKit::WebsiteDataStore::removePrevalentDomains):
2636         (WebKit::WebsiteDataStore::hasStorageAccess):
2637         (WebKit::WebsiteDataStore::requestStorageAccess):
2638         (WebKit::WebsiteDataStore::grantStorageAccess):
2639         (WebKit::WebsiteDataStore::setTimeToLiveUserInteraction):
2640         (WebKit::WebsiteDataStore::logUserInteraction):
2641         (WebKit::WebsiteDataStore::hasHadUserInteraction):
2642         (WebKit::WebsiteDataStore::clearUserInteraction):
2643         (WebKit::WebsiteDataStore::isGrandfathered):
2644         (WebKit::WebsiteDataStore::setGrandfathered):
2645         (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
2646         (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources):
2647         (WebKit::WebsiteDataStore::webPageWasAdded):
2648         (WebKit::WebsiteDataStore::webPageWasInvalidated):
2649         (WebKit::WebsiteDataStore::webProcessWillOpenConnection):
2650         (WebKit::WebsiteDataStore::webPageWillOpenConnection):
2651         (WebKit::WebsiteDataStore::webPageDidCloseConnection):
2652         (WebKit::WebsiteDataStore::webProcessDidCloseConnection):
2653         (WebKit::WebsiteDataStore::isAssociatedProcessPool const):
2654         (WebKit::WebsiteDataStore::processPools const):
2655         (WebKit::WebsiteDataStore::resourceLoadStatisticsEnabled const):
2656         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
2657         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
2658         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
2659         (WebKit::WebsiteDataStore::logTestingEvent):
2660         * UIProcess/WebsiteData/WebsiteDataStore.h:
2661         (WebKit::WebsiteDataStore::setStatisticsTestingCallback):
2662         * WebProcess/WebProcess.cpp:
2663         (WebKit::WebProcess::initializeWebProcess):
2664
2665 2019-01-15  Darin Adler  <darin@apple.com>
2666
2667         Use references rather than pointers for register/unregister functions, and more
2668         https://bugs.webkit.org/show_bug.cgi?id=175028
2669
2670         Reviewed by Daniel Bates.
2671
2672         * WebProcess/FullScreen/WebFullScreenManager.cpp:
2673         (WebKit::WebFullScreenManager::willEnterFullScreen): Update for change to the
2674         functions in Document; pass a reference.
2675         (WebKit::WebFullScreenManager::didEnterFullScreen): Ditto, don't pass the element.
2676         (WebKit::WebFullScreenManager::willExitFullScreen): Ditto.
2677         (WebKit::WebFullScreenManager::didExitFullScreen): Ditto.
2678
2679         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2680         (WebKit::UserMediaPermissionRequestManager::startUserMediaRequest): Pass a reference.
2681         (WebKit::UserMediaPermissionRequestManager::mediaCanStart): Ditto.
2682         (WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps): Ditto.
2683         * WebProcess/Plugins/PluginView.cpp:
2684         (WebKit::PluginView::~PluginView): Ditto.
2685         (WebKit::PluginView::initializePlugin): Ditto.
2686
2687 2019-01-20  Michael Catanzaro  <mcatanzaro@igalia.com>
2688
2689         Unreviewed, fix -Wreturn-type warning
2690         https://bugs.webkit.org/show_bug.cgi?id=193333
2691         <rdar://problem/45649489>
2692
2693         * UIProcess/Automation/WebAutomationSession.cpp:
2694         (WebKit::toProtocol):
2695
2696 2019-01-20  chris fleizach  <cfleizach@apple.com>
2697
2698         AX: Support returning relative frames for accessibility
2699         https://bugs.webkit.org/show_bug.cgi?id=193414
2700         <rdar://problem/47268501>
2701
2702         Reviewed by Zalan Bujtas.
2703
2704         * UIProcess/API/Cocoa/WKWebView.mm:
2705         (-[WKWebView accessibilityAttributeValue:forParameter:]):
2706         (-[WKWebView IGNORE_WARNINGS_END]):
2707         * UIProcess/API/mac/WKView.mm:
2708         (-[WKView accessibilityAttributeValue:forParameter:]):
2709         (-[WKView IGNORE_WARNINGS_END]):
2710         * UIProcess/Cocoa/WebViewImpl.h:
2711         * UIProcess/Cocoa/WebViewImpl.mm:
2712         (WebKit::WebViewImpl::accessibilityAttributeValue):
2713         * UIProcess/ios/WKContentView.mm:
2714         (-[WKContentView accessibilityConvertRelativeFrameFromPage:]):
2715
2716 2019-01-20  Michael Catanzaro  <mcatanzaro@igalia.com>
2717
2718         Unreviewed, rolling out r240209.
2719
2720         Broke GTK/WPE injected bundle
2721
2722         Reverted changeset:
2723
2724         "AX: Support returning relative frames for accessibility"
2725         https://bugs.webkit.org/show_bug.cgi?id=193414
2726         https://trac.webkit.org/changeset/240209
2727
2728 2019-01-12  Dan Bernstein  <mitz@apple.com>
2729
2730         [Cocoa] Avoid importing directly from subumbrella frameworks
2731         https://bugs.webkit.org/show_bug.cgi?id=186016
2732         <rdar://problem/40591038>
2733
2734         Reviewed by Sam Weinig.
2735
2736         * Configurations/BaseTarget.xcconfig: Removed -iframework options from OTHER_CFLAGS and
2737           OTHER_CPLUSPLUSFLAGS.
2738         * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Import Carbon.h instead of an
2739           HIToolbox header.
2740         * UIProcess/Cocoa/WebViewImpl.mm: Ditto.
2741         * UIProcess/mac/WKPrintingView.mm: Import Quartz.h instead of a PDFKit header.
2742         * UIProcess/mac/WKTextInputWindowController.mm: Import Carbon.h instead of an HIToolbox
2743           header.
2744         * WebProcess/Plugins/PDF/PDFAnnotationTextWidgetDetails.h: Import Quartz.h instead of a
2745           PDFKit header.
2746         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h: Ditto.
2747         * WebProcess/Plugins/PDF/PDFPlugin.mm: Ditto.
2748         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: Ditto.
2749         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm: Ditto.
2750         * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm: Ditto.
2751         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: Ditto.
2752         * WebProcess/WebPage/mac/WebPageMac.mm: Ditto.
2753
2754 2019-01-20  chris fleizach  <cfleizach@apple.com>
2755
2756         AX: Support returning relative frames for accessibility
2757         https://bugs.webkit.org/show_bug.cgi?id=193414
2758         <rdar://problem/47268501>
2759
2760         Reviewed by Zalan Bujtas.
2761
2762         * UIProcess/API/Cocoa/WKWebView.mm:
2763         (-[WKWebView accessibilityAttributeValue:forParameter:]):
2764         (-[WKWebView IGNORE_WARNINGS_END]):
2765         * UIProcess/API/mac/WKView.mm:
2766         (-[WKView accessibilityAttributeValue:forParameter:]):
2767         (-[WKView IGNORE_WARNINGS_END]):
2768         * UIProcess/Cocoa/WebViewImpl.h:
2769         * UIProcess/Cocoa/WebViewImpl.mm:
2770         (WebKit::WebViewImpl::accessibilityAttributeValue):
2771         * UIProcess/ios/WKContentView.mm:
2772         (-[WKContentView accessibilityConvertRelativeFrameFromPage:]):
2773
2774 2019-01-20  Antoine Quint  <graouts@apple.com>
2775
2776         Add a POINTER_EVENTS feature flag
2777         https://bugs.webkit.org/show_bug.cgi?id=193577
2778         <rdar://problem/47408511>
2779
2780         Unreviewed. Also enable Pointer Events for iosmac.
2781
2782         * Configurations/FeatureDefines.xcconfig:
2783
2784 2019-01-19  David Kilzer  <ddkilzer@apple.com>
2785
2786         Follow-up: iOS: Updating input mode should update the software keyboard
2787         <https://bugs.webkit.org/show_bug.cgi?id=193565>
2788         <rdar://problem/47376334>
2789
2790         * WebProcess/WebPage/WebPage.cpp:
2791         (WebKit::WebPage::focusedElementDidChangeInputMode): Fix iOS
2792         Debug builds after r240199 by downcasting `element` to
2793         `HTMLElement` before calling canonicalInputMode().
2794
2795 2019-01-19  David Kilzer  <ddkilzer@apple.com>
2796
2797         Sort WebKit Xcode project file
2798
2799         * WebKit.xcodeproj/project.pbxproj:
2800
2801 2019-01-19  Antoine Quint  <graouts@apple.com>
2802
2803         Add a POINTER_EVENTS feature flag
2804         https://bugs.webkit.org/show_bug.cgi?id=193577
2805
2806         Reviewed by Dean Jackson.
2807
2808         * Configurations/FeatureDefines.xcconfig:
2809
2810 2019-01-18  Ryosuke Niwa  <rniwa@webkit.org>
2811
2812         iOS: Updating input mode should update the software keyboard
2813         https://bugs.webkit.org/show_bug.cgi?id=193565
2814         <rdar://problem/47376334>
2815
2816         Reviewed by Wenson Hsieh.
2817
2818         Update the software keyboard when the inputmode content attribute on the focused element had been mutated.
2819
2820         * Scripts/webkit/messages.py:
2821         * Shared/WebCoreArgumentCoders.h:
2822         * UIProcess/PageClient.h:
2823         * UIProcess/WebPageProxy.h:
2824         * UIProcess/WebPageProxy.messages.in:
2825         * UIProcess/ios/PageClientImplIOS.h:
2826         * UIProcess/ios/PageClientImplIOS.mm:
2827         (WebKit::PageClientImpl::focusedElementDidChangeInputMode):
2828         * UIProcess/ios/WKContentViewInteraction.h:
2829         * UIProcess/ios/WKContentViewInteraction.mm:
2830         (-[WKContentView _didUpdateInputMode:]):
2831         * UIProcess/ios/WebPageProxyIOS.mm:
2832         (WebKit::WebPageProxy::focusedElementDidChangeInputMode):
2833         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2834         (WebKit::WebChromeClient::focusedElementDidChangeInputMode):
2835         * WebProcess/WebCoreSupport/WebChromeClient.h:
2836         * WebProcess/WebPage/WebPage.cpp:
2837         (WebKit::WebPage::focusedElementDidChangeInputMode):
2838         * WebProcess/WebPage/WebPage.h:
2839
2840 2019-01-18  Tim Horton  <timothy_horton@apple.com>
2841
2842         Adjust WKDrawingView protocol method name
2843         https://bugs.webkit.org/show_bug.cgi?id=193604
2844
2845         Reviewed by Wenson Hsieh.
2846
2847         * UIProcess/ios/WKDrawingView.mm:
2848         (-[WKDrawingView canvasViewDrawingDidChange:]):
2849         (-[WKDrawingView drawingDidChange:]): Deleted.
2850
2851 2019-01-18  David Kilzer  <ddkilzer@apple.com>
2852
2853         [WebKit] Change Xcode folders to map to folders on disk
2854
2855         * WebKit.xcodeproj/project.pbxproj: Update these folders:
2856         - Shared/Authentication
2857         - Shared/Authentication/cocoa
2858
2859 2019-01-18  Brian Burg  <bburg@apple.com>
2860
2861         Automation.computeElementLayout should return visual viewport-aware coordinates
2862         https://bugs.webkit.org/show_bug.cgi?id=193598
2863         <rdar://problem/35325644>
2864
2865         Reviewed by Simon Fraser.
2866
2867         Previously I added CoordinateSystem::VisualViewport to stub out this for iOS.
2868         But I think that it's a mistake for safaridriver to care about VisualViewport
2869         being enabled or not, because it is a runtime-switchable setting.
2870
2871         This patch removes CoordinateSystem::VisualViewport. Make the existing
2872         CoordinateSystem::LayoutViewport use visual viewport semantics if needed.
2873
2874         This is tested by WebDriver element clicking tests. There should not be any
2875         difference in behavior until it is possible to zoom with gestures via WebDriver.
2876
2877         * Shared/CoordinateSystem.h:
2878         * UIProcess/Automation/Automation.json:
2879         * UIProcess/Automation/WebAutomationSession.cpp:
2880         (WebKit::protocolStringToCoordinateSystem):
2881         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2882         (WebKit::WebAutomationSessionProxy::computeElementLayout):
2883
2884 2019-01-18  Daniel Bates  <dabates@apple.com>
2885
2886         Fix some build issues.
2887
2888         Include missing header WKDrawingCoordinator.
2889
2890         * UIProcess/ios/WKInkPickerView.mm:
2891
2892 2019-01-18  Tim Horton  <timothy_horton@apple.com>
2893
2894         Get rid of ADVANCED_SPELL_CHECKING
2895         https://bugs.webkit.org/show_bug.cgi?id=193592
2896
2897         Reviewed by Wenson Hsieh.
2898
2899         * UIProcess/Cocoa/WebViewImpl.mm:
2900         (WebKit::WebViewImpl::requestCandidatesForSelectionIfNeeded):
2901         (WebKit::WebViewImpl::insertText):
2902         * UIProcess/mac/TextCheckerMac.mm:
2903         (WebKit::TextChecker::checkTextOfParagraph):
2904         (WebKit::TextChecker::getGuessesForWord):
2905
2906 2019-01-18  Chris Dumez  <cdumez@apple.com>
2907
2908         Regression(PSON) Content blockers are sometimes lost on back navigation cross-site
2909         https://bugs.webkit.org/show_bug.cgi?id=193588
2910         <rdar://problem/47131566>
2911
2912         Reviewed by Alex Christensen.
2913
2914         When the WebPageProxy needs to create initialization parameters for its WebPage in the
2915         WebContent process, it calls WebProcessProxy::addWebUserContentControllerProxy()
2916         which calls WebUserContentControllerProxy::addProcess(). This last call is supposed to
2917         register the WebProcessProxy with the WebUserContentControllerProxy and adding the
2918         contentRuleLists to the WebPageCreationParameters. The issue is that if the
2919         WebUserContentControllerProxy already knows about this WebProcessProxy, it would return
2920         early and not populate the WebPageCreationParameters.
2921
2922         In PSON world, when navigating back to a page that failed to enter page cache, we reuse
2923         the process where we previously loaded the page but re-create a new WebPage on the
2924         WebContent process site. When this happens, WebUserContentControllerProxy would not
2925         add the contentRuleLists to the WebPageCreationParameters and the new WebPage in the
2926         previously-suspended process would be missing them.
2927
2928         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2929         (WebKit::WebUserContentControllerProxy::addProcess):
2930
2931 2019-01-18  Jer Noble  <jer.noble@apple.com>
2932
2933         SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds
2934         https://bugs.webkit.org/show_bug.cgi?id=189553
2935
2936         Reviewed by Tim Horton.
2937
2938         * Configurations/Base.xcconfig:
2939         * Configurations/BaseTarget.xcconfig:
2940         * Configurations/SDKVariant.xcconfig: Added.
2941
2942 2019-01-18  Antti Koivisto  <antti@apple.com>
2943
2944         Implement asynchronous frame scrolling for iOS
2945         https://bugs.webkit.org/show_bug.cgi?id=193539
2946         <rdar://problem/47379873>
2947
2948         Reviewed by Simon Fraser.
2949
2950         Add a scrolling node type that can handle UIScrollView backed frames.
2951         It basically just instantiates and forwards to the existing ScrollingTreeScrollingNodeDelegateIOS.
2952
2953         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
2954         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
2955         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2956         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2957         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h: Added.
2958         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm: Added.
2959         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::create):
2960         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::ScrollingTreeFrameScrollingNodeRemoteIOS):
2961         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::~ScrollingTreeFrameScrollingNodeRemoteIOS):
2962         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateBeforeChildren):
2963         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
2964         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterAncestorChange):
2965         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::scrollPosition const):
2966         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::setScrollLayerPosition):
2967         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterDelegatedScroll):
2968         * WebKit.xcodeproj/project.pbxproj:
2969
2970 2019-01-18  Chris Dumez  <cdumez@apple.com>
2971
2972         Regression(PSON) Scroll position is not always restored properly when navigating back
2973         https://bugs.webkit.org/show_bug.cgi?id=193578
2974         <rdar://problem/47386331>
2975
2976         Reviewed by Tim Horton.
2977
2978         Fix issues causing the scroll position to not be restored at all (or incorrectly) when
2979         navigating back cross-site with PSON enabled. Also make sure that the swipe gesture
2980         snapshot really stays up until we've restored the scroll position.
2981
2982         Note that even after those changes, I can still sometimes reproduce a white flash when
2983         swiping back to Google search results (scroll position being correct now). This is
2984         tracked by <rdar://problem/47071684> and happens even if I disable PSON entirely.
2985
2986         * Shared/SessionState.cpp:
2987         (WebKit::FrameState::encode const):
2988         (WebKit::FrameState::decode):
2989         * Shared/SessionState.h:
2990         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
2991         (WebKit::toFrameState):
2992         (WebKit::applyFrameState):
2993         obscuredInsets is present on the HistoryItem in the WebProcess but was never passed to
2994         or stored by the UIProcess on the WebBackForwardListItem. obscuredInsets is needed to
2995         properly restore the scrollPosition (position was 70px off on my iPad without this).
2996         With PSON enabled, if you swipe back cross-process and the previous page was not put
2997         into PageCache, then the HistoryItem is gone on the WebProcess side. What happens is
2998         that the UIProcess sends its WebBackForwardListItem to the WebProcess, which restores
2999         the HistoryItem there, and then asks it to load it. The obscuredInsets was getting lost
3000         in the process since the UIProcess never knew about it.
3001
3002         * UIProcess/Cocoa/ViewGestureController.cpp:
3003         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
3004         Drop logic that was causing the ViewGestureController to not wait for the scroll position
3005         to be restored before taking down the snapshot, when UI-side compositing is enabled.
3006         If you look at the comment above the code, you'll see that the code in question was meant
3007         to impact only the non-UI side compositing code path. As a matter of fact, when the code
3008         was reviewed at https://bugs.webkit.org/show_bug.cgi?id=151224, it was protected by a
3009         #if PLATFORM(MAC), before getting modified the wrong way before landing. In practice, we
3010         would have often restored the scroll position by the time the load is finished so it would
3011         not cause a flash in most cases. However, with PSON enabled and the layer tree freezing we
3012         do on process-swap, the first post-scroll restoration layer tree commit may now occur a
3013         little bit later and we would lose the race more often.
3014
3015         * UIProcess/WebProcessProxy.cpp:
3016         (WebKit::WebProcessProxy::updateBackForwardItem):
3017         * UIProcess/WebProcessProxy.h:
3018         When adding PageCache support to PSON, we used to navigate the "suspended" page to
3019         about:blank. This would lead to unwanted WebProcessProxy::updateBackForwardItem()
3020         calls from the WebProcess which we wanted to ignore. We thus added logic to ignore
3021         updateBackForwardItem() IPC from the old WebProcess after a swap. The issue with this
3022         is that we sometimes miss/ignore legit updates to the HistoryItem from the old process,
3023         in particular with regards to the scroll position and the pageScaleFactor. So if you
3024         swiped and then quickly enough did a cross-site navigation, the UIProcess'
3025         WebBackForwardList would not get updated with the latest scroll position and we would
3026         thus fail to restore it later on. To address the issue, we now stop ignoring updates
3027         from the old WebProcess after a swap. This logic is no longer needed since we no longer
3028         navigate the old page to about:blank after a swap, we merely suspend it "in place".
3029
3030 2019-01-18  Wenson Hsieh  <wenson_hsieh@apple.com>
3031
3032         Remove some last vestiges of assisted node terminology in WebKit
3033         https://bugs.webkit.org/show_bug.cgi?id=193572
3034
3035         Reviewed by Tim Horton.
3036
3037         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
3038         * UIProcess/ios/WKContentViewInteraction.mm:
3039         (-[WKContentView gestureRecognizerShouldBegin:]):
3040         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
3041         (-[WKContentView _showKeyboard]):
3042         (-[WKContentView _hideKeyboard]):
3043
3044         Add a FIXME about invoking `-reloadInputViews` on watchOS when the focused element is blurred.
3045
3046         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3047         (-[WKContentView _elementDidBlur]):
3048         (-[WKContentView updateCurrentFocusedElementInformation:]):
3049         (-[WKContentView _startAssistingKeyboard]): Deleted.
3050         (-[WKContentView _stopAssistingKeyboard]): Deleted.
3051         * WebProcess/WebPage/ios/WebPageIOS.mm:
3052         (WebKit::WebPage::getFocusedElementInformation):
3053
3054 2019-01-18  Youenn Fablet  <youenn@apple.com>
3055
3056         Add a new SPI to request for cache storage quota increase
3057         https://bugs.webkit.org/show_bug.cgi?id=193323
3058
3059         Reviewed by Alex Christensen.
3060
3061         Add a delegate on the WebSiteDataStore for WebKit to ask for quota update.
3062         The current SPI is currently CacheStorage specific but future work should
3063         make it so that other storage like IDB use the same mechanism.
3064         By default, quota remains unchanged if delegate is not implemented.
3065
3066         * NetworkProcess/NetworkProcess.cpp:
3067         * UIProcess/API/Cocoa/WKStorageQuotaDelegatePrivate.h: Added.
3068         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3069         (WebsiteDataStoreQuotaManager::WebsiteDataStoreQuotaManager):
3070         (-[WKWebsiteDataStore _quotaDelegate]):
3071         (-[WKWebsiteDataStore set_quotaDelegate:]):
3072         * UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h:
3073         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3074         * UIProcess/Network/NetworkProcessProxy.cpp:
3075         (WebKit::NetworkProcessProxy::requestCacheStorageSpace):
3076         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3077         (WebKit::WebsiteDataStore::WebsiteDataStore):
3078         * UIProcess/WebsiteData/WebsiteDataStore.h:
3079         (WebKit::WebsiteDataStore::quotaManager):
3080         (WebKit::WebsiteDataStore::setQuotaManager):
3081         * UIProcess/WebsiteData/WebsiteDataStoreQuotaManager.h: Added.
3082         (WebKit::WebsiteDataStoreQuotaManager::~WebsiteDataStoreQuotaManager):
3083         (WebKit::WebsiteDataStoreQuotaManager::requestCacheStorageSpace):
3084         * WebKit.xcodeproj/project.pbxproj:
3085
3086 2019-01-18  Philippe Normand  <pnormand@igalia.com>
3087
3088         [WPE] Add Qt extension
3089         https://bugs.webkit.org/show_bug.cgi?id=191464
3090
3091         Reviewed by Carlos Garcia Campos.
3092
3093         This new extension is a QML plugin embedding a WPE ViewBackend
3094         implementation. It provides a public API very similar to Qt's
3095         WebView module. It comes with a simple mini-browser implemented in
3096         QML.
3097
3098         QtWPE is known to work with the Wayland-EGL (in GNOME and Weston
3099         compositors) and EGLFS QPAs.
3100
3101         * PlatformWPE.cmake:
3102         * UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.cpp: Added.
3103         (WPEQmlExtensionPlugin::registerTypes):
3104         * UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.h: Added.
3105         * UIProcess/API/wpe/qt/WPEQtView.cpp: Added.
3106         (WPEQtView::WPEQtView):
3107         (WPEQtView::~WPEQtView):
3108         (WPEQtView::geometryChanged):
3109         (WPEQtView::configureWindow):
3110         (WPEQtView::createOffscreen):
3111         (WPEQtView::backendCreated):
3112         (WPEQtView::notifyUrlChangedCallback):
3113         (WPEQtView::notifyTitleChangedCallback):
3114         (WPEQtView::notifyLoadProgressCallback):
3115         (WPEQtView::notifyLoadChangedCallback):
3116         (WPEQtView::notifyLoadFailedCallback):
3117         (WPEQtView::updatePaintNode):
3118         (WPEQtView::url const):
3119         (WPEQtView::setUrl):
3120         (WPEQtView::loadProgress const):
3121         (WPEQtView::title const):
3122         (WPEQtView::canGoBack const):
3123         (WPEQtView::isLoading const):
3124         (WPEQtView::canGoForward const):
3125         (WPEQtView::goBack):
3126         (WPEQtView::goForward):
3127         (WPEQtView::reload):
3128         (WPEQtView::stop):
3129         (WPEQtView::loadHtml):
3130         (WPEQtView::jsAsyncReadyCallback):
3131         (WPEQtView::handleJsResult):
3132         (WPEQtView::runJavaScript):
3133         (WPEQtView::mousePressEvent):
3134         (WPEQtView::mouseReleaseEvent):
3135         (WPEQtView::hoverEnterEvent):
3136         (WPEQtView::hoverLeaveEvent):
3137         (WPEQtView::hoverMoveEvent):
3138         (WPEQtView::wheelEvent):
3139         (WPEQtView::keyPressEvent):
3140         (WPEQtView::keyReleaseEvent):
3141         (WPEQtView::touchEvent):
3142         * UIProcess/API/wpe/qt/WPEQtView.h: Added.
3143         * UIProcess/API/wpe/qt/WPEQtViewBackend.cpp: Added.
3144         (configureCallback):
3145         (WPEQtViewBackend::WPEQtViewBackend):
3146         (WPEQtViewBackend::~WPEQtViewBackend):
3147         (WPEQtViewBackend::configureGlibEglDisplay):
3148         (WPEQtViewBackend::configureEglDisplay):
3149         (WPEQtViewBackend::initialize):
3150         (WPEQtViewBackend::backend const):
3151         (WPEQtViewBackend::resize):
3152         (WPEQtViewBackend::getTexture):
3153         (WPEQtViewBackend::initSurface):
3154         (WPEQtViewBackend::displayImage):
3155         (WPEQtViewBackend::modifiers const):
3156         (WPEQtViewBackend::dispatchHoverEnterEvent):
3157         (WPEQtViewBackend::dispatchHoverLeaveEvent):
3158         (WPEQtViewBackend::dispatchHoverMoveEvent):
3159         (WPEQtViewBackend::dispatchMousePressEvent):
3160         (WPEQtViewBackend::dispatchMouseReleaseEvent):
3161         (WPEQtViewBackend::dispatchWheelEvent):
3162         (WPEQtViewBackend::dispatchKeyEvent):
3163         (WPEQtViewBackend::dispatchTouchEvent):
3164         * UIProcess/API/wpe/qt/WPEQtViewBackend.h: Added.
3165         * UIProcess/API/wpe/qt/WPEQtViewLoadRequest.cpp: Added.
3166         (WPEQtViewLoadRequest::WPEQtViewLoadRequest):
3167         (WPEQtViewLoadRequest::~WPEQtViewLoadRequest):
3168         (WPEQtViewLoadRequest::url const):
3169         (WPEQtViewLoadRequest::status const):
3170         (WPEQtViewLoadRequest::errorString const):
3171         * UIProcess/API/wpe/qt/WPEQtViewLoadRequest.h: Added.
3172         * UIProcess/API/wpe/qt/WPEQtViewLoadRequestPrivate.h: Added.
3173         (WPEQtViewLoadRequestPrivate::WPEQtViewLoadRequestPrivate):
3174         (WPEQtViewLoadRequestPrivate::~WPEQtViewLoadRequestPrivate):
3175         * UIProcess/API/wpe/qt/qmldir: Added.
3176
3177 2019-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
3178
3179         [iOS] Content offset jumps erratically when autoscrolling near scroll view content inset areas
3180         https://bugs.webkit.org/show_bug.cgi?id=193494
3181         <rdar://problem/46859627>
3182
3183         Reviewed by Simon Fraser and Tim Horton.
3184
3185         Adds `contentInsets` to `VisibleContentRectUpdateInfo`. This keeps track of the visible content insets
3186         surrounding the unobscured content rect. See WebCore ChangeLog for more details.
3187
3188         * Shared/VisibleContentRectUpdateInfo.cpp:
3189         (WebKit::VisibleContentRectUpdateInfo::encode const):
3190         (WebKit::VisibleContentRectUpdateInfo::decode):
3191         (WebKit::operator<<):
3192         * Shared/VisibleContentRectUpdateInfo.h:
3193         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
3194         (WebKit::VisibleContentRectUpdateInfo::contentInsets const):
3195         (WebKit::operator==):
3196         * UIProcess/API/Cocoa/WKWebView.mm:
3197         (-[WKWebView _computedObscuredInset]):
3198         (-[WKWebView _computedContentInset]):
3199         (-[WKWebView _computedUnobscuredSafeAreaInset]):
3200
3201         We don't care about source compatibility with iOS 10 and below anymore, so we should change these >= iOS 11
3202         target checks to simply `PLATFORM(IOS)`.
3203
3204         (-[WKWebView _updateVisibleContentRects]):
3205
3206         Compute the visible content insets on all sides of the unobscured content rect. These insets are scaled to
3207         content coordinates.
3208
3209         * UIProcess/ios/WKContentView.h:
3210         * UIProcess/ios/WKContentView.mm:
3211         (floatBoxExtent):
3212
3213         Add a helper to convert `UIEdgeInsets` to `WebCore::FloatBoxExtent`, and use it in a few places below.
3214
3215         (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
3216         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): Deleted.
3217         * WebProcess/WebPage/ios/WebPageIOS.mm:
3218         (WebKit::WebPage::updateVisibleContentRects):
3219
3220         Update the Page's content insets.
3221
3222 2019-01-17  Truitt Savell  <tsavell@apple.com>
3223
3224         Unreviewed, rolling out r240124.
3225
3226         This commit broke an internal build.
3227
3228         Reverted changeset:
3229
3230         "SDK_VARIANT build destinations should be separate from non-
3231         SDK_VARIANT builds"
3232         https://bugs.webkit.org/show_bug.cgi?id=189553
3233         https://trac.webkit.org/changeset/240124
3234
3235 2019-01-17  John Wilander  <wilander@apple.com>
3236
3237         Add infrastructure to enable/disable ITP Debug Mode through Preferences
3238         https://bugs.webkit.org/show_bug.cgi?id=193510
3239         <rdar://problem/47330969>
3240
3241         Reviewed by Dean Jackson.
3242
3243         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3244         (WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode):
3245         (WebKit::ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode):
3246         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode):
3247             These functions are now suited for runtime switching of ITP Debug Mode.
3248         * Shared/WebPreferences.yaml:
3249             Changed name from ResourceLoadStatisticsDebugMode to ItpDebugModeEnabled.
3250         * UIProcess/API/Cocoa/WKPreferences.mm:
3251         (-[WKPreferences _setItpDebugModeEnabled:]):
3252         (-[WKPreferences _itpDebugModeEnabled]):
3253             New private preferences functions.
3254         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3255         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
3256         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
3257             Removed support for old experimental user default. Added a new one that's
3258             not connected to any UI, i.e. merely for command line debugging where
3259             ITP Debug Mode needs to be on all the time.
3260
3261 2019-01-17  Tim Horton  <timothy_horton@apple.com>
3262
3263         Adopt NSTextCheckingSuppressInitialCapitalizationKey
3264         https://bugs.webkit.org/show_bug.cgi?id=193545
3265
3266         Reviewed by Dean Jackson.
3267
3268         * UIProcess/mac/TextCheckerMac.mm:
3269         (WebKit::TextChecker::checkTextOfParagraph):
3270         (WebKit::TextChecker::getGuessesForWord):
3271
3272 2019-01-17  Jer Noble  <jer.noble@apple.com>
3273
3274         SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds
3275         https://bugs.webkit.org/show_bug.cgi?id=189553
3276
3277         Reviewed by Tim Horton.
3278
3279         * Configurations/Base.xcconfig:
3280         * Configurations/BaseTarget.xcconfig:
3281         * Configurations/SDKVariant.xcconfig: Added.
3282
3283 2019-01-16  Dean Jackson  <dino@apple.com>
3284
3285         (iPad) Link tapping is sluggish on many sites
3286         https://bugs.webkit.org/show_bug.cgi?id=193522
3287         <rdar://problem/47102987>
3288
3289         Reviewed by Wenson Hsieh.
3290
3291         Some WKWebView clients might set the initial zoom scale of the page to
3292         something other than 1, which disables the "fast tap" behaviour.
3293         The fix is very simple -- just check against the initial scale rather
3294         than 1.
3295
3296         The most likely regression from this would be pages designed for desktop,
3297         but provide a viewport tag saying width=device-width and initial-scale.
3298         They might stop allowing double-tap-to-zoom.
3299
3300         * UIProcess/API/Cocoa/WKWebView.mm:
3301         (-[WKWebView _allowsDoubleTapGestures]): Check against initial page scale.
3302
3303 2019-01-17  Alex Christensen  <achristensen@webkit.org>
3304
3305         Stop using NetworkStorageSession::storageSession in WebCore
3306         https://bugs.webkit.org/show_bug.cgi?id=193529
3307
3308         Reviewed by Tim Horton.
3309
3310         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3311         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
3312         * NetworkProcess/NetworkProcess.h:
3313         * NetworkProcess/NetworkSocketStream.cpp:
3314         (WebKit::NetworkSocketStream::create):
3315         (WebKit::NetworkSocketStream::NetworkSocketStream):
3316         * NetworkProcess/NetworkSocketStream.h:
3317         * NetworkProcess/NetworkStorageSessionProvider.h: Added.
3318         * WebKit.xcodeproj/project.pbxproj:
3319         * WebProcess/Network/WebSocketProvider.cpp:
3320         (WebKit::WebSocketProvider::createSocketStreamHandle):
3321         * WebProcess/Network/WebSocketProvider.h:
3322         * WebProcess/WebPage/WebCookieJar.cpp:
3323         (WebKit::WebCookieJar::WebCookieJar):
3324         * WebProcess/WebPage/WebCookieJar.h:
3325
3326 2019-01-16  Youenn Fablet  <youenn@apple.com>
3327
3328         Add a new SPI for controlling getUserMedia
3329         https://bugs.webkit.org/show_bug.cgi?id=192793
3330
3331         Reviewed by Eric Carlson.
3332
3333         Some weaknesses of the current getUserMedia/enumerateDevices SPI were found.
3334         In particular:
3335         - The hash salt should be handled by WebKit not by apps using WebKit.
3336         - No need to expose the frame URL, only the top level origin is needed.
3337         - The names of the callback are changed to improve the intent of these callbacks.
3338         Addressed these by creating a new SPI which will replace the current one.
3339         The current SPI will be removed later on.
3340
3341         Did some refactoring by making the callbacks not return false.
3342         Instead, implement the default behavior inside the request objects as deny methods.
3343         Some further refactoring will be done as a follow-up to better align the C API with the Cocoa API.
3344
3345         * UIProcess/API/APIUIClient.h:
3346         (API::UIClient::decidePolicyForUserMediaPermissionRequest):
3347         (API::UIClient::checkUserMediaPermissionForOrigin):
3348         * UIProcess/API/C/WKPage.cpp:
3349         (WKPageSetPageUIClient):
3350         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3351         * UIProcess/API/Cocoa/WKWebView.mm:
3352         (-[WKWebView _mediaCaptureState]):
3353         (-[WKWebView _setMediaCaptureMuted:]):
3354         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3355         * UIProcess/API/glib/WebKitUIClient.cpp:
3356         * UIProcess/Cocoa/MediaCaptureUtilities.h: Added.
3357         * UIProcess/Cocoa/MediaCaptureUtilities.mm: Added.
3358         * UIProcess/Cocoa/UIDelegate.h:
3359         * UIProcess/Cocoa/UIDelegate.mm:
3360         (WebKit::UIDelegate::setDelegate):
3361         (WebKit::requestUserMediaAuthorizationForFrame):
3362         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
3363         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
3364         (WebKit::UIDelegate::UIClient::mediaCaptureStateDidChange):
3365         * UIProcess/UserMediaPermissionCheckProxy.h:
3366         (WebKit::UserMediaPermissionCheckProxy::deny):
3367         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3368         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
3369         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
3370         * UIProcess/UserMediaPermissionRequestProxy.h:
3371
3372 2019-01-16  Youenn Fablet  <youenn@apple.com>
3373
3374         Pipe cache quota request from Network Process to UIProcess
3375         https://bugs.webkit.org/show_bug.cgi?id=193296
3376
3377         Reviewed by Alex Christensen.
3378
3379         When cache storage hits quota for a given origin, pipe the request back to NetworkProcess.
3380         No record will be put until the quota request is answered.
3381         The request is sent from CacheStorage::Caches to CacheStorage::Engine and to NetworkProcess.
3382         NetworkProcess then sends it to NetworkProcessProxy.
3383         Currently NetworkProcessProxy just answers by keeping the quota as it is.
3384         In the future, NetworkProcessProxy should make a delegate call to let the app using WebKit
3385         make a decision on the quota. This will allow prompting user to bump it as done for other data.
3386
3387         * NetworkProcess/NetworkProcess.cpp:
3388         (WebKit::NetworkProcess::requestCacheStorageSpace):
3389         * NetworkProcess/NetworkProcess.h:
3390         * NetworkProcess/cache/CacheStorageEngine.cpp:
3391         (WebKit::CacheStorage::Engine::~Engine):
3392         (WebKit::CacheStorage::Engine::from):
3393         (WebKit::CacheStorage::Engine::Engine):
3394         (WebKit::CacheStorage::Engine::requestSpace):
3395         (WebKit::CacheStorage::Engine::requestSpaceCompleted):
3396         * NetworkProcess/cache/CacheStorageEngine.h:
3397         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
3398         (WebKit::CacheStorage::Cache::put):
3399         (WebKit::CacheStorage::Cache::retryPuttingPendingRecords):
3400         * NetworkProcess/cache/CacheStorageEngineCache.h:
3401         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
3402         (WebKit::CacheStorage::Caches::requestSpace):
3403         (WebKit::CacheStorage::Caches::notifyCachesOfRequestSpaceEnd):
3404         * NetworkProcess/cache/CacheStorageEngineCaches.h:
3405         (WebKit::CacheStorage::Caches::isRequestingSpace const):
3406         * UIProcess/Network/NetworkProcessProxy.cpp:
3407         (WebKit::NetworkProcessProxy::requestCacheStorageSpace):
3408         * UIProcess/Network/NetworkProcessProxy.h:
3409         * UIProcess/Network/NetworkProcessProxy.messages.in:
3410
3411 2019-01-16  Alex Christensen  <achristensen@webkit.org>
3412
3413         sendBeacon to previously-unvisited https domain always fails
3414         https://bugs.webkit.org/show_bug.cgi?id=193508
3415
3416         Reviewed by Geoffrey Garen.
3417
3418         * NetworkProcess/PingLoad.cpp:
3419         (WebKit::PingLoad::didReceiveChallenge):
3420         If a ping load is doing a TLS handshake, continue if the server has good certificates.
3421
3422 2019-01-16  Youenn Fablet  <youenn@apple.com>
3423
3424         ASSERTION FAILED: m_networkLoadInformationByID.contains(identifier) in WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics
3425         https://bugs.webkit.org/show_bug.cgi?id=189097
3426         <rdar://problem/43856423>
3427
3428         Reviewed by Alex Christensen.
3429
3430         In case where the inspector is launched, it will instruct the NetworkConnectionToWebProcess to start capturing network metrics.
3431         If this happens in the middle of a load, addNetworkLoadInformationMetrics might fail since addNetworkLoadInformation will not be called.
3432         To fix this issue, store whether to capture metrics at NetworkResourceLoader level.
3433
3434         To ensure that the case of switching back and forth capture of metrics, disable loader capture of metrics whenver NetworkConnectionToWebProcess is asked to.
3435
3436         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3437         (WebKit::NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled):
3438         * NetworkProcess/NetworkConnectionToWebProcess.h:
3439         (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics):
3440         * NetworkProcess/NetworkResourceLoader.cpp:
3441         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
3442         (WebKit::NetworkResourceLoader::shouldCaptureExtraNetworkLoadMetrics const):
3443         * NetworkProcess/NetworkResourceLoader.h:
3444
3445 2019-01-16  Alex Christensen  <achristensen@webkit.org>
3446
3447         Revert r239938
3448         https://bugs.webkit.org/show_bug.cgi?id=193267
3449         <rdar://problem/47297304>
3450
3451         * Configurations/WebContent-iOS.entitlements:
3452
3453 2019-01-16  Chris Dumez  <cdumez@apple.com>
3454
3455         Regression(r240046) Several API tests are crashing
3456         https://bugs.webkit.org/show_bug.cgi?id=193509
3457
3458         Reviewed by Geoffrey Garen.
3459
3460         The crashes would happen because loadRequestShared() would take a WebProcessProxy& in parameter but
3461         then call reattachToWebProcess() if the page is not valid, which would replace m_process and invalidate
3462         our process reference.
3463
3464         To address the issue, move the reattachToWebProcess() call to loadRequest(), before calling
3465         loadRequestShared(). Also, update *Shared() methods to take a Ref<WebProcessProxy>&& instead
3466         of a WebProcessProxy& in parameter. Since we call client delegates, we need to make sure
3467         our process stays alive.
3468
3469         * UIProcess/ProvisionalPageProxy.cpp:
3470         (WebKit::ProvisionalPageProxy::loadData):
3471         (WebKit::ProvisionalPageProxy::loadRequest):
3472         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
3473         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
3474         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
3475         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
3476         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
3477         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
3478         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
3479         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
3480         (WebKit::ProvisionalPageProxy::startURLSchemeTask):
3481         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
3482         * UIProcess/WebPageProxy.cpp:
3483         (WebKit::WebPageProxy::loadRequest):
3484         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
3485         (WebKit::WebPageProxy::loadData):
3486         (WebKit::WebPageProxy::loadDataWithNavigationShared):
3487         (WebKit::WebPageProxy::didPerformDragControllerAction):
3488         (WebKit::WebPageProxy::findPlugin):
3489         (WebKit::WebPageProxy::didCreateMainFrame):
3490         (WebKit::WebPageProxy::didCreateSubframe):
3491         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
3492         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
3493         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
3494         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared):
3495         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
3496         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
3497         (WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
3498         (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared):
3499         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
3500         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
3501         (WebKit::WebPageProxy::didCommitLoadForFrame):
3502         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
3503         (WebKit::WebPageProxy::didFinishLoadForFrame):
3504         (WebKit::WebPageProxy::didFailLoadForFrame):
3505         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
3506         (WebKit::WebPageProxy::didReceiveTitleForFrame):
3507         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
3508         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
3509         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
3510         (WebKit::WebPageProxy::frameDidBecomeFrameSet):
3511         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
3512         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
3513         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3514         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
3515         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
3516         (WebKit::WebPageProxy::decidePolicyForResponse):
3517         (WebKit::WebPageProxy::decidePolicyForResponseShared):
3518         (WebKit::WebPageProxy::unableToImplementPolicy):
3519         (WebKit::WebPageProxy::willSubmitForm):
3520         (WebKit::WebPageProxy::didNavigateWithNavigationData):
3521         (WebKit::WebPageProxy::didNavigateWithNavigationDataShared):
3522         (WebKit::WebPageProxy::didPerformClientRedirect):
3523         (WebKit::WebPageProxy::didPerformClientRedirectShared):
3524         (WebKit::WebPageProxy::didPerformServerRedirect):
3525         (WebKit::WebPageProxy::didUpdateHistoryTitle):
3526         (WebKit::WebPageProxy::createNewPage):
3527         (WebKit::WebPageProxy::runJavaScriptAlert):
3528         (WebKit::WebPageProxy::runJavaScriptConfirm):
3529         (WebKit::WebPageProxy::runJavaScriptPrompt):
3530         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
3531         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
3532         (WebKit::WebPageProxy::runOpenPanel):
3533         (WebKit::WebPageProxy::printFrame):
3534         (WebKit::WebPageProxy::backForwardGoToItem):
3535         (WebKit::WebPageProxy::backForwardGoToItemShared):
3536         (WebKit::WebPageProxy::learnWord):
3537         (WebKit::WebPageProxy::ignoreWord):
3538         (WebKit::WebPageProxy::didReceiveEvent):
3539         (WebKit::WebPageProxy::editingRangeCallback):
3540         (WebKit::WebPageProxy::rectForCharacterRangeCallback):
3541         (WebKit::WebPageProxy::focusedFrameChanged):
3542         (WebKit::WebPageProxy::frameSetLargestFrameChanged):
3543         (WebKit::WebPageProxy::exceededDatabaseQuota):
3544         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
3545         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
3546         (WebKit::WebPageProxy::enumerateMediaDevicesForFrame):
3547         (WebKit::WebPageProxy::startURLSchemeTask):
3548         (WebKit::WebPageProxy::startURLSchemeTaskShared):
3549         (WebKit::WebPageProxy::stopURLSchemeTask):
3550         (WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
3551         * UIProcess/WebPageProxy.h:
3552
3553 2019-01-16  Chris Dumez  <cdumez@apple.com>
3554
3555         Regression(PSON) View becomes blank after click a cross-site download link
3556         https://bugs.webkit.org/show_bug.cgi?id=193361
3557         <rdar://problem/47099573>
3558
3559         Reviewed by Geoffrey Garen.
3560
3561         The issue tracked by rdar://problem/47099573 is that a provisional load may get
3562         canceled (or converted into a download) *after* we've decided to process-swap.
3563         In such cases, the view should keep displaying the current site and it should
3564         still be interactive. However, with the previous PSON model, the view (pageProxy)
3565         would have already swapped to the new process and would end up displaying the
3566         initially empty document.
3567
3568         To address the issue, this patch introduces the concept of a provisional load
3569         in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional
3570         process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the
3571         provisional page until after the load was committed in the new process. This means
3572         that the view / WebPageProxy keeps using the old process and displays the current
3573         content until a load has committed in the provisional page. If no load commits
3574         in the provisional process (e.g. because the load is cancelled or converted into
3575         a download), then we merely destroy the ProvisionalPageProxy and terminate its
3576         process, without impacting the WebPageProxy.
3577
3578         * Shared/WebPageCreationParameters.cpp:
3579         (WebKit::WebPageCreationParameters::encode const):
3580         (WebKit::WebPageCreationParameters::decode):
3581         * Shared/WebPageCreationParameters.h:
3582         Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to
3583         delay attaching the drawing area in case of a process-swap, no matter what
3584         now that the previous process is kept alive until the provisional load is
3585         committed in the new process.
3586
3587         * Shared/WebPolicyAction.h:
3588         Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of
3589         process-swap, we now tell the previous process to simply ignore the load, while
3590         we create a ProvisionalPageProxy to do the new load in a new process.
3591         Suspension of the previous page in the old process, happens later, when a load
3592         is actually committed in the new process.
3593
3594         * Sources.txt:
3595         Add new ProvisionalPageProxy file.
3596
3597         * UIProcess/API/Cocoa/WKWebView.mm:
3598         (-[WKWebView _killWebContentProcessAndResetState]):
3599         When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current
3600         process and the provisional one, to maintain previous behavior in our API tests.
3601
3602         * UIProcess/API/gtk/PageClientImpl.cpp:
3603         (WebKit::PageClientImpl::createDrawingAreaProxy):
3604         * UIProcess/API/gtk/PageClientImpl.h:
3605         * UIProcess/API/wpe/PageClientImpl.cpp:
3606         (WebKit::PageClientImpl::createDrawingAreaProxy):
3607         * UIProcess/API/wpe/PageClientImpl.h:
3608         * UIProcess/AcceleratedDrawingAreaProxy.cpp:
3609         (WebKit::AcceleratedDrawingAreaProxy::AcceleratedDrawingAreaProxy):
3610         (WebKit::AcceleratedDrawingAreaProxy::didUpdateBackingStoreState):
3611         (WebKit::AcceleratedDrawingAreaProxy::sendUpdateBackingStoreState):
3612         (WebKit::AcceleratedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState):
3613         (WebKit::AcceleratedDrawingAreaProxy::setNativeSurfaceHandleForCompositing):
3614         (WebKit::AcceleratedDrawingAreaProxy::destroyNativeSurfaceHandleForCompositing):
3615         * UIProcess/AcceleratedDrawingAreaProxy.h:
3616         * UIProcess/Cocoa/WebViewImpl.h:
3617         * UIProcess/Cocoa/WebViewImpl.mm:
3618         (WebKit::WebViewImpl::createDrawingAreaProxy):
3619         * UIProcess/DrawingAreaProxy.cpp:
3620         (WebKit::DrawingAreaProxy::DrawingAreaProxy):
3621         (WebKit::DrawingAreaProxy::~DrawingAreaProxy):
3622         (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired):
3623         * UIProcess/DrawingAreaProxy.h:
3624         (WebKit::DrawingAreaProxy::process):
3625         * UIProcess/DrawingAreaProxyImpl.cpp:
3626         (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
3627         (WebKit::DrawingAreaProxyImpl::update):
3628         * UIProcess/DrawingAreaProxyImpl.h:
3629         * UIProcess/PageClient.h:
3630         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
3631         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
3632         (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
3633         (WebKit::RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy):
3634         (WebKit::RemoteLayerTreeDrawingAreaProxy::deviceScaleFactorDidChange):
3635         (WebKit::RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry):
3636         (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidStart):
3637         (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidEnd):
3638         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
3639         (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState):
3640         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
3641         * UIProcess/ios/PageClientImplIOS.h:
3642         * UIProcess/ios/PageClientImplIOS.mm:
3643         (WebKit::PageClientImpl::createDrawingAreaProxy):
3644         * UIProcess/ios/WKContentView.h:
3645         * UIProcess/ios/WKContentView.mm:
3646         (-[WKContentView _createDrawingAreaProxy:]):
3647         * UIProcess/mac/PageClientImplMac.h:
3648         * UIProcess/mac/PageClientImplMac.mm:
3649         (WebKit::PageClientImpl::createDrawingAreaProxy):
3650         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
3651         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
3652         (WebKit::TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy):
3653         (WebKit::TiledCoreAnimationDrawingAreaProxy::deviceScaleFactorDidChange):
3654         (WebKit::TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange):
3655         (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
3656         (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence):
3657         (WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry):
3658         (WebKit::TiledCoreAnimationDrawingAreaProxy::adjustTransientZoom):
3659         (WebKit::TiledCoreAnimationDrawingAreaProxy::commitTransientZoom):
3660         (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing):
3661         * UIProcess/mac/WebPageProxyMac.mm:
3662         * UIProcess/win/PageClientImpl.cpp:
3663         (WebKit::PageClientImpl::createDrawingAreaProxy):
3664         * UIProcess/win/PageClientImpl.h:
3665         * UIProcess/win/PageClientImpl.cpp:
3666         (WebKit::PageClientImpl::createDrawingAreaProxy):
3667         * UIProcess/win/PageClientImpl.h:
3668         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3669         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
3670         Pass the drawing area's associated process when constructing it and store it as a member
3671         in addition to the page. This is necessary now that a page can be associated with 2
3672         WebProcesses at a time, each having its own drawing area.
3673
3674         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3675         (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded):
3676         Pass the process.
3677
3678         * UIProcess/ProvisionalPageProxy.cpp: Added.
3679         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
3680         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
3681         (WebKit::ProvisionalPageProxy::processDidTerminate):
3682         (WebKit::ProvisionalPageProxy::takeDrawingArea):
3683         (WebKit::ProvisionalPageProxy::cancel):
3684         (WebKit::ProvisionalPageProxy::processDidFinishLaunching):
3685         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch):
3686         (WebKit::ProvisionalPageProxy::initializeWebPage):
3687         (WebKit::ProvisionalPageProxy::loadData):
3688         (WebKit::ProvisionalPageProxy::loadRequest):
3689         (WebKit::ProvisionalPageProxy::goToBackForwardItem):
3690         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
3691         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
3692         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
3693         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
3694         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
3695         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
3696         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
3697         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
3698         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
3699         (WebKit::ProvisionalPageProxy::startURLSchemeTask):
3700         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
3701         (WebKit::ProvisionalPageProxy::didReceiveMessage):
3702         (WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
3703         * UIProcess/ProvisionalPageProxy.h: Added.
3704         (WebKit::ProvisionalPageProxy::page):
3705         (WebKit::ProvisionalPageProxy::mainFrame const):
3706         (WebKit::ProvisionalPageProxy::process):
3707         (WebKit::ProvisionalPageProxy::processSwapRequestedByClient const):
3708         (WebKit::ProvisionalPageProxy::navigationID const):
3709         (WebKit::ProvisionalPageProxy::drawingArea const):
3710         New WebPageProxy-like class which is owned by the WebPageProxy and proxies IPC from
3711         the provisional process.
3712
3713         * UIProcess/SuspendedPageProxy.cpp:
3714         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
3715         (WebKit::SuspendedPageProxy::unsuspend):
3716         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
3717         Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier
3718         when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy
3719         which tries to register itself as an IPC message receiver for the same pageID when
3720         a process-swap occurs and we're switching to a suspended page.
3721
3722         * UIProcess/WebFrameProxy.cpp:
3723         (WebKit::WebFrameProxy::isMainFrame const):
3724         WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame.
3725         Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's
3726         m_mainFrame to maintain previous behavior.
3727
3728         * UIProcess/WebPageProxy.cpp:
3729         (WebKit::WebPageProxy::provisionalDrawingArea const):
3730         Add getter for the provisional drawing area. We normally only deal with the page's current drawing area, but
3731         the ViewGestureController needs access to the provisional once to display the swipe gesture snapshot.
3732
3733         (WebKit::WebPageProxy::swapToWebProcess):
3734         swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess()
3735         later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs
3736         to initialize some data members such as the drawing area and the main frame as it is transferring them over from
3737         the ProvisionalPageProxy which started the provisional load.
3738
3739         (WebKit::WebPageProxy::finishAttachingToWebProcess):
3740         We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
3741         committed in the provisional process.
3742
3743         (WebKit::WebPageProxy::setDrawingArea):
3744         (WebKit::WebPageProxy::initializeWebPage):
3745         - We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
3746           committed in the provisional process.
3747         - Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess().
3748
3749         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
3750         (WebKit::WebPageProxy::loadRequest):
3751         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
3752         Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not
3753         Yes. This avoids hitting some assertions as this was already called during the first API call if needed.
3754
3755         (WebKit::WebPageProxy::loadData):
3756         (WebKit::WebPageProxy::loadDataWithNavigationShared):
3757         (WebKit::WebPageProxy::stopLoading):
3758         (WebKit::WebPageProxy::reload):
3759         (WebKit::WebPageProxy::didPerformDragControllerAction):
3760         (WebKit::WebPageProxy::findPlugin):
3761         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3762         In case of process swap, tell the previous process to ignore the load instead of suspending it right away.
3763         Suspension now happens later, only if we end up committing the provisional load in the new process.
3764         Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used
3765         to happen a bit later but it is clearer if we do this as early as possible I think.
3766
3767         (WebKit::WebPageProxy::commitProvisionalPage):
3768         When the load is committed in the new process, we call WebPageProxy::commitProvisionalPage(). It takes care of:
3769         - Actually swapping the WebPageProxy to the new process by calling processDidTerminate() / swapToWebProcess().
3770         - Suspending the current page.
3771         - Letting the client know the load is comitted
3772         - Destroy the ProvisionalPageProxy.
3773         This work used to happen earlier in continueNavigationInNewProcess().
3774
3775         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3776         Moved some of the logic to commitProvisionalPage(). We now merely start the load in a new ProvisionalPageProxy,
3777         without actually having the WebPageProxy switch to the new process yet.
3778
3779         (WebKit::WebPageProxy::didCreateMainFrame):
3780         (WebKit::WebPageProxy::didCreateSubframe):
3781         (WebKit::WebPageProxy::didCreateWindow):
3782         Drop some code that is no longer needed, now that the ProvisionalPageProxy takes care of this.
3783
3784         (WebKit::WebPageProxy::didDestroyNavigation):
3785         On process-swap, when telling the previous process to ignore the load and starting the new load in a new
3786         ProvisionalPageProxy, the previous WebPage attempts to destroy the navigation. In this case, we ignore
3787         the call since the navigation is merely taken over by the ProvisionalPageProxy.
3788
3789         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
3790         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
3791         Moved some PSON logic to the ProvisionalPageProxy instead.
3792
3793         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
3794         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared):
3795         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
3796         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
3797         (WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
3798         (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared):
3799
3800         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
3801         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
3802         When didFailProvisionalLoadForFrame() is called for a ProvisionalPageProxy, destroy it.
3803
3804         (WebKit::WebPageProxy::didCommitLoadForFrame):
3805         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
3806         (WebKit::WebPageProxy::didFinishLoadForFrame):
3807         (WebKit::WebPageProxy::didFailLoadForFrame):
3808         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
3809         (WebKit::WebPageProxy::didReceiveTitleForFrame):
3810         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
3811         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
3812         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
3813         (WebKit::WebPageProxy::frameDidBecomeFrameSet):
3814         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
3815         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
3816         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3817         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
3818         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
3819         (WebKit::WebPageProxy::decidePolicyForResponse):
3820         (WebKit::WebPageProxy::decidePolicyForResponseShared):
3821         (WebKit::WebPageProxy::unableToImplementPolicy):
3822         (WebKit::WebPageProxy::willSubmitForm):
3823         (WebKit::WebPageProxy::didNavigateWithNavigationData):
3824         (WebKit::WebPageProxy::didNavigateWithNavigationDataShared):
3825         (WebKit::WebPageProxy::didPerformClientRedirect):
3826         (WebKit::WebPageProxy::didPerformClientRedirectShared):
3827         (WebKit::WebPageProxy::didPerformServerRedirect):
3828         (WebKit::WebPageProxy::didUpdateHistoryTitle):
3829         (WebKit::WebPageProxy::createNewPage):
3830         (WebKit::WebPageProxy::runJavaScriptAlert):
3831         (WebKit::WebPageProxy::runJavaScriptConfirm):
3832         (WebKit::WebPageProxy::runJavaScriptPrompt):
3833         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
3834         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
3835         (WebKit::WebPageProxy::runOpenPanel):
3836         (WebKit::WebPageProxy::printFrame):
3837         (WebKit::WebPageProxy::backForwardGoToItem):
3838         (WebKit::WebPageProxy::backForwardGoToItemShared):
3839         (WebKit::WebPageProxy::learnWord):
3840         (WebKit::WebPageProxy::ignoreWord):
3841         (WebKit::WebPageProxy::didReceiveEvent):
3842         (WebKit::WebPageProxy::editingRangeCallback):
3843         (WebKit::WebPageProxy::rectForCharacterRangeCallback):
3844         (WebKit::WebPageProxy::focusedFrameChanged):
3845         (WebKit::WebPageProxy::frameSetLargestFrameChanged):
3846
3847         (WebKit::WebPageProxy::provisionalProcessDidTerminate):
3848         Cancel the provisiona load and destroy the ProvisionalPageProxy if
3849         the provisional process crashes.
3850
3851         (WebKit::WebPageProxy::resetState):
3852         Drop some code that is no longer needed.
3853
3854         (WebKit::WebPageProxy::creationParameters):
3855         - Move the hasRegisteredServiceWorkers flag initialization from the call site to here now that we have
3856         more than one call site. This was just some bad factoring.
3857         - Take the process in parameter now that we page can be associated with several processes at a time.
3858
3859         (WebKit::WebPageProxy::exceededDatabaseQuota):
3860         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
3861         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
3862         (WebKit::WebPageProxy::enumerateMediaDevicesForFrame):
3863         (WebKit::WebPageProxy::startURLSchemeTask):
3864         (WebKit::WebPageProxy::startURLSchemeTaskShared):
3865         (WebKit::WebPageProxy::stopURLSchemeTask):
3866         (WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
3867         (WebKit::WebPageProxy::checkURLReceivedFromCurrentOrPreviousWebProcess):
3868         (WebKit::WebPageProxy::willAcquireUniversalFileReadSandboxExtension):
3869         * UIProcess/WebPageProxy.h:
3870         (WebKit::WebPageProxy::visitedLinkStore):
3871         (WebKit::WebPageProxy::provisionalPageProxy const):
3872
3873         * UIProcess/WebProcessProxy.cpp:
3874         (WebKit::WebProcessProxy::hasProvisionalPageWithID const):
3875         (WebKit::WebProcessProxy::updateBackForwardItem):
3876         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
3877         (WebKit::WebProcessProxy::didFinishLaunching):
3878         (WebKit::WebProcessProxy::canTerminateChildProcess):
3879         * UIProcess/WebProcessProxy.h:
3880         (WebKit::WebProcessProxy::addProvisionalPageProxy):
3881         (WebKit::WebProcessProxy::removeProvisionalPageProxy):
3882         Before updating a BackForwardListItem, we normally make sure the process has a WebPageProxy with the
3883         item's pageID. We have to tweak the logic because there may now be no WebPageProxy with this pageID
3884         associated with this process yet, because it is still a ProvisionalPageProxy.        
3885
3886         * UIProcess/WebURLSchemeHandler.cpp:
3887         (WebKit::WebURLSchemeHandler::startTask):
3888         * UIProcess/WebURLSchemeHandler.h:
3889         * UIProcess/WebURLSchemeTask.cpp:
3890         (WebKit::WebURLSchemeTask::create):
3891         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
3892         (WebKit::WebURLSchemeTask::didPerformRedirection):
3893         (WebKit::WebURLSchemeTask::didReceiveResponse):
3894         (WebKit::WebURLSchemeTask::didReceiveData):
3895         (WebKit::WebURLSchemeTask::didComplete):
3896         (WebKit::WebURLSchemeTask::pageDestroyed):
3897         * UIProcess/WebURLSchemeTask.h:
3898         Pass the process when constructing a WebURLSchemeTask and store it as a data member in addition to
3899         the page. This is necessary now that a WebPageProxy can be associated with several WebProcesses.
3900
3901         * UIProcess/ios/ViewGestureControllerIOS.mm:
3902         (WebKit::ViewGestureController::endSwipeGesture):
3903         Use the provisional drawing area to display the swipe snapshot as it may differ from the one currently
3904         associated with the page in case of process swap.
3905
3906         * WebKit.xcodeproj/project.pbxproj:
3907         Add ProvisionalPageProxy class.
3908
3909         * WebProcess/WebPage/WebFrame.cpp:
3910         (WebKit::toPolicyAction):
3911         (WebKit::WebFrame::didReceivePolicyDecision):
3912         * WebProcess/WebPage/WebPage.cpp:
3913         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
3914         (WebKit::WebPage::reinitializeWebPage):
3915         (WebKit::WebPage::didReceivePolicyDecision):
3916         Stop dealing with WebPolicyAction::Suspend as it no longer exists.
3917
3918         (WebKit::WebPage::didCompletePageTransition):
3919
3920         (WebKit::WebPage::setIsSuspended):
3921         Suspend the Page when setIsSuspended(true) is called, now that there is no longer a WebPolicyAction::Suspend.
3922         setIsSuspended(true) IPC is sent when we actually commit the provisional page.
3923
3924         * WebProcess/WebPage/WebPage.h:
3925
3926 2019-01-16  Tim Horton  <timothy_horton@apple.com>
3927
3928         Frequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded()
3929         https://bugs.webkit.org/show_bug.cgi?id=193468
3930         <rdar://problem/38645869>
3931
3932         Reviewed by Zalan Bujtas.
3933
3934         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3935         (WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded):
3936         Adjust the null-check a bit; Zalan pointed out that the layout could
3937         be responsible for the Frame/RenderView going away, so we should bail
3938         *after* layout, not before.
3939
3940 2019-01-15  Fujii Hironori  <Hironori.Fujii@sony.com>
3941
3942         Unreviewed WinCairo build fix.
3943
3944         * WebProcess/WebPage/WebPageInspectorTargetController.cpp:
3945         (WebKit::WebPageInspectorTargetController::connectInspector): Use 'auto' instead of unprefixed InspectorTarget.
3946         (WebKit::WebPageInspectorTargetController::disconnectInspector): Ditto.
3947         (WebKit::WebPageInspectorTargetController::sendMessageToTargetBackend): Ditto.
3948
3949 2019-01-15  Alex Christensen  <achristensen@webkit.org>
3950
3951         Reduce use of NetworkStorageSession::defaultStorageSession in WebCore
3952         https://bugs.webkit.org/show_bug.cgi?id=193368
3953
3954         Reviewed by Geoff Garen.
3955
3956         * WebProcess/Plugins/PluginView.cpp:
3957         (WebKit::PluginView::getAuthenticationInfo):
3958
3959 2019-01-15  Alex Christensen  <achristensen@webkit.org>
3960
3961         Remove more NetworkProcess::singleton use
3962         https://bugs.webkit.org/show_bug.cgi?id=193484
3963
3964         Reviewed by Geoffrey Garen.
3965
3966         This removes the use of NetworkProcess::singleton in the LegacyCustomProtocolManager.
3967         This is the kind of awful duct tape code that keeps me aw