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