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