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