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