Adopt WebCore::RegistrableDomain in WebCore::ResourceLoadStatistics and WebKit::Netwo...
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-02-27  John Wilander  <wilander@apple.com>
2
3         Adopt WebCore::RegistrableDomain in WebCore::ResourceLoadStatistics and WebKit::NetworkProcessProxy
4         https://bugs.webkit.org/show_bug.cgi?id=195071
5         <rdar://problem/48417690>
6
7         Reviewed by Alex Christensen and Brent Fulgham.
8
9         This patch adopts WebCore::RegistrableDomain in WebKit::NetworkProcessProxy
10         and makes the necessary infrastructure changes to support that.
11
12         The previous HashCountedSets in WebCore::ResourceLoadStatistics are now just
13         HashSets since we never used the counts for anything. This change simplified
14         the IPC::ArgumentCoder<ResourceLoadStatistics> encode and decode functions.
15
16         The patch also makes WebCore::RegistrableDomain's String constructor private.
17         A new create function WebCore::RegistrableDomain::uncheckedCreateFromString()
18         is introduced to better signal to users that creating a registrable domain
19         object with a string may create an object that doesn't match a registrable
20         domain in a valid HTTP-family URL.
21
22         Finally, this patch harmonizes parameter and variable naming, going from
23         "origin" to "domain" and "mainFrame" to "topFrame."
24
25         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
26         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
27         (WebKit::ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain const):
28         (WebKit::ResourceLoadStatisticsMemoryStore::markAsPrevalentIfHasRedirectedToPrevalent):
29         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess):
30         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
31         (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
32         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceLoading):
33         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceRedirect):
34         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubresourceUnder const):
35         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubFrameUnder const):
36         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsRedirectingTo const):
37         (WebKit::ResourceLoadStatisticsMemoryStore::setSubframeUnderTopFrameDomain):
38         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUnderTopFrameDomain):
39         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectTo):
40         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectFrom):
41         (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectTo):
42         (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectFrom):
43         (WebKit::ResourceLoadStatisticsMemoryStore::createEncoderFromData const):
44         (WebKit::ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt):
45         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUnexpiredRecentUserInteraction const):
46         (WebKit::ResourceLoadStatisticsMemoryStore::setSubframeUnderTopFrameOrigin): Deleted.
47         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUnderTopFrameOrigin): Deleted.
48         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
49         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
50         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted):
51         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameDomain):
52         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameDomain):
53         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
54         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin): Deleted.
55         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin): Deleted.
56         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
57         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
58         (WebKit::sortedPrevalentResourceTelemetry):
59         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
60         * NetworkProcess/NetworkProcess.cpp:
61         (WebKit::NetworkProcess::setSubframeUnderTopFrameDomain):
62         (WebKit::NetworkProcess::setSubresourceUnderTopFrameDomain):
63         (WebKit::filterForRegistrableDomains):
64         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
65         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
66         (WebKit::NetworkProcess::setSubframeUnderTopFrameOrigin): Deleted.
67         (WebKit::NetworkProcess::setSubresourceUnderTopFrameOrigin): Deleted.
68         * NetworkProcess/NetworkProcess.h:
69         * NetworkProcess/NetworkProcess.messages.in:
70         * NetworkProcess/NetworkSession.cpp:
71         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
72         * NetworkProcess/NetworkSession.h:
73         * Platform/classifier/ResourceLoadStatisticsClassifier.cpp:
74         (WebKit::ResourceLoadStatisticsClassifier::calculateResourcePrevalence):
75         * Shared/WebCoreArgumentCoders.cpp:
76         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
77         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
78         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
79         (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin):
80         (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin):
81         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
82         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
83         * UIProcess/Network/NetworkProcessProxy.cpp:
84         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
85         (WebKit::NetworkProcessProxy::isPrevalentResource):
86         (WebKit::NetworkProcessProxy::isVeryPrevalentResource):
87         (WebKit::NetworkProcessProxy::setPrevalentResource):
88         (WebKit::NetworkProcessProxy::setPrevalentResourceForDebugMode):
89         (WebKit::NetworkProcessProxy::setVeryPrevalentResource):
90         (WebKit::NetworkProcessProxy::setLastSeen):
91         (WebKit::NetworkProcessProxy::clearPrevalentResource):
92         (WebKit::NetworkProcessProxy::logUserInteraction):
93         (WebKit::NetworkProcessProxy::hasHadUserInteraction):
94         (WebKit::NetworkProcessProxy::clearUserInteraction):
95         (WebKit::NetworkProcessProxy::setSubframeUnderTopFrameDomain):
96         (WebKit::NetworkProcessProxy::isRegisteredAsRedirectingTo):
97         (WebKit::NetworkProcessProxy::isRegisteredAsSubFrameUnder):
98         (WebKit::NetworkProcessProxy::setSubresourceUnderTopFrameDomain):
99         (WebKit::NetworkProcessProxy::isRegisteredAsSubresourceUnder):
100         (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectTo):
101         (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectFrom):
102         (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectTo):
103         (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectFrom):
104         (WebKit::NetworkProcessProxy::isGrandfathered):
105         (WebKit::NetworkProcessProxy::setGrandfathered):
106         (WebKit::NetworkProcessProxy::hasStorageAccessForFrame):
107         (WebKit::NetworkProcessProxy::hasStorageAccess):
108         (WebKit::NetworkProcessProxy::requestStorageAccess):
109         (WebKit::NetworkProcessProxy::requestStorageAccessConfirm):
110         (WebKit::NetworkProcessProxy::grantStorageAccess):
111         (WebKit::NetworkProcessProxy::setSubframeUnderTopFrameOrigin): Deleted.
112         (WebKit::NetworkProcessProxy::setSubresourceUnderTopFrameOrigin): Deleted.
113         * UIProcess/Network/NetworkProcessProxy.h:
114         * UIProcess/Network/NetworkProcessProxy.messages.in:
115         * UIProcess/WebPageProxy.cpp:
116         (WebKit::WebPageProxy::requestStorageAccessConfirm):
117         * UIProcess/WebPageProxy.h:
118         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
119         (WebKit::WebsiteDataStore::isPrevalentResource):
120         (WebKit::WebsiteDataStore::setPrevalentResource):
121         (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode):
122         (WebKit::WebsiteDataStore::isVeryPrevalentResource):
123         (WebKit::WebsiteDataStore::setVeryPrevalentResource):
124         (WebKit::WebsiteDataStore::setSubframeUnderTopFrameDomain):
125         (WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder):
126         (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameDomain):
127         (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder):
128         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo):
129         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom):
130         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo):
131         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom):
132         (WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo):
133         (WebKit::WebsiteDataStore::clearPrevalentResource):
134         (WebKit::WebsiteDataStore::setLastSeen):
135         (WebKit::WebsiteDataStore::hasStorageAccess):
136         (WebKit::WebsiteDataStore::requestStorageAccess):
137         (WebKit::WebsiteDataStore::grantStorageAccess):
138         (WebKit::WebsiteDataStore::logUserInteraction):
139         (WebKit::WebsiteDataStore::hasHadUserInteraction):
140         (WebKit::WebsiteDataStore::clearUserInteraction):
141         (WebKit::WebsiteDataStore::setGrandfathered):
142         (WebKit::WebsiteDataStore::setSubframeUnderTopFrameOrigin): Deleted.
143         (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameOrigin): Deleted.
144         * UIProcess/WebsiteData/WebsiteDataStore.h:
145         * WebProcess/WebPage/WebPage.cpp:
146         (WebKit::WebPage::hasStorageAccess):
147         (WebKit::WebPage::requestStorageAccess):
148
149 2019-02-27  Keith Rollin  <krollin@apple.com>
150
151         Fix Xcode project UUIDs for TextCheckerCompletion.cpp and TextCheckerCompletion.h
152         https://bugs.webkit.org/show_bug.cgi?id=195109
153         <rdar://problem/48442272>
154
155         Reviewed by Alexey Proskuryakov.
156
157         In r144436, TextCheckerCompletion.cpp and TextCheckerCompletion.h were
158         added to WebKit2.xcodeproj with invalid UUIDs (they included Q's and
159         Z's in hexadecimal strings). While these UUIDs haven't caused any
160         problems in practice over the last six years, they are indeed invalid,
161         and were discovered via an Xcode-project processing tool that did not
162         anticipate their format. Fix this by removing the files from the
163         project and re-adding them.
164
165         * WebKit.xcodeproj/project.pbxproj:
166
167 2019-02-27  Youenn Fablet  <youenn@apple.com>
168
169         Remove UserMediaProcessManager processState map
170         https://bugs.webkit.org/show_bug.cgi?id=195056
171
172         Reviewed by Eric Carlson.
173
174         Before the patch, the WebProcessProxy->ProcessState map was storing the list of manager proxies and process state.
175         To improve on this model, this patch does the following:
176         - Move the process state to WebProcessProxy.
177         - Remove the map and replace it by a set of all manager proxies.
178
179         This simplifies the handling.
180         On WebProcess side, instead of storing the sandbox extensions in each WebPage, we handle them in WebProcess directly.
181         This mirrors what is being done in UIProcess and reduces the risk of inconsistencies between the two, the risk being that capture would fail.
182
183         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
184         (WebKit::UserMediaPermissionRequestManagerProxy::forEach):
185         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy):
186         (WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
187         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
188         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
189         * UIProcess/UserMediaProcessManager.cpp:
190         (WebKit::UserMediaProcessManager::muteCaptureMediaStreamsExceptIn):
191         (WebKit::UserMediaProcessManager::willCreateMediaStream):
192         (WebKit::UserMediaProcessManager::endedCaptureSession):
193         (WebKit::UserMediaProcessManager::setCaptureEnabled):
194         (WebKit::UserMediaProcessManager::captureDevicesChanged):
195         (WebKit::ProcessState::ProcessState): Deleted.
196         (WebKit::ProcessState::hasVideoExtension const): Deleted.
197         (WebKit::ProcessState::grantVideoExtension): Deleted.
198         (WebKit::ProcessState::revokeVideoExtension): Deleted.
199         (WebKit::ProcessState::hasAudioExtension const): Deleted.
200         (WebKit::ProcessState::grantAudioExtension): Deleted.
201         (WebKit::ProcessState::revokeAudioExtension): Deleted.
202         (WebKit::stateMap): Deleted.
203         (WebKit::processState): Deleted.
204         (WebKit::ProcessState::addRequestManager): Deleted.
205         (WebKit::ProcessState::removeRequestManager): Deleted.
206         (WebKit::UserMediaProcessManager::addUserMediaPermissionRequestManagerProxy): Deleted.
207         (WebKit::UserMediaProcessManager::removeUserMediaPermissionRequestManagerProxy): Deleted.
208         (WebKit::UserMediaProcessManager::startedCaptureSession): Deleted.
209         * UIProcess/UserMediaProcessManager.h:
210         * UIProcess/WebProcessProxy.h:
211         (WebKit::WebProcessProxy::mediaCaptureSandboxExtensions const):
212         (WebKit::WebProcessProxy::hasVideoCaptureExtension const):
213         (WebKit::WebProcessProxy::grantVideoCaptureExtension):
214         (WebKit::WebProcessProxy::revokeVideoCaptureExtension):
215         (WebKit::WebProcessProxy::hasAudioCaptureExtension const):
216         (WebKit::WebProcessProxy::grantAudioCaptureExtension):
217         (WebKit::WebProcessProxy::revokeAudioCaptureExtension):
218         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
219         (WebKit::UserMediaPermissionRequestManager::~UserMediaPermissionRequestManager): Deleted.
220         (WebKit::UserMediaPermissionRequestManager::clear): Deleted.
221         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Deleted.
222         (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): Deleted.
223         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
224         * WebProcess/WebPage/WebPage.cpp:
225         (WebKit::WebPage::close):
226         (WebKit::WebPage::grantUserMediaDeviceSandboxExtensions): Deleted.
227         (WebKit::WebPage::revokeUserMediaDeviceSandboxExtensions): Deleted.
228         * WebProcess/WebPage/WebPage.h:
229         * WebProcess/WebPage/WebPage.messages.in:
230         * WebProcess/WebProcess.cpp:
231         (WebKit::WebProcess::grantUserMediaDeviceSandboxExtensions):
232         (WebKit::WebProcess::revokeUserMediaDeviceSandboxExtensions):
233         * WebProcess/WebProcess.h:
234         * WebProcess/WebProcess.messages.in:
235
236 2019-02-27  Per Arne Vollan  <pvollan@apple.com>
237
238         [macOS] Disable permissive call logging in sandbox
239         https://bugs.webkit.org/show_bug.cgi?id=194061
240         <rdar://problem/47686253>
241
242         Reviewed by Brent Fulgham.
243
244         Strict call filtering should be reenabled.
245
246         * WebProcess/com.apple.WebProcess.sb.in:
247
248 2019-02-27  Chris Dumez  <cdumez@apple.com>
249
250         [HTTPSUpgrade] Use open source database until the feature is ready
251         https://bugs.webkit.org/show_bug.cgi?id=195069
252         <rdar://problem/47838224>
253
254         Reviewed by Geoffrey Garen.
255
256         * DerivedSources-input.xcfilelist:
257         * DerivedSources.make:
258
259 2019-02-27  Antoine Quint  <graouts@apple.com>
260
261         Support Pointer Events on macOS
262         https://bugs.webkit.org/show_bug.cgi?id=195008
263         <rdar://problem/47454419>
264
265         Reviewed by Dean Jackson.
266
267         * Configurations/FeatureDefines.xcconfig:
268
269 2019-02-27  Sihui Liu  <sihui_liu@apple.com>
270
271         Network Process is put to suspended when holding locked IndexedDB files
272         https://bugs.webkit.org/show_bug.cgi?id=195024
273         <rdar://problem/45194169>
274
275         Reviewed by Geoffrey Garen.
276
277         * NetworkProcess/NetworkProcess.cpp:
278         (WebKit::NetworkProcess::idbServer):
279         (WebKit::NetworkProcess::notifyHoldingLockedFiles):
280         * NetworkProcess/NetworkProcess.h:
281         * UIProcess/Network/NetworkProcessProxy.cpp:
282         (WebKit::NetworkProcessProxy::didClose):
283         (WebKit::NetworkProcessProxy::setIsIDBDatabaseHoldingLockedFiles):
284         * UIProcess/Network/NetworkProcessProxy.h:
285         * UIProcess/Network/NetworkProcessProxy.messages.in:
286
287 2019-02-26  Simon Fraser  <simon.fraser@apple.com>
288
289         Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
290         https://bugs.webkit.org/show_bug.cgi?id=194973
291
292         Reviewed by Antti Koivisto.
293
294         This patch cleans up how the scrolling tree responds to scrolls.
295
296         First, ScrollingTreeScrollingNode::m_currentScrollPosition is "truth" for scrolling thread/
297         UI process scroll position.
298
299         On macOS where handleWheelEvent on the scrolling thread changes scroll position, the
300         bottleneck is ScrollingTreeScrollingNode::scrollTo() which sets the new scroll position,
301         update the visual viewport (for frame scrolls) updates the scrolledContentsLayer position,
302         updates related layers on this node (counter-scrolling layers etc), and then tells the
303         scrolling tree, which recurses through descendant nodes so they can adjust their layer
304         positions.
305
306         On iOS, the bottleneck is ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling(),
307         which does the above other than setting scrolledContentsLayer (since we're reacting to
308         layer state changes, not producing them).
309
310         updateLayersAfterAncestorChange() is renamed to relatedNodeScrollPositionDidChange(), and
311         ScrollingTree does the tree walk so classes don't have to implement
312         updateLayersAfterAncestorChange() just to talk children. The ScrollingTree tree walk knows
313         how to get the correct layoutViewport and to stop at frame boundaries (layer updates never
314         need to cross frame boundaries).
315
316         We preserve 'cumulativeDelta'; it's necessary for things like fixed inside overflow:scroll,
317         since the fixed state was computed with the "layout" scroll position, so we have to account
318         for the scroll delta since the last committed position. It's possible we could improve this
319         in future.
320
321         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
322         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
323         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
324         (WebKit::RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling):
325         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
326         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
327         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
328         (WebKit::RemoteScrollingTree::scrollingTreeNodeDidScroll):
329         * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
330         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
331         (WebKit::RemoteScrollingCoordinatorProxy::currentLayoutViewport const):
332         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
333         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
334         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
335         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::repositionScrollingLayers):
336         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::repositionRelatedLayers):
337         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::scrollPosition const): Deleted.
338         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::setScrollPosition): Deleted.
339         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::setScrollLayerPosition): Deleted.
340         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateChildNodesAfterScroll): Deleted.
341         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterDelegatedScroll): Deleted.
342         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterViewportChange): Deleted.
343         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterAncestorChange): Deleted.
344         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
345         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
346         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::repositionScrollingLayers):
347         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterAncestorChange): Deleted.
348         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollPosition const): Deleted.
349         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::setScrollLayerPosition): Deleted.
350         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterDelegatedScroll): Deleted.
351         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
352         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
353         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::ScrollingTreeScrollingNodeDelegateIOS):
354         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers):
355         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll):
356         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateLayersAfterAncestorChange): Deleted.
357         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollPosition const): Deleted.
358         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::setScrollLayerPosition): Deleted.
359         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll): Deleted.
360         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll const): Deleted.
361         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm:
362         (WebKit::ScrollerPairMac::updateValues):
363         (WebKit::ScrollerPairMac::valuesForOrientation):
364         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp:
365         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::repositionRelatedLayers):
366         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::setScrollLayerPosition): Deleted.
367         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h:
368         * UIProcess/ios/WKContentView.mm:
369         (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
370
371 2019-02-27  Alex Christensen  <achristensen@webkit.org>
372
373         Silence log after r242122
374         https://bugs.webkit.org/show_bug.cgi?id=195074
375
376         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
377         (WebKit::LocalStorageDatabaseTracker::databasePath const):
378         m_localStorageDirectory can now be null for ephemeral sessions.
379         This is not a failure to create a directory and needs no log.
380         This fixes the WKWebView.InitializingWebViewWithEphemeralStorageDoesNotLog API test.
381
382 2019-02-27  Timothy Hatcher  <timothy@apple.com>
383
384         REGRESSION: WebKit content crash in Base System (because NSAppearance is NULL).
385         https://bugs.webkit.org/show_bug.cgi?id=195086
386         rdar://problem/48419124
387
388         Reviewed by Tim Horton.
389
390         * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm:
391         (-[WKScrollerImpDelegate effectiveAppearanceForScrollerImp:]): Always return a valid NSAppearance.
392
393 2019-02-26  Chris Dumez  <cdumez@apple.com>
394
395         [PSON] Add mechanism to clear suspended pages while bypassing the WebProcess cache
396         https://bugs.webkit.org/show_bug.cgi?id=195089
397
398         Reviewed by Geoffrey Garen.
399
400         Add a convenient mechanism to clear suspended pages while bypassing the WebProcess
401         cache since we need to do this on memory pressure and when clearing website data.
402
403         * UIProcess/WebPageProxy.cpp:
404         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
405         * UIProcess/WebProcessCache.cpp:
406         (WebKit::WebProcessCache::addProcessIfPossible):
407         (WebKit::WebProcessCache::addProcess):
408         (WebKit::WebProcessCache::takeProcess):
409         (WebKit::WebProcessCache::CachedProcess::~CachedProcess):
410         * UIProcess/WebProcessCache.h:
411         (WebKit::WebProcessCache::setIsDisabled): Deleted.
412         * UIProcess/WebProcessPool.cpp:
413         (WebKit::WebProcessPool::handleMemoryPressureWarning):
414         (WebKit::WebProcessPool::hasSuspendedPageFor const):
415         (WebKit::WebProcessPool::clearSuspendedPages):
416         * UIProcess/WebProcessPool.h:
417         * UIProcess/WebProcessProxy.cpp:
418         (WebKit::WebProcessProxy::maybeShutDown):
419         (WebKit::WebProcessProxy::canTerminateAuxiliaryProcess):
420         * UIProcess/WebProcessProxy.h:
421         (WebKit::WebProcessProxy::suspendedPageCount const):
422         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
423         (WebKit::WebsiteDataStore::removeData):
424
425 2019-02-26  Alex Christensen  <achristensen@webkit.org>
426
427         Move ephemeral local storage from WebProcess to UIProcess
428         https://bugs.webkit.org/show_bug.cgi?id=195074
429         <rdar://problem/47937975>
430
431         Reviewed by Geoff Garen.
432
433         Before PSON, a page could navigate to another domain that navigates back and still have its local storage.
434         Since PSON makes it unreliable to retain the state in the WebProcess, move it to the process with the rest of the local storage.
435         If it's ephemeral, we obviously can't use the SQLite on-disk storage implementation, so use the same WebCore::StorageMap we used to in the WebProcess.
436
437         * UIProcess/WebStorage/StorageManager.cpp:
438         (WebKit::StorageManager::LocalStorageNamespace::LocalStorageNamespace):
439         (WebKit::StorageManager::StorageManager):
440         (WebKit::StorageManager::createLocalStorageMap):
441         (WebKit::StorageManager::createTransientLocalStorageMap):
442         (WebKit::StorageManager::createSessionStorageMap):
443         (WebKit::StorageManager::destroyStorageMap):
444         (WebKit::StorageManager::getValues):
445         (WebKit::StorageManager::setItem):
446         (WebKit::StorageManager::removeItem):
447         (WebKit::StorageManager::clear):
448         * UIProcess/WebStorage/StorageManager.h:
449         * UIProcess/WebStorage/StorageManager.messages.in:
450         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
451         (WebKit::WebsiteDataStore::WebsiteDataStore):
452         * WebProcess/WebStorage/StorageAreaMap.cpp:
453         (WebKit::StorageAreaMap::StorageAreaMap):
454         (WebKit::StorageAreaMap::setItem):
455         (WebKit::StorageAreaMap::removeItem):
456         (WebKit::StorageAreaMap::clear):
457         (WebKit::StorageAreaMap::loadValuesIfNeeded):
458         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
459         (WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace):
460         (WebKit::StorageNamespaceImpl::storageArea):
461         (WebKit::StorageNamespaceImpl::copy):
462         (): Deleted.
463         (WebKit::StorageNamespaceImpl::ephemeralLocalStorageArea): Deleted.
464         * WebProcess/WebStorage/StorageNamespaceImpl.h:
465
466 2019-02-20  Jer Noble  <jer.noble@apple.com>
467
468         [Cocoa] Media elements will restart network buffering just before suspending
469         https://bugs.webkit.org/show_bug.cgi?id=193691
470
471         Reviewed by Eric Carlson.
472
473         When the WebProcess receives a notification that the process is about to become
474         suspended, it tells the MemoryPressureHandler to release all critical memory. This
475         has the side effect of causing AVFoundation-backed media elements to dump their
476         in-memory caches and start downloading media data again. Instead, media elements
477         should all stop buffering media data during suspension. Add new testing SPI to
478         simulate suspension and resume messages.
479
480         * UIProcess/API/Cocoa/WKWebView.mm:
481         (-[WKWebView _processWillSuspendImminentlyForTesting]):
482         (-[WKWebView _processDidResumeForTesting]):
483         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
484         * UIProcess/WebProcessProxy.h:
485         * UIProcess/ios/WKInkPickerView.mm:
486         * WebProcess/WebPage/WebPage.cpp:
487         (WebKit::WebPage::suspendAllMediaBuffering):
488         (WebKit::WebPage::resumeAllMediaBuffering):
489         * WebProcess/WebPage/WebPage.h:
490         * WebProcess/WebProcess.cpp:
491         (WebKit::WebProcess::actualPrepareToSuspend):
492         (WebKit::WebProcess::cancelPrepareToSuspend):
493         (WebKit::WebProcess::processDidResume):
494         (WebKit::WebProcess::suspendAllMediaBuffering):
495         (WebKit::WebProcess::resumeAllMediaBuffering):
496         * WebProcess/WebProcess.h:
497
498 2019-02-26  Youenn Fablet  <youenn@apple.com>
499
500         Move service worker response validation from the service worker client to the service worker itself
501         https://bugs.webkit.org/show_bug.cgi?id=194716
502
503         Reviewed by Geoffrey Garen.
504
505         Removed response validation as it is now done in service worker side.
506
507         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
508         (WebKit::ServiceWorkerClientFetch::didReceiveRedirectResponse):
509         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
510
511 2019-02-26  Zalan Bujtas  <zalan@apple.com>
512
513         [ContentChangeObserver] clearContentChangeObservers should be internal to ContentChangeObserver class
514         https://bugs.webkit.org/show_bug.cgi?id=195066
515         <rdar://problem/48411682>
516
517         Reviewed by Tim Horton.
518
519         * WebProcess/WebCoreSupport/WebChromeClient.h:
520         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
521         (WebKit::WebChromeClient::clearContentChangeObservers): Deleted.
522
523 2019-02-26  Per Arne Vollan  <pvollan@apple.com>
524
525         [iOS] Sandbox should allow mach lookups related to media capturing
526         https://bugs.webkit.org/show_bug.cgi?id=194951
527
528         Reviewed by Eric Carlson.
529
530         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
531
532 2019-02-26  Brent Fulgham  <bfulgham@apple.com>
533
534         Update NetworkSession to use Session Cleanup when available
535         https://bugs.webkit.org/show_bug.cgi?id=195019
536         <rdar://problem/45149868>
537
538         Reviewed by Alex Christensen.
539
540         If the build environment supports Session Cleanup, initialize it.
541
542         No test changes since this doesn't do anything on the test systems at present.
543
544         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
545         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
546
547 2019-02-26  Chris Dumez  <cdumez@apple.com>
548
549         [iOS] Regression(PSON) Scroll position is no longer restored when navigating back to reddit.com
550         https://bugs.webkit.org/show_bug.cgi?id=195054
551         <rdar://problem/48330549>
552
553         Reviewed by Geoff Garen.
554
555         We attempt to restore the scroll position twice, on first layout and then on load completion.
556         Before PSON, the scroll position would fail to get restored on first layout but would succeed
557         on load completion because the view is tall enough by then. With PSON however, we would
558         fail to restore the scroll position on load completion because the view would not be tall
559         enough yet by this point. The reason is that the dynamic resources would not be in the memory cache
560         and would then get reloaded abd finish loading *after* the load event.
561
562         To address the issue, we now make sure to not purge the memory cache on process suspension on
563         iOS if there is currently a SuspendedPageProxy in the UIProcess for this process.
564
565         * UIProcess/SuspendedPageProxy.cpp:
566         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
567         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
568         * UIProcess/WebProcessProxy.cpp:
569         (WebKit::WebProcessProxy::incrementSuspendedPageCount):
570         (WebKit::WebProcessProxy::decrementSuspendedPageCount):
571         * UIProcess/WebProcessProxy.h:
572         * WebProcess/WebProcess.cpp:
573         (WebKit::WebProcess::initializeWebProcess):
574         (WebKit::WebProcess::setHasSuspendedPageProxy):
575         * WebProcess/WebProcess.h:
576         * WebProcess/WebProcess.messages.in:
577
578 2019-02-26  Ryosuke Niwa  <rniwa@webkit.org>
579
580         [iOS] REGRESSION(r238490?): Safari sometimes shows blank page until a cross site navigation or re-opening the tab
581         https://bugs.webkit.org/show_bug.cgi?id=195037
582         <rdar://problem/48154508>
583
584         Reviewed by Antti Koivisto.
585
586         Restore the pre-r238490 behavior of WebPage::didCompletePageTransition clearing LayerTreeFreezeReason::ProcessSuspended
587         as this has been an issue when I was able to reproduce the issue locally.
588
589         Also added release logging to help diagnose the issue in the future.
590
591         * WebProcess/WebPage/WebPage.cpp:
592         (WebKit::WebPage::freezeLayerTree):
593         (WebKit::WebPage::unfreezeLayerTree):
594         (WebKit::WebPage::didCompletePageTransition):
595         * WebProcess/WebProcess.cpp:
596         (WebKit::WebProcess::freezeAllLayerTrees):
597         (WebKit::WebProcess::unfreezeAllLayerTrees):
598
599 2019-02-26  Youenn Fablet  <youenn@apple.com>
600
601         Create WebPageProxy::m_userMediaPermissionRequestManager only when needed
602         https://bugs.webkit.org/show_bug.cgi?id=195051
603
604         Reviewed by Eric Carlson.
605
606         Before the patch, WebPageProxy::m_userMediaPermissionRequestManager was created
607         in some methods to reset its state when main document is changing, view is becoming visible...
608         This code is unnecessary if the page did not create it already using JS APIs such as getUserMedia/enumerateDevices/ondevicechange.
609         This patch skips processing in the other cases if WebPageProxy::m_userMediaPermissionRequestManager is null.
610
611         * UIProcess/WebPageProxy.cpp:
612         (WebKit::WebPageProxy::close): No need to nullify it since it will be done in resetState shortly after.
613         (WebKit::WebPageProxy::didChangeMainDocument):
614         (WebKit::WebPageProxy::viewIsBecomingVisible):
615         (WebKit::WebPageProxy::clearUserMediaState):
616         (WebKit::WebPageProxy::updatePlayingMediaDidChange): m_userMediaPermissionRequestManager should not be null here
617         since there is or was some capturing done for the page.
618
619 2019-02-26  Zalan Bujtas  <zalan@apple.com>
620
621         [ContentChangeObserver] Simplify content observation API by removing explicit DOMTimer observation.
622         https://bugs.webkit.org/show_bug.cgi?id=195023
623         <rdar://problem/48381885>
624
625         Reviewed by Tim Horton.
626
627         * WebProcess/WebPage/ios/WebPageIOS.mm:
628         (WebKit::WebPage::handleSyntheticClick):
629
630 2019-02-26  Takashi Komori  <Takashi.Komori@sony.com>
631
632         [Curl] Load HTTP body of 401 response when AuthenticationChange is cancelled.
633         https://bugs.webkit.org/show_bug.cgi?id=191652
634
635         Reviewed by Alex Christensen.
636
637         Test: http/tests/security/401-logout/401-logout.php
638
639         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
640         (WebKit::NetworkDataTaskCurl::tryHttpAuthentication):
641         (WebKit::NetworkDataTaskCurl::tryProxyAuthentication):
642         * NetworkProcess/curl/NetworkDataTaskCurl.h:
643
644 2019-02-26  Youenn Fablet  <youenn@apple.com>
645
646         WebPageProxy should nullify m_userMediaPermissionRequestManager after resetting the media state
647         https://bugs.webkit.org/show_bug.cgi?id=195028
648         <rdar://problem/48243733>
649
650         Reviewed by Eric Carlson.
651
652         Covered by API test.
653
654         * UIProcess/WebPageProxy.cpp:
655         (WebKit::WebPageProxy::resetState):
656
657 2019-02-26  Philippe Normand <pnormand@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
658
659         [WPE] Add API for webview background color configuration
660         https://bugs.webkit.org/show_bug.cgi?id=192305
661
662         Reviewed by Michael Catanzaro.
663
664         In the case of WPE we need to send the background color to the web process to be used as the background color of
665         the page. This patch adapts the GTK+ implementation to do the same, since it's a lot simpler. The patch also
666         removes the SetDrawsBackground message in favor of the new SetBackgroundColor message that receives an optional
667         color.
668
669         * PlatformWPE.cmake: Add new WPE API for WebKitColor boxed type.
670         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
671         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext): Remove background rendering and opacity handling.
672         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
673         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
674         (WebKit::ThreadedCompositor::renderLayerTree): Remove drawsBakground and always clear the context with
675         transparent color.
676         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
677         * Shared/WebPageCreationParameters.cpp:
678         (WebKit::WebPageCreationParameters::encode const): Replace drawsBackground with backgroundColor.
679         (WebKit::WebPageCreationParameters::decode): Ditto.
680         * Shared/WebPageCreationParameters.h:
681         * SourcesWPE.txt:
682         * UIProcess/API/glib/WebKitWebView.cpp:
683         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
684         (webkit_web_view_set_background_color):
685         (webkit_web_view_get_background_color):
686         * UIProcess/API/wpe/WebKitColor.cpp: Added.
687         (webkit_color_copy):
688         (webkit_color_free):
689         (webkitColorToWebCoreColor):
690         (webkitColorFillFromWebCoreColor):
691         (webkit_color_parse):
692         * UIProcess/API/wpe/WebKitColor.h: Added.
693         * UIProcess/API/wpe/WebKitColorPrivate.h: Added.
694         * UIProcess/API/wpe/WebKitWebView.h: Implement webkit_web_view_set_background_color API.
695         * UIProcess/API/wpe/WebKitWebViewWPE.cpp: Ditto.
696         (webkit_web_view_set_background_color):
697         (webkit_web_view_get_background_color):
698         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt: Add new symbols.
699         * UIProcess/WebPageProxy.cpp:
700         (WebKit::WebPageProxy::setDrawsBackground): Set a transparent background color when false is passed.
701         (WebKit::WebPageProxy::setBackgroundColor): Send background color to the WebProcess.
702         (WebKit::WebPageProxy::creationParameters): Replace drawsBackground with backgroundColor.
703         * UIProcess/WebPageProxy.h:
704         (WebKit::WebPageProxy::drawsBackground const):
705         (WebKit::WebPageProxy::backgroundColor const):
706         * UIProcess/cairo/BackingStoreCairo.cpp:
707         (WebKit::BackingStore::incorporateUpdate): Remove GTK+ code to handle background color.
708         * UIProcess/gtk/AcceleratedBackingStore.cpp:
709         * UIProcess/gtk/AcceleratedBackingStore.h: Make paint() pure virtual and remove the implementation.
710         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
711         (WebKit::AcceleratedBackingStoreWayland::paint): Dot not call AcceleratedBackingStore::paint() now that is pure virtual.
712         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
713         (WebKit::AcceleratedBackingStoreX11::paint): Ditto.
714         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
715         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Use background color as provided by the
716         UIProcess when creating the FrameView.
717         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
718         * WebProcess/WebPage/AcceleratedDrawingArea.h:
719         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
720         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
721         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
722         (WebKit::ThreadedCoordinatedLayerTreeHost::setIsDiscardable):
723         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
724         * WebProcess/WebPage/DrawingArea.h:
725         * WebProcess/WebPage/DrawingAreaImpl.cpp:
726         (WebKit::DrawingAreaImpl::display): Remove special case for transparent background.
727         * WebProcess/WebPage/LayerTreeHost.h:
728         * WebProcess/WebPage/WebPage.cpp:
729         (WebKit::WebPage::setBackgroundColor): New API for background color configuration. Proxies to FrameView and DrawingArea.
730         * WebProcess/WebPage/WebPage.h:
731         (WebKit::WebPage::backgroundColor const): Read-only access to the current background color.
732         * WebProcess/WebPage/WebPage.messages.in: Replace SetDrawsBackground message with SetBackgroundColor.
733
734 2019-02-25  Yongjun Zhang  <yongjun_zhang@apple.com>
735
736         scalableNativeWebpageParameters() is not preserved on new page navigation.
737         https://bugs.webkit.org/show_bug.cgi?id=194892
738         <rdar://problem/47538280>
739
740         If a page's current default viewport configuration is scalableNativeWebpageParameters due to
741         the fact that m_canIgnoreScalingConstraints is true, loading a new page should preserve this
742         configuration until we derive the right values from viewport meta-tag.
743
744         Reviewed by Wenson Hsieh.
745
746         * WebProcess/WebPage/ios/WebPageIOS.mm:
747         (WebKit::WebPage::resetViewportDefaultConfiguration): Use nativeWebpageParameters() instance method to
748             get the appropriate default configuration.
749
750 2019-02-25  Wenson Hsieh  <wenson_hsieh@apple.com>
751
752         [iOS] Adjust initial scale zooming heuristics when changing view scale
753         https://bugs.webkit.org/show_bug.cgi?id=194995
754
755         Reviewed by Tim Horton.
756
757         Currently, we only zoom to the new initial scale iff we're exactly at initial scale before changing the view
758         scale. This was done so that if a user zoomed in really far and then increased the view scale, we wouldn't end
759         up zooming out as a result. However, this leads to confusing behavior in the case where the user has manually
760         changed the zoom scale to something close to (but not exactly) initial scale, and then attempts to zoom in
761         further using view scale. In this case, we'll end up keeping page scale the same, so it looks like nothing is
762         happening.
763
764         To fix this, we tweak our heuristics for determining whether to jump to initial scale; if the view scale is
765         increasing and the new initial scale is greater than the current scale, zoom to initial scale. Likewise, if the
766         view scale is decreasing and the new initial scale is less than the current scale, zoom to initial scale.
767
768         Test: fast/viewport/ios/initial-scale-after-changing-view-scale.html
769
770         * WebProcess/WebPage/ios/WebPageIOS.mm:
771         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
772
773 2019-02-25  John Wilander  <wilander@apple.com>
774
775         Introduce and adopt new class RegistrableDomain for eTLD+1
776         https://bugs.webkit.org/show_bug.cgi?id=194791
777         <rdar://problem/48179240>
778
779         Reviewed by Alex Christensen, Fujii Hironori, and Brent Fulgham.
780
781         A new API test was added. Plenty of existing layout tests under
782         http/tests/resourceLoadStatistics/ and http/tests/storageAccess/ test the code.
783
784         This patch introduces and adopts a new class called WebCore::RegistrableDomain
785         which represents a domain's eTLD+1 (effective top level domain plus one) and is
786         the basis for the term "site," as in same-site. Other popular names include
787         high-level domain, primary domain, and top privately controlled/owned domain.
788         Effective top level domains are enumerated on the Public Suffix List
789         (https://publicsuffix.org).
790
791         This class just uses the full domain for when the Public Suffix List cannot help
792         finding the registrable domain and for WebKit ports that haven't enabled
793         PUBLIC_SUFFIX_LIST. It also uses the string "nullOrigin" as a representation
794         for the null or unique origin (this matches how these origins were handled
795         before).
796
797         The implementation is a wrapper around a String and the functions and class
798         members that now make use of this new class used to handle regular String
799         objects which didn't help much in terms of type safety or guarantees that the
800         string had already been converted to an eTLD+1.
801
802         We've at least two bad bugs in the Storage Access API because of confusion
803         between a URL's eTLD+1 and its host. The usage of WebCore::RegistrableDomain
804         will prohibit such bugs in the future.
805
806         Partitioning in WebKit also uses eTLD+1 to a large extent. I plan to adopt
807         WebCore::RegistrableDomain for partitioning in a later patch.
808
809         This patch also enhances parameter naming by:
810         - Removing parts that refer to "primary" as in primaryDomain.
811         - Replacing references to "TopPrivatelyControlledDomain" with "RegistrableDomain."
812         - Replacing references to "TopPrivatelyOwnedDomain" with "RegistrableDomain."
813         - Using the term "domain" consistently instead of e.g. "host."
814
815         A follow-up patch will continue backwards in call chains to create
816         WebCore::RegistrableDomain objects as early as possible instead of using strings.
817         I did not do that work here in the interest of patch size.
818
819         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
820         (WebKit::domainsToString):
821         (WebKit::pruneResources):
822         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
823         (WebKit::ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain const):
824         (WebKit::ResourceLoadStatisticsMemoryStore::markAsPrevalentIfHasRedirectedToPrevalent):
825         (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentDueToDebugMode):
826         (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
827         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
828         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
829         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess):
830         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
831         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData):
832         (WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode):
833         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode):
834         (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
835         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceLoading):
836         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceRedirect):
837         (WebKit::ResourceLoadStatisticsMemoryStore::logUserInteraction):
838         (WebKit::ResourceLoadStatisticsMemoryStore::clearUserInteraction):
839         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUserInteraction):
840         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResource):
841         (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentResource const):
842         (WebKit::ResourceLoadStatisticsMemoryStore::isVeryPrevalentResource const):
843         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubresourceUnder const):
844         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubFrameUnder const):
845         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsRedirectingTo const):
846         (WebKit::ResourceLoadStatisticsMemoryStore::clearPrevalentResource):
847         (WebKit::ResourceLoadStatisticsMemoryStore::setGrandfathered):
848         (WebKit::ResourceLoadStatisticsMemoryStore::isGrandfathered const):
849         (WebKit::ResourceLoadStatisticsMemoryStore::setSubframeUnderTopFrameOrigin):
850         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUnderTopFrameOrigin):
851         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectTo):
852         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectFrom):
853         (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectTo):
854         (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectFrom):
855         (WebKit::ResourceLoadStatisticsMemoryStore::ensureResourceStatisticsForRegistrableDomain):
856         (WebKit::ResourceLoadStatisticsMemoryStore::mergeStatistics):
857         (WebKit::ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt):
858         (WebKit::debugLogDomainsInBatches):
859         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
860         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlockingForDomains):
861         (WebKit::ResourceLoadStatisticsMemoryStore::clearBlockingStateForDomains):
862         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor):
863         (WebKit::ResourceLoadStatisticsMemoryStore::pruneStatisticsIfNeeded):
864         (WebKit::ResourceLoadStatisticsMemoryStore::setLastSeen):
865         (WebKit::ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource):
866         (WebKit::ResourceLoadStatisticsMemoryStore::ensureResourceStatisticsForPrimaryDomain): Deleted.
867         (WebKit::ResourceLoadStatisticsMemoryStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor): Deleted.
868         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
869         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
870         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
871         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
872         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccessForFrame):
873         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
874         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted):
875         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
876         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
877         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
878         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
879         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
880         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading):
881         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading):
882         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect):
883         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
884         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
885         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
886         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
887         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
888         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
889         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
890         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
891         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder):
892         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
893         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
894         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
895         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
896         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
897         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
898         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
899         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
900         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
901         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
902         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
903         (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains):
904         (WebKit::WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains):
905         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
906         (WebKit::WebResourceLoadStatisticsStore::removePrevalentDomains):
907         (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler):
908         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
909         (WebKit::WebResourceLoadStatisticsStore::registrableDomainsWithWebsiteData):
910         (WebKit::isolatedPrimaryDomain): Deleted.
911         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): Deleted.
912         (WebKit::WebResourceLoadStatisticsStore::topPrivatelyControlledDomainsWithWebsiteData): Deleted.
913         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
914         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
915         (WebKit::NetworkConnectionToWebProcess::logUserInteraction):
916         (WebKit::NetworkConnectionToWebProcess::logWebSocketLoading):
917         (WebKit::NetworkConnectionToWebProcess::logSubresourceLoading):
918         (WebKit::NetworkConnectionToWebProcess::logSubresourceRedirect):
919         (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
920         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
921         * NetworkProcess/NetworkConnectionToWebProcess.h:
922         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
923         * NetworkProcess/NetworkProcess.cpp:
924         (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
925         (WebKit::NetworkProcess::isGrandfathered):
926         (WebKit::NetworkProcess::isPrevalentResource):
927         (WebKit::NetworkProcess::isVeryPrevalentResource):
928         (WebKit::NetworkProcess::setGrandfathered):
929         (WebKit::NetworkProcess::setPrevalentResource):
930         (WebKit::NetworkProcess::setPrevalentResourceForDebugMode):
931         (WebKit::NetworkProcess::setVeryPrevalentResource):
932         (WebKit::NetworkProcess::clearPrevalentResource):
933         (WebKit::NetworkProcess::setSubframeUnderTopFrameOrigin):
934         (WebKit::NetworkProcess::isRegisteredAsRedirectingTo):
935         (WebKit::NetworkProcess::isRegisteredAsSubFrameUnder):
936         (WebKit::NetworkProcess::setSubresourceUnderTopFrameOrigin):
937         (WebKit::NetworkProcess::setSubresourceUniqueRedirectTo):
938         (WebKit::NetworkProcess::setSubresourceUniqueRedirectFrom):
939         (WebKit::NetworkProcess::isRegisteredAsSubresourceUnder):
940         (WebKit::NetworkProcess::setTopFrameUniqueRedirectTo):
941         (WebKit::NetworkProcess::setTopFrameUniqueRedirectFrom):
942         (WebKit::NetworkProcess::setLastSeen):
943         (WebKit::NetworkProcess::hasStorageAccessForFrame):
944         (WebKit::NetworkProcess::hasStorageAccess):
945         (WebKit::NetworkProcess::requestStorageAccess):
946         (WebKit::NetworkProcess::requestStorageAccessGranted):
947         (WebKit::NetworkProcess::grantStorageAccess):
948         (WebKit::NetworkProcess::logFrameNavigation):
949         (WebKit::NetworkProcess::logUserInteraction):
950         (WebKit::NetworkProcess::hadUserInteraction):
951         (WebKit::NetworkProcess::clearUserInteraction):
952         (WebKit::NetworkProcess::removePrevalentDomains):
953         (WebKit::filterForRegistrableDomains):
954         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
955         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
956         (WebKit::filterForTopLevelDomains): Deleted.
957         (WebKit::NetworkProcess::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): Deleted.
958         (WebKit::NetworkProcess::topPrivatelyControlledDomainsWithWebsiteData): Deleted.
959         * NetworkProcess/NetworkProcess.h:
960         * NetworkProcess/NetworkProcess.messages.in:
961         * NetworkProcess/NetworkResourceLoader.cpp:
962         (WebKit::logCookieInformationInternal):
963         * NetworkProcess/NetworkSession.cpp:
964         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores):
965         (WebKit::NetworkSession::registrableDomainsWithWebsiteData):
966         (WebKit::NetworkSession::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): Deleted.
967         (WebKit::NetworkSession::topPrivatelyControlledDomainsWithWebsiteData): Deleted.
968         * NetworkProcess/NetworkSession.h:
969         * Shared/WebCoreArgumentCoders.cpp:
970         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
971         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
972         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
973         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
974         * UIProcess/Network/NetworkProcessProxy.cpp:
975         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
976         (WebKit::NetworkProcessProxy::isPrevalentResource):
977         (WebKit::NetworkProcessProxy::isVeryPrevalentResource):
978         (WebKit::NetworkProcessProxy::setPrevalentResource):
979         (WebKit::NetworkProcessProxy::setPrevalentResourceForDebugMode):
980         (WebKit::NetworkProcessProxy::setVeryPrevalentResource):
981         (WebKit::NetworkProcessProxy::setLastSeen):
982         (WebKit::NetworkProcessProxy::clearPrevalentResource):
983         (WebKit::NetworkProcessProxy::logUserInteraction):
984         (WebKit::NetworkProcessProxy::hasHadUserInteraction):
985         (WebKit::NetworkProcessProxy::clearUserInteraction):
986         (WebKit::NetworkProcessProxy::setSubframeUnderTopFrameOrigin):
987         (WebKit::NetworkProcessProxy::isRegisteredAsRedirectingTo):
988         (WebKit::NetworkProcessProxy::isRegisteredAsSubFrameUnder):
989         (WebKit::NetworkProcessProxy::setSubresourceUnderTopFrameOrigin):
990         (WebKit::NetworkProcessProxy::isRegisteredAsSubresourceUnder):
991         (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectTo):
992         (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectFrom):
993         (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectTo):
994         (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectFrom):
995         (WebKit::NetworkProcessProxy::isGrandfathered):
996         (WebKit::NetworkProcessProxy::setGrandfathered):
997         (WebKit::NetworkProcessProxy::hasStorageAccessForFrame):
998         (WebKit::NetworkProcessProxy::hasStorageAccess):
999         (WebKit::NetworkProcessProxy::requestStorageAccess):
1000         (WebKit::NetworkProcessProxy::grantStorageAccess):
1001         (WebKit::NetworkProcessProxy::notifyWebsiteDataDeletionForRegistrableDomainsFinished):
1002         (WebKit::NetworkProcessProxy::notifyWebsiteDataScanForRegistrableDomainsFinished):
1003         (WebKit::NetworkProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished): Deleted.
1004         (WebKit::NetworkProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished): Deleted.
1005         * UIProcess/Network/NetworkProcessProxy.h:
1006         * UIProcess/Network/NetworkProcessProxy.messages.in:
1007         * UIProcess/WebPageProxy.cpp:
1008         (WebKit::WebPageProxy::logFrameNavigation):
1009         (WebKit::WebPageProxy::requestStorageAccessConfirm):
1010         * UIProcess/WebProcessProxy.cpp:
1011         (WebKit::WebProcessProxy::notifyPageStatisticsAndDataRecordsProcessed):
1012         (WebKit::WebProcessProxy::notifyWebsiteDataScanForRegistrableDomainsFinished):
1013         (WebKit::WebProcessProxy::notifyWebsiteDataDeletionForRegistrableDomainsFinished):
1014         (WebKit::WebProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished): Deleted.
1015         (WebKit::WebProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished): Deleted.
1016         * UIProcess/WebProcessProxy.h:
1017         * UIProcess/WebResourceLoadStatisticsStore.messages.in:
1018         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1019         (WebKit::WebsiteDataStore::isPrevalentResource):
1020         (WebKit::WebsiteDataStore::setPrevalentResource):
1021         (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode):
1022         (WebKit::WebsiteDataStore::isVeryPrevalentResource):
1023         (WebKit::WebsiteDataStore::setVeryPrevalentResource):
1024         (WebKit::WebsiteDataStore::setSubframeUnderTopFrameOrigin):
1025         (WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder):
1026         (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameOrigin):
1027         (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder):
1028         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo):
1029         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom):
1030         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo):
1031         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom):
1032         (WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo):
1033         (WebKit::WebsiteDataStore::clearPrevalentResource):
1034         (WebKit::WebsiteDataStore::setLastSeen):
1035         (WebKit::WebsiteDataStore::hasStorageAccess):
1036         (WebKit::WebsiteDataStore::requestStorageAccess):
1037         (WebKit::WebsiteDataStore::grantStorageAccess):
1038         (WebKit::WebsiteDataStore::logUserInteraction):
1039         (WebKit::WebsiteDataStore::hasHadUserInteraction):
1040         (WebKit::WebsiteDataStore::clearUserInteraction):
1041         (WebKit::WebsiteDataStore::setGrandfathered):
1042         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains): Deleted.
1043         * UIProcess/WebsiteData/WebsiteDataStore.h:
1044         * WebProcess/WebPage/WebPage.cpp:
1045         (WebKit::WebPage::hasStorageAccess):
1046         (WebKit::WebPage::requestStorageAccess):
1047         * WebProcess/WebProcess.cpp:
1048         (WebKit::m_nonVisibleProcessCleanupTimer):
1049         (WebKit::WebProcess::initializeWebProcess):
1050
1051 2019-02-25  Adrian Perez de Castro  <aperez@igalia.com>
1052
1053         [WPE] Bump WPEBackend-fdo requirement to API version 1.0
1054         https://bugs.webkit.org/show_bug.cgi?id=195001
1055
1056         Reviewed by Carlos Garcia Campos.
1057
1058         API version 1.0 always includes the functionality previously guarded with
1059         WPE_BACKEND_CHECK_VERSION(): remove the guards and always use the new functions
1060         unconditionally.
1061
1062         * UIProcess/API/wpe/WPEView.cpp:
1063         (WKWPE::View::View): Remove usage of WPE_BACKEND_CHECK_VERSION().
1064         (WKWPE::m_backend): Ditto.
1065         * UIProcess/API/wpe/qt/WPEQtViewBackend.cpp:
1066         (WPEQtViewBackend::WPEQtViewBackend): Use libWPEBackend-fdo-1.0 as
1067         library name, remove call to wpe_fdo_initialize_for_egl_display().
1068         (WPEQtViewBackend::create): Call wpe_fdo_initialize_for_egl_display()
1069         here, to bail out early in case initialization fails.
1070         * UIProcess/glib/WebProcessPoolGLib.cpp:
1071         (WebKit::WebProcessPool::platformInitializeWebProcess): Remove usage of
1072         WPE_BACKEND_CHECK_VERSION().
1073
1074 2019-02-25  Per Arne Vollan  <pvollan@apple.com>
1075
1076         A prewarmed Web process should have a process assertion.
1077         https://bugs.webkit.org/show_bug.cgi?id=195006
1078
1079         Reviewed by Geoffrey Garen.
1080
1081         To make sure the prewarm message is handled in the Web process before the process is suspended,
1082         the process should have a process assertion. This can be fixed by sending the prewarm message
1083         inside WebProcessPool::initializeNewWebProcess, since all message sent inside this method are
1084         guaranteed to be handled before the WebContent process is suspended.
1085
1086         This patch is based on Chris Dumez' idea and obervation of the issue.
1087
1088         * UIProcess/WebProcessPool.cpp:
1089         (WebKit::WebProcessPool::createNewWebProcess):
1090         (WebKit::WebProcessPool::initializeNewWebProcess):
1091         * UIProcess/WebProcessPool.h:
1092
1093 2019-02-25  Michael Catanzaro  <mcatanzaro@igalia.com>
1094
1095         [GTK] Enable PSON
1096         https://bugs.webkit.org/show_bug.cgi?id=194979
1097
1098         Reviewed by Žan Doberšek.
1099
1100         It is expected that this may introduce unexpected regressions, so it's appropriate to do
1101         this at the start of a new release cycle.
1102
1103         * Shared/WebPreferencesDefaultValues.h:
1104
1105 2019-02-25  Michael Catanzaro  <mcatanzaro@igalia.com>
1106
1107         [WPE][GTK] Clean up handling of WEBKIT_FORCE_COMPLEX_TEXT
1108         https://bugs.webkit.org/show_bug.cgi?id=194614
1109
1110         Reviewed by Carlos Garcia Campos.
1111
1112         This environment variable is now enabled for WPE, not just for GTK.
1113
1114         It is now possible to use this environment variable to enable complex text, not just to
1115         disable it.
1116
1117         WebProcessPool::setAlwaysUsesComplexTextCodePath is fixed to be respected even when this
1118         environment variable is set, although WPE and GTK will never do so.
1119
1120         * UIProcess/glib/WebProcessPoolGLib.cpp:
1121         (WebKit::WebProcessPool::platformInitialize):
1122         (WebKit::WebProcessPool::platformInitializeWebProcess):
1123
1124 2019-02-24  Zalan Bujtas  <zalan@apple.com>
1125
1126         Introduce ContentChangeObserver class
1127         https://bugs.webkit.org/show_bug.cgi?id=194977
1128         <rdar://problem/48338115>
1129
1130         Reviewed by Simon Fraser.
1131
1132         * WebProcess/WebPage/ios/WebPageIOS.mm:
1133         (WebKit::WebPage::handleSyntheticClick):
1134         (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
1135
1136 2019-02-24  Simon Fraser  <simon.fraser@apple.com>
1137
1138         Migrate from "fixedPositionRect" to "layoutViewport" in the scrolling tree
1139         https://bugs.webkit.org/show_bug.cgi?id=194984
1140
1141         Reviewed by Sam Weinig.
1142
1143         Rename "fixedPositionRect" to "layoutViewport" in scrolling tree code.
1144
1145         Remove ScrollingTree::fixedPositionRect() which was only used on iOS, to fetch the
1146         current layout viewport rect. Instead, set the layout viewport on the root
1147         node in ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling().
1148         
1149         Add a WK2 Scrolling log channel.
1150
1151         * Platform/Logging.h:
1152         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1153         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
1154         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1155         (WebKit::RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling):
1156         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
1157         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
1158         (WebKit::RemoteScrollingTree::fixedPositionRect): Deleted.
1159         * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
1160         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1161         (WebKit::RemoteScrollingCoordinatorProxy::currentLayoutViewport const):
1162         (WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect const): Deleted.
1163         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
1164         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
1165         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateChildNodesAfterScroll):
1166         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterViewportChange):
1167         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterAncestorChange):
1168         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
1169         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
1170         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterAncestorChange):
1171         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
1172         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1173         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateLayersAfterAncestorChange):
1174         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll):
1175         * UIProcess/ios/WKContentView.mm:
1176         (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
1177
1178 2019-02-20  Darin Adler  <darin@apple.com>
1179
1180         Finish removing String::format
1181         https://bugs.webkit.org/show_bug.cgi?id=194893
1182
1183         Reviewed by Daniel Bates.
1184
1185         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
1186         (WebKit::LocalAuthenticator::getAssertion): Use makeString, attempting to fix
1187         a problem where we passed an NSData * to format with a "%s"."
1188
1189 2019-02-24  Michael Catanzaro  <mcatanzaro@igalia.com>
1190
1191         [WPE] Install MemoryPressureHandler in UIProcess
1192         https://bugs.webkit.org/show_bug.cgi?id=194617
1193
1194         Reviewed by Žan Doberšek.
1195
1196         Currently only GTK and Cocoa ports run MemoryPressureHandler in the UI process. WPE should
1197         too.
1198
1199         We need @no-unify to avoid changing the unified source bundles under API/, which are
1200         notoriously fragile. (WebMemoryPressureHandler.cpp sorts just above API/.)
1201
1202         * SourcesWPE.txt:
1203         * UIProcess/WebMemoryPressureHandler.cpp:
1204         (WebKit::installMemoryPressureHandler):
1205         * UIProcess/glib/WebProcessPoolGLib.cpp:
1206         (WebKit::WebProcessPool::platformInitialize):
1207
1208 2019-02-23  Chris Dumez  <cdumez@apple.com>
1209
1210         Give DrawingAreas their own identifiers
1211         https://bugs.webkit.org/show_bug.cgi?id=194969
1212         <rdar://problem/48154508>
1213
1214         Unreviewed, fix API test debug assertion failures after r241988.
1215         We do not support sending an ObjectIdentifier that is 0 via IPC so update WebPageProxy::CreateNewPage
1216         IPC to return an Optional<WebPageCreationParameters> instead of a WebPageCreationParameters. It returns
1217         nullopt when there this no UIClient or the client did not create the page, instead of returning a
1218         default-initialized WebPageCreationParameters.
1219
1220         * UIProcess/WebPageProxy.cpp:
1221         (WebKit::WebPageProxy::createNewPage):
1222         * UIProcess/WebPageProxy.messages.in:
1223         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1224         (WebKit::WebChromeClient::createWindow):
1225
1226 2019-02-23  Simon Fraser  <simon.fraser@apple.com>
1227
1228         Remove remnants of iOS WK1 scrolling tree code
1229         https://bugs.webkit.org/show_bug.cgi?id=194980
1230
1231         Reviewed by Sam Weinig.
1232
1233         Remove ScrollingTreeIOS and ScrollingCoordinatorIOS which were never instantiated.
1234
1235         Merge ScrollingTreeFrameScrollingNodeIOS into ScrollingTreeFrameScrollingNodeRemoteIOS,
1236         removing code which never applies to iOS WK2 (e.g. the synchronous scrolling code path).
1237
1238         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
1239         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
1240         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
1241         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::ScrollingTreeFrameScrollingNodeRemoteIOS):
1242         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateBeforeChildren):
1243         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
1244         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::minimumScrollPosition const):
1245         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::maximumScrollPosition const):
1246         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::scrollPosition const):
1247         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::setScrollPosition):
1248         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::setScrollLayerPosition):
1249         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateChildNodesAfterScroll):
1250         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterDelegatedScroll):
1251         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterViewportChange):
1252         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterAncestorChange):
1253         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
1254
1255 2019-02-23  Keith Miller  <keith_miller@apple.com>
1256
1257         Add new mac target numbers
1258         https://bugs.webkit.org/show_bug.cgi?id=194955
1259
1260         Reviewed by Tim Horton.
1261
1262         * Configurations/Base.xcconfig:
1263         * Configurations/DebugRelease.xcconfig:
1264
1265 2019-02-22  Chris Dumez  <cdumez@apple.com>
1266
1267         Give DrawingAreas their own identifiers
1268         https://bugs.webkit.org/show_bug.cgi?id=194969
1269         <rdar://problem/48154508>
1270
1271         Reviewed by Geoffrey Garen.
1272
1273         Give DrawingAreas their own identifiers instead of using the pageID. It will make the IPC more robust now that a
1274         WebPageProxy can have several drawing areas with PSON.
1275
1276         * Shared/DrawingAreaInfo.h:
1277         * Shared/WebPageCreationParameters.cpp:
1278         (WebKit::WebPageCreationParameters::encode const):
1279         (WebKit::WebPageCreationParameters::decode):
1280         * Shared/WebPageCreationParameters.h:
1281         * UIProcess/AcceleratedDrawingAreaProxy.cpp:
1282         (WebKit::AcceleratedDrawingAreaProxy::sendUpdateBackingStoreState):
1283         (WebKit::AcceleratedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState):
1284         (WebKit::AcceleratedDrawingAreaProxy::setNativeSurfaceHandleForCompositing):
1285         (WebKit::AcceleratedDrawingAreaProxy::destroyNativeSurfaceHandleForCompositing):
1286         * UIProcess/DrawingAreaProxy.cpp:
1287         (WebKit::DrawingAreaProxy::DrawingAreaProxy):
1288         (WebKit::DrawingAreaProxy::~DrawingAreaProxy):
1289         (WebKit::DrawingAreaProxy::messageSenderConnection const):
1290         (WebKit::DrawingAreaProxy::sendMessage):
1291         (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired):
1292         * UIProcess/DrawingAreaProxy.h:
1293         (WebKit::DrawingAreaProxy::identifier const):
1294         (WebKit::DrawingAreaProxy::process const):
1295         * UIProcess/DrawingAreaProxyImpl.cpp:
1296         (WebKit::DrawingAreaProxyImpl::update):
1297         * UIProcess/ProvisionalPageProxy.cpp:
1298         (WebKit::ProvisionalPageProxy::initializeWebPage):
1299         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1300         (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
1301         (WebKit::RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy):
1302         (WebKit::RemoteLayerTreeDrawingAreaProxy::deviceScaleFactorDidChange):
1303         (WebKit::RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry):
1304         (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidStart):
1305         (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidEnd):
1306         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
1307         (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState):
1308         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
1309         * UIProcess/WebPageProxy.cpp:
1310         (WebKit::WebPageProxy::initializeWebPage):
1311         (WebKit::WebPageProxy::createNewPage):
1312         (WebKit::WebPageProxy::creationParameters):
1313         * UIProcess/WebPageProxy.h:
1314         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1315         (WebKit::TiledCoreAnimationDrawingAreaProxy::deviceScaleFactorDidChange):
1316         (WebKit::TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange):
1317         (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
1318         (WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry):
1319         (WebKit::TiledCoreAnimationDrawingAreaProxy::adjustTransientZoom):
1320         (WebKit::TiledCoreAnimationDrawingAreaProxy::commitTransientZoom):
1321         (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing):
1322         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1323         (WebKit::AcceleratedDrawingArea::AcceleratedDrawingArea):
1324         (WebKit::AcceleratedDrawingArea::layerHostDidFlushLayers):
1325         (WebKit::AcceleratedDrawingArea::sendDidUpdateBackingStoreState):
1326         * WebProcess/WebPage/DrawingArea.cpp:
1327         (WebKit::DrawingArea::DrawingArea):
1328         (WebKit::DrawingArea::removeMessageReceiverIfNeeded):
1329         * WebProcess/WebPage/DrawingArea.h:
1330         (WebKit::DrawingArea::identifier const):
1331         (WebKit::DrawingArea::send):
1332         * WebProcess/WebPage/DrawingAreaImpl.cpp:
1333         (WebKit::DrawingAreaImpl::sendDidUpdateBackingStoreState):
1334         (WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode):
1335         (WebKit::DrawingAreaImpl::display):
1336         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1337         (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
1338         (WebKit::RemoteLayerTreeDrawingArea::updateGeometry):
1339         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1340         * WebProcess/WebPage/WebPage.cpp:
1341         (WebKit::WebPage::reinitializeWebPage):
1342         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1343         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
1344         (WebKit::TiledCoreAnimationDrawingArea::sendEnterAcceleratedCompositingModeIfNeeded):
1345         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded):
1346         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1347         (WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
1348         (WebKit::TiledCoreAnimationDrawingArea::setLayerHostingMode):
1349
1350 2019-02-22  Andy Estes  <aestes@apple.com>
1351
1352         [Cocoa] Do not suppress deprecation warnings when calling sandbox_extension_issue_file
1353         https://bugs.webkit.org/show_bug.cgi?id=194971
1354         <rdar://problem/35786264>
1355
1356         Reviewed by Tim Horton.
1357
1358         sandbox_extension_issue_file is not actually deprecated.
1359
1360         * Shared/mac/SandboxExtensionMac.mm:
1361         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
1362
1363 2019-02-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1364
1365         [iOS] Callout menu overlaps in-page controls when editing a comment in github.com's issue tracker
1366         https://bugs.webkit.org/show_bug.cgi?id=194873
1367         <rdar://problem/46701974>
1368
1369         Reviewed by Tim Horton.
1370
1371         On the topic of supporting web-based rich text editors on iOS, one problematic area has always been handling
1372         conflicts between platform UI (i.e., the system callout menu) and in-page text editing controls. This issue
1373         comes up in websites that don't use the "hidden contenteditable" approach to rich text editing, but also show
1374         additional controls in a toolbar or contextual menu above the selection. In these cases, what often happens is
1375         that system controls overlap controls in the page.
1376
1377         Luckily, the iOS callout menu (i.e. the private UICalloutBar) is capable of presenting with a list of "evasion
1378         rects" to avoid; if the callout bar would normally intersect with one of these rects, then a different
1379         orientation that does not intersect with one of these rects is chosen instead. Currently, the only rect added
1380         here by UIKit when presenting the callout menu is the bounding rect of the on-screen keyboard, but after
1381         <rdar://problem/48128337>, we now have a generalized mechanism for offering additional evasion rects before
1382         UIKit presents the callout menu.
1383
1384         This patch adopts the mechanism introduced in <rdar://problem/48128337>, and introduces a heuristic for
1385         determining the approximate location of controls in the page which might overlap the callout menu. This
1386         heuristic works by hit-testing for clickable (but non-editable) nodes above the bounds of the selection, which
1387         are additionally not hit-tested by advancing outwards from any of the other edges of the selection bounds.
1388         Additionally, any hit-tested nodes whose bounding rects are very large (relative to the content view size) are
1389         ignored (this deals with scenarios where the body or a large container element has a click handler). We then add
1390         the bounding rects of each of the nodes that fit this criteria to the list of rects for UIKit to avoid when
1391         presenting the system callout menu.
1392
1393         The result is that WebKit will, by default, avoid overlapping anything that looks like controls in the page when
1394         showing a callout menu in editable content. In practice, this fixes overlapping controls on most websites that
1395         roll their own context menu or toolbar in their rich text editor.
1396
1397         Test: editing/selection/ios/avoid-showing-callout-menu-over-controls.html
1398
1399         * Platform/spi/ios/UIKitSPI.h:
1400         * UIProcess/WebPageProxy.h:
1401         * UIProcess/ios/WKContentViewInteraction.mm:
1402         (-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]):
1403         (-[WKContentView requestRectsToEvadeForSelectionCommandsWithCompletionHandler:]):
1404         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
1405
1406         Drive-by: handle null completion handler arguments more gracefully, by raising an NSException and bailing before
1407         attempting to invoke a nil block.
1408
1409         * UIProcess/ios/WebPageProxyIOS.mm:
1410         (WebKit::WebPageProxy::requestEvasionRectsAboveSelection):
1411
1412         See above for more detail.
1413
1414         * WebProcess/WebPage/WebPage.h:
1415         * WebProcess/WebPage/WebPage.messages.in:
1416         * WebProcess/WebPage/ios/WebPageIOS.mm:
1417         (WebKit::WebPage::requestEvasionRectsAboveSelection):
1418
1419 2019-02-22  Simon Fraser  <simon.fraser@apple.com>
1420
1421         Unreviewed build fix: need a WebCore:: namespace on ScrollingEventResult.
1422
1423         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
1424
1425 2019-02-22  Chris Dumez  <cdumez@apple.com>
1426
1427         Regression(PSON) Unable to preview password-protected documents on iCloud.com
1428         https://bugs.webkit.org/show_bug.cgi?id=194954
1429         <rdar://problem/48127957>
1430
1431         Reviewed by Alex Christensen.
1432
1433         Make sure the ProvisionalPageProxy forwards to the WebPageProxy the QuickLook-related
1434         IPC on iOS.
1435
1436         * UIProcess/ProvisionalPageProxy.cpp:
1437         (WebKit::ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame):
1438         (WebKit::ProvisionalPageProxy::didReceiveMessage):
1439         * UIProcess/ProvisionalPageProxy.h:
1440         * UIProcess/WebPageProxy.h:
1441         * UIProcess/ios/WebPageProxyIOS.mm:
1442         (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame):
1443         (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrameShared):
1444
1445 2019-02-22  Per Arne Vollan  <pvollan@apple.com>
1446
1447         [iOS] Sandbox should allow mach lookups related to media capturing
1448         https://bugs.webkit.org/show_bug.cgi?id=194951
1449         <rdar://problem/48013875>
1450
1451         Reviewed by Brent Fulgham.
1452
1453         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1454
1455 2019-02-22  Alexander Mikhaylenko  <exalm7659@gmail.com>
1456
1457         [GTK] Navigation gesture improvements
1458         https://bugs.webkit.org/show_bug.cgi?id=194943
1459
1460         Reviewed by Michael Catanzaro.
1461
1462         Cancel the gesture if progress is less than 0.5 and velocity is not high enough.
1463
1464         Allow to continue the gesture during animation. Introduce finished state to be used
1465         when showing snapshot after the animation ends.
1466
1467         Fix duration calculation, also slow it down so that the initial velocity matches
1468         what it was during the gesture.
1469
1470         * UIProcess/ViewGestureController.h: Add shouldCancel() and State::Finishing to SwipeProgressTracker.
1471         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
1472         (WebKit::ViewGestureController::SwipeProgressTracker::handleEvent):
1473         Fix velocity calculation, allow scrolling during State::Animating.
1474         (WebKit::ViewGestureController::SwipeProgressTracker::shouldCancel): Added.
1475         (WebKit::ViewGestureController::SwipeProgressTracker::startAnimation): Use shouldCancel() and fix duration calculation.
1476         (WebKit::ViewGestureController::SwipeProgressTracker::endAnimation): Set state to State::Finishing when the animation ends.
1477
1478 2019-02-22  Chris Dumez  <cdumez@apple.com>
1479
1480         REGRESSION(PSON) Scroll position is sometimes not restored on history navigation
1481         https://bugs.webkit.org/show_bug.cgi?id=194924
1482         <rdar://problem/48216125>
1483
1484         Reviewed by Geoffrey Garen.
1485
1486         When process-swapping, we would create a new WebPage in the new process, which would
1487         call restoreSessionInternal() to restore the HistoryItems based on the UIProcess's
1488         backforward list. The issue is that this session restoring would send HistoryItem
1489         updates back to the UIProcess. Without PSON, this would be unnecessary but harmless.
1490         With PSON though, this may end up overwriting values set by the previous process,
1491         such as the scroll position.
1492
1493         Address the issue by temporarily disabling the HistoryItem update notifications to
1494         the UIProcess while restoring a session.
1495
1496         * UIProcess/API/Cocoa/WKBackForwardListItem.mm:
1497         (-[WKBackForwardListItem _scrollPosition]):
1498         * UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h:
1499         * WebProcess/WebPage/WebPage.cpp:
1500         (WebKit::WebPage::restoreSessionInternal):
1501
1502 2019-02-21  Adrian Perez de Castro  <aperez@igalia.com>
1503
1504         [WPE][GTK] No API documentation generated for WebKitUserContentFilterStore
1505         https://bugs.webkit.org/show_bug.cgi?id=194908
1506
1507         Reviewed by Carlos Garcia Campos.
1508
1509         * UIProcess/API/gtk/docs/webkit2gtk-4.0.types: Add entry for webkit_user_content_filter_store_get_type().
1510         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add entry for WebKitUserContentFilterStore.
1511         * UIProcess/API/wpe/docs/wpe-docs.sgml: Ditto.
1512
1513 2019-02-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1514
1515         wpewebkit-2.23.90 Failing to build on Fedora
1516         https://bugs.webkit.org/show_bug.cgi?id=194922
1517
1518         Unreviewed. Fix path to WebKitUserContentFilterStore.h in WPE_API_INSTALLED_HEADERS.
1519
1520         * PlatformWPE.cmake:
1521
1522 2019-02-21  Simon Fraser  <simon.fraser@apple.com>
1523
1524         Hardcode Visual Viewports on everywhere except iOS WK1
1525         https://bugs.webkit.org/show_bug.cgi?id=194928
1526
1527         Reviewed by Zalan Bujtas.
1528
1529         Remove the WK1 and WK2 preferences and MiniBrowser menu item for "visual viewports",
1530         change the default value of the Setting to 'true', and hardcode WebView on iOS to
1531         set it to false. The setting has shipped for several years and there's no need to turn
1532         it off now.
1533
1534         Similarly, disable the "Visual Viewport API" on iOS WK1, since it makes no sense if
1535         Visual Viewports are not enabled.
1536         
1537         Remove the "visualViewportEnabled" flag and unused code paths from scrolling tree code
1538         that only runs in WK2
1539
1540         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1541         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
1542         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
1543         * Shared/WebPreferences.yaml:
1544         * UIProcess/API/Cocoa/WKPreferences.mm:
1545         (-[WKPreferences _visualViewportEnabled]): Deleted.
1546         (-[WKPreferences _setVisualViewportEnabled:]): Deleted.
1547         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1548         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1549         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
1550         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
1551         (WebKit::RemoteScrollingCoordinatorProxy::visualViewportEnabled const): Deleted.
1552         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1553         (WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect const):
1554         * UIProcess/WebPageProxy.h:
1555         * UIProcess/ios/WKContentView.mm:
1556         (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
1557         * UIProcess/ios/WebPageProxyIOS.mm:
1558         (WebKit::WebPageProxy::computeCustomFixedPositionRect const):
1559         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1560         (WebKit::WebAutomationSessionProxy::computeElementLayout):
1561         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1562         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1563         * WebProcess/WebPage/ios/WebPageIOS.mm:
1564         (WebKit::WebPage::getFocusedElementInformation):
1565         (WebKit::WebPage::dynamicViewportSizeUpdate):
1566         (WebKit::WebPage::updateVisibleContentRects):
1567
1568 2019-02-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1569
1570         [GTK] Epiphany searching for plugins even if plugins are disabled
1571         https://bugs.webkit.org/show_bug.cgi?id=194352
1572
1573         Reviewed by Michael Catanzaro.
1574
1575         Check pluginsEnabled setting before trying to get plugins from UI process.
1576
1577         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
1578         (WebKit::WebPluginInfoProvider::populatePluginCache):
1579
1580 2019-02-21  Darin Adler  <darin@apple.com>
1581
1582         Some refinements for Node and Document
1583         https://bugs.webkit.org/show_bug.cgi?id=194764
1584
1585         Reviewed by Ryosuke Niwa.
1586
1587         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
1588         (webkit_dom_document_get_override_style): Changed to return nullptr directly instead of
1589         calling a bunch of WebCore code first. No real value in checking arguments or doing any work.
1590
1591         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1592         (WebKit::WebFrameLoaderClient::shouldAlwaysUsePluginDocument const): Deleted.
1593         No need to override the function inherited from the base class, nor to keep track of the
1594         unnecessary task of implementing this some day.
1595         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: Updated for the above.
1596
1597 2019-02-21  Ryosuke Niwa  <rniwa@webkit.org>
1598
1599         Discard cached processes when clearing website data store
1600         https://bugs.webkit.org/show_bug.cgi?id=194894
1601
1602         Reviewed by Chris Dumez.
1603
1604         Clear the process cache when clearing the website data store so that there is no way to infer
1605         which site the user had visited by observing for which sites WebContent processes had been cached.
1606
1607         There is one sublty in WebsiteDataStore::removeData that we have to delay the clearing of
1608         the web process cache until the next run loop because SuspendedPageProxy::~SuspendedPageProxy
1609         invokes WebProcessProxy::maybeShutDown in the next run loop. We also have to disable the process
1610         cache during this time as it would otherwise trigger the responsiveness check of WebContent process
1611         can take arbitrarily long time.
1612
1613         * UIProcess/API/Cocoa/WKProcessPool.mm:
1614         (-[WKProcessPool _processCacheCapacity]): Added for testing.
1615         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1616         * UIProcess/WebProcessCache.cpp:
1617         (WebKit::WebProcessCache::addProcess): Avoid adding web processes to the cache while the suspended
1618         pages are being cleared.
1619         * UIProcess/WebProcessCache.h:
1620         (WebKit::WebProcessCache::disabled const): Added.
1621         (WebKit::WebProcessCache::setDisabled): Added.
1622         * UIProcess/WebProcessPool.cpp:
1623         (WebKit::WebProcessPool::handleMemoryPressureWarning):
1624         (WebKit::WebProcessPool::clearSuspendedPages): Added.
1625         * UIProcess/WebProcessPool.h:
1626         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1627         (WebKit::WebsiteDataStore::removeData):
1628
1629 2019-02-21  Alex Christensen  <achristensen@webkit.org>
1630
1631         Clicking "Go Back" on a safe browsing warning before a WKWebView has loaded any page should request to close the WKWebView
1632         https://bugs.webkit.org/show_bug.cgi?id=194914
1633         <rdar://problem/47586889>
1634
1635         Reviewed by Geoffrey Garen.
1636
1637         * UIProcess/API/APIUIClient.h:
1638         (API::UIClient::didShowSafeBrowsingWarning):
1639         (API::UIClient::didClickGoBackFromSafeBrowsingWarning): Deleted.
1640         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1641         * UIProcess/Cocoa/UIDelegate.h:
1642         * UIProcess/Cocoa/UIDelegate.mm:
1643         (WebKit::UIDelegate::setDelegate):
1644         (WebKit::UIDelegate::UIClient::didClickGoBackFromSafeBrowsingWarning): Deleted.
1645         * UIProcess/WebPageProxy.cpp:
1646         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1647
1648 2019-02-21  Tim Horton  <timothy_horton@apple.com>
1649
1650         Turn a high-value UI-side-compositing assertion into a release assert
1651         https://bugs.webkit.org/show_bug.cgi?id=194887
1652
1653         Reviewed by Simon Fraser.
1654
1655         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
1656         (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
1657         There is absolutely no situation in which this assert should fire
1658         if WebKit is behaving correctly, and it will basically always result
1659         in a UI process crash (or at least confusion), so make it a release assert.
1660         This would have saved us a lot of stress in bug 194845.
1661
1662 2019-02-21  Don Olmstead  <don.olmstead@sony.com>
1663
1664         [MSVC] Fix compilation errors with lambdas in ResourceLoadStatistics
1665         https://bugs.webkit.org/show_bug.cgi?id=194913
1666
1667         Reviewed by Brent Fulgham.
1668
1669         MSVC has problems with the scoping of `this` within a nested lambda. To work around the
1670         behavior the enclosing lambda's wrapping of `this` is used within the nested lambda.
1671
1672         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1673         (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords):
1674         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1675         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted):
1676
1677 2019-02-21  Chris Dumez  <cdumez@apple.com>
1678
1679         Fix API test crashes after r241855.
1680
1681         Reviewed by Ryosuke Niwa.
1682
1683         * UIProcess/WebProcessCache.cpp:
1684         (WebKit::WebProcessCache::addProcessIfPossible):
1685
1686 2019-02-21  Alex Christensen  <achristensen@webkit.org>
1687
1688         API::HTTPCookieStore should expose setCookies()
1689         https://bugs.webkit.org/show_bug.cgi?id=194861
1690
1691         Reviewed by Brent Fulgham.
1692
1693         Pass a Vector<Cookie> instead of just one cookie at a time.
1694         This will add the ability to set multiple cookies without an IPC roundtrip per cookie.
1695
1696         * NetworkProcess/Cookies/WebCookieManager.cpp:
1697         (WebKit::WebCookieManager::setCookie):
1698         * NetworkProcess/Cookies/WebCookieManager.h:
1699         * NetworkProcess/Cookies/WebCookieManager.messages.in:
1700         * UIProcess/API/APIHTTPCookieStore.cpp:
1701         (API::HTTPCookieStore::setCookies):
1702         (API::HTTPCookieStore::setCookie): Deleted.
1703         * UIProcess/API/APIHTTPCookieStore.h:
1704         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
1705         (-[WKHTTPCookieStore setCookie:completionHandler:]):
1706         * UIProcess/WebCookieManagerProxy.cpp:
1707         (WebKit::WebCookieManagerProxy::setCookies):
1708         (WebKit::WebCookieManagerProxy::setCookie): Deleted.
1709         * UIProcess/WebCookieManagerProxy.h:
1710
1711 2019-02-21  Antoine Quint  <graouts@apple.com>
1712
1713         Move UIWebTouchEventsGestureRecognizer.activeTouchesByIdentifier to SPI
1714         https://bugs.webkit.org/show_bug.cgi?id=194531
1715         <rdar://problem/47714562>
1716
1717         Reviewed by Tim Horton.
1718
1719         Follow-up commit to ensure this SPI is only called on newer versions of iOS.
1720
1721         * UIProcess/ios/WKContentViewInteraction.mm:
1722         (-[WKContentView cancelPointersForGestureRecognizer:]):
1723
1724 2019-02-21  Tim Horton  <timothy_horton@apple.com>
1725
1726         Crash under RemoteLayerTreePropertyApplier::applyProperties when reattaching to old process
1727         https://bugs.webkit.org/show_bug.cgi?id=194845
1728         <rdar://problem/47944579>
1729
1730         Reviewed by Antti Koivisto.
1731
1732         New test: ProcessSwap.PageOverlayLayerPersistence
1733
1734         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
1735         (WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged):
1736         Keep track of all properties that have ever changed on a layer, so we
1737         can re-send them if a layer moves between contexts.
1738
1739         * WebProcess/WebPage/DrawingArea.cpp:
1740         (WebKit::DrawingArea::~DrawingArea):
1741         (WebKit::DrawingArea::removeMessageReceiverIfNeeded):
1742         * WebProcess/WebPage/DrawingArea.h:
1743         (WebKit::DrawingArea::layerHostDidFlushLayers):
1744         Make it possible to tear down DrawingArea's MessageReceiver before it is destroyed,
1745         so that we can keep two DrawingAreas alive in a single process for a short time.
1746
1747         (WebKit::DrawingArea::adoptLayersFromDrawingArea):
1748         Add adoptLayersFromDrawingArea; see below for its only useful implementation.
1749
1750         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp:
1751         (WebKit::GraphicsLayerCARemote::GraphicsLayerCARemote):
1752         (WebKit::GraphicsLayerCARemote::~GraphicsLayerCARemote):
1753         (WebKit::GraphicsLayerCARemote::createPlatformCALayer):
1754         (WebKit::GraphicsLayerCARemote::createPlatformCALayerForEmbeddedView):
1755         (WebKit::GraphicsLayerCARemote::moveToContext):
1756         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h:
1757         Make it possible to move a GraphicsLayerCARemote between RemoteLayerTreeContexts.
1758
1759         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
1760         (WebKit::PlatformCALayerRemote::create):
1761         (WebKit::PlatformCALayerRemote::createForEmbeddedView):
1762         (WebKit::PlatformCALayerRemote::~PlatformCALayerRemote):
1763         (WebKit::PlatformCALayerRemote::moveToContext):
1764         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
1765         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
1766         (WebKit::PlatformCALayerRemoteCustom::create):
1767         (WebKit::PlatformCALayerRemoteCustom::clone const):
1768         Make it possible to move a PlatformCALayerRemote between RemoteLayerTreeContexts.
1769
1770         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
1771         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
1772         (WebKit::RemoteLayerTreeContext::~RemoteLayerTreeContext):
1773         (WebKit::RemoteLayerTreeContext::adoptLayersFromContext):
1774         (WebKit::RemoteLayerTreeContext::layerDidEnterContext):
1775         (WebKit::RemoteLayerTreeContext::layerWillLeaveContext):
1776         (WebKit::RemoteLayerTreeContext::graphicsLayerDidEnterContext):
1777         (WebKit::RemoteLayerTreeContext::graphicsLayerWillLeaveContext):
1778         (WebKit::RemoteLayerTreeContext::layerWasCreated): Deleted.
1779         (WebKit::RemoteLayerTreeContext::layerWillBeDestroyed): Deleted.
1780         Keep track of all GraphicsLayerCARemote instances in the context, like we
1781         do for PlatformCALayerRemote, so that we can update their context backpointers if needed.
1782
1783         Also make it possible to move all outstanding layers to a new context.
1784
1785         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
1786         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1787         (WebKit::RemoteLayerTreeDrawingArea::adoptLayersFromDrawingArea):
1788         * WebProcess/WebPage/WebPage.cpp:
1789         (WebKit::WebPage::reinitializeWebPage):
1790         When doing a DrawingArea swap, transition all layers from the old context
1791         to the new one. In order to do this, we temporarily keep both DrawingAreas
1792         alive, but make use of the new mechanism to remove the old one's MessageReceiver
1793         before installing the new one, so that destroying the old one later doesn't
1794         remove it (avoiding re-introducing bug 189481).
1795
1796 2019-02-21  Chris Dumez  <cdumez@apple.com>
1797
1798         Unreviewed API test fix after r241855.
1799
1800         * UIProcess/WebProcessProxy.cpp:
1801         (WebKit::WebProcessProxy::~WebProcessProxy):
1802
1803 2019-02-21  Antoine Quint  <graouts@apple.com>
1804
1805         Move UIWebTouchEventsGestureRecognizer.activeTouchesByIdentifier to SPI
1806         https://bugs.webkit.org/show_bug.cgi?id=194531
1807         <rdar://problem/47714562>
1808
1809         Reviewed by Dean Jackson.
1810
1811         * Platform/spi/ios/UIKitSPI.h:
1812         * UIProcess/ios/WKContentViewInteraction.mm:
1813         (-[WKContentView cancelPointersForGestureRecognizer:]): We update the referenced Radar since we need to keep the call
1814         to respondsToSelector until the SPI has shipped for OpenSource builds to work.
1815
1816 2019-02-20  Antti Koivisto  <antti@apple.com>
1817
1818         Make programmatic frame scrolling work on iOS
1819         https://bugs.webkit.org/show_bug.cgi?id=194886
1820
1821         Reviewed by Simon Fraser.
1822
1823         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1824         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
1825
1826         Don't move based on the layout scroll position. This just overrides the user scroll position.
1827         Remove ScrolledContentsLayer checks, we only need to deal with the ScrollContainerLayer here.
1828
1829         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::setScrollLayerPosition):
1830
1831         Scroll the UIScrollView correctly. This is called as a result of setting the RequestedScrollPosition property.
1832         Remove scroll origin code, it doesn't look correct (and is untested).
1833
1834 2019-02-20  Chris Dumez  <cdumez@apple.com>
1835
1836         [PSON] Make sure hung processes are not kept alive by suspended pages or process caching
1837         https://bugs.webkit.org/show_bug.cgi?id=194881
1838         <rdar://problem/48249014>
1839
1840         Reviewed by Geoffrey Garen.
1841
1842         After we construct a SuspendedPageProxy and before we send the IPC to the WebProcess to
1843         ask it to suspend, start a 10 seconds timer. If the process does not answer the request
1844         to suspend before the timer fires, we destroy the SuspendedPageProxy so that we do not
1845         keep a hung process around.
1846
1847         For the WebProcessCache, we now call WebProcessProxy::isResponsive() on the process
1848         before adding it to the cache. Internally, this relies on an IPC handshake with the
1849         WebProcess. If the process is not responsive, we do not add it to the cache and we
1850         shut it down. If it is responsive then we proceed normally with adding it to the
1851         cache.
1852
1853         * UIProcess/SuspendedPageProxy.cpp:
1854         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
1855         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
1856         (WebKit::SuspendedPageProxy::suspensionTimedOut):
1857         * UIProcess/SuspendedPageProxy.h:
1858         * UIProcess/WebProcessCache.cpp:
1859         (WebKit::WebProcessCache::addProcessIfPossible):
1860         (WebKit::WebProcessCache::addProcess):
1861         * UIProcess/WebProcessCache.h:
1862         * UIProcess/WebProcessProxy.cpp:
1863         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
1864         (WebKit::WebProcessProxy::maybeShutDown):
1865         (WebKit::WebProcessProxy::isResponsive):
1866         * UIProcess/WebProcessProxy.h:
1867
1868 2019-02-20  Chris Dumez  <cdumez@apple.com>
1869
1870         Unreviewed build fix after r241823.
1871
1872         * UIProcess/SuspendedPageProxy.h:
1873
1874 2019-02-20  Alex Christensen  <achristensen@webkit.org>
1875
1876         Unreviewed, rolling out r241838.
1877
1878         Broke API tests
1879
1880         Reverted changeset:
1881
1882         "Resolve WebsiteDataStore/HTTPCookieStore ref cycle"
1883         https://bugs.webkit.org/show_bug.cgi?id=194868
1884         https://trac.webkit.org/changeset/241838
1885
1886 2019-02-20  Wenson Hsieh  <wenson_hsieh@apple.com>
1887
1888         REGRESSION: [ iOS ] Layout Test editing/input/ios/rtl-keyboard-input-on-focus.html is a Timeout
1889         https://bugs.webkit.org/show_bug.cgi?id=194601
1890         <rdar://problem/48080316>
1891
1892         Reviewed by Tim Horton.
1893
1894         Following r241311, if a web view becomes first responder and is then moved offscreen (or obscured, hidden, or in
1895         the case of WebKitTestRunner, its UIWindow loses its status as keyWindow), we end up holding on to the input
1896         view update deferral token indefinitely, waiting for the current focused element to be blurred or refocused.
1897
1898         This also manifests other user-facing bugs, the most common of which is the keyboard occasionally remaining
1899         onscreen after typing a URL in the unified field in MobileSafari and hitting Return, in the case where there is
1900         no autofocused element on the page.
1901
1902         To fix this, when becoming the first responder, additionally install a callback to detect when the page is
1903         finished handling the activity state change, and invalidate the input deferral token then. This retains the
1904         behavior where calling -becomeFirstResponder on the web view while a different view is focused will keep the
1905         keyboard stable, since the focused element message from the web process should be dispatched when handling the
1906         activity state change within the web process.
1907
1908         Of course, the web process may not be responsive at all while the web view is still in the view hierarchy, in
1909         which case we may still end up deferring input view updates indefinitely. In this case, we maintain a separate
1910         watchdog timer with a short delay, after which we unconditionally invalidate the token.
1911
1912         * UIProcess/WebPageProxy.cpp:
1913         (WebKit::WebPageProxy::installActivityStateChangeCompletionHandler):
1914
1915         Move the implementation of installActivityStateChangeCompletionHandler into cross-platform code.
1916
1917         * UIProcess/WebPageProxy.h:
1918         * UIProcess/ios/WKContentView.mm:
1919         * UIProcess/ios/WKContentViewInteraction.mm:
1920         (-[WKContentView cleanupInteraction]):
1921         (-[WKContentView _cancelPreviousResetInputViewDeferralRequest]):
1922         (-[WKContentView _scheduleResetInputViewDeferralAfterBecomingFirstResponder]):
1923         (-[WKContentView _resetInputViewDeferral]):
1924         (-[WKContentView becomeFirstResponderForWebView]):
1925         (-[WKContentView resignFirstResponderForWebView]):
1926         (-[WKContentView _commitPotentialTapFailed]):
1927         (-[WKContentView _didNotHandleTapAsClick:]):
1928         (-[WKContentView _didCompleteSyntheticClick]):
1929
1930         Funnel all existing calls that reset _inputViewDeferralToken to nullptr, such that they go through a helper
1931         method instead that also cancels any scheduled requests to clear the token.
1932
1933         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1934         (WebKit::RemoteLayerTreeDrawingArea::activityStateDidChange):
1935
1936         Respond to all pending callbacks after handling the activity state change.
1937
1938 2019-02-20  Chris Dumez  <cdumez@apple.com>
1939
1940         Regression(PSON) "Reload without content extensions" does not work when the main resource is blocked
1941         https://bugs.webkit.org/show_bug.cgi?id=194872
1942         <rdar://problem/47924500>
1943
1944         Reviewed by Alex Christensen.
1945
1946         [WKWebView _reloadWithoutContentBlockers] relies on a ReloadOption flag that is passed to WebCore
1947         instead of using WebsitePolicies.contentBlockersEnabled flag. If the reload causes a process swap
1948         due to PSON, then the new process does not know about this ReloadOption and fails to honor it.
1949
1950         Since the modern way to do this is WebsitePolicies, and since WebsitePolicies are properly
1951         propagated cross-process in case of process swap, this patch updates _reloadWithoutContentBlockers
1952         to set a flag on the Navigation which we use to later set the WebsitePolicies.contentBlockersEnabled
1953         flag in WebPageProxy::receivedNavigationPolicyDecision().
1954
1955         * UIProcess/API/APINavigation.h:
1956         (API::Navigation::setUserContentExtensionsEnabled):
1957         (API::Navigation::userContentExtensionsEnabled const):
1958         * UIProcess/WebPageProxy.cpp:
1959         (WebKit::WebPageProxy::reload):
1960         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1961
1962 2019-02-20  Truitt Savell  <tsavell@apple.com>
1963
1964         Unreviewed, rolling out r241817.
1965
1966         Caused 4 API failures
1967
1968         Reverted changeset:
1969
1970         "[GTK] Epiphany searching for plugins even if plugins are
1971         disabled"
1972         https://bugs.webkit.org/show_bug.cgi?id=194352
1973         https://trac.webkit.org/changeset/241817
1974
1975 2019-02-20  Andy Estes  <aestes@apple.com>
1976
1977         [Xcode] Add SDKVariant.xcconfig to various Xcode projects
1978         https://bugs.webkit.org/show_bug.cgi?id=194869
1979
1980         Rubber-stamped by Jer Noble.
1981
1982         * WebKit.xcodeproj/project.pbxproj:
1983
1984 2019-02-20  Alex Christensen  <achristensen@webkit.org>
1985
1986         Resolve WebsiteDataStore/HTTPCookieStore ref cycle
1987         https://bugs.webkit.org/show_bug.cgi?id=194868
1988
1989         Reviewed by Geoffrey Garen.
1990
1991         * UIProcess/API/APIHTTPCookieStore.cpp:
1992         (API::HTTPCookieStore::HTTPCookieStore):
1993         (API::HTTPCookieStore::cookies):
1994         (API::HTTPCookieStore::setCookie):
1995         (API::HTTPCookieStore::deleteCookie):
1996         (API::HTTPCookieStore::registerObserver):
1997         (API::HTTPCookieStore::unregisterObserver):
1998         (API::HTTPCookieStore::cookieManagerDestroyed):
1999         (API::HTTPCookieStore::registerForNewProcessPoolNotifications):
2000         (API::HTTPCookieStore::ref const):
2001         (API::HTTPCookieStore::deref const):
2002         * UIProcess/API/APIHTTPCookieStore.h:
2003
2004 2019-02-20  Per Arne Vollan  <pvollan@apple.com>
2005
2006         [iOS] Open sandbox for specific call.
2007         https://bugs.webkit.org/show_bug.cgi?id=194860
2008         <rdar://problem/48166729>
2009
2010         Reviewed by Brent Fulgham.
2011
2012         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2013
2014 2019-02-20  Alex Christensen  <achristensen@webkit.org>
2015
2016         Move API::HTTPCookieStore ownership from API::WebsiteDataStore to WebKit::WebsiteDataStore
2017         https://bugs.webkit.org/show_bug.cgi?id=194842
2018
2019         Reviewed by Geoff Garen.
2020
2021         We need a way to get from WebKit::WebsiteDataStore to API::HTTPCookieStore.  It can't be done before this.
2022         This made an existing reference cycle easier to see, and we should fix it in a followup patch.
2023
2024         * UIProcess/API/APIWebsiteDataStore.cpp:
2025         (API::WebsiteDataStore::httpCookieStore):
2026         * UIProcess/API/APIWebsiteDataStore.h:
2027         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2028         (WebKit::WebsiteDataStore::cookieStore):
2029         * UIProcess/WebsiteData/WebsiteDataStore.h:
2030
2031 2019-02-20  Chris Dumez  <cdumez@apple.com>
2032
2033         Regression(PSON) Crash under WebKit::WebPageProxy::decidePolicyForNavigationActionSync
2034         https://bugs.webkit.org/show_bug.cgi?id=194857
2035         <rdar://problem/47759323>
2036
2037         Reviewed by Alex Christensen.
2038
2039         The ProvisionalPageProxy was blindly forwarding the DecidePolicyForNavigationActionSync
2040         synchronous IPC to the WebPageProxy, without passing it the process the IPC came from.
2041         As a result, WebPageProxy::decidePolicyForNavigationActionSync() would try to look up
2042         a WebFrameProxy using the provided frameID from the wrong process and we would end up
2043         hitting a RELEASE_ASSERT().
2044
2045         * UIProcess/ProvisionalPageProxy.cpp:
2046         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync):
2047         (WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
2048         * UIProcess/ProvisionalPageProxy.h:
2049         * UIProcess/WebPageProxy.cpp:
2050         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
2051         (WebKit::WebPageProxy::decidePolicyForNavigationActionSyncShared):
2052         * UIProcess/WebPageProxy.h:
2053
2054 2019-02-20  Don Olmstead  <don.olmstead@sony.com>
2055
2056         [MSVC] Fix compilation errors with lambdas in Service Workers
2057         https://bugs.webkit.org/show_bug.cgi?id=194841
2058
2059         Reviewed by Alex Christensen.
2060
2061         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2062         (WebKit::ServiceWorkerClientFetch::didReceiveRedirectResponse):
2063
2064 2019-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2065
2066         [GTK] Epiphany searching for plugins even if plugins are disabled
2067         https://bugs.webkit.org/show_bug.cgi?id=194352
2068
2069         Reviewed by Michael Catanzaro.
2070
2071         Check pluginsEnabled setting before trying to get plugins from UI process.
2072
2073         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
2074         (WebKit::WebPluginInfoProvider::populatePluginCache):
2075
2076 2019-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2077
2078         [WPE] Send client host fd and library name as web process creation parameters
2079         https://bugs.webkit.org/show_bug.cgi?id=194494
2080
2081         Reviewed by Žan Doberšek.
2082
2083         Instead of using command line arguments. The code is simpler and we don't need wpe specific code in process
2084         launcher glib implementation.
2085
2086         * Shared/WebProcessCreationParameters.cpp:
2087         (WebKit::WebProcessCreationParameters::encode const):
2088         (WebKit::WebProcessCreationParameters::decode):
2089         * Shared/WebProcessCreationParameters.h:
2090         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2091         (WebKit::ProcessLauncher::launchProcess):
2092         * UIProcess/glib/WebProcessPoolGLib.cpp:
2093         (WebKit::WebProcessPool::platformInitializeWebProcess):
2094         * WebProcess/glib/WebProcessGLib.cpp:
2095         (WebKit::WebProcess::platformInitializeWebProcess):
2096         * WebProcess/wpe/WebProcessMainWPE.cpp:
2097
2098 2019-02-20  Adrian Perez de Castro  <aperez@igalia.com>
2099
2100         [WPE][GTK] Enable support for CONTENT_EXTENSIONS
2101         https://bugs.webkit.org/show_bug.cgi?id=167941
2102
2103         Reviewed by Carlos Garcia Campos.
2104
2105         Adds new API to manage a collection of content extensions on disk (including compilation
2106         of new ones) using WebKitUserContentFilterStore; the associated WebKitUserContentFilter
2107         type (which represents a compiled content extension); and the functions needed to enable
2108         and disable them for a given WebKitUserContentManager.
2109
2110         The WebKitUserContentFilterStore public API is expressed in abstract terms of "saving"
2111         filters into the store (which involves compiling the JSON source rule set); and "loading"
2112         them back as main operations. This way we do not disclose to users of the API any detail
2113         about compilation, nor how contents are laid out on disk, and the documentation explicitly
2114         tells about only using the provided functions to manipulate the on-disk contents. This
2115         way we allow ourselves some leeway if the implementation needs changing in the future.
2116
2117         * PlatformGTK.cmake: Added WebKitUserContentFilterStore.h to the list of public API headers.
2118         * PlatformWPE.cmake: Ditto.
2119         * SourcesGTK.txt: Added WebKitUserContentFilterStore.cpp
2120         * SourcesWPE.txt: Ditto.
2121         * UIProcess/API/glib/WebKitError.cpp: Add definition of webkit_user_content_filter_error_quark().
2122         * UIProcess/API/glib/WebKitUserContent.cpp: Added WebKitUserContentFilter.
2123         (_WebKitUserContentFilter::_WebKitUserContentFilter):
2124         (webkit_user_content_filter_ref):
2125         (webkit_user_content_filter_unref):
2126         (webkit_user_content_filter_get_identifier):
2127         (webkitUserContentFilterCreate):
2128         (webkitUserContentFilterGetContentRuleList):
2129         * UIProcess/API/glib/WebKitUserContentFilterStore.cpp: Added.
2130         (toGError): Utility function to convert content extension error codes to GError.
2131         (webkit_user_content_filter_store_class_init):
2132         (webkit_user_content_filter_store_new):
2133         (webkit_user_content_filter_store_get_path):
2134         (webkitUserContentFilterStoreSaveBytes): Common function used as final step for all the
2135         functions which save (compile) JSON rule sets into the store, to avoid duplicating code.
2136         (webkit_user_content_filter_store_save):
2137         (webkit_user_content_filter_store_save_finish):
2138         (webkit_user_content_filter_store_save_from_file):
2139         (webkit_user_content_filter_store_save_from_file_finish):
2140         (webkit_user_content_filter_store_remove):
2141         (webkit_user_content_filter_store_remove_finish):
2142         (webkit_user_content_filter_store_load):
2143         (webkit_user_content_filter_store_lookup_finish):
2144         (webkit_user_content_filter_store_fetch_identifiers):
2145         (webkit_user_content_filter_store_fetch_identifiers_finish):
2146         * UIProcess/API/glib/WebKitUserContentManager.cpp: Added definitions for the new API
2147         functions to add and remove filters from an user content manager.
2148         (webkit_user_content_manager_add_filter):
2149         (webkit_user_content_manager_remove_filter):
2150         (webkit_user_content_manager_remove_all_filters):
2151         * UIProcess/API/glib/WebKitUserContentPrivate.h: Added declarations for
2152         webkitUserContentFilterCreate() and webkitUserContentFilterGetContentRuleList().
2153         * UIProcess/API/gtk/WebKitAutocleanups.h: Added autocleanups for WebKitUserContentFilter
2154         and WebKitUserContentFilterStore.
2155         * UIProcess/API/gtk/WebKitError.h: Added declarations for WEBKIT_USER_CONTENT_FILTER_ERROR
2156         plus the associated webkit_user_content_filter_error_quark() function and
2157         WebKitUserContentFilterErrror enum.
2158         * UIProcess/API/gtk/WebKitUserContent.h: Added declarations for WebKitUserContentFilter
2159         and its associated functions.
2160         * UIProcess/API/gtk/WebKitUserContentFilterStore.h: Added.
2161         * UIProcess/API/gtk/WebKitUserContentManager.h: Added declarations for the functions to
2162         add and remove filters from the user content manager.
2163         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Added new API functions and types to
2164         be included in the documentation.
2165         * UIProcess/API/gtk/webkit2.h: Added inclusion of WebKitUserContentFilterStore.h
2166         * UIProcess/API/wpe/WebKitError.h: Same as for the GTK port header.
2167         * UIProcess/API/wpe/WebKitUserContent.h: Same as for the GTK port header.
2168         * UIProcess/API/wpe/WebKitUserContentFilterStore.h: Added.
2169         * UIProcess/API/wpe/WebKitUserContentManager.h: Same as for the GTK port header.
2170         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt: Added new API functions and types to be
2171         included in the documentation.
2172         * UIProcess/API/wpe/webkit.h: Added inclusion of WebKitUserContentFilterStore.h
2173
2174 2019-02-19  Antti Koivisto  <antti@apple.com>
2175
2176         Pass rootContentsLayer to Mac remote layer tree
2177         https://bugs.webkit.org/show_bug.cgi?id=194828
2178
2179         Reviewed by Simon Fraser.
2180
2181         Make this code path work again.
2182
2183         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2184         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
2185         (ArgumentCoder<ScrollingStateFrameScrollingNode>::decode):
2186         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2187         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2188
2189 2019-02-19  Alex Christensen  <achristensen@webkit.org>
2190
2191         Reduce use of LegacySync IPC messages
2192         https://bugs.webkit.org/show_bug.cgi?id=194783
2193
2194         Reviewed by Geoffrey Garen.
2195
2196         * UIProcess/WebProcessPool.cpp:
2197         (WebKit::WebProcessPool::handleSynchronousMessage):
2198         * UIProcess/WebProcessPool.h:
2199         * UIProcess/WebProcessPool.messages.in:
2200         * UIProcess/WebProcessProxy.cpp:
2201         (WebKit::WebProcessProxy::getPlugins):
2202         (WebKit::WebProcessProxy::shouldTerminate):
2203         * UIProcess/WebProcessProxy.h:
2204         * UIProcess/WebProcessProxy.messages.in:
2205         * WebProcess/Plugins/PluginProcessConnection.cpp:
2206         (WebKit::PluginProcessConnection::setException):
2207         * WebProcess/Plugins/PluginProcessConnection.h:
2208         * WebProcess/Plugins/PluginProcessConnection.messages.in:
2209         * WebProcess/Plugins/PluginProxy.cpp:
2210         (WebKit::PluginProxy::didCreatePlugin):
2211         (WebKit::PluginProxy::didFailToCreatePlugin):
2212         (WebKit::PluginProxy::proxiesForURL):
2213         (WebKit::PluginProxy::cookiesForURL):
2214         (WebKit::PluginProxy::getAuthenticationInfo):
2215         (WebKit::PluginProxy::getPluginElementNPObject):
2216         (WebKit::PluginProxy::evaluate):
2217         (WebKit::PluginProxy::createPluginContainer):
2218         * WebProcess/Plugins/PluginProxy.h:
2219         * WebProcess/Plugins/PluginProxy.messages.in:
2220
2221 2019-02-19  Alex Christensen  <achristensen@webkit.org>
2222
2223         Remove assertion introduced in r229683
2224         https://bugs.webkit.org/show_bug.cgi?id=194825
2225         <rdar://problem/47628258>
2226
2227         Reviewed by Geoffrey Garen.
2228
2229         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2230         (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
2231         If we reach this code and the form's original Document's Frame has been destroyed,
2232         we have already been told to submit the form so do so, just like we do if the WebPage
2233         has been destroyed.  This is a rare edge case having to do with the timing of Frame
2234         destruction and decidePolicyForNavigationAction response, which unfortunately does not
2235         reproduce with a test case unless the timing of IPC is just right.
2236
2237 2019-02-19  Antoine Quint  <graouts@apple.com>
2238
2239         [iOS] "touch-action: none" should not prevent text selection or tapping on a link
2240         https://bugs.webkit.org/show_bug.cgi?id=194812
2241         <rdar://problem/47901131>
2242
2243         Reviewed by Dean Jackson.
2244
2245         We shouldn't prevent all gestures to be disabled when "touch-action: none" is set and instead follow the same code path we would use should
2246         "pan-x", "pan-y" or "pinch-zoom" be used.
2247
2248         * UIProcess/ios/WKContentViewInteraction.mm:
2249         (-[WKContentView _handleTouchActionsForTouchEvent:]):
2250
2251 2019-02-18  Alex Christensen  <achristensen@webkit.org>
2252
2253         Revert functional part of r241451
2254         https://bugs.webkit.org/show_bug.cgi?id=194510
2255
2256         * UIProcess/WebPageProxy.cpp:
2257         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
2258         It caused crashes and assertions on Linux and Cocoa without safe browsing, which
2259         means it's fundamentally flawed in some way.  The testing piping was fine.
2260
2261 2019-02-18  Chris Dumez  <cdumez@apple.com>
2262
2263         REGRESSION (PSON): Can't access optumbank.com from myuhc.com
2264         https://bugs.webkit.org/show_bug.cgi?id=194797
2265         <rdar://problem/48055151>
2266
2267         Reviewed by Geoffrey Garen.
2268
2269         The issue was caused by us mistakenly process-swapping for a same-site server side redirect.
2270         The reason we were getting it wrong is because the logic in
2271         WebProcessPool::processForNavigationInternal() was expecting page.process() to be the source
2272         process and page.pageLoadState().url() to be the source URL. Those assumptions are incorrect
2273         when a server-side redirect occurs in a provisional process. In such case, the source process
2274         is the ProvisionalPageProxy's process and the source URL is the provisional URL, not the
2275         committed one.
2276
2277         * UIProcess/ProvisionalPageProxy.cpp:
2278         (WebKit::ProvisionalPageProxy::didPerformServerRedirect):
2279         (WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
2280         (WebKit::ProvisionalPageProxy::didReceiveMessage):
2281         * UIProcess/ProvisionalPageProxy.h:
2282         Make sure the provisional page forwards IPC related to server-side redirects to the page so
2283         that the client gets informed.
2284
2285         * UIProcess/WebPageProxy.cpp:
2286         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2287         (WebKit::WebPageProxy::didPerformServerRedirect):
2288         (WebKit::WebPageProxy::didPerformServerRedirectShared):
2289         * UIProcess/WebPageProxy.h:
2290         * UIProcess/WebProcessPool.cpp:
2291         (WebKit::WebProcessPool::processForNavigation):
2292         (WebKit::WebProcessPool::processForNavigationInternal):
2293         * UIProcess/WebProcessPool.h:
2294
2295 2019-02-16  Darin Adler  <darin@apple.com>
2296
2297         Continue reducing use of String::format, now focusing on hex: "%p", "%x", etc.
2298         https://bugs.webkit.org/show_bug.cgi?id=194752
2299
2300         Reviewed by Daniel Bates.
2301
2302         * Platform/IPC/win/ConnectionWin.cpp:
2303         (IPC::Connection::createServerAndClientIdentifiers): Use makeString instead of
2304         String::format.
2305         * Shared/win/WebEventFactory.cpp:
2306         (WebKit::keyIdentifierFromEvent): Ditto.
2307
2308         * UIProcess/API/APINavigation.cpp:
2309         (API::Navigation::loggingString const): Use hex instead of String::format.
2310         * UIProcess/SuspendedPageProxy.cpp:
2311         (WebKit::SuspendedPageProxy::loggingString const): Ditto.
2312
2313         * UIProcess/WebBackForwardList.cpp:
2314         (WebKit::WebBackForwardList::loggingString): Added a "0x".
2315
2316         * UIProcess/gtk/InputMethodFilter.cpp:
2317         (WebKit::InputMethodFilter::logHandleKeyboardEventForTesting): Use makeString and hex
2318         instead of String::format and "%x".
2319         (WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting):
2320         Ditto.
2321
2322 2019-02-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2323
2324         [iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements
2325         https://bugs.webkit.org/show_bug.cgi?id=194670
2326         <rdar://problem/39066529>
2327
2328         Reviewed by Tim Horton.
2329
2330         Remove all IPC plumbing for getTypesByFidelityForItemAtIndex, now that the types in fidelity order have been
2331         rolled into PasteboardItemInfo.
2332
2333         Additionally, remove support for subresource URL replacement. This feature was originally added with the
2334         intention that private clients (i.e. Mail) would intercept pasted or dropped images and replace their URLs.
2335         However, since <rdar://problem/43216836>, our strategy for this scenario has changed, such that WebKit now
2336         handles the drop/paste, and later delivers the image data to the client via NSFileWrappers in the UI process.
2337         At this time, there are no adopters of this SPI, and no adopters of the V2 injected bundle editing client. As
2338         such, we can simply revert all of this to its state prior to the introduction of the replacement URL SPI, with
2339         the exception to changes in WKBundlePageEditorClient.h, wherein there is a nonzero (but likely tiny) chance of
2340         completely breaking binary compatability with any third parties on macOS which may have tried to adopt
2341         subresource URL replacement.
2342
2343         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
2344         (WebKit::WebPasteboardProxy::getPasteboardTypesByFidelityForItemAtIndex): Deleted.
2345         * UIProcess/WebPasteboardProxy.h:
2346         * UIProcess/WebPasteboardProxy.messages.in:
2347         * UIProcess/ios/WKContentViewInteraction.mm:
2348         (-[WKContentView canPerformActionForWebView:withSender:]):
2349
2350         Return YES for -paste: in the case where:
2351         1. The pasteboard contains items that are explicitly marked as attachments.
2352         2. The selection is richly contenteditable.
2353         3. Attachment elements are enabled.
2354
2355         Among other things, this allows the callout bar on iOS to show the "Paste" action.
2356
2357         * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h:
2358         (API::InjectedBundle::EditorClient::performTwoStepDrop):
2359         (API::InjectedBundle::EditorClient::replacementURLForResource): Deleted.
2360         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h:
2361         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2362         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]):
2363         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
2364         (WebKit::InjectedBundlePageEditorClient::replacementURLForResource): Deleted.
2365         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h:
2366         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
2367         (WebKit::WebEditorClient::replacementURLForResource): Deleted.
2368         * WebProcess/WebCoreSupport/WebEditorClient.h:
2369         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2370         (WebKit::WebPlatformStrategies::getTypesByFidelityForItemAtIndex): Deleted.
2371         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
2372
2373 2019-02-18  Jeremy Jones  <jeremyj@apple.com>
2374
2375         exitFullscreen should not instantiate a new model/interface mapping.
2376         https://bugs.webkit.org/show_bug.cgi?id=191988
2377         rdar://problem/42327939
2378
2379         Reviewed by Jer Noble.
2380
2381         This change is a speculative fix for a crash that cannot be reproduced.
2382
2383         Somehow, exitFullscreen is being requested after didCleanupFullscreen has completed.
2384         This change should allow us to prevent the crash in release, and assert in debug.
2385
2386         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2387         (WebKit::VideoFullscreenManagerProxy::exitFullscreen):
2388
2389 2019-02-18  John Wilander  <wilander@apple.com>
2390
2391         Check the existence of the frame in Document::hasFrameSpecificStorageAccess() and Document::setHasFrameSpecificStorageAccess()
2392         https://bugs.webkit.org/show_bug.cgi?id=194777
2393         <rdar://problem/47731945>
2394
2395         Reviewed by Geoffrey Garen and Chris Dumez.
2396
2397         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2398         (WebKit::NetworkConnectionToWebProcess::logUserInteraction):
2399            Now returns early if the incoming session ID is invalid.
2400            Added an ASSERT to help us find other call sites passing invalid session IDs.
2401
2402 2019-02-18  Per Arne Vollan  <pvollan@apple.com>
2403
2404         It should be possible to get the mouse event modifiers for a page overlay client.
2405         https://bugs.webkit.org/show_bug.cgi?id=189621
2406         <rdar://problem/44437279>
2407
2408         Reviewed by Daniel Bates.
2409
2410         When access to the WindowServer is blocked, [NSEvent modifierFlags] always returns 0.
2411         This can be fixed by swizzling the class method, and getting the cached modifiers from
2412         PlatformKeyboardEvent.
2413  
2414         * WebProcess/cocoa/WebProcessCocoa.mm:
2415         (WebKit::currentModifierFlags):
2416         (WebKit::WebProcess::platformInitializeProcess):
2417
2418 2019-02-18  Claudio Saavedra  <csaavedra@igalia.com>
2419
2420         WebPageProxy::didFinishDocumentLoadForFrame() crashing in WPE and GTK+ ports
2421         https://bugs.webkit.org/show_bug.cgi?id=194774
2422
2423         Reviewed by Alex Christensen.
2424
2425         * UIProcess/WebPageProxy.cpp:
2426         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
2427         Null check navigation before using it.
2428         This is a regression from r241451.
2429
2430 2019-02-18  Daniel Bates  <dabates@apple.com>
2431
2432         [iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content-editable element
2433         https://bugs.webkit.org/show_bug.cgi?id=192824
2434         <rdar://problem/47100332>
2435
2436         Reviewed by Wenson Hsieh.
2437
2438         Use the same code path for key events to editable elements and non-editable elements.
2439
2440         Currently we have different code paths for hardware key events depending on whether the active element
2441         is editable or non-editable. Historically to support dispatching DOM keyboard events for hardware key
2442         presses this differentiation was a necessary workaround for UIKit's event processing precedence of
2443         interpreting key events for system text editing commands and app commands before dispatching unhandled
2444         key events to WebKit. This workaround intercepted raw key UIEvents and manually reconstructed a
2445         WebEvent from it. However there is not enough information in an UIEvent to reconstruct a WebEvent that
2446         is identical to the WebEvent that UIKit would have dispatched. In particular, keyup UIEvents always have
2447         empty modified and unmodified input strings. The UIKit keyboard machinery maintains additional state
2448         that is necessary to manufacture the correct WebEvent corresponding to a UIEvent.
2449
2450         As a side benefit of this change, with the exception of modifier flag changes, both hardware and software
2451         key events use the same code path.
2452
2453         * UIProcess/ios/WKContentViewInteraction.h:
2454         * UIProcess/ios/WKContentViewInteraction.mm:
2455         (-[WKContentView shouldShowAutomaticKeyboardUI]): Extracted code from _requiresKeyboardWhenFirstResponder
2456         (-[WKContentView _disableAutomaticKeyboardUI]): Implement UIKit SPI to prevent showing the keyboard UI
2457         when there is no focused element now that we are no longer intercepting key UIEvents. Formerly the
2458         keyboard UI was disabled as a side effect of not becoming first responder when there was no focused
2459         element (by returning NO in -_requiresKeyboardWhenFirstResponder).
2460         (-[WKContentView _requiresKeyboardWhenFirstResponder]): Always return YES when building with USE(UIKIT_KEYBOARD_ADDITIONS)
2461         so that we always accept key events. Instead of selectively replying to create a keyboard as a means of
2462         hiding the automatic keyboard UI we now implement _disableAutomaticKeyboardUI to selectively hide the
2463         automatic keyboard UI.
2464         (-[WKContentView applyAutocorrection:toString:withCompletionHandler:]): If we are not in an editable
2465         element then we cannot perform the replacement. This logic was necessary now that we always require a
2466         keyboard.
2467         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]): If we are not in an editable
2468         element then return an autocorrection object that indicates that we could not compute this data. This
2469         logic was necessary now that we always require a keyboard.
2470         (-[WKContentView textInputTraits]): Do not update traits when the keyboard is going to be dismissed
2471         now that we require a keyboard when first responder even if the focused element is non-editable.
2472         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): Skip logic for re-sending UIEvents to UIKit
2473         as UIKit now processes the event first. This logic was necessary in order to finally allow UIKit
2474         its chance to interpret the UIEvent, we intercepted, for app key commands.
2475         (-[WKContentView _elementDidBlur]): Call [self _endEditing] so that we dismiss any open form controls
2476         (e.g. a <select> popover menu). Currently this happens either by -_requiresKeyboardWhenFirstResponder
2477         responding NO when switching to another field or pressing Tab or Shift + Tab key command, which we will
2478         no longer use when building with USE(UIKIT_KEYBOARD_ADDITIONS) once I land <https://bugs.webkit.org/show_bug.cgi?id=193048>.
2479         * UIProcess/ios/forms/WKFormSelectPopover.mm:
2480         (-[WKSelectPopover initWithView:hasGroups:]): Do not assign ourself as the keyboard delegate. Otherwise,
2481         type ahead and tab cycling will not work. Currently type ahead and tab cycling work by using the non-
2482         editable code path via -_handleKeyUIEvent. Now that we no longer differentiate between key events for
2483         editable and non-editable elements we need to ensure that the WKContentView is the keyboard delegate
2484         when the popover is presented.
2485
2486 2019-02-18  Jiewen Tan  <jiewen_tan@apple.com>
2487
2488         Tell Networking Process to not optimize load
2489         https://bugs.webkit.org/show_bug.cgi?id=194753
2490         <rdar://problem/48143603>
2491
2492         Reviewed by Brent Fulgham.
2493
2494         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2495         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2496
2497 2019-02-18  Dean Jackson  <dino@apple.com>
2498
2499         iOS Safari will not load USDZ in QLPreview when opening as BLOB
2500         https://bugs.webkit.org/show_bug.cgi?id=194766
2501         <rdar://problem/42769186>
2502
2503         Reviewed by Wenson Hsieh.
2504
2505         A download from a Blob URL can happen effectively instantly, which means
2506         that the loadHandler on the registerItemForTypeIdentifier method might not have
2507         been called yet, and we haven't been told what the completionHandler is.
2508         In this case, keep a record of the URL we finished with, and call the completionHandler
2509         right away.
2510
2511         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Add a new private member variable: _downloadedURL.
2512         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]): Call the completionHandler
2513         right away if we've finished.
2514         (-[_WKPreviewControllerDataSource finish:]): Remember that we've finished by recording the URL.
2515
2516 2019-02-18  Alex Christensen  <achristensen@webkit.org>
2517
2518         Disable safe browsing in WKWebView and remove its WKPreferences API
2519         https://bugs.webkit.org/show_bug.cgi?id=194723
2520         <rdar://problem/48122993>
2521
2522         Reviewed by Geoffrey Garen.
2523
2524         * Shared/WebPreferences.yaml:
2525         * UIProcess/API/Cocoa/WKPreferences.h:
2526         * UIProcess/API/Cocoa/WKPreferences.mm:
2527         (-[WKPreferences setSafeBrowsingEnabled:]): Deleted.
2528         (-[WKPreferences isSafeBrowsingEnabled]): Deleted.
2529
2530 2019-02-18  Chris Fleizach  <cfleizach@apple.com>
2531
2532         AX: PSON: Going back from apple.com to search results, cannot interact with HTML content. Disabling Swap Processes on Cross-Site Navigation resolves the issue.
2533         https://bugs.webkit.org/show_bug.cgi?id=194742
2534
2535         Reviewed by Chris Dumez.
2536
2537         Re-initialize the accessibility web process tokens when swapping processes.
2538         Send page load notifications from the UIProcess instead of the WebProcess to improve reliability.
2539
2540         * UIProcess/mac/PageClientImplMac.mm:
2541         (WebKit::PageClientImpl::didFinishLoadForMainFrame):
2542         (WebKit::PageClientImpl::didFailLoadForMainFrame):
2543         * WebProcess/WebPage/WebPage.cpp:
2544         (WebKit::WebPage::reinitializeWebPage):
2545         * WebProcess/WebPage/WebPage.h:
2546         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2547         (WebKit::WebPage::platformReinitialize):
2548         (WebKit::WebPage::platformDetach): Deleted.
2549         (WebKit::WebPage::platformEditorState const): Deleted.
2550         (WebKit::WebPage::updateAccessibilityTree): Deleted.
2551         (WebKit::WebPage::performDefaultBehaviorForKeyEvent): Deleted.
2552         (WebKit::WebPage::platformCanHandleRequest): Deleted.
2553         (WebKit::WebPage::platformUserAgent const): Deleted.
2554         (WebKit::WebPage::getCenterForZoomGesture): Deleted.
2555         (WebKit::WebPage::setInputMethodState): Deleted.
2556         (WebKit::WebPage::collapseSelectionInFrame): Deleted.
2557         * WebProcess/WebPage/ios/WebPageIOS.mm:
2558         (WebKit::WebPage::platformReinitialize):
2559         * WebProcess/WebPage/mac/WebPageMac.mm:
2560         (WebKit::WebPage::platformReinitialize):
2561         * WebProcess/WebPage/win/WebPageWin.cpp:
2562         (WebKit::WebPage::platformReinitialize):
2563         * WebProcess/WebPage/wpe/WebPageWPE.cpp:
2564         (WebKit::WebPage::platformReinitialize):
2565
2566 2019-02-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2567
2568         [GTK] Crash while filling selection data during drag and drop
2569         https://bugs.webkit.org/show_bug.cgi?id=194698
2570
2571         Reviewed by Michael Catanzaro.
2572
2573         I can't reproduce this, but it seems that m_draggingSelectionData is nullptr in fillDragData(). That can happen
2574         when startDrag cancels a previous DND operation, because the new m_draggingSelectionData is set before the
2575         current DND operation is cancelled, which sets it to nullptr.
2576
2577         * UIProcess/gtk/DragAndDropHandler.cpp:
2578         (WebKit::DragAndDropHandler::startDrag): Finish the previous operation before setting m_draggingSelectionData.
2579
2580 2019-02-17  Youenn Fablet  <youenn@apple.com>
2581
2582         https://device.login.microsoftonline.com is hanging on STP75
2583         https://bugs.webkit.org/show_bug.cgi?id=194734
2584         <rdar://problem/47573830>
2585
2586         Reviewed by Jiewen Tan.
2587
2588         Make sure to only go the XPC route if SecKeyProxyStore has credentials.
2589         Tested manually by going to the above website with and without the patch.
2590         Load hangs without the patch and completes with the patch.
2591
2592         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
2593         (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
2594         * UIProcess/Authentication/cocoa/SecKeyProxyStore.h:
2595         * UIProcess/Authentication/cocoa/SecKeyProxyStore.mm:
2596         (WebKit::SecKeyProxyStore::initialize):
2597
2598 2019-02-17  David Kilzer  <ddkilzer@apple.com>
2599
2600         Unreviewed, rolling out r241620.
2601
2602         "Causes use-after-free crashes running layout tests with ASan and GuardMalloc."
2603         (Requested by ddkilzer on #webkit.)
2604
2605         Reverted changeset:
2606
2607         "[WTF] Add environment variable helpers"
2608         https://bugs.webkit.org/show_bug.cgi?id=192405
2609         https://trac.webkit.org/changeset/241620
2610
2611 2019-02-15  Youenn Fablet  <youenn@apple.com>
2612
2613         NetworkDataTask should check its client before calling shouldCaptureExtraNetworkLoadMetrics
2614         https://bugs.webkit.org/show_bug.cgi?id=194732
2615
2616         Reviewed by Geoffrey Garen.
2617
2618         NetworkDataTask may be kept alive if refing it after its NetworkLoad is gone.
2619         This might happen for instance in DownloadManager or when checking for TLS certificates.
2620         In that case, if the NetworkLoad gets destroyed, it clears the client of the NetworkDataTask.
2621         To ensure that NetworkDataTask does not try to use its client, add a null check.
2622
2623         * NetworkProcess/NetworkDataTask.cpp:
2624         (WebKit::NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics const):
2625
2626 2019-02-15  Chris Dumez  <cdumez@apple.com>
2627
2628         [PSON] Allow tweaking WebProcess cache parameters via user defaults
2629         https://bugs.webkit.org/show_bug.cgi?id=194731
2630         <rdar://problem/48125377>
2631
2632         Reviewed by Geoffrey Garen.
2633
2634         Allow tweaking WebProcess cache parameters via user defaults like so:
2635         $ defaults write com.apple.Safari WebProcessCacheCachedProcessLifetimeInSeconds 120
2636         -> Cached processes will be evicted after 2 minutes (instead of 30)
2637
2638         $ defaults write com.apple.Safari WebProcessCacheClearingDelayAfterApplicationResignsActiveInSeconds 60
2639         -> Web process cache will be cleared if Safari is no longer active for 1 minutes (instead of 5).
2640
2641         * SourcesCocoa.txt:
2642         * UIProcess/Cocoa/WebProcessCacheCocoa.mm: Copied from Source/WebKit/UIProcess/WebProcessCache.h.
2643         (WebKit::WebProcessCache::platformInitialize):
2644         * UIProcess/WebProcessCache.cpp:
2645         (WebKit::WebProcessCache::WebProcessCache):
2646         (WebKit::WebProcessCache::platformInitialize):
2647         * UIProcess/WebProcessCache.h:
2648         * WebKit.xcodeproj/project.pbxproj:
2649
2650 2019-02-15  Chris Dumez  <cdumez@apple.com>
2651
2652         [PSON] Disable WebContent process cache on devices with less than 3GB of RAM
2653         https://bugs.webkit.org/show_bug.cgi?id=194726
2654         <rdar://problem/48126255>
2655
2656         Reviewed by Geoffrey Garen.
2657
2658         * UIProcess/WebProcessCache.cpp:
2659         (WebKit::WebProcessCache::updateCapacity):
2660
2661 2019-02-15  Andy Estes  <aestes@apple.com>
2662
2663         [iOS] Stop setting a background color on the PDF host view
2664         https://bugs.webkit.org/show_bug.cgi?id=194722
2665         <rdar://48124152>
2666
2667         Reviewed by Wenson Hsieh.
2668
2669         PDFKit already sets a background color on this view, so there’s no need (and some harm) in
2670         us doing it too.
2671
2672         * UIProcess/ios/WKPDFView.mm:
2673         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
2674
2675 2019-02-15  Alex Christensen  <achristensen@webkit.org>
2676
2677         Update IPC code generator unit test expectations after r241611
2678         https://bugs.webkit.org/show_bug.cgi?id=194678
2679
2680         * Scripts/webkit/LegacyMessages-expected.h:
2681         * Scripts/webkit/Messages-expected.h:
2682         * Scripts/webkit/MessagesSuperclass-expected.h:
2683
2684 2019-02-15  Ross Kirsling  <ross.kirsling@sony.com>
2685
2686         [WTF] Add environment variable helpers
2687         https://bugs.webkit.org/show_bug.cgi?id=192405
2688
2689         Reviewed by Michael Catanzaro.
2690
2691         * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
2692         (main):
2693         * Platform/unix/LoggingUnix.cpp:
2694         (WebKit::logLevelString):
2695         * Platform/win/LoggingWin.cpp:
2696         (WebKit::logLevelString):
2697         * PluginProcess/mac/PluginProcessMac.mm:
2698         (WebKit::shouldCallRealDebugger):
2699         * Shared/Plugins/unix/PluginSearchPath.cpp:
2700         (WebKit::pluginsDirectories):
2701         * Shared/glib/ProcessExecutablePathGLib.cpp:
2702         (WebKit::findWebKitProcess):
2703         * UIProcess/API/glib/WebKitSettings.cpp:
2704         (webKitSettingsConstructed):
2705         (webKitSettingsSetProperty):
2706         * UIProcess/API/glib/WebKitWebContext.cpp:
2707         (injectedBundleDirectory):
2708         (webkitWebContextConstructed):
2709         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
2710         (webkitWebViewMaximizeWindow):
2711         (webkitWebViewRestoreWindow):
2712         * UIProcess/API/wpe/WPEView.cpp:
2713         (WKWPE::m_backend):
2714         * UIProcess/AuxiliaryProcessProxy.cpp:
2715         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
2716         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2717         (WebKit::XDGDBusProxyLauncher::launch):
2718         (WebKit::bindDBusSession):
2719         (WebKit::bindX11):
2720         (WebKit::bindWayland):
2721         (WebKit::bindPulse):
2722         (WebKit::bindPathVar):
2723         (WebKit::bindGStreamerData):
2724         (WebKit::bubblewrapSpawn):
2725         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2726         (WebKit::ProcessLauncher::launchProcess):
2727         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2728         (WebKit::systemDirectoryPath):
2729         (WebKit::ProcessLauncher::launchProcess):
2730         * UIProcess/glib/WebProcessPoolGLib.cpp:
2731         (WebKit::memoryPressureMonitorDisabled):
2732         (WebKit::WebProcessPool::platformInitialize):
2733         (WebKit::WebProcessPool::platformInitializeWebProcess):
2734         * UIProcess/gtk/HardwareAccelerationManager.cpp:
2735         (WebKit::HardwareAccelerationManager::HardwareAccelerationManager):
2736         * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
2737         (main):
2738         * WebProcess/gtk/WebProcessMainGtk.cpp:
2739         * WebProcess/wpe/WebProcessMainWPE.cpp:
2740         Utilize WTF::Environment where possible.
2741
2742 2019-02-15  Alex Christensen  <achristensen@webkit.org>
2743
2744         Add SPI version of WKPreferences.safeBrowsingEnabled
2745         https://bugs.webkit.org/show_bug.cgi?id=194718
2746         <rdar://problem/48122993>
2747
2748         Rubber-stamped by Brady Eidson.
2749
2750         * UIProcess/API/Cocoa/WKPreferences.mm:
2751         (-[WKPreferences _isSafeBrowsingEnabled]):
2752         (-[WKPreferences _setSafeBrowsingEnabled:]):
2753         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2754
2755 2019-02-15  Wenson Hsieh  <wenson_hsieh@apple.com>
2756
2757         [iOS] WKWebView callout bar is missing Change Writing Direction item
2758         https://bugs.webkit.org/show_bug.cgi?id=190015
2759         <rdar://problem/44810366>
2760
2761         Reviewed by Tim Horton.
2762
2763         Support -makeTextWritingDirectionLeftToRight: and -makeTextWritingDirectionRightToLeft: in WKWebView on iOS.
2764         To match behavior in native UITextViews on iOS, we implement these methods by changing the *base* writing
2765         direction, rather than the text writing direction (this is in contrast to macOS, which has different
2766         NSResponder methods for changing the base writing direction as opposed to the text writing direction).
2767
2768         Additionally fixes the implementation of -makeTextWritingDirectionNatural:, which currently attempts to change
2769         the text writing direction instead of the base writing direction.
2770
2771         * Platform/spi/ios/UIKitSPI.h:
2772
2773         Add a forward declaration for keyboards SPI to determine whether the user has an active RTL keyboard.
2774
2775         * Shared/EditorState.cpp:
2776         (WebKit::EditorState::PostLayoutData::encode const):
2777         (WebKit::EditorState::PostLayoutData::decode):
2778         (WebKit::operator<<):
2779         * Shared/EditorState.h:
2780
2781         Plumb the base writing direction to the UI process through EditorState.
2782
2783         * UIProcess/ios/WKContentViewInteraction.h:
2784         * UIProcess/ios/WKContentViewInteraction.mm:
2785         (-[WKContentView makeTextWritingDirectionNaturalForWebView:]):
2786         (-[WKContentView makeTextWritingDirectionLeftToRightForWebView:]):
2787         (-[WKContentView makeTextWritingDirectionRightToLeftForWebView:]):
2788
2789         Implement the new SPI (see above for more details).
2790
2791         (-[WKContentView canPerformActionForWebView:withSender:]):
2792
2793         Implement -canPerformAction: for LTR and RTL actions. To match existing UIWebView behavior, we only enable
2794         these actions if either the base writing direction is RTL, or the user has an active RTL keyboard. This means,
2795         for instance, that in the case where a user with only an English keyboard is editing LTR content, we would never
2796         show an option to convert to RTL.
2797
2798         * WebProcess/WebPage/WebPage.cpp:
2799         (WebKit::WebPage::editorState const):
2800
2801 2019-02-15  Alex Christensen  <achristensen@webkit.org>
2802
2803         Make WebPaymentCoordinatorProxy more robust and modern
2804         https://bugs.webkit.org/show_bug.cgi?id=194678
2805
2806         Reviewed by Andy Estes.
2807
2808         Use WeakPtr instead of storing raw pointers in lambdas or the global activePaymentCoordinatorProxy to avoid UAF problems.
2809         Call CompletionHandlers in all code paths to avoid hangs.
2810         Use Delayed instead of LegacySync for synchronous messaging to progress towards removing LegacySync messages.
2811
2812         * Scripts/webkit/messages.py:
2813         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
2814         (WebKit::activePaymentCoordinatorProxy):
2815         (WebKit::WebPaymentCoordinatorProxy::~WebPaymentCoordinatorProxy):
2816         (WebKit::WebPaymentCoordinatorProxy::availablePaymentNetworks):
2817         (WebKit::WebPaymentCoordinatorProxy::canMakePayments):
2818         (WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
2819         (WebKit::WebPaymentCoordinatorProxy::didReachFinalState):
2820         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
2821         * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
2822         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
2823         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
2824         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
2825         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
2826
2827 2019-02-15  Youenn Fablet  <youenn@apple.com>
2828
2829         Make ServiceWorkerClientFetch closer to WebResourceLoader
2830         https://bugs.webkit.org/show_bug.cgi?id=194651
2831
2832         Unreviewed, build fix for WPE.
2833
2834         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
2835
2836 2019-02-15  Chris Dumez  <cdumez@apple.com>
2837
2838         Regression(PSON) Navigating quickly back and forth can lead to getting 'about:blank' in the backforward list
2839         https://bugs.webkit.org/show_bug.cgi?id=194717
2840         <rdar://problem/47884404>
2841
2842         Reviewed by Brady Eidson.
2843
2844         When the client does a history navigation, the UIProcess sends a WebPage::GoToBackForwardItem IPC to the
2845         WebProcess and the WebProcess sends a WebPageProxy::BackForwardGoToItem IPC back to the UIProcess to
2846         update the current item in the BackForwardList. This means that there is a slight delay between the
2847         point a client requests a history navigation and the point where the BackForwardList's current item gets
2848         update. This delay is pre-existing behavior and not new to PSON.
2849
2850         However, with PSON enabled, if we decide to process-swap for the history navigation, we'll tell the
2851         previous (committed) process to ignore the load and we ask a new (provisional) process to do the history
2852         navigation. When the previous process receives the request to ignore the history navigation, it restores
2853         the History's current item to the one previous the navigation, which sends a WebPageProxy::GoToBackForwardItem
2854         IPC to the UIProcess to update the BackForwardList as well. In parallel, the new process starts the
2855         history navigation and also sends a WebPageProxy::GoToBackForwardItem to update the BackForwardList's
2856         current item as well. We end up with a race between the 2 GoToBackForwardItem IPC messages coming from
2857         the old and new process. If the old process's message loses the race, we end up with the wrong current
2858         history item getting set in the UIProcess. Later, when we commit the provisional load and try to suspend
2859         the previous page, we would save the SuspendedPage on the *wrong* BackForwardList item. If one tries to
2860         load this BackForwardList item later, we'll use its SuspendedPage and try to unsuspend it. However,
2861         because the PageCache entry is saved on another HistoryItem than the one getting loaded in the WebProcess
2862         side, we attempt to do a regular load instead of a PageCache restore. We end up failing the load because
2863         pages cannot trigger new loads while in page cache. Because the load fails, we end up loading the
2864         initial empty document and this is how we end up with 'about:blank' in the back forward list.
2865
2866         To address the issue, update WebPageProxy::backForwardGoToItem() to ignore messages from the old/committed
2867         WebProcess when there is a pending provisional load. If the committed processes starts a legit new
2868         load, it would clear any existing pending provisional load before attempting the call backForwardGoToItem().
2869         As a result, ignoring such messages from the old processes when there is a pending provisional load is
2870         safe.
2871
2872         In the future, we should probably move more of the history / backForwardList management to the UIProcess
2873         to avoid this sort of issues. This would be a much larger refactoring though so I am going with this
2874         simpler fix that is easily cherry-pickable for now.
2875
2876         * UIProcess/WebPageProxy.cpp:
2877         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
2878         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2879         (WebKit::WebPageProxy::backForwardGoToItem):
2880
2881 2019-02-15  Alex Christensen  <achristensen@webkit.org>
2882
2883         Update IPC code generator unit test expectations after r241595
2884         https://bugs.webkit.org/show_bug.cgi?id=194679
2885
2886         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
2887         (WebKit::WebPage::didReceiveSyncWebPageMessage):
2888         * Scripts/webkit/MessageReceiver-expected.cpp:
2889         (WebKit::WebPage::didReceiveSyncMessage):
2890
2891 2019-02-15  Youenn Fablet  <youenn@apple.com>
2892
2893         Make ServiceWorkerClientFetch closer to WebResourceLoader
2894         https://bugs.webkit.org/show_bug.cgi?id=194651
2895
2896         Reviewed by Alex Christensen.
2897
2898         The goal of this refactoring is to, at some point use the regular network process load path for service worker loads.
2899         This should simplify things and allow less IPC exchanges, for instance in the case of fetch not handled by service worker.
2900
2901         Introduce two IPC messages for supporting redirect responses and allow the didReceiveResponse/continueDidReceiveResponse
2902         handshake for navigation loads.
2903
2904         This makes ServiceWorker having to buffer load information for this particular case.
2905
2906         * NetworkProcess/NetworkProcess.cpp:
2907         (WebKit::NetworkProcess::didReceiveFetchRedirectResponse):
2908         (WebKit::NetworkProcess::didReceiveFetchResponse):
2909         * NetworkProcess/NetworkProcess.h:
2910         * NetworkProcess/NetworkProcess.messages.in:
2911         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
2912         (WebKit::WebSWServerConnection::continueDidReceiveFetchResponse):
2913         (WebKit::WebSWServerConnection::didReceiveFetchRedirectResponse):
2914         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
2915         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
2916         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
2917         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2918         (WebKit::ServiceWorkerClientFetch::start):
2919         (WebKit::ServiceWorkerClientFetch::didReceiveRedirectResponse):
2920         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
2921         (WebKit::ServiceWorkerClientFetch::didReceiveData):
2922         (WebKit::ServiceWorkerClientFetch::didFinish):
2923         (WebKit::ServiceWorkerClientFetch::didFail):
2924         (WebKit::ServiceWorkerClientFetch::didNotHandle):
2925         (WebKit::ServiceWorkerClientFetch::cancel):
2926         * WebProcess/Storage/ServiceWorkerClientFetch.h:
2927         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in:
2928         * WebProcess/Storage/WebSWClientConnection.cpp:
2929         (WebKit::WebSWClientConnection::startFetch):
2930         (WebKit::WebSWClientConnection::cancelFetch):
2931         (WebKit::WebSWClientConnection::continueDidReceiveFetchResponse):
2932         * WebProcess/Storage/WebSWClientConnection.h:
2933         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2934         (WebKit::WebSWContextManagerConnection::continueDidReceiveFetchResponse):
2935         (WebKit::WebSWContextManagerConnection::startFetch):
2936         * WebProcess/Storage/WebSWContextManagerConnection.h:
2937         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2938         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
2939         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
2940         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveRedirection):
2941         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
2942         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
2943         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish):
2944         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
2945         (WebKit::WebServiceWorkerFetchTaskClient::didFinish):
2946         (WebKit::WebServiceWorkerFetchTaskClient::continueDidReceiveResponse):
2947         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
2948
2949 2019-02-15  Brian Burg  <bburg@apple.com>
2950
2951         [Mac] WebInspectorUI.framework does not need to be soft-linked anymore
2952         https://bugs.webkit.org/show_bug.cgi?id=194411
2953         <rdar://problem/47787614>
2954
2955         Reviewed by Joseph Pecoraro.
2956
2957         * Configurations/WebKit.xcconfig:
2958         Conditionalize weak linking to WebInspectorUI.framework for Mac only.
2959
2960         * UIProcess/mac/WebInspectorProxyMac.mm:
2961         (WebKit::WebInspectorProxy::inspectorPageURL):
2962         (WebKit::WebInspectorProxy::inspectorTestPageURL):
2963         (WebKit::WebInspectorProxy::inspectorBaseURL):
2964         * WebProcess/WebPage/mac/WebInspectorUIMac.mm:
2965         (WebKit::webInspectorUILocalizedStringsURL):
2966         Rewrite uses of the bundle to exit early if bundle couldn't be loaded.
2967
2968 2019-02-15  Alex Christensen  <achristensen@webkit.org>
2969
2970         IPC code should support messages with both Delayed and WantsConnection attributes
2971         https://bugs.webkit.org/show_bug.cgi?id=194679
2972
2973         Reviewed by Geoffrey Garen.
2974
2975         * Platform/IPC/HandleMessage.h:
2976         (IPC::callMemberFunctionImpl):
2977         (IPC::callMemberFunction):
2978         (IPC::handleMessageDelayedWantsConnection):
2979         * Scripts/webkit/messages.py:
2980         * UIProcess/WebStorage/StorageManager.cpp:
2981         (WebKit::StorageManager::getValues):
2982         * UIProcess/WebStorage/StorageManager.h:
2983         * UIProcess/WebStorage/StorageManager.messages.in:
2984
2985 2019-02-15  Commit Queue  <commit-queue@webkit.org>
2986
2987         Unreviewed, rolling out r241559 and r241566.
2988         https://bugs.webkit.org/show_bug.cgi?id=194710
2989
2990         Causes layout test crashes under GuardMalloc (Requested by
2991         ryanhaddad on #webkit).
2992
2993         Reverted changesets:
2994
2995         "[WTF] Add environment variable helpers"
2996         https://bugs.webkit.org/show_bug.cgi?id=192405
2997         https://trac.webkit.org/changeset/241559
2998
2999         "Unreviewed build fix for WinCairo Debug after r241559."
3000         https://trac.webkit.org/changeset/241566
3001
3002 2019-02-15  Michael Catanzaro  <mcatanzaro@igalia.com>
3003
3004         [WPE][GTK] Defer sandboxing APIs to 2.26
3005         https://bugs.webkit.org/show_bug.cgi?id=194274
3006
3007         Reviewed by Carlos Garcia Campos.
3008
3009         The web process sandbox has not been widely-tested yet, so we should defer the new APIs to
3010         2.26.
3011
3012         * UIProcess/API/glib/WebKitWebContext.cpp:
3013
3014 2019-02-10  Darin Adler  <darin@apple.com>
3015
3016         Replace more uses of String::format with StringConcatenate (mostly non-Apple platform-specific cases)
3017         https://bugs.webkit.org/show_bug.cgi?id=194487
3018
3019         Reviewed by Daniel Bates.
3020
3021         * NetworkProcess/NetworkProcess.cpp:
3022         (WebKit::NetworkProcess::switchToNewTestingSession): Use makeString instead of String::format.
3023         * NetworkProcess/soup/NetworkProcessSoup.cpp:
3024         (WebKit::buildAcceptLanguages): Ditto.
3025         * UIProcess/API/glib/IconDatabase.cpp:
3026         (WebKit::IconDatabase::performURLImport): Ditto.
3027         * UIProcess/gtk/InputMethodFilter.cpp:
3028         (WebKit::InputMethodFilter::logConfirmCompositionForTesting): Ditto.
3029         (WebKit::InputMethodFilter::logSetPreeditForTesting): Ditto.
3030
3031 2019-02-15  Truitt Savell  <tsavell@apple.com>
3032
3033         Unreviewed, rolling out r241564.
3034
3035         Caused 50+ Timeouts on Mac WK2, mostly in the http/ directory
3036
3037         Reverted changeset:
3038
3039         "[Mac] WebInspectorUI.framework does not need to be soft-
3040         linked anymore"
3041         https://bugs.webkit.org/show_bug.cgi?id=194411
3042         https://trac.webkit.org/changeset/241564
3043
3044 2019-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
3045
3046         Unreviewed. Fix GTK+ build after r241556
3047
3048         I guess this is due to unified builds after a new file being added in r241556.
3049
3050         * UIProcess/API/C/WKAuthenticationDecisionListener.cpp:
3051         * UIProcess/API/C/WKPage.cpp:
3052
3053 2019-02-14  Brent Fulgham  <bfulgham@apple.com>
3054
3055         REGRESSION (r240446): Storage Access API does not handle domains consistently
3056         https://bugs.webkit.org/show_bug.cgi?id=194664
3057
3058         Reviewed by Alex Christensen.
3059         
3060         During my refactoring of the ResourceLoadStatistics code, I introduced two bugs:
3061         (1) I neglected to be consistent in my use of 'primaryDomain', causing some Storage
3062         Access API code paths to store approves under one domain (e.g., 'www.example.com'),
3063         while checking status under the eTLD+1 (e.g., 'example.com'). The exact string matching
3064         requirement caused these to get missed.
3065
3066         (2) I used a move operator before a final set of copies of domain names, leading to
3067         some empty strings being passed to Storage Access API calls.
3068
3069         Both issues are corrected in this patch.
3070
3071         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3072         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode): Always make the
3073         domain comply with our 'primaryDomain' logic.
3074         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess): Ditto.
3075         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted): Ditto.
3076         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation): Ditto.
3077         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading): Ditto.
3078         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading): Ditto.
3079         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect): Ditto.
3080         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction): Ditto.
3081         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction): Ditto.
3082         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction): Ditto.
3083         (WebKit::WebResourceLoadStatisticsStore::setLastSeen): Ditto.
3084         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource): Ditto.
3085         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource): Ditto.
3086         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource): Ditto.
3087         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource): Ditto.
3088         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder): Ditto.
3089         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder): Ditto.
3090         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo): Ditto.
3091         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource): Ditto.
3092         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered): Ditto.
3093         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered): Ditto.
3094         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin): Ditto.
3095         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin): Ditto.
3096         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo): Ditto.
3097         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom): Ditto.
3098         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo): Ditto.
3099         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom): Ditto.
3100         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3101         (WebKit::WebsiteDataStore::hasStorageAccess): Always make the
3102         domain comply with our 'primaryDomain' logic.
3103         (WebKit::WebsiteDataStore::requestStorageAccess): Ditto. Also make copy of domain
3104         names before moving them to the completion handler.
3105         (WebKit::WebsiteDataStore::grantStorageAccess): Ditto.
3106         * WebProcess/WebPage/WebPage.cpp:
3107         (WebKit::WebPage::hasStorageAccess):  Always make the domain comply with our
3108         'primaryDomain' logic.
3109         (WebKit::WebPage::requestStorageAccess): Ditto.
3110
3111 2019-02-14  Tim Horton  <timothy_horton@apple.com>
3112
3113         Fix the build.
3114
3115         * UIProcess/ios/WKDrawingView.mm:
3116         (-[WKDrawingView renderedDrawing]):
3117
3118 2019-02-14  Youenn Fablet  <youenn@apple.com>
3119
3120         ASSERTION FAILED: m_caches.isEmpty() || !m_pendingInitializationCallbacks.isEmpty() in WebKit::CacheStorage::Caches::clearMemoryRepresentation()
3121         https://bugs.webkit.org/show_bug.cgi?id=188393
3122         <rdar://problem/43025665>
3123
3124         Reviewed by Alex Christensen.
3125
3126         In case Caches::dispose is called, clearMemoryRepresentation might be called if there is no active cache.
3127         We also ensure to not clear the memory representation if there is any remaining removed cache.
3128         Update the clearMemoryRepresentation assertion to take that into account.
3129
3130         In case a Caches is cleared twice, the clearMemoryRepresentation assertion will assert while it should not.
3131         In that case m_storage is null the second time. Update the assertion accordingly.
3132
3133         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
3134         (WebKit::CacheStorage::Caches::hasActiveCache const):
3135         (WebKit::CacheStorage::Caches::dispose):
3136         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
3137         * NetworkProcess/cache/CacheStorageEngineCaches.h:
3138
3139 2019-02-14  Brian Burg  <bburg@apple.com>
3140
3141         [Mac] WebInspectorUI.framework does not need to be soft-linked anymore
3142         https://bugs.webkit.org/show_bug.cgi?id=194411
3143         <rdar://problem/47787614>
3144
3145         Reviewed by Joseph Pecoraro.
3146
3147         * Configurations/WebKit.xcconfig:
3148         Conditionalize weak linking to WebInspectorUI.framework for Mac only.
3149
3150         * UIProcess/mac/WebInspectorProxyMac.mm:
3151         (WebKit::WebInspectorProxy::inspectorPageURL):
3152         (WebKit::WebInspectorProxy::inspectorTestPageURL):
3153         (WebKit::WebInspectorProxy::inspectorBaseURL):
3154         * WebProcess/WebPage/mac/WebInspectorUIMac.mm:
3155         (WebKit::webInspectorUILocalizedStringsURL):
3156         Rewrite uses of the bundle to exit early if bundle couldn't be loaded.
3157
3158 2019-02-14  Michael Catanzaro  <mcatanzaro@igalia.com>
3159
3160         [GTK] WebKitGTK+ -> WebKitGTK
3161         https://bugs.webkit.org/show_bug.cgi?id=194658
3162
3163         Reviewed by Alex Christensen.
3164
3165         This renames WebKitGTK+ to WebKitGTK in a few user-visible places: the API documentation,
3166         the pkg-config, and an error message.
3167
3168         In a couple places where it's exposed in WPE documentation, WPE is now mentioned, or the
3169         reference to "WebKitGTK+" is changed to just "WebKit."
3170
3171         * UIProcess/API/glib/WebKitSettings.cpp:
3172         (webkit_settings_class_init):
3173         * UIProcess/API/glib/WebKitWebView.cpp:
3174         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
3175         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivateGtk.h:
3176         * gtk/webkit2gtk-web-extension.pc.in:
3177         * gtk/webkit2gtk.pc.in:
3178
3179 2019-02-14  Ross Kirsling  <ross.kirsling@sony.com>
3180
3181         [WTF] Add environment variable helpers
3182         https://bugs.webkit.org/show_bug.cgi?id=192405
3183
3184         Reviewed by Michael Catanzaro.
3185
3186         * NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
3187         (main):
3188         * Platform/unix/EnvironmentUtilities.cpp:
3189         (WebKit::EnvironmentUtilities::stripValuesEndingWithString):
3190         * Platform/unix/LoggingUnix.cpp:
3191         (WebKit::logLevelString):
3192         * Platform/win/LoggingWin.cpp:
3193         (WebKit::logLevelString):
3194         * PluginProcess/mac/PluginProcessMac.mm:
3195         (WebKit::shouldCallRealDebugger):
3196         * Shared/Plugins/unix/PluginSearchPath.cpp:
3197         (WebKit::pluginsDirectories):
3198         * Shared/glib/ProcessExecutablePathGLib.cpp:
3199         (WebKit::findWebKitProcess):
3200         * UIProcess/API/glib/WebKitSettings.cpp:
3201         (webKitSettingsConstructed):
3202         (webKitSettingsSetProperty):
3203         * UIProcess/API/glib/WebKitWebContext.cpp:
3204         (injectedBundleDirectory):
3205         (webkitWebContextConstructed):
3206         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
3207         (webkitWebViewMaximizeWindow):
3208         (webkitWebViewRestoreWindow):
3209         * UIProcess/API/wpe/WPEView.cpp:
3210         (WKWPE::m_backend):
3211         * UIProcess/AuxiliaryProcessProxy.cpp:
3212         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
3213         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
3214         (WebKit::XDGDBusProxyLauncher::launch):
3215         (WebKit::bindDBusSession):
3216         (WebKit::bindX11):
3217         (WebKit::bindWayland):
3218         (WebKit::bindPulse):
3219         (WebKit::bindPathVar):
3220         (WebKit::bindGStreamerData):
3221         (WebKit::bubblewrapSpawn):
3222         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
3223         (WebKit::ProcessLauncher::launchProcess):
3224         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
3225         (WebKit::systemDirectoryPath):
3226         (WebKit::ProcessLauncher::launchProcess):
3227         * UIProcess/glib/WebProcessPoolGLib.cpp:
3228         (WebKit::memoryPressureMonitorDisabled):
3229         (WebKit::WebProcessPool::platformInitialize):
3230         (WebKit::WebProcessPool::platformInitializeWebProcess):
3231         * UIProcess/gtk/HardwareAccelerationManager.cpp:
3232         (WebKit::HardwareAccelerationManager::HardwareAccelerationManager):
3233         * WebProcess/EntryPoint/unix/WebProcessMain.cpp:
3234         (main):
3235         * WebProcess/gtk/WebProcessMainGtk.cpp:
3236         * WebProcess/wpe/WebProcessMainWPE.cpp:
3237         Utilize WTF::Environment where possible.
3238
3239 2019-02-14  Jiewen Tan  <jiewen_tan@apple.com>
3240
3241         Handle _WKNavigationActionPolicyAllowWithoutTryingAppLink for LoadOptimizer
3242         https://bugs.webkit.org/show_bug.cgi?id=194640
3243         <rdar://problem/48064140>
3244
3245         Reviewed by Brent Fulgham.
3246
3247         * UIProcess/Cocoa/NavigationState.mm:
3248         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3249
3250 2019-02-14  Chris Dumez  <cdumez@apple.com>
3251
3252         [PSON] Introduce a WebContent Process cache
3253         https://bugs.webkit.org/show_bug.cgi?id=194594
3254         <rdar://problem/46793397>
3255
3256         Reviewed by Geoff Garen.
3257
3258         Introduce a WebContent Process cache to reduce the number of process launches when
3259         process swap on navigation is enabled, and to reduce the power cost of the feature.
3260
3261         If a WebProcess loaded pages from a single registrable domain then it is eligible
3262         for the cache. When process-swapping on navigation to a new registrable domain, we
3263         now attempt to retrieve a process from the cache for the domain in question instead
3264         of always launching a new one.
3265
3266         The WebProcess cache currently has the following attributes:
3267         - It may contains 4 processes per GB of RAM the machine has, up to 30 processes.
3268         - WebProcesses automatically get evicted from the cache after 30 minutes.
3269         - If the application is no longer the active app, then the cache will get cleared
3270           after 5 minutes.
3271         - WebProcesses that are in the cache are reported as "(Cached)" in Activity Monitor.
3272
3273         The WebProcess cache is currently disabled by default and can by enabled by the
3274         client via SPI.
3275
3276         * Shared/WebBackForwardListItem.cpp:
3277         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
3278         * Shared/WebBackForwardListItem.h:
3279         (WebKit::WebBackForwardListItem::lastProcessIdentifier const):
3280         (WebKit::WebBackForwardListItem::setLastProcessIdentifier):
3281         Add new lastProcessIdentifier data member that reflects which process this item
3282         was last loaded in. It is normally identical to the identifier of the process
3283         that created the item but it gets overriden in case of cross-site client-side
3284         redirect, since a new process takes over the item in this case.
3285
3286         * Sources.txt:
3287         Add new source file.
3288
3289         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3290         (API::ProcessPoolConfiguration::copy):
3291         * UIProcess/API/APIProcessPoolConfiguration.h:
3292         * UIProcess/API/C/WKContextConfigurationRef.cpp:
3293         (WKContextConfigurationUsesWebProcessCache):
3294         (WKContextConfigurationSetUsesWebProcessCache):
3295         * UIProcess/API/C/WKContextConfigurationRef.h:
3296         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3297         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3298         (-[_WKProcessPoolConfiguration setUsesWebProcessCache:]):
3299         (-[_WKProcessPoolConfiguration usesWebProcessCache]):
3300         Add new SPI to enable the WebProcess cache.
3301
3302         * UIProcess/API/Cocoa/WKProcessPool.mm:
3303         (-[WKProcessPool _webProcessCountIgnoringPrewarmedAndCached]):
3304         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3305         Add new SPI for testing which returns the number of WebProcesses ignoring
3306         both prewarmed and cached ones.
3307
3308         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3309         (WebKit::WebProcessPool::registerNotificationObservers):
3310         (WebKit::WebProcessPool::unregisterNotificationObservers):
3311         Add application active state observers as the WebProcess cache gets cleared
3312         when the application resigns active state for more than 5 minutes.
3313
3314         * UIProcess/ProvisionalPageProxy.cpp:
3315         (WebKit::ProvisionalPageProxy::loadRequest):
3316         When doing a load in a new process with the BackForwardList locked (i.e. client-side
3317         redirect), make sure we update the last process identifier for the BackForwardListItem.
3318         This is important because the logic in WebProcessPool::processForNavigation() relies on
3319         this identifier to select which process to do the history navigation into, and we want
3320         to do the load in the post-redirect process, not the pre-redirect one.
3321
3322         * UIProcess/WebPageProxy.cpp:
3323         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
3324         Tell the WebProcess whenever a main frame provisional load is started, providing the URL.
3325
3326         * UIProcess/WebProcessCache.cpp: Added.
3327         (WebKit::WebProcessCache::WebProcessCache):
3328         (WebKit::WebProcessCache::addProcess):
3329         (WebKit::WebProcessCache::takeProcess):
3330         (WebKit::WebProcessCache::updateMaximumSize):
3331         (WebKit::WebProcessCache::clear):
3332         (WebKit::WebProcessCache::setApplicationIsActive):
3333         (WebKit::WebProcessCache::evictProcess):
3334         (WebKit::WebProcessCache::CachedProcess::CachedProcess):
3335         (WebKit::WebProcessCache::CachedProcess::~CachedProcess):
3336         (WebKit::WebProcessCache::CachedProcess::takeProcess):
3337         (WebKit::WebProcessCache::CachedProcess::evictionTimerFired):
3338         * UIProcess/WebProcessCache.h: Added.
3339         (WebKit::WebProcessCache::maximumSize):
3340         (WebKit::WebProcessCache::size const):
3341         (WebKit::WebProcessCache::CachedProcess::process):
3342         Add process cache implementation.
3343
3344         * UIProcess/WebProcessPool.cpp:
3345         (WebKit::m_webProcessCache):
3346         WebProcessCache is stored on the WebProcessPool via m_webProcessCache data member.
3347
3348         (WebKit::WebProcessPool::~WebProcessPool):
3349         Clear the WebProcess cache in the destructor.
3350
3351         (WebKit::WebProcessPool::setApplicationIsActive):
3352         Notify the WebProcessCache whenever the application's active state changes.
3353
3354         (WebKit::WebProcessPool::createWebPage):