Protect globalWebSocketStreamMap with a Lock
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-02-05  Alex Christensen  <achristensen@webkit.org>
2
3         Protect globalWebSocketStreamMap with a Lock
4         https://bugs.webkit.org/show_bug.cgi?id=194224
5         <rdar://problem/47581081>
6
7         Reviewed by Ryosuke Niwa.
8
9         * WebProcess/Network/WebSocketStream.cpp:
10         (WebKit::WebSocketStream::streamWithIdentifier):
11         (WebKit::WebSocketStream::networkProcessCrashed):
12         (WebKit::WebSocketStream::WebSocketStream):
13         (WebKit::WebSocketStream::~WebSocketStream):
14
15 2019-02-04  Alex Christensen  <achristensen@webkit.org>
16
17         Add Networking Daemon skeleton
18         https://bugs.webkit.org/show_bug.cgi?id=194278
19
20         Reviewed by Zalan Bujtas.
21
22         Daemon skeletons? This is spooky stuff.
23
24         * NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.h: Added.
25         * NetworkProcess/EntryPoint/Cocoa/Daemon/DaemonEntryPoint.mm: Added.
26         (WebKit::DaemonMain):
27         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
28         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
29         (WebKit::NetworkDataTaskCocoa::restrictRequestReferrerToOriginIfNeeded):
30         * Shared/API/Cocoa/WKMain.h:
31         * Shared/API/Cocoa/WKMain.mm:
32         (WKDaemonMain):
33         * Shared/EntryPointUtilities/Cocoa/AuxiliaryProcessMain.cpp:
34         (main):
35         * SourcesCocoa.txt:
36         * UnifiedSources-input.xcfilelist:
37         * WebKit.xcodeproj/project.pbxproj:
38
39 2019-02-04  Yusuke Suzuki  <ysuzuki@apple.com>
40
41         [JSC] Shrink size of VM by lazily allocating IsoSubspaces for non-common types
42         https://bugs.webkit.org/show_bug.cgi?id=193993
43
44         Reviewed by Keith Miller.
45
46         * WebProcess/Plugins/Netscape/JSNPMethod.h:
47         * WebProcess/Plugins/Netscape/JSNPObject.h:
48
49 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
50
51         Move some macOS/iOS scrolling code into the scrolling/cocoa directory
52         https://bugs.webkit.org/show_bug.cgi?id=194245
53
54         Reviewed by Zalan Bujtas.
55
56         Use PLATFORM(MAC), not !PLATFORM(IOS_FAMILY).
57
58         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
59         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
60
61 2019-02-04  Ms2ger  <Ms2ger@igalia.com>
62
63         [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI
64         https://bugs.webkit.org/show_bug.cgi?id=174816
65
66         Reviewed by Michael Catanzaro.
67
68         Add webkit_uri_for_display for GTK and WPE.
69
70         * PlatformGTK.cmake:
71         * PlatformWPE.cmake:
72         * SourcesGTK.txt:
73         * SourcesWPE.txt:
74         * UIProcess/API/glib/WebKitURIUtilities.cpp: Added.
75         (webkit_uri_for_display):
76         * UIProcess/API/gtk/WebKitURIUtilities.h: Added.
77         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
78         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
79         * UIProcess/API/gtk/webkit2.h:
80         * UIProcess/API/wpe/WebKitURIUtilities.h: Added.
81         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
82         * UIProcess/API/wpe/docs/wpe-docs.sgml:
83         * UIProcess/API/wpe/webkit.h:
84
85 2019-02-04  Alex Christensen  <achristensen@webkit.org>
86
87         Move XPCService main to a shared file calling a C function
88         https://bugs.webkit.org/show_bug.cgi?id=194256
89
90         Reviewed by Brady Eidson.
91
92         This not only reduces a few kilobytes of duplicated binary from the XPCService executables,
93         It will allow me to introduce a new kind of executable which will need to parse argv and call a different C function.
94         This is similar to r236075 but more general.
95
96         * Shared/API/Cocoa/WKMain.h: Added.
97         * Shared/API/Cocoa/WKMain.mm: Added.
98         (WKXPCServiceMain):
99         * Shared/EntryPointUtilities/Cocoa/AuxiliaryProcessMain.cpp: Added.
100         (main):
101         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
102         (main): Deleted.
103         * SourcesCocoa.txt:
104         * WebKit.xcodeproj/project.pbxproj:
105
106 2019-02-04  Alex Christensen  <achristensen@webkit.org>
107
108         Make MessageSender functions const
109         https://bugs.webkit.org/show_bug.cgi?id=194247
110
111         Reviewed by Brady Eidson.
112
113         * NetworkProcess/Downloads/Download.cpp:
114         (WebKit::Download::messageSenderConnection const):
115         (WebKit::Download::messageSenderDestinationID const):
116         (WebKit::Download::messageSenderConnection): Deleted.
117         (WebKit::Download::messageSenderDestinationID): Deleted.
118         * NetworkProcess/Downloads/Download.h:
119         * NetworkProcess/Downloads/PendingDownload.cpp:
120         (WebKit::PendingDownload::messageSenderConnection const):
121         (WebKit::PendingDownload::messageSenderDestinationID const):
122         (WebKit::PendingDownload::messageSenderConnection): Deleted.
123         (WebKit::PendingDownload::messageSenderDestinationID): Deleted.
124         * NetworkProcess/Downloads/PendingDownload.h:
125         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
126         (WebKit::WebIDBConnectionToClient::messageSenderConnection const):
127         (WebKit::WebIDBConnectionToClient::messageSenderConnection): Deleted.
128         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
129         * NetworkProcess/NetworkResourceLoader.cpp:
130         (WebKit::NetworkResourceLoader::messageSenderConnection const):
131         (WebKit::NetworkResourceLoader::messageSenderConnection): Deleted.
132         * NetworkProcess/NetworkResourceLoader.h:
133         * NetworkProcess/NetworkSocketStream.cpp:
134         (WebKit::NetworkSocketStream::messageSenderConnection const):
135         (WebKit::NetworkSocketStream::messageSenderDestinationID const):
136         (WebKit::NetworkSocketStream::messageSenderConnection): Deleted.
137         (WebKit::NetworkSocketStream::messageSenderDestinationID): Deleted.
138         * NetworkProcess/NetworkSocketStream.h:
139         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
140         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
141         (WebKit::WebSWServerToContextConnection::messageSenderConnection const):
142         (WebKit::WebSWServerToContextConnection::messageSenderDestinationID const):
143         (WebKit::WebSWServerToContextConnection::messageSenderConnection): Deleted.
144         (WebKit::WebSWServerToContextConnection::messageSenderDestinationID): Deleted.
145         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
146         * Platform/IPC/MessageSender.h:
147         * Shared/AuxiliaryProcess.cpp:
148         (WebKit::AuxiliaryProcess::messageSenderConnection const):
149         (WebKit::AuxiliaryProcess::messageSenderDestinationID const):
150         (WebKit::AuxiliaryProcess::messageSenderConnection): Deleted.
151         (WebKit::AuxiliaryProcess::messageSenderDestinationID): Deleted.
152         * Shared/AuxiliaryProcess.h:
153         * UIProcess/WebConnectionToWebProcess.cpp:
154         (WebKit::WebConnectionToWebProcess::messageSenderConnection const):
155         (WebKit::WebConnectionToWebProcess::messageSenderDestinationID const):
156         (WebKit::WebConnectionToWebProcess::messageSenderConnection): Deleted.
157         (WebKit::WebConnectionToWebProcess::messageSenderDestinationID): Deleted.
158         * UIProcess/WebConnectionToWebProcess.h:
159         * UIProcess/WebPageProxy.cpp:
160         (WebKit::WebPageProxy::messageSenderConnection const):
161         (WebKit::WebPageProxy::messageSenderDestinationID const):
162         (WebKit::WebPageProxy::messageSenderConnection): Deleted.
163         (WebKit::WebPageProxy::messageSenderDestinationID): Deleted.
164         * UIProcess/WebPageProxy.h:
165         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
166         (WebKit::WebIDBConnectionToServer::messageSenderConnection const):
167         (WebKit::WebIDBConnectionToServer::messageSenderConnection): Deleted.
168         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
169         * WebProcess/Network/WebResourceLoader.cpp:
170         (WebKit::WebResourceLoader::messageSenderConnection const):
171         (WebKit::WebResourceLoader::messageSenderDestinationID const):
172         (WebKit::WebResourceLoader::messageSenderConnection): Deleted.
173         (WebKit::WebResourceLoader::messageSenderDestinationID): Deleted.
174         * WebProcess/Network/WebResourceLoader.h:
175         * WebProcess/Network/WebSocketStream.cpp:
176         (WebKit::WebSocketStream::messageSenderConnection const):
177         (WebKit::WebSocketStream::messageSenderDestinationID const):
178         (WebKit::WebSocketStream::messageSenderConnection): Deleted.
179         (WebKit::WebSocketStream::messageSenderDestinationID): Deleted.
180         * WebProcess/Network/WebSocketStream.h:
181         * WebProcess/Storage/WebSWClientConnection.h:
182         * WebProcess/WebConnectionToUIProcess.cpp:
183         (WebKit::WebConnectionToUIProcess::messageSenderConnection const):
184         (WebKit::WebConnectionToUIProcess::messageSenderDestinationID const):
185         (WebKit::WebConnectionToUIProcess::messageSenderConnection): Deleted.
186         (WebKit::WebConnectionToUIProcess::messageSenderDestinationID): Deleted.
187         * WebProcess/WebConnectionToUIProcess.h:
188         * WebProcess/WebPage/WebPage.cpp:
189         (WebKit::WebPage::messageSenderConnection const):
190         (WebKit::WebPage::messageSenderDestinationID const):
191         (WebKit::WebPage::messageSenderConnection): Deleted.
192         (WebKit::WebPage::messageSenderDestinationID): Deleted.
193         * WebProcess/WebPage/WebPage.h:
194
195 2019-02-04  Brady Eidson  <beidson@apple.com>
196
197         Take additional process assertion while downloading.
198         <rdar://problem/47741356> and https://bugs.webkit.org/show_bug.cgi?id=194239
199
200         Reviewed by Chris Dumez.
201
202         When the first download starts, grab this new assertion.
203         When the last download ends, release it.
204
205         * Configurations/Network-iOS.entitlements:
206
207         * NetworkProcess/Downloads/DownloadManager.cpp:
208         (WebKit::DownloadManager::dataTaskBecameDownloadTask):
209         (WebKit::DownloadManager::downloadFinished):
210         * NetworkProcess/Downloads/DownloadManager.h:
211
212         * Platform/spi/ios/AssertionServicesSPI.h:
213
214         * UIProcess/ProcessAssertion.cpp:
215         (WebKit::ProcessAssertion::ProcessAssertion):
216         * UIProcess/ProcessAssertion.h:
217         (WebKit::ProcessAssertion::ProcessAssertion):
218
219         * UIProcess/WebProcessProxy.cpp:
220         (WebKit::WebProcessProxy::didSetAssertionState):
221
222         * UIProcess/ios/ProcessAssertionIOS.mm:
223         (WebKit::flagsForState):
224         (WebKit::reasonForState):
225         (WebKit::ProcessAssertion::ProcessAssertion):
226
227 2019-02-04  Said Abou-Hallawa  <said@apple.com>
228
229         [CG] Enable setAdditionalSupportedImageTypes for WK1
230         https://bugs.webkit.org/show_bug.cgi?id=194190
231
232         Reviewed by Tim Horton.
233
234         Move the function webCoreStringVectorFromNSStringArray from WebKit to
235         WebCore so it can be used by both WebKit and WebKitLegacy.
236
237         * Platform/mac/StringUtilities.h:
238         * Platform/mac/StringUtilities.mm:
239         (WebKit::webCoreStringVectorFromNSStringArray): Deleted.
240         * UIProcess/API/Cocoa/WKWebView.mm:
241         (-[WKWebView _initializeWithConfiguration:]):
242
243 2019-02-04  Benjamin Poulain  <benjamin@webkit.org>
244
245         Use deferrable timer to restart the Responsiveness Timer on each wheel event
246         https://bugs.webkit.org/show_bug.cgi?id=194135
247
248         Reviewed by Simon Fraser.
249
250         Simon Fraser suggested a neat improvement over my previous optimization
251         of ResponsivenessTimer.
252
253         Instead of reseting the deadline with every event, we can let the timer
254         fire and add the missing time from the last start.
255
256         I implemented that behavior in the new Deferrable Timer class and use
257         it from ResponsivenessTimer.
258
259         * NetworkProcess/watchos/NetworkProximityAssertion.h:
260         * UIProcess/ResponsivenessTimer.h:
261         * WebProcess/Plugins/PluginView.h:
262
263 2019-02-04  Simon Fraser  <simon.fraser@apple.com>
264
265         PageOverlayController's layers should be created lazily
266         https://bugs.webkit.org/show_bug.cgi?id=194199
267         rdar://problem/46571593
268
269         Reviewed by Tim Horton.
270         
271         Expose PageOverlayController::hasDocumentOverlays() and hasViewOverlays()
272         and use them to only parent the overlay-hosting layers when necessary.
273
274         For document overlays, RenderLayerCompositor::appendDocumentOverlayLayers() can
275         simply do nothing if there are none. Updates are triggered via Page::installedPageOverlaysChanged(),
276         which calls FrameView::setNeedsCompositingConfigurationUpdate() to trigger the root layer
277         compositing updates that parents the layerWithDocumentOverlays().
278
279         View overlays are added to the layer tree via the DrawingArea. When we go between having
280         none and some view overlays, Page::installedPageOverlaysChanged() calls attachViewOverlayGraphicsLayer()
281         on the ChromeClient, and the DrawingArea responds by calling updateRootLayers() and scheduling a
282         compositing flush (this has to be done manually because view overlay layers are outside the
283         subtree managed by RenderLayerCompositor).
284         
285         Now that GraphicsLayers are ref-counted, we can let the DrawingArea simply retain its m_viewOverlayRootLayer;
286         there is no need for RenderLayerCompositor::attachRootLayer()/detachRootLayer() to do anything with view
287         overlay layers. This implies that a page can navigate (new FrameView) and view overlays will persist, without
288         having to be manually removed and re-added. We can also remove the Frame argument to attachViewOverlayGraphicsLayer().
289
290         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
291         (WebKit::WebChromeClient::attachViewOverlayGraphicsLayer):
292         * WebProcess/WebCoreSupport/WebChromeClient.h:
293         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
294         (WebKit::AcceleratedDrawingArea::attachViewOverlayGraphicsLayer):
295         * WebProcess/WebPage/AcceleratedDrawingArea.h:
296         * WebProcess/WebPage/DrawingArea.h:
297         (WebKit::DrawingArea::attachViewOverlayGraphicsLayer):
298         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
299         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
300         (WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer):
301         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
302         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
303         (WebKit::TiledCoreAnimationDrawingArea::attachViewOverlayGraphicsLayer):
304         (WebKit::TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged):
305
306 2019-02-04  Michael Catanzaro  <mcatanzaro@igalia.com>
307
308         Unreviewed, improve preprocessor guard
309         https://bugs.webkit.org/show_bug.cgi?id=194166
310         <rdar://problem/47694328>
311
312         AC mode is only optional in GTK port. Requested by Zan.
313
314         * WebProcess/WebPage/WebPage.cpp:
315         (WebKit::WebPage::updatePreferences):
316
317 2019-02-04  Sihui Liu  <sihui_liu@apple.com>
318
319         IndexedDB: leak WebIDBConnectionToServer in layout tests
320         https://bugs.webkit.org/show_bug.cgi?id=193688
321         <rdar://problem/47353263>
322
323         Reviewed by Geoffrey Garen.
324
325         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
326         (WebKit::NetworkConnectionToWebProcess::didClose):
327         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
328         (WebKit::NetworkConnectionToWebProcess::removeIDBConnectionToServer): Deleted.
329         * NetworkProcess/NetworkConnectionToWebProcess.h:
330         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
331         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
332         (WebKit::WebIDBConnectionToServer::~WebIDBConnectionToServer):
333
334 2019-02-04  Antoine Quint  <graouts@apple.com>
335
336         <rdar://problem/47788802>
337
338         Unreviewed build fix.
339
340         * Platform/spi/ios/UIKitSPI.h:
341
342 2019-02-04  Youenn Fablet  <youenn@apple.com>
343
344         Capture state should be managed consistently when doing process swapping
345         https://bugs.webkit.org/show_bug.cgi?id=194122
346         <rdar://problem/47609293>
347
348         Reviewed by Eric Carlson.
349
350         When doing PSON, WebPageProxy::resetState is called.
351         It resets the media state, but does not call the client delegates.
352         Instead of directly updating the media state, call the routine used to update it so that client delegates are called.
353
354         Covered by new API test and layout test.
355
356         * UIProcess/API/Cocoa/WKWebView.mm:
357         (-[WKWebView _mediaCaptureState]):
358         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
359         * UIProcess/WebPageProxy.cpp:
360         (WebKit::WebPageProxy::resetState):
361         (WebKit::WebPageProxy::isPlayingMediaDidChange):
362         (WebKit::WebPageProxy::updatePlayingMediaDidChange):
363         * UIProcess/WebPageProxy.h:
364
365 2019-02-04  Antoine Quint  <graouts@apple.com>
366
367         Use a dedicated type instead of int32_t for pointer identifiers
368         https://bugs.webkit.org/show_bug.cgi?id=194217
369
370         Reviewed by Antti Koivisto.
371
372         * Scripts/webkit/messages.py:
373         * UIProcess/WebPageProxy.cpp:
374         (WebKit::WebPageProxy::cancelPointer):
375         * UIProcess/WebPageProxy.h:
376         * WebProcess/WebPage/WebPage.cpp:
377         (WebKit::WebPage::cancelPointer):
378         * WebProcess/WebPage/WebPage.h:
379         * WebProcess/WebPage/WebPage.messages.in:
380
381 2019-02-04  Michael Catanzaro  <mcatanzaro@igalia.com>
382
383         Unreviewed, avoid -Wswitch warnings introduced in r240880
384         https://bugs.webkit.org/show_bug.cgi?id=193740
385         <rdar://problem/47527267>
386
387         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
388         (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse):
389
390 2019-02-04  Alexander Mikhaylenko  <exalm7659@gmail.com>
391
392         [GTK] Allow pinch zoom on touchpad
393         https://bugs.webkit.org/show_bug.cgi?id=194201
394
395         Reviewed by Michael Catanzaro.
396
397         Enable touchpad events for WebkitWebViewBase, then feed touchpad
398         pinch events to GestureController.
399
400         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
401         (webkitWebViewBaseRealize): Added GDK_TOUCHPAD_GESTURE_MASK to event mask.
402         (webkitWebViewBaseEvent): Added.
403         (webkit_web_view_base_class_init): Override event vfunc.
404
405 2019-02-04  Michael Catanzaro  <mcatanzaro@igalia.com>
406
407         Unreviewed, only force settings.acceleratedCompositingEnabled() to true for Cocoa ports
408         https://bugs.webkit.org/show_bug.cgi?id=194166
409         <rdar://problem/47694328>
410
411         Accelerated compositing is broken for me at least. We're a long way from being able to force
412         it.
413
414         * WebProcess/WebPage/WebPage.cpp:
415         (WebKit::WebPage::updatePreferences):
416
417 2019-02-04  Abderrahim Kitouni  <akitouni@gnome.org>
418
419         [GTK] Remove last python2 dependency from CMake build process
420         https://bugs.webkit.org/show_bug.cgi?id=194218
421
422         Reviewed by Michael Catanzaro.
423
424         * InspectorGResources.cmake:
425
426 2019-02-04  Antti Koivisto  <antti@apple.com>
427
428         Rename GraphicsLayer and PlatformCALayer type enum values to match "scroll container layer" convention
429         https://bugs.webkit.org/show_bug.cgi?id=194215
430
431         Reviewed by Frédéric Wang.
432
433         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
434         (WebKit::RemoteLayerBackingStore::drawInContext):
435         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
436         (WebKit::RemoteLayerTreeHost::makeNode):
437         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
438         (WebKit::RemoteLayerTreeHost::makeNode):
439
440 2019-02-03  Antti Koivisto  <antti@apple.com>
441
442         [iOS] Tiles not created in large scrollable iframes
443         https://bugs.webkit.org/show_bug.cgi?id=193665
444
445         Reviewed by Simon Fraser.
446
447         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
448         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateBeforeChildren):
449         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
450         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateBeforeChildren):
451
452         We now use scrollContainerLayer consistently so remove the special cases.
453
454 2019-02-03  Fujii Hironori  <Hironori.Fujii@sony.com>
455
456         [curl] [WebKit] Assertion failures of missing networkStorageSession for storage/indexeddb tests
457         https://bugs.webkit.org/show_bug.cgi?id=194141
458
459         Reviewed by Ross Kirsling.
460
461         Implemented WebKit::NetworkProcess::switchToNewTestingSession and
462         WebKit::NetworkProcess::ensureSession for curl port.
463
464         * NetworkProcess/NetworkProcess.cpp:
465         (WebKit::NetworkProcess::switchToNewTestingSession):
466         (WebKit::NetworkProcess::ensureSession):
467
468 2019-02-03  Simon Fraser  <simon.fraser@apple.com>
469
470         Make setNeedsLayout on the root more explicitly about triggering its side-effects
471         https://bugs.webkit.org/show_bug.cgi?id=194198
472
473         Reviewed by Antti Koivisto.
474
475         Call the newly named functions.
476
477         * WebProcess/Plugins/PDF/PDFPlugin.mm:
478         (WebKit::PDFPlugin::updateScrollbars):
479         * WebProcess/Plugins/PluginView.cpp:
480         (WebKit::PluginView::didInitializePlugin):
481         * WebProcess/WebPage/WebPage.cpp:
482         (WebKit::WebPage::setHeaderBannerHeightForTesting):
483         (WebKit::WebPage::setFooterBannerHeightForTesting):
484         * WebProcess/WebPage/mac/PageBannerMac.mm:
485         (WebKit::PageBanner::addToPage):
486         (WebKit::PageBanner::detachFromPage):
487         (WebKit::PageBanner::hide):
488
489 2019-02-03  Ryosuke Niwa  <rniwa@webkit.org>
490
491         Validate navigation policy decisions to avoid crashes in continueLoadAfterNavigationPolicy
492         https://bugs.webkit.org/show_bug.cgi?id=194189
493
494         Reviewed by Geoffrey Garen.
495
496         Pass the policy check identifier around functions and store it in PolicyDecisionSender
497         so that we can send it back to WebCore with the navigation policy decision.
498
499         We also store it in WebFrame in the case the policy decision had to be invalidated
500         before the decision was received (via WebFrame::invalidatePolicyListener).
501
502         * Scripts/webkit/messages.py:
503         * UIProcess/ProvisionalPageProxy.cpp:
504         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
505         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
506         * UIProcess/ProvisionalPageProxy.h:
507         * UIProcess/WebPageProxy.cpp:
508         (WebKit::WebPageProxy::PolicyDecisionSender): Added PolicyCheckIdentifier as a member.
509         (WebKit::WebPageProxy::PolicyDecisionSender::create):
510         (WebKit::WebPageProxy::PolicyDecisionSender::send):
511         (WebKit::WebPageProxy::PolicyDecisionSender::PolicyDecisionSender):
512         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
513         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
514         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
515         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
516         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
517         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
518         (WebKit::WebPageProxy::decidePolicyForResponse):
519         (WebKit::WebPageProxy::decidePolicyForResponseShared):
520         * UIProcess/WebPageProxy.h:
521         * UIProcess/WebPageProxy.messages.in:
522         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
523         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
524         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
525         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
526         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
527         * WebProcess/WebPage/WebFrame.cpp:
528         (WebKit::WebFrame::setUpPolicyListener):
529         (WebKit::WebFrame::invalidatePolicyListener):
530         (WebKit::WebFrame::didReceivePolicyDecision):
531         * WebProcess/WebPage/WebFrame.h:
532         * WebProcess/WebPage/WebPage.cpp:
533         (WebKit::WebPage::didReceivePolicyDecision):
534         * WebProcess/WebPage/WebPage.h:
535         * WebProcess/WebPage/WebPage.messages.in:
536
537 2019-02-03  Megan Gardner  <megan_gardner@apple.com>
538
539         Turn on Smart Paste
540         https://bugs.webkit.org/show_bug.cgi?id=193786
541
542         Reviewed by Ryosuke Niwa.
543
544         * Platform/spi/ios/UIKitSPI.h:
545         * UIProcess/ios/TextCheckerIOS.mm:
546         (WebKit::TextChecker::isSmartInsertDeleteEnabled):
547         Use the flag from UIKit to determine if smart copy paste should be
548         turned on.
549
550 2019-02-02  Simon Fraser  <simon.fraser@apple.com>
551
552         Tidy up data memebers of FrameView and related classes to shrink class sizes
553         https://bugs.webkit.org/show_bug.cgi?id=194197
554
555         Reviewed by Zalan Bujtas.
556
557         * UIProcess/PageClient.h: Declare enum size.
558
559 2018-12-16  Darin Adler  <darin@apple.com>
560
561         Convert additional String::format clients to alternative approaches
562         https://bugs.webkit.org/show_bug.cgi?id=192746
563
564         Reviewed by Alexey Proskuryakov.
565
566         * UIProcess/Cocoa/ViewGestureController.cpp:
567         (WebKit::ViewGestureController::SnapshotRemovalTracker::startWatchdog):
568         Use makeString and FormattedNumber.
569
570         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
571         (WebKit::LocalAuthenticator::getAssertion): Added a comment about an
572         incorrect format specifier and left this code as is for now.
573
574 2019-02-01  David Kilzer  <ddkilzer@apple.com>
575
576         Move soft-linking of TelephonyUtilities.framework out of TUCallSPI.h
577         <https://webkit.org/b/193866>
578
579         Reviewed by Alex Christensen.
580
581         * Platform/mac/MenuUtilities.mm:
582         - Update for rename of TUCallSPI.h to TelephonyUtilitiesSPI.h.
583         - Add soft-linking code formerly in TUCallSPI.h.
584
585 2019-02-01  Alex Christensen  <achristensen@webkit.org>
586
587         Move XPCService entry points from mac directory to new Cocoa directory
588         https://bugs.webkit.org/show_bug.cgi?id=194129
589
590         Reviewed by Chris Dumez.
591
592         * Configurations/NetworkService.xcconfig:
593         * Configurations/PluginService.64.xcconfig:
594         * Configurations/WebContentService.xcconfig:
595         * NetworkProcess/EntryPoint/Cocoa: Copied from Source/WebKit/NetworkProcess/EntryPoint/mac.
596         * NetworkProcess/EntryPoint/mac: Removed.
597         * PluginProcess/EntryPoint/Cocoa: Copied from Source/WebKit/PluginProcess/EntryPoint/mac.
598         * PluginProcess/EntryPoint/mac: Removed.
599         * Shared/EntryPointUtilities/Cocoa: Copied from Source/WebKit/Shared/EntryPointUtilities/mac.
600         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
601         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
602         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
603         * Shared/EntryPointUtilities/mac: Removed.
604         * SourcesCocoa.txt:
605         * WebKit.xcodeproj/project.pbxproj:
606         * WebProcess/EntryPoint/Cocoa: Copied from Source/WebKit/WebProcess/EntryPoint/mac.
607         * WebProcess/EntryPoint/mac: Removed.
608
609 2019-02-01  Wenson Hsieh  <wenson_hsieh@apple.com>
610
611         [iOS] Consistent 1 sec hang when triggering modal alerts while handling synchronous touch events
612         https://bugs.webkit.org/show_bug.cgi?id=194140
613         <rdar://problem/47728098>
614
615         Reviewed by Tim Horton.
616
617         Currently, the UI process hangs when attempting to synchronously present modal UI from the web process while the
618         UI process is waiting for sync IPC in the web process. While we have logic to generally mitigate IPC deadlock in
619         this scenario by dispatching the web process' sync IPC immediately with the intention of allowing the web
620         process to finish processing sync IPC (and consequently unblock the UI process), this fails in the case where
621         the sync IPC message from the web process to the UI process requires main thread execution for an arbitrary
622         amount of time (for instance, modal alert dialogs). In this case, we'll end up in a state where we've handled
623         the web process' sync IPC in the UI process, yet we can't resume execution since the web process is still
624         blocked.
625
626         By far the most egregious scenario in which this manifests is during synchronous gesture recognizer IPC, i.e.
627         grabbing position information from the UI process, and handling touch events synchronously. Luckily, these are
628         also cases where (1) we know sync IPC may safely time out, and (2) the presentation of modal UI from the web
629         process should cause the gesture recognizers to fail anyways. As such, we can mitigate these scenarios in the
630         web process by responding to the these pending sync IPC messages *before* sending our own sync IPC to the UI
631         process.
632
633         Test: fast/events/touch/ios/show-modal-alert-during-touch-start.html
634
635         * Shared/ios/InteractionInformationAtPosition.h:
636         (WebKit::InteractionInformationAtPosition::invalidInformation):
637         * Shared/ios/InteractionInformationAtPosition.mm:
638         (WebKit::InteractionInformationAtPosition::encode const):
639         (WebKit::InteractionInformationAtPosition::decode):
640
641         Add a new flag to indicate whether an interaction information response can be valid. Interaction information
642         cannot be valid in the case where the interaction information request was interrupted by certain sync IPC
643         messages from the web process.
644
645         * UIProcess/API/C/WKContextConfigurationRef.cpp:
646         (WKContextConfigurationIgnoreSynchronousMessagingTimeoutsForTesting):
647         (WKContextConfigurationSetIgnoreSynchronousMessagingTimeoutsForTesting):
648
649         Add some testing SPI to ignore sync IPC timeouts, for the purposes of testing. Rather than use the existing
650         Objective-C SPI in WKWebProcessPoolConfiguration, I decided to add C API plumbing for this flag, so that other
651         non-Cocoa ports may also support the new layout test option to ignore sync IPC timeouts.
652
653         * UIProcess/API/C/WKContextConfigurationRef.h:
654         * UIProcess/ios/WKContentViewInteraction.mm:
655         (-[WKContentView ensurePositionInformationIsUpToDate:]):
656         (-[WKContentView _positionInformationDidChange:]):
657         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
658         (WebKit::WebChromeClient::runBeforeUnloadConfirmPanel):
659         (WebKit::WebChromeClient::runJavaScriptAlert):
660         (WebKit::WebChromeClient::runJavaScriptConfirm):
661         (WebKit::WebChromeClient::runJavaScriptPrompt):
662         (WebKit::WebChromeClient::print):
663         (WebKit::WebChromeClient::exceededDatabaseQuota):
664         (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
665
666         Cancel any pending sync IPC replies prior to sending sync IPC messages to the UI process which may result in
667         sync IPC deadlock, by using the new helper method, sendSyncWithDelayedReply, instead of just sendSync.
668
669         * WebProcess/WebPage/WebPage.cpp:
670         (WebKit::WebPage::cancelGesturesBlockedOnSynchronousReplies):
671
672         Add a helper to cancel pending sync messages coming in from the UI process that are being called from within
673         gesture recognizer delegate hooks.
674
675         (WebKit::WebPage::touchEventSync):
676         * WebProcess/WebPage/WebPage.h:
677
678         Add a new helper, sendSyncWithDelayedReply, to be used when sending a sync IPC message to the UI process that
679         cannot be immediately completed upon arrival. Importantly, this cancels pending sync replies, and also passes
680         IPC::SendSyncOption::InformPlatformProcessWillSuspend.
681
682         * WebProcess/WebPage/WebPage.messages.in:
683
684         Change these from LegacySync to Delayed messages.
685
686         * WebProcess/WebPage/ios/WebPageIOS.mm:
687         (WebKit::WebPage::getPositionInformation):
688
689         Make this sync IPC handler (as well as WebPage::touchEventSync) store the IPC reply during the scope of the
690         method, and invoke the stored reply at the end of the method if it wasn't interrupted due to something calling
691         cancelGesturesBlockedOnSynchronousReplies().
692
693         (WebKit::WebPage::positionInformation):
694
695         Refactor getPositionInformation by pulling out the logic for building an InteractionInformationAtPosition into
696         a separate helper.
697
698         (WebKit::WebPage::requestPositionInformation):
699
700 2019-02-01  David Quesada  <david_quesada@apple.com>
701
702         Network Process crash when resuming downloads: '-[__NSDictionaryI setObject:forKey:]: unrecognized selector sent to instance %p'
703         https://bugs.webkit.org/show_bug.cgi?id=194144
704         rdar://problem/47553456
705
706         Reviewed by Geoffrey Garen.
707
708         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
709         (WebKit::Download::resume):
710             Make a mutable copy of the root object decoded from the resume data.
711             It might have been originally encoded as an immutable dictionary.
712
713 2019-02-01  Chris Dumez  <cdumez@apple.com>
714
715         REGRESSION: Flaky ASSERTION FAILED: m_uncommittedState.state == State::Committed on http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html
716         https://bugs.webkit.org/show_bug.cgi?id=193740
717         <rdar://problem/47527267>
718
719         Reviewed by Alex Christensen.
720
721         The issue was happening when the page is triggering a cross-site navigation while in the middle of parsing. This would cause us to
722         start a new provisional load in a new process before the previous process sends the DidFinishLoadForFrame() IPC to the UIProcess.
723         Getting such IPC after a provisional load has started would mess up our state machine and trip assertions.
724
725         This patch restores non-PSON behavior which is that the previous load in the old process now gets stopped so that no DidFinishLoadForFrame()
726         / DidFailLoadForFrame() gets sent. To achieve this behavior, I introduced a new "StopAllLoads" PolicyAction that we now send the old
727         process when the load is continuing in a new process, instead of sending it "Ignore".
728
729         * NetworkProcess/NetworkDataTaskBlob.cpp:
730         (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
731         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
732         (toNSURLSessionResponseDisposition):
733         * UIProcess/WebPageProxy.cpp:
734         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
735
736 2019-02-01  Jer Noble  <jer.noble@apple.com>
737
738         Unreviewed build fix; Respect the 'condition:' field in the WebPreferences.yaml when generating
739         WebPreferencesStoreDefaultsMap.cpp.
740
741         * page/SettingsBase.h:
742
743 2019-02-01  Antoine Quint  <graouts@apple.com>
744
745         Dispatch pointercancel events when content is panned or zoomed on iOS
746         https://bugs.webkit.org/show_bug.cgi?id=193962
747         <rdar://problem/47629134>
748
749         Reviewed by Dean Jackson.
750
751         When a user-agent-provided interaction, such as panning or zooming on iOS, uses a set of touches, we should dispatch a pointercancel
752         event for the pointer ids of the touches involved. To facilitate this, we add a new method on WKContentView to cancel all the pointers
753         matching active touches for a provided UIGestureRecognizer through an async IPC call into the Web process using the new method
754         PointerCaptureController::cancelPointer().
755
756         * Platform/spi/ios/UIKitSPI.h: Add the necessary forward declaration for a necessary UIKit SPI allowing us to get the set of last-seen
757         UITouches by the identifier generated for the matching WebKit touch.
758         * UIProcess/API/Cocoa/WKWebView.mm:
759         (-[WKWebView scrollViewWillBeginZooming:withView:]): Dispatch touchcancel events for all pointers involved in a pinch gesture on the
760         top-level UIScrollView.
761         (-[WKWebView _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]): Dispatch
762         touchcancel events for all pointers involved in a pan gesture on the top-level UIScrollView. We can infer this by looking at whether the
763         adjusted content offset, after accounting for the permitted touch actions, is different from the original content offset.
764         * UIProcess/PageClient.h: Expose a new virtual cancelPointersForGestureRecognizer() method which will allow the iOS implementation to
765         forward the call to WKContentViewInteraction.
766         (WebKit::PageClient::cancelPointersForGestureRecognizer):
767         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: Expose the WebPageProxy such that we may access it to cancel pointers for
768         a given gesture recognizer from within ScrollingTreeScrollingNodeDelegateIOS.
769         (WebKit::RemoteScrollingCoordinatorProxy::webPageProxy const):
770         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
771         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
772         (-[WKScrollingNodeScrollViewDelegate _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]):
773         Dispatch touchcancel events for all pointers involved in a pan gesture on a nested UIScrollView. We can infer this by looking at
774         whether the adjusted content offset, after accounting for the permitted touch actions, is different from the original content offset.
775         (-[WKScrollingNodeScrollViewDelegate scrollViewWillBeginZooming:withView:]): Dispatch touchcancel events for all pointers involved in a
776         pinch gesture on a nested UIScrollView.
777         (-[WKScrollingNodeScrollViewDelegate cancelPointersForGestureRecognizer:]):
778         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::cancelPointersForGestureRecognizer):
779         * UIProcess/WebPageProxy.cpp:
780         (WebKit::WebPageProxy::cancelPointer):
781         * UIProcess/WebPageProxy.h:
782         * UIProcess/ios/PageClientImplIOS.h:
783         * UIProcess/ios/PageClientImplIOS.mm:
784         (WebKit::PageClientImpl::cancelPointersForGestureRecognizer):
785         * UIProcess/ios/WKContentViewInteraction.h:
786         * UIProcess/ios/WKContentViewInteraction.mm:
787         (-[WKContentView cancelPointersForGestureRecognizer:]): Obtain all active UITouch objects for the view and dispatch a pointercancel event,
788         through the WebPageProxy, for all touches associated with the provided gesture recognizer.
789         * WebProcess/WebPage/WebPage.cpp:
790         (WebKit::WebPage::cancelPointer):
791         * WebProcess/WebPage/WebPage.h:
792         * WebProcess/WebPage/WebPage.messages.in:
793
794 2019-02-01  Jer Noble  <jer.noble@apple.com>
795
796         Make the WebKit default for media source based on the WebCore default.
797         https://bugs.webkit.org/show_bug.cgi?id=194172
798
799         Reviewed by Eric Carlson.
800
801         * Shared/WebPreferences.yaml:
802         * UIProcess/API/Cocoa/WKPreferences.mm:
803         (-[WKPreferences _setMediaSourceEnabled:]):
804         (-[WKPreferences _mediaSourceEnabled]):
805         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
806
807 2019-02-01  Simon Fraser  <simon.fraser@apple.com>
808
809         Force settings.acceleratedCompositingEnabled() to true for WebKit
810         https://bugs.webkit.org/show_bug.cgi?id=194166
811         rdar://problem/47694328
812
813         Reviewed by Tim Horton.
814
815         WebKit relies on accelerated compositing for its drawing areas to function correctly,
816         and sometimes clients (*cough* Safari *cough*) have bugs where they clobber the settings,
817         so force this setting to be always on (and release log if this happens).
818
819         * WebProcess/WebPage/WebPage.cpp:
820         (WebKit::WebPage::updatePreferences):
821
822 2019-02-01  Antti Koivisto  <antti@apple.com>
823
824         Don't use base layer() as the scroll layer in scrolling tree.
825         https://bugs.webkit.org/show_bug.cgi?id=194160
826
827         Reviewed by Simon Fraser.
828
829         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
830         (ArgumentCoder<ScrollingStateNode>::encode):
831         (ArgumentCoder<ScrollingStateNode>::decode):
832         (ArgumentCoder<ScrollingStateScrollingNode>::encode):
833         (ArgumentCoder<ScrollingStateScrollingNode>::decode):
834         (WebKit::dump):
835         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
836         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
837         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
838         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
839         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
840         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateBeforeChildren):
841         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
842         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateBeforeChildren):
843         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
844         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateBeforeChildren):
845         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
846
847 2019-02-01  Michael Catanzaro  <mcatanzaro@igalia.com>
848
849         [SOUP] Improve use of SoupCookiePersistentStorageType
850         https://bugs.webkit.org/show_bug.cgi?id=194103
851
852         Reviewed by Carlos Garcia Campos.
853
854         Turn it into an enum class, and stop casting it to and from uint32_t.
855
856         * NetworkProcess/Cookies/WebCookieManager.h:
857         * NetworkProcess/Cookies/WebCookieManager.messages.in:
858         * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp:
859         (WebKit::WebCookieManager::setCookiePersistentStorage):
860         * NetworkProcess/NetworkSessionCreationParameters.cpp:
861         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
862         (WebKit::NetworkSessionCreationParameters::decode):
863         * NetworkProcess/NetworkSessionCreationParameters.h:
864         * Shared/soup/SoupCookiePersistentStorageType.h:
865         (): Deleted.
866         * UIProcess/API/glib/WebKitCookieManager.cpp:
867         * UIProcess/WebCookieManagerProxy.h:
868         * UIProcess/soup/WebCookieManagerProxySoup.cpp:
869         (WebKit::WebCookieManagerProxy::setCookiePersistentStorage):
870         (WebKit::WebCookieManagerProxy::getCookiePersistentStorage const):
871
872 2019-02-01  Per Arne Vollan  <pvollan@apple.com>
873
874         [macOS] Revert parts of r240811, since it causes kernel panics.
875         https://bugs.webkit.org/show_bug.cgi?id=194061
876
877         Unreviewed crash fix.
878
879         * WebProcess/com.apple.WebProcess.sb.in:
880
881 2019-02-01  Michael Catanzaro  <mcatanzaro@igalia.com>
882
883         [SOUP] Improve use of PAL::SessionID in WebKitCookieManager
884         https://bugs.webkit.org/show_bug.cgi?id=194092
885
886         Reviewed by Carlos Garcia Campos.
887
888         Always get it from the data store instead of assuming the default session ID, and add a
889         helper function for this.
890
891         * UIProcess/API/glib/WebKitCookieManager.cpp:
892         (_WebKitCookieManagerPrivate::sessionID const):
893         (_WebKitCookieManagerPrivate::~_WebKitCookieManagerPrivate):
894         (webkitCookieManagerCreate):
895         (webkit_cookie_manager_set_persistent_storage):
896         (webkit_cookie_manager_set_accept_policy):
897         (webkit_cookie_manager_get_accept_policy):
898         (webkit_cookie_manager_add_cookie):
899         (webkit_cookie_manager_get_cookies):
900         (webkit_cookie_manager_delete_cookie):
901
902 2019-01-31  Takashi Komori  <Takashi.Komori@sony.com>
903
904         [Curl] Remove unnecessary member from NetworkStorageSession.
905         https://bugs.webkit.org/show_bug.cgi?id=194137
906
907         Reviewed by Don Olmstead.
908
909         * NetworkProcess/curl/NetworkProcessCurl.cpp:
910         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
911
912 2019-01-31  Jiewen Tan  <jiewen_tan@apple.com>
913
914         Unreviewed, build fix after r240805
915
916         This patch reverts the BlockPtr change since it breaks iOS builds.
917
918         * UIProcess/Cocoa/NavigationState.mm:
919         (WebKit::tryInterceptNavigation):
920
921 2019-01-31  Chris Dumez  <cdumez@apple.com>
922
923         Page zoom level is lost after a process swap or a crash
924         https://bugs.webkit.org/show_bug.cgi?id=194105
925         <rdar://problem/47610781>
926
927         Reviewed by Alex Christensen.
928
929         Previously, when the client would call setPageAndTextZoomFactors() on the WebPageProxy,
930         we would update the WebPageProxy's corresponding data members and send an IPC to the
931         WebProcess to apply the zoom factors.
932
933         The issue is that on process crash or process-swap, we never communicate those zoom factors
934         to the new WebProcess. Even if the client were to call setPageAndTextZoomFactors() with
935         the same factors again, it would be a no-op since the WebPageProxy's data members already
936         reflect the expected values.
937
938         To address the issue, pass both the page zoom and the text zoom factors to the WebProcess
939         via WebPageCreationParameters. This way, there is no need to send an extra IPC and we're
940         sure the WebPageProxy's factors are properly applied to the WebPage on WebContent process
941         side upon creation (whether after a crash or a process swap).
942
943         * Shared/WebPageCreationParameters.cpp:
944         (WebKit::WebPageCreationParameters::encode const):
945         (WebKit::WebPageCreationParameters::decode):
946         * Shared/WebPageCreationParameters.h:
947         * UIProcess/WebPageProxy.cpp:
948         (WebKit::WebPageProxy::creationParameters):
949         * WebProcess/WebPage/WebPage.cpp:
950
951 2019-01-31  Per Arne Vollan  <pvollan@apple.com>
952
953         [macOS] Disable permissive call logging in sandbox
954         https://bugs.webkit.org/show_bug.cgi?id=194061
955
956         Reviewed by Alexey Proskuryakov.
957
958         Strict call filtering should be reenabled.
959
960         * WebProcess/com.apple.WebProcess.sb.in:
961
962 2019-01-31  Per Arne Vollan  <pvollan@apple.com>
963
964         [macOS] Crash when control-clicking or copying text rendered with a web font
965         https://bugs.webkit.org/show_bug.cgi?id=193913
966         <rdar://problem/47541039>
967
968         Reviewed by Brent Fulgham.
969
970         On older versions of macOS, allowing mach lookup to com.apple.FontObjectsServer is needed.
971
972         * WebProcess/com.apple.WebProcess.sb.in:
973
974 2019-01-31  Benjamin Poulain  <benjamin@webkit.org>
975
976         Remove WKPageIsWebProcessResponsive
977         https://bugs.webkit.org/show_bug.cgi?id=194096
978
979         Reviewed by Alex Christensen.
980
981         It is not used by any client.
982
983         It is also bad API. It is better to let WebKit track
984         responsiveness and tell the client with processDidBecomeResponsive.
985
986         * UIProcess/API/C/WKPage.cpp:
987         (WKPageIsWebProcessResponsive): Deleted.
988         * UIProcess/API/C/WKPagePrivate.h:
989         * UIProcess/WebPageProxy.cpp:
990         (WebKit::WebPageProxy::isWebProcessResponsive): Deleted.
991         * UIProcess/WebPageProxy.h:
992
993 2019-01-31  Alex Christensen  <achristensen@webkit.org>
994
995         Revert r238819 which is unneeded and caused a performance regression.
996         https://bugs.webkit.org/show_bug.cgi?id=192272
997         <rdar://problem/46664625>
998
999         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
1000         (API::InjectedBundle::PageLoaderClient::didStartProvisionalLoadForFrame):
1001         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
1002         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
1003         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1004         (PageLoaderClient::didStartProvisionalLoadForFrame):
1005         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
1006         (WebKit::InjectedBundlePageLoaderClient::didStartProvisionalLoadForFrame):
1007         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
1008         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1009         (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):
1010         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1011
1012 2019-01-31  Jiewen Tan  <jiewen_tan@apple.com>
1013
1014         Formalize WebKitAdditions mechanism of LoadOptimizer
1015         https://bugs.webkit.org/show_bug.cgi?id=193886
1016         <rdar://problem/47696809>
1017
1018         Reviewed by Brent Fulgham.
1019
1020         This patch does the following few things:
1021         1) formalizes WebKitAdditions mechanism of LoadOptimizer;
1022         2) modernizes AppLinks code in tryInterceptNavigation to use BlockPtr;
1023         3) lets AppLinks have higher precedence than LoadOptimizer.
1024
1025         * SourcesCocoa.txt:
1026         * UIProcess/Cocoa/LoadOptimizer.h: Removed.
1027         * UIProcess/Cocoa/LoadOptimizer.mm: Removed.
1028         * UIProcess/Cocoa/NavigationState.mm:
1029         (WebKit::tryOptimizingLoad):
1030         (WebKit::tryInterceptNavigation):
1031         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1032         (WebKit::WebsiteDataStore::WebsiteDataStore):
1033         * UIProcess/WebsiteData/WebsiteDataStore.h:
1034         (WebKit::WebsiteDataStore::loadOptimizer): Deleted.
1035         * WebKit.xcodeproj/project.pbxproj:
1036
1037 2019-01-31  Chris Dumez  <cdumez@apple.com>
1038
1039         Regression(PSON) Crash under WebProcessProxy::canTerminateChildProcess()
1040         https://bugs.webkit.org/show_bug.cgi?id=194094
1041         <rdar://problem/47580753>
1042
1043         Reviewed by Ryosuke Niwa.
1044
1045         If a SuspendedPageProxy gets destroyed while a WebPageProxy is waiting for its to finish to suspend,
1046         call the "failure to suspend" completion handler asynchronously instead of synchronouly to make sure
1047         the completion handler cannot try and use the suspended page proxy while it is being destroyed.
1048
1049         * UIProcess/SuspendedPageProxy.cpp:
1050         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
1051
1052 2019-01-31  Timothy Hatcher  <timothy@apple.com>
1053
1054         Fix LSAppLink deprecation warnings.
1055         https://bugs.webkit.org/show_bug.cgi?id=194097
1056
1057         Unreviewed build fix.
1058
1059         * UIProcess/ios/WKActionSheetAssistant.mm:
1060         (-[WKActionSheetAssistant _appendOpenActionsForURL:actions:elementInfo:]):
1061
1062 2019-01-30  Simon Fraser  <simon.fraser@apple.com>
1063
1064         [Mac] Implement basic hit testing in the scrolling tree
1065         https://bugs.webkit.org/show_bug.cgi?id=172917
1066         <rdar://problem/34215516>
1067
1068         Reviewed by Antti Koivisto.
1069
1070         Changed return types, "using namespace WebCore" in ScrollingTreeFrameScrollingNodeRemoteMac.cpp.
1071
1072         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1073         (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
1074         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
1075         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.h:
1076         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm:
1077         (WebKit::ScrollerPairMac::handleWheelEvent):
1078         (WebKit::ScrollerPairMac::handleMouseEvent):
1079         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp:
1080         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleWheelEvent):
1081         (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::handleMouseEvent):
1082         * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h:
1083
1084 2019-01-31  Michael Catanzaro  <mcatanzaro@igalia.com>
1085
1086         [SOUP] Move cookiePersistentStoragePath and cookiePersistentStorageType from NetworkProcess to NetworkSession
1087         https://bugs.webkit.org/show_bug.cgi?id=194075
1088
1089         Reviewed by Alex Christensen.
1090
1091         Move cookiePersistentStoragePath and cookiePersistentStorageType from NetworkProcess to
1092         NetworkSession to reduce globals. This removes two of the six soup-specific variables in
1093         NetworkProcessCreationParameters
1094
1095         * NetworkProcess/Cookies/WebCookieManager.h:
1096         * NetworkProcess/Cookies/WebCookieManager.messages.in:
1097         * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp:
1098         (WebKit::WebCookieManager::setCookiePersistentStorage):
1099         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1100         (WebKit::NetworkProcessCreationParameters::encode const):
1101         (WebKit::NetworkProcessCreationParameters::decode):
1102         * NetworkProcess/NetworkProcessCreationParameters.h:
1103         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1104         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
1105         (WebKit::NetworkSessionCreationParameters::encode const):
1106         (WebKit::NetworkSessionCreationParameters::decode):
1107         * NetworkProcess/NetworkSessionCreationParameters.h:
1108         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1109         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
1110         * NetworkProcess/soup/NetworkSessionSoup.cpp:
1111         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
1112         * SourcesGTK.txt:
1113         * SourcesWPE.txt:
1114         * UIProcess/API/glib/WebKitCookieManager.cpp:
1115         (webkit_cookie_manager_set_persistent_storage):
1116         * UIProcess/WebCookieManagerProxy.cpp:
1117         (WebKit::WebCookieManagerProxy::WebCookieManagerProxy):
1118         * UIProcess/WebCookieManagerProxy.h:
1119         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1120         (WebKit::WebsiteDataStore::parameters):
1121         * UIProcess/WebsiteData/WebsiteDataStore.h:
1122         * UIProcess/WebsiteData/curl/WebsiteDataStoreCurl.cpp:
1123         (WebKit::WebsiteDataStore::platformSetNetworkParameters):
1124         (WebKit::WebsiteDataStore::platformSetParameters): Deleted.
1125         * UIProcess/soup/WebCookieManagerProxySoup.cpp:
1126         (WebKit::WebCookieManagerProxy::setCookiePersistentStorage):
1127         (WebKit::WebCookieManagerProxy::getCookiePersistentStorage const):
1128         * UIProcess/soup/WebProcessPoolSoup.cpp:
1129         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1130
1131 2019-01-31  Ryosuke Niwa  <rniwa@webkit.org>
1132
1133         iOS: Crash in InteractiveUpdateHandler set by ViewGestureController::beginSwipeGesture
1134         https://bugs.webkit.org/show_bug.cgi?id=194083
1135
1136         Reviewed by Tim Horton.
1137
1138         We think this crash is a regression from r236966. Prior to r236966, we could only called
1139         removeSwipeSnapshot() only when m_provisionalOrSameDocumentLoadCallback was set but now
1140         we can call it either when m_snapshotRemovalTracker::start was called, or it had been reset.
1141         This can result in m_webPageProxyForBackForwardListForCurrentSwipe getting cleared before
1142         InteractiveUpdateHandler is called by UIGestureRecognizer, resulting in the crash.
1143
1144         This patch tries to restore the behavior prior to r236966 by only invoking removeSwipeSnapshot()
1145         when SnapshotRemovalTracker has a valid removal callback set.
1146
1147         Unfortunately no new tests since there is no reproducible test case, and neither API tests
1148         nor layout tests seem to have the capability to trigger swipe gestures via UIGestureRecognizer,
1149         which is required for this crash to occur. Notably, back-forward swipe tests I enabled in
1150         r240765 bypass UIKit and emulates the action instead.
1151
1152         * UIProcess/Cocoa/ViewGestureController.cpp:
1153         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
1154         * UIProcess/Cocoa/ViewGestureController.h:
1155         (WebKit::ViewGestureController::SnapshotRemovalTracker::hasRemovalCallback const):
1156
1157 2019-01-30  Benjamin Poulain  <benjamin@webkit.org>
1158
1159         <rdar://problem/47570443> Responsiveness timers are too expensive for frequent events
1160         https://bugs.webkit.org/show_bug.cgi?id=194003
1161
1162         Reviewed by Geoffrey Garen.
1163
1164         The problem here is specific to wheel events.
1165
1166         For every wheel event, we start a responsiveness timer and send
1167         a ping to the WebProcess. When the WebProcess respond, we stop the timer.
1168
1169         The cost of setting up the timers adds up since we get many events.
1170
1171         The first step to improve the situation was to switch ResponsivenessTimer
1172         to WebCore::Timer. Since WebCore::Timer reuse the same CFRunLoopTimerRef,
1173         we save the allocation/deallocation, insertion in the event loop, etc.
1174
1175         Using WebCore::Timer saves some instructions but we were still hitting
1176         the kernel at 120hz to set up then kill each timer.
1177         The second improvement of the patch is to avoid that by not killing the timer
1178         when we hear back from the WebProcess.
1179
1180         Instead of killing the timer, we let it run and ignore the result.
1181         When the next event comes, we reschedule the existing timer.
1182         This brings down the timers to 60Hz, the same rate as the events.
1183
1184         The very last event does time out. In that case, we have a bad idle wake up:
1185         we wake up a sleeping CPU do do nothing.
1186         In the case of wheel events, this is fine since we saved a bunch of CPU already.
1187         For all the other cases, I kept the normal operating mode to avoid the idle wake.
1188
1189         * UIProcess/ResponsivenessTimer.cpp:
1190         (WebKit::ResponsivenessTimer::ResponsivenessTimer):
1191         (WebKit::ResponsivenessTimer::invalidate):
1192         (WebKit::ResponsivenessTimer::timerFired):
1193         (WebKit::ResponsivenessTimer::start):
1194         (WebKit::ResponsivenessTimer::startWithLazyStop):
1195         (WebKit::ResponsivenessTimer::stop):
1196         (WebKit::ResponsivenessTimer::processTerminated):
1197         (WebKit::ResponsivenessTimer::~ResponsivenessTimer): Deleted.
1198         * UIProcess/ResponsivenessTimer.h:
1199         * UIProcess/WebPageProxy.cpp:
1200         (WebKit::WebPageProxy::sendWheelEvent):
1201         * UIProcess/WebProcessProxy.cpp:
1202         (WebKit::WebProcessProxy::isResponsiveWithLazyStop):
1203         * UIProcess/WebProcessProxy.h:
1204
1205 2019-01-30  Daniel Bates  <dabates@apple.com>
1206
1207         [iOS] REGRESSION (r238635): Text area fails to re-focus after dismissal of keyboard on support.apple.com
1208         https://bugs.webkit.org/show_bug.cgi?id=193987
1209         <rdar://problem/47230785>
1210
1211         Reviewed by Tim Horton.
1212
1213         It is unnecessary to relinquish first responder status when a user explicitly dismissing
1214         the keyboard. Moreover, doing so prevents key commands from being intercepted when a
1215         hardware keyboard is subsequently attached.
1216         
1217         Following r238635 a page becomes focused (accepting of keyboard input) and defocused
1218         when the WKContentView becomes first responder and resigns first responder, respectively.
1219         When a user explicitly dismisses the keyboard by tapping Done (iPhone) or the hide keyboard
1220         button (iPad) then UIKit tells WKContentView to resign its first responder status only
1221         to make its superview, WKWebView, first responder. When a person subsequently taps on the
1222         page again, the WKContentView requests to become the first responder. However changes to
1223         page focus are not guaranteed to be sent to the WebProcess immediately (WebPageProxy::activityStateDidChange()
1224         will schedule an update). In particular, they are not guaranteed to be sent before the
1225         WebProcess is told about a tap. Therefore, the WebProcess has out-of-date information on
1226         focus state of the page. Instead we should detect when WKWebView is being asked to resign
1227         as a result of the keyboard dismissal and refuse the request, taking care to end the current
1228         editing session, blur the focused element, and dismiss the on-screen keyboard.
1229
1230         * Platform/spi/ios/UIKitSPI.h: Expose some SPI.
1231         * UIProcess/ios/WKContentViewInteraction.h:
1232         * UIProcess/ios/WKContentViewInteraction.mm:
1233         (-[WKContentView setupInteraction]): Register to receive notifications whenever a user
1234         explicitly dismisses the keyboard.
1235         (-[WKContentView resignFirstResponderForWebView]): If we are being asked to resign as a
1236         result of a user explicitly dismissing the keyboard then refuse to resign.
1237         (-[WKContentView _keyboardDidRequestDismissal:]): Update state, if applicable.
1238
1239 2019-01-30  Keith Rollin  <krollin@apple.com>
1240
1241         Add default constructor for NetworkActivityTracker
1242         https://bugs.webkit.org/show_bug.cgi?id=194058
1243         <rdar://problem/47685457>
1244
1245         Reviewed by Chris Dumez.
1246
1247         ResourceNetworkActivityTracker has a default constructor. It also has
1248         a NetworkActivityTracker data member, which does not have a default
1249         constructor. This will cause some compilers to complain -- they can't
1250         default-create a ResourceNetworkActivityTracker because they can't
1251         default-create its data members. Address this by adding a default
1252         constructor for NetworkActivityTracker.
1253
1254         * NetworkProcess/NetworkActivityTracker.h:
1255
1256 2019-01-30  Daniel Steffen  <dsteffen@apple.com>
1257
1258         <rdar://problem/29471922> Safari should switch from the legacy denap SPI to handling vouchers
1259         https://bugs.webkit.org/show_bug.cgi?id=193992
1260
1261         Reviewed by Geoffrey Garen.
1262
1263         The denap SPI is deprecated.
1264         The new way of staying out of AppNap is through a voucher.
1265
1266         * Platform/IPC/mac/ConnectionMac.mm:
1267         (IPC::readFromMachPort):
1268         * Platform/IPC/mac/ImportanceAssertion.h:
1269         (IPC::ImportanceAssertion::ImportanceAssertion):
1270         (IPC::ImportanceAssertion::~ImportanceAssertion):
1271
1272 2019-01-30  Chris Dumez  <cdumez@apple.com>
1273
1274         Fix crashes when trying to ref the CallbackAggregator in NetworkProcess
1275         https://bugs.webkit.org/show_bug.cgi?id=194054
1276
1277         Reviewed by Brent Fulgham.
1278
1279         The callback aggregators should be ThreadSafeRefCounted since they are passed to other threads.
1280
1281         * NetworkProcess/NetworkProcess.cpp:
1282         (WebKit::NetworkProcess::fetchWebsiteData):
1283         (WebKit::NetworkProcess::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
1284         (WebKit::NetworkProcess::topPrivatelyControlledDomainsWithWebsiteData):
1285
1286 2019-01-30  Daniel Bates  <dabates@apple.com>
1287
1288         [iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content-editable element
1289         https://bugs.webkit.org/show_bug.cgi?id=192824
1290         <rdar://problem/47100332>
1291
1292         Reviewed by Wenson Hsieh.
1293
1294         Use the same code path for key events to editable elements and non-editable elements.
1295
1296         Currently we have different code paths for hardware key events depending on whether the active element
1297         is editable or non-editable. Historically to support dispatching DOM keyboard events for hardware key
1298         presses this differentiation was a necessary workaround for UIKit's event processing precedence of
1299         interpreting key events for system text editing commands and app commands before dispatching unhandled
1300         key events to WebKit. This workaround intercepted raw key UIEvents and manually reconstructed a
1301         WebEvent from it. However there is not enough information in an UIEvent to reconstruct a WebEvent that
1302         is identical to the WebEvent that UIKit would have dispatched. In particular, keyup UIEvents always have
1303         empty modified and unmodified input strings. The UIKit keyboard machinery maintains additional state
1304         that is necessary to manufacture the correct WebEvent corresponding to a UIEvent.
1305
1306         As a side benefit of this change, with the exception of modifier flag changes, both hardware and software
1307         key events use the same code path.
1308
1309         * UIProcess/ios/WKContentViewInteraction.h:
1310         * UIProcess/ios/WKContentViewInteraction.mm:
1311         (-[WKContentView shouldShowAutomaticKeyboardUI]): Extracted code from _requiresKeyboardWhenFirstResponder
1312         (-[WKContentView _disableAutomaticKeyboardUI]): Implement UIKit SPI to prevent showing the keyboard UI
1313         when there is no focused element now that we are no longer intercepting key UIEvents. Formerly the
1314         keyboard UI was disabled as a side effect of not becoming first responder when there was no focused
1315         element (by returning NO in -_requiresKeyboardWhenFirstResponder).
1316         (-[WKContentView _requiresKeyboardWhenFirstResponder]): Always return YES when building with USE(UIKIT_KEYBOARD_ADDITIONS)
1317         so that we always accept key events. Instead of selectively replying to create a keyboard as a means of
1318         hiding the automatic keyboard UI we now implement _disableAutomaticKeyboardUI to selectively hide the
1319         automatic keyboard UI.
1320         (-[WKContentView textInputTraits]): Do not update traits when the keyboard is going to be dismissed
1321         now that we require a keyboard when first responder even if the focused element is non-editable.
1322         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): Skip logic for re-sending UIEvents to UIKit
1323         as UIKit now processes the event first. This logic was necessary in order to finally allow UIKit
1324         its chance to interpret the UIEvent, we intercepted, for app key commands.
1325         (-[WKContentView _elementDidBlur]): Call [self _endEditing] so that we dismiss any open form controls
1326         (e.g. a <select> popover menu). Currently this happens either by -_requiresKeyboardWhenFirstResponder
1327         responding NO when switching to another field or pressing Tab or Shift + Tab key command, which we will
1328         no longer use when building with USE(UIKIT_KEYBOARD_ADDITIONS) once I land <https://bugs.webkit.org/show_bug.cgi?id=193048>.
1329         * UIProcess/ios/forms/WKFormSelectPopover.mm:
1330         (-[WKSelectPopover initWithView:hasGroups:]): Do not assign ourself as the keyboard delegate. Otherwise,
1331         type ahead and tab cycling will not work. Currently type ahead and tab cycling work by using the non-
1332         editable code path via -_handleKeyUIEvent. Now that we no longer differentiate between key events for
1333         editable and non-editable elements we need to ensure that the WKContentView is the keyboard delegate
1334         when the popover is presented.
1335
1336 2019-01-30  Per Arne Vollan  <pvollan@apple.com>
1337
1338         [macOS] Sandbox fails to compile on 10.12
1339         https://bugs.webkit.org/show_bug.cgi?id=194035
1340         <rdar://problem/47651260>
1341
1342         Reviewed by Brent Fulgham.
1343
1344         This was caused by the commit <https://trac.webkit.org/changeset/239994>, which is only valid for
1345         10.14 and later.
1346
1347         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
1348         * WebProcess/com.apple.WebProcess.sb.in:
1349
1350 2019-01-29  Conrad Shultz  <conrad_shultz@apple.com>
1351
1352         Ensure image picker sourceType is set before cameraDevice
1353         https://bugs.webkit.org/show_bug.cgi?id=193998
1354
1355         Reviewed by Beth Dakin.
1356
1357         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1358         (-[WKFileUploadPanel _showPhotoPickerWithSourceType:]):
1359
1360 2019-01-30  Chris Dumez  <cdumez@apple.com>
1361
1362         Regression(PSON) Load hang can occur on history navigation
1363         https://bugs.webkit.org/show_bug.cgi?id=194030
1364         <rdar://problem/47656939>
1365
1366         Reviewed by Antti Koivisto.
1367
1368         We do not support having more than one WebPage in a WebProcess with the same page ID. As a result,
1369         if we decide to reuse an existing process on process-swap, we need to make sure that we either use
1370         its suspended page (when possible, meaning that it is for the right HistoryItem / page) or we need
1371         make sure we drop the existing suspended page for this process / pagePID combination, so that the
1372         WebPage on WebProcess side gets closed before we attempt to do the new load.
1373
1374         We were doing this correctly in 2 places in WebProcessPool::processForNavigationInternal() but failed
1375         to do so in a third place, when doing back to a HistoryItem which does not have a SuspendedPage but
1376         whose process is still alive (presumably because it is kept alive by another suspended page). This
1377         patch fixes this third place to remove any suspended page in the process for the current page before
1378         reusing the process. An assertion was also added to the call site in
1379         WebPageProxy::receivedNavigationPolicyDecision() to make sure we catch this more easily in the
1380         future.
1381
1382         * UIProcess/WebPageProxy.cpp:
1383         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1384         * UIProcess/WebProcessPool.cpp:
1385         (WebKit::WebProcessPool::processForNavigationInternal):
1386         (WebKit::WebProcessPool::removeAllSuspendedPagesForPage):
1387         (WebKit::WebProcessPool::hasSuspendedPageFor const):
1388         * UIProcess/WebProcessPool.h:
1389
1390 2019-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1391
1392         [GTK][Wayland] REGRESSION(r240712): Clear the GL context if it's the current one on dispose
1393         https://bugs.webkit.org/show_bug.cgi?id=194024
1394
1395         Reviewed by Michael Catanzaro.
1396
1397         Fixes a crash in gdk_gl_context_dispose().
1398
1399         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
1400         (WebKit::AcceleratedBackingStoreWayland::~AcceleratedBackingStoreWayland):
1401
1402 2019-01-30  Antti Koivisto  <antti@apple.com>
1403
1404         Crash in WebKit::RemoteLayerTreePropertyApplier::updateChildren
1405         https://bugs.webkit.org/show_bug.cgi?id=193897
1406         <rdar://problem/47427750>
1407
1408         Reviewed by Simon Fraser.
1409
1410         There has been some null pointer crashes where we fail to find a remote layer tree node that matches
1411         the transaction properties.
1412
1413         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
1414         (WebKit::RemoteLayerTreePropertyApplier::updateChildren):
1415
1416         Null check the nodes.
1417
1418 2019-01-30  Simon Fraser  <simon.fraser@apple.com>
1419
1420         Add some basic geometry information to the scrolling tree
1421         https://bugs.webkit.org/show_bug.cgi?id=194002
1422
1423         Reviewed by Antti Koivisto.
1424
1425         Add a comment explaining why we don't need to encode/decode ParentRelativeScrollableRect.
1426
1427         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1428         (ArgumentCoder<ScrollingStateFrameHostingNode>::encode):
1429
1430 2019-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1431
1432         [GTK] gdk_cairo_draw_from_gl() in AcceleratedBackingStoreWayland fails in GtkInspector's magnifier
1433         https://bugs.webkit.org/show_bug.cgi?id=193903
1434
1435         Reviewed by Michael Catanzaro.
1436
1437         The problem is that the GL context used by WaylandCompositor can't share resources with the one used by GTK+
1438         when painting with gdk_cairo_draw_from_gl(). Accelerated compositing in Wayland works only because
1439         WaylandCompositor makes the context current only once on initialization. So, when we render the first frame on
1440         accelerated compositing mode, GTK+ is rendering in non-GL mode, and switches to the GL mode when
1441         gdk_cairo_draw_from_gl() is called. Since GTK+ didn't have a GL context yet, the first frame is always rendered
1442         by GTK+ using the software fallback (glReadPixels). The thing is that the first time gdk_cairo_draw_from_gl() is
1443         called, GTK+ creates a GL context for painting that is made current, and it will remain the current one
1444         forever. The first frame fails to render with "GL_INVALID_OPERATION in glBindTexture(non-gen name)" because the
1445         texture created in WaylandCompositor GL context can't be accessed from GTK+ GL context. The following frames are
1446         handled with the GTK+ GL context. I would say this works by casuality and it could be the cause of other
1447         accelerated compositing issues in Wayland.
1448
1449         We need to create our own GdkGLContext for the WebView, and use that in the WaylandCompositor. When the
1450         GdkGLContext is created, the GTK+ GL context for painting is used as a shared context, ensuring that resources
1451         created in the new context will be accessible from the painting one.
1452
1453         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1454         (webkitWebViewBaseMakeGLContextCurrent): Call AcceleratedBackingStore::makeContextCurrent().
1455         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
1456         * UIProcess/WebPageProxy.h:
1457         * UIProcess/gtk/AcceleratedBackingStore.h:
1458         (WebKit::AcceleratedBackingStore::makeContextCurrent): New virtual method only implemented by Wayland backend.
1459         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
1460         (WebKit::AcceleratedBackingStoreWayland::tryEnsureGLContext): Try to create a GL context with
1461         gdk_window_create_gl_context(), falling back to a WebCore::GLContext if it fails or GTK+ version is not new enough.
1462         (WebKit::AcceleratedBackingStoreWayland::makeContextCurrent): Make the GL context current.
1463         (WebKit::AcceleratedBackingStoreWayland::paint): Check if we have a GdkGLContext before trying to use gdk_cairo_draw_from_gl().
1464         (WebKit::AcceleratedBackingStoreWayland::canGdkUseGL const): Deleted.
1465         * UIProcess/gtk/AcceleratedBackingStoreWayland.h:
1466         * UIProcess/gtk/WaylandCompositor.cpp:
1467         (WebKit::WaylandCompositor::Surface::Surface): Move the texture creation to setWebPage(), since we need the
1468         WebView GL context.
1469         (WebKit::WaylandCompositor::Surface::~Surface): Move the code to destroy GL resources to setWebPage().
1470         (WebKit::WaylandCompositor::Surface::setWebPage): Create the texture when a new page is set and destroy GL
1471         resources when unset.
1472         (WebKit::WaylandCompositor::Surface::prepareTextureForPainting): Make WebView GL context current.
1473         (WebKit::WaylandCompositor::Surface::commit): Ditto.
1474         (WebKit::WaylandCompositor::initializeEGL): Use a temporary GLContext.
1475         * UIProcess/gtk/WaylandCompositor.h:
1476         * UIProcess/gtk/WebPageProxyGtk.cpp:
1477         (WebKit::WebPageProxy::makeGLContextCurrent): Call webkitWebViewBaseMakeGLContextCurrent().
1478
1479 2019-01-29  Ryosuke Niwa  <rniwa@webkit.org>
1480
1481         iOS: Nullptr crash in WebPage::getPositionInformation dereferencing an input element for data list
1482         https://bugs.webkit.org/show_bug.cgi?id=193996
1483
1484         Reviewed by Wenson Hsieh.
1485
1486         Added a missing nullptr check.
1487
1488         * WebProcess/WebPage/ios/WebPageIOS.mm:
1489         (WebKit::WebPage::getPositionInformation):
1490
1491 2019-01-29  Simon Fraser  <simon.fraser@apple.com>
1492
1493         Add nodes to the scrolling tree in z-index order.
1494         https://bugs.webkit.org/show_bug.cgi?id=192529
1495         <rdar://problem/47402708>
1496
1497         Reviewed by Dean Jackson.
1498
1499         FrameHosting nodes have layers, so need to update them.
1500
1501         * Platform/Logging.cpp:
1502         (WebKit::initializeLogChannelsIfNecessary):
1503         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1504         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1505
1506 2019-01-29  Alex Christensen  <achristensen@webkit.org>
1507
1508         Change NetworkConnectionToWebProcess* to NetworkConnectionToWebProcess& where possible
1509         https://bugs.webkit.org/show_bug.cgi?id=193974
1510
1511         Reviewed by Tim Horton.
1512
1513         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
1514         (WebKit::NetworkBlobRegistry::registerFileBlobURL):
1515         (WebKit::NetworkBlobRegistry::registerBlobURL):
1516         (WebKit::NetworkBlobRegistry::registerBlobURLOptionallyFileBacked):
1517         (WebKit::NetworkBlobRegistry::registerBlobURLForSlice):
1518         (WebKit::NetworkBlobRegistry::unregisterBlobURL):
1519         (WebKit::NetworkBlobRegistry::blobSize):
1520         (WebKit::NetworkBlobRegistry::connectionToWebProcessDidClose):
1521         * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
1522         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1523         (WebKit::NetworkConnectionToWebProcess::didClose):
1524         (WebKit::NetworkConnectionToWebProcess::registerFileBlobURL):
1525         (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
1526         (WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
1527         (WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
1528         (WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
1529         (WebKit::NetworkConnectionToWebProcess::unregisterBlobURL):
1530         (WebKit::NetworkConnectionToWebProcess::blobSize):
1531         * NetworkProcess/NetworkProcess.cpp:
1532         (WebKit::NetworkProcess::removeNetworkConnectionToWebProcess):
1533         * NetworkProcess/NetworkProcess.h:
1534
1535 2019-01-29  Youenn Fablet  <youenn@apple.com>
1536
1537         Adopt new SPI to evaluate server certificate trust
1538         https://bugs.webkit.org/show_bug.cgi?id=193355
1539
1540         Reviewed by Alex Christensen.
1541
1542         Use new SPI provided in NSURLSession to evaluate server certificates.
1543         If successful, let loading proceed as usual.
1544         Otherwise, go to the UIProcess to ask for a decision on continuing the load or not.
1545
1546         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1547         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1548         (canNSURLSessionTrustEvaluate):
1549         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
1550         (WebKit::NetworkSessionCocoa::continueDidReceiveChallenge):
1551
1552 2019-01-29  Tim Horton  <timothy_horton@apple.com>
1553
1554         Fix the build
1555
1556         * UIProcess/ios/WKDrawingCoordinator.h:
1557         * UIProcess/ios/WKDrawingCoordinator.mm:
1558         * UIProcess/ios/WKDrawingView.mm:
1559
1560 2019-01-29  Alex Christensen  <achristensen@webkit.org>
1561
1562         Remove unused NetworkProcessProxy::writeBlobToFilePath
1563         https://bugs.webkit.org/show_bug.cgi?id=193990
1564
1565         Reviewed by Wenson Hsieh.
1566
1567         This code was only used in code that was introduced in r235202
1568         but that has since been refactored to not use blobs.  Its tests still pass.
1569         This removes the only UIProcess-controlled code that uses NetworkBlobRegistry::singleton.
1570
1571         * NetworkProcess/NetworkProcess.cpp:
1572         (WebKit::NetworkProcess::writeBlobToFilePath): Deleted.
1573         * NetworkProcess/NetworkProcess.h:
1574         * NetworkProcess/NetworkProcess.messages.in:
1575         * UIProcess/Cocoa/WebViewImpl.mm:
1576         (WebKit::WebViewImpl::writeToURLForFilePromiseProvider):
1577         * UIProcess/Network/NetworkProcessProxy.cpp:
1578         (WebKit::NetworkProcessProxy::writeBlobToFilePath): Deleted.
1579         * UIProcess/Network/NetworkProcessProxy.h:
1580         * UIProcess/WebPageProxy.cpp:
1581         (WebKit::WebPageProxy::writeBlobToFilePath): Deleted.
1582         * UIProcess/WebPageProxy.h:
1583
1584 2019-01-29  Devin Rousso  <drousso@apple.com>
1585
1586         Web Inspector: expose a way of determining if a detached frontend is for a remote target
1587         https://bugs.webkit.org/show_bug.cgi?id=193951
1588         <rdar://problem/47621366>
1589
1590         Reviewed by Joseph Pecoraro.
1591
1592         * UIProcess/WebInspectorProxy.h:
1593         (WebKit::WebInspectorProxy::InspectionTargetType): Added.
1594         (WebKit::WebInspectorProxy::createFrontendWindow):
1595         * UIProcess/mac/WebInspectorProxyMac.mm:
1596         (WebKit::WebInspectorProxy::createFrontendWindow):
1597         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
1598         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
1599         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
1600
1601         * UIProcess/API/Cocoa/_WKInspectorWindow.h: Moved from UIProcess/mac/WKInspectorWindow.h.
1602         * UIProcess/API/Cocoa/_WKInspectorWindow.mm: Moved from UIProcess/mac/WKInspectorWindow.mm.
1603         (-[WKInspectorWindow isRemote]): Added.
1604
1605         * Shared/API/Cocoa/_WKNSWindowExtras.mm:
1606         (-[NSWindow _web_isWebInspectorWindow]):
1607
1608         * PlatformMac.cmake:
1609         * SourcesCocoa.txt:
1610         * UnifiedSources-input.xcfilelist:
1611         * WebKit.xcodeproj/project.pbxproj:
1612
1613 2019-01-29  Alex Christensen  <achristensen@webkit.org>
1614
1615         Rename ChildProcess to AuxiliaryProcess
1616         https://bugs.webkit.org/show_bug.cgi?id=193943
1617
1618         Reviewed by Andy Estes.
1619
1620         "Child" implies that there is a parent, but I'm about to introduce a type of NetworkProcess that
1621         doesn't always have a parent, and may have many UIProcesses that it is the auxiliary for.
1622
1623         * CMakeLists.txt:
1624         * DerivedSources-input.xcfilelist:
1625         * DerivedSources-output.xcfilelist:
1626         * DerivedSources.make:
1627         * NetworkProcess/Cookies/WebCookieManager.cpp:
1628         * NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp:
1629         * NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm:
1630         (WebKit::initializeAuxiliaryProcess<NetworkProcess>):
1631         (WebKit::initializeChildProcess<NetworkProcess>): Deleted.
1632         * NetworkProcess/NetworkProcess.cpp:
1633         (WebKit::callExitSoon):
1634         (WebKit::NetworkProcess::NetworkProcess):
1635         (WebKit::NetworkProcess::didReceiveMessage):
1636         (WebKit::NetworkProcess::initializeConnection):
1637         (WebKit::NetworkProcess::terminate):
1638         (WebKit::NetworkProcess::initializeProcess):
1639         (WebKit::NetworkProcess::initializeProcessName):
1640         (WebKit::NetworkProcess::initializeSandbox):
1641         * NetworkProcess/NetworkProcess.h:
1642         * NetworkProcess/NetworkProcessSupplement.h:
1643         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1644         (WebKit::NetworkCache::Storage::deleteOldVersions):
1645         * NetworkProcess/ios/NetworkProcessIOS.mm:
1646         (WebKit::NetworkProcess::initializeProcess):
1647         (WebKit::NetworkProcess::initializeProcessName):
1648         (WebKit::NetworkProcess::initializeSandbox):
1649         * NetworkProcess/mac/NetworkProcessMac.mm:
1650         (WebKit::NetworkProcess::initializeProcess):
1651         (WebKit::NetworkProcess::initializeProcessName):
1652         (WebKit::NetworkProcess::initializeSandbox):
1653         * NetworkProcess/soup/NetworkProcessMainSoup.cpp:
1654         (WebKit::initializeAuxiliaryProcess<NetworkProcess>):
1655         (WebKit::NetworkProcessMainUnix):
1656         (WebKit::initializeChildProcess<NetworkProcess>): Deleted.
1657         * NetworkProcess/watchos/NetworkProximityManager.h:
1658         * NetworkProcess/watchos/NetworkProximityManager.mm:
1659         (WebKit::NetworkProximityManager::NetworkProximityManager):
1660         * NetworkProcess/win/NetworkProcessMainWin.cpp:
1661         (WebKit::initializeAuxiliaryProcess<NetworkProcess>):
1662         (WebKit::NetworkProcessMainWin):
1663         (WebKit::initializeChildProcess<NetworkProcess>): Deleted.
1664         * PlatformGTK.cmake:
1665         * PlatformMac.cmake:
1666         * PlatformWin.cmake:
1667         * PluginProcess/PluginProcess.cpp:
1668         (WebKit::PluginProcess::initializeProcess):
1669         (WebKit::PluginProcess::initializeConnection):
1670         (WebKit::PluginProcess::didReceiveMessage):
1671         (WebKit::PluginProcess::initializeProcessName):
1672         (WebKit::PluginProcess::initializeSandbox):
1673         * PluginProcess/PluginProcess.h:
1674         * PluginProcess/mac/PluginProcessMac.mm:
1675         (WebKit::PluginProcess::platformInitializeProcess):
1676         (WebKit::PluginProcess::initializeProcessName):
1677         (WebKit::PluginProcess::initializeSandbox):
1678         (WebKit::PluginProcess::stopRunLoop):
1679         * PluginProcess/unix/PluginProcessMainUnix.cpp:
1680         (WebKit::PluginProcessMainUnix):
1681         * PluginProcess/unix/PluginProcessUnix.cpp:
1682         (WebKit::PluginProcess::platformInitializeProcess):
1683         * Shared/Authentication/AuthenticationManager.cpp:
1684         (WebKit::AuthenticationManager::AuthenticationManager):
1685         * Shared/Authentication/AuthenticationManager.h:
1686         * Shared/AuxiliaryProcess.cpp: Copied from Source/WebKit/Shared/ChildProcess.cpp.
1687         (WebKit::AuxiliaryProcess::AuxiliaryProcess):
1688         (WebKit::AuxiliaryProcess::~AuxiliaryProcess):
1689         (WebKit::AuxiliaryProcess::didClose):
1690         (WebKit::AuxiliaryProcess::initialize):
1691         (WebKit::AuxiliaryProcess::setProcessSuppressionEnabled):
1692         (WebKit::AuxiliaryProcess::initializeProcess):
1693         (WebKit::AuxiliaryProcess::initializeProcessName):
1694         (WebKit::AuxiliaryProcess::initializeConnection):
1695         (WebKit::AuxiliaryProcess::addMessageReceiver):
1696         (WebKit::AuxiliaryProcess::removeMessageReceiver):
1697         (WebKit::AuxiliaryProcess::disableTermination):
1698         (WebKit::AuxiliaryProcess::enableTermination):
1699         (WebKit::AuxiliaryProcess::messageSenderConnection):
1700         (WebKit::AuxiliaryProcess::messageSenderDestinationID):
1701         (WebKit::AuxiliaryProcess::terminationTimerFired):
1702         (WebKit::AuxiliaryProcess::stopRunLoop):
1703         (WebKit::AuxiliaryProcess::platformStopRunLoop):
1704         (WebKit::AuxiliaryProcess::terminate):
1705         (WebKit::AuxiliaryProcess::shutDown):
1706         (WebKit::AuxiliaryProcess::registerURLSchemeServiceWorkersCanHandle const):
1707         (WebKit::AuxiliaryProcess::platformInitialize):
1708         (WebKit::AuxiliaryProcess::initializeSandbox):
1709         (WebKit::AuxiliaryProcess::didReceiveInvalidMessage):
1710         (WebKit::AuxiliaryProcess::didReceiveMemoryPressureEvent):
1711         (WebKit::ChildProcess::ChildProcess): Deleted.
1712         (WebKit::ChildProcess::~ChildProcess): Deleted.
1713         (WebKit::ChildProcess::didClose): Deleted.
1714         (WebKit::ChildProcess::initialize): Deleted.
1715         (WebKit::ChildProcess::setProcessSuppressionEnabled): Deleted.
1716         (WebKit::ChildProcess::initializeProcess): Deleted.
1717         (WebKit::ChildProcess::initializeProcessName): Deleted.
1718         (WebKit::ChildProcess::initializeConnection): Deleted.
1719         (WebKit::ChildProcess::addMessageReceiver): Deleted.
1720         (WebKit::ChildProcess::removeMessageReceiver): Deleted.
1721         (WebKit::ChildProcess::disableTermination): Deleted.
1722         (WebKit::ChildProcess::enableTermination): Deleted.
1723         (WebKit::ChildProcess::messageSenderConnection): Deleted.
1724         (WebKit::ChildProcess::messageSenderDestinationID): Deleted.
1725         (WebKit::ChildProcess::terminationTimerFired): Deleted.
1726         (WebKit::ChildProcess::stopRunLoop): Deleted.
1727         (WebKit::ChildProcess::platformStopRunLoop): Deleted.
1728         (WebKit::ChildProcess::terminate): Deleted.
1729         (WebKit::ChildProcess::shutDown): Deleted.
1730         (WebKit::ChildProcess::registerURLSchemeServiceWorkersCanHandle const): Deleted.
1731         (WebKit::ChildProcess::platformInitialize): Deleted.
1732         (WebKit::ChildProcess::initializeSandbox): Deleted.
1733         (WebKit::ChildProcess::didReceiveInvalidMessage): Deleted.
1734         (WebKit::ChildProcess::didReceiveMemoryPressureEvent): Deleted.
1735         * Shared/AuxiliaryProcess.h: Copied from Source/WebKit/Shared/ChildProcess.h.
1736         (WebKit::ChildProcess::parentProcessConnection const): Deleted.
1737         (WebKit::ChildProcess::messageReceiverMap): Deleted.
1738         (WebKit::ChildProcess::setTerminationTimeout): Deleted.
1739         (WebKit::ChildProcess::shouldOverrideQuarantine): Deleted.
1740         * Shared/AuxiliaryProcess.messages.in: Copied from Source/WebKit/Shared/ChildProcess.messages.in.
1741         * Shared/AuxiliaryProcessSupplement.h: Copied from Source/WebKit/Shared/ChildProcessSupplement.h.
1742         (WebKit::AuxiliaryProcessSupplement::~AuxiliaryProcessSupplement):
1743         (WebKit::ChildProcessSupplement::~ChildProcessSupplement): Deleted.
1744         (WebKit::ChildProcessSupplement::initializeConnection): Deleted.
1745         * Shared/ChildProcess.cpp: Removed.
1746         * Shared/ChildProcess.h: Removed.
1747         * Shared/ChildProcess.messages.in: Removed.
1748         * Shared/ChildProcessSupplement.h: Removed.
1749         * Shared/Cocoa/AuxiliaryProcessCocoa.mm: Copied from Source/WebKit/Shared/Cocoa/ChildProcessCocoa.mm.
1750         (WebKit::AuxiliaryProcess::didReceiveInvalidMessage):
1751         (WebKit::ChildProcess::didReceiveInvalidMessage): Deleted.
1752         * Shared/Cocoa/ChildProcessCocoa.mm: Removed.
1753         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
1754         (WebKit::initializeAuxiliaryProcess):
1755         (WebKit::XPCServiceInitializer):
1756         (WebKit::initializeChildProcess): Deleted.
1757         * Shared/WebSQLiteDatabaseTracker.cpp:
1758         (WebKit::WebSQLiteDatabaseTracker::WebSQLiteDatabaseTracker):
1759         (WebKit::WebSQLiteDatabaseTracker::hysteresisUpdated):
1760         (WebKit::m_childProcessType): Deleted.
1761         * Shared/WebSQLiteDatabaseTracker.h:
1762         * Shared/ios/AuxiliaryProcessIOS.mm: Copied from Source/WebKit/Shared/ios/ChildProcessIOS.mm.
1763         (WebKit::AuxiliaryProcess::platformInitialize):
1764         (WebKit::AuxiliaryProcess::initializeSandbox):
1765         (WebKit::AuxiliaryProcess::setQOS):
1766         (WebKit::AuxiliaryProcess::platformStopRunLoop):
1767         (WebKit::ChildProcess::platformInitialize): Deleted.
1768         (WebKit::ChildProcess::initializeSandbox): Deleted.
1769         (WebKit::ChildProcess::setQOS): Deleted.
1770         (WebKit::ChildProcess::platformStopRunLoop): Deleted.
1771         * Shared/ios/ChildProcessIOS.mm: Removed.
1772         * Shared/mac/AuxiliaryProcessMac.mm: Copied from Source/WebKit/Shared/mac/ChildProcessMac.mm.
1773         (WebKit::SandboxInfo::SandboxInfo):
1774         (WebKit::AuxiliaryProcess::launchServicesCheckIn):
1775         (WebKit::AuxiliaryProcess::platformInitialize):
1776         (WebKit::processStorageClass):
1777         (WebKit::sandboxDirectory):
1778         (WebKit::applySandbox):
1779         (WebKit::initializeSandboxParameters):
1780         (WebKit::AuxiliaryProcess::initializeSandbox):
1781         (WebKit::AuxiliaryProcess::stopNSAppRunLoop):
1782         (WebKit::AuxiliaryProcess::stopNSRunLoop):
1783         (WebKit::AuxiliaryProcess::platformStopRunLoop):
1784         (WebKit::AuxiliaryProcess::setQOS):
1785         (WebKit::AuxiliaryProcess::isSystemWebKit):
1786         (WebKit::ChildProcess::launchServicesCheckIn): Deleted.
1787         (WebKit::ChildProcess::platformInitialize): Deleted.
1788         (WebKit::ChildProcess::initializeSandbox): Deleted.
1789         (WebKit::ChildProcess::stopNSAppRunLoop): Deleted.
1790         (WebKit::ChildProcess::stopNSRunLoop): Deleted.
1791         (WebKit::ChildProcess::platformStopRunLoop): Deleted.
1792         (WebKit::ChildProcess::setQOS): Deleted.
1793         (WebKit::ChildProcess::isSystemWebKit): Deleted.
1794         * Shared/mac/ChildProcessMac.mm: Removed.
1795         * Shared/mac/SecItemShim.cpp:
1796         (WebKit::globalNetworkProcess):
1797         (WebKit::sendSecItemRequest):
1798         (WebKit::initializeSecItemShim):
1799         * Shared/mac/SecItemShim.h:
1800         * Shared/unix/AuxiliaryProcessMain.cpp: Copied from Source/WebKit/Shared/unix/ChildProcessMain.cpp.
1801         (WebKit::AuxiliaryProcessMainBase::parseCommandLine):
1802         (WebKit::ChildProcessMainBase::parseCommandLine): Deleted.
1803         * Shared/unix/AuxiliaryProcessMain.h: Copied from Source/WebKit/Shared/unix/ChildProcessMain.h.
1804         (WebKit::AuxiliaryProcessMainBase::takeInitializationParameters):
1805         (WebKit::initializeAuxiliaryProcess):
1806         (WebKit::AuxiliaryProcessMain):
1807         (WebKit::ChildProcessMainBase::platformInitialize): Deleted.
1808         (WebKit::ChildProcessMainBase::platformFinalize): Deleted.
1809         (WebKit::ChildProcessMainBase::takeInitializationParameters): Deleted.
1810         (WebKit::initializeChildProcess): Deleted.
1811         (WebKit::ChildProcessMain): Deleted.
1812         * Shared/unix/ChildProcessMain.cpp: Removed.
1813         * Shared/unix/ChildProcessMain.h: Removed.
1814         * Shared/win/AuxiliaryProcessMainWin.cpp: Copied from Source/WebKit/Shared/win/ChildProcessMainWin.cpp.
1815         (WebKit::AuxiliaryProcessMainBase::parseCommandLine):
1816         (WebKit::ChildProcessMainBase::parseCommandLine): Deleted.
1817         * Shared/win/ChildProcessMainWin.cpp: Removed.
1818         * Sources.txt:
1819         * SourcesCocoa.txt:
1820         * SourcesGTK.txt:
1821         * SourcesWPE.txt:
1822         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
1823         * UIProcess/Authentication/AuthenticationChallengeProxy.h:
1824         * UIProcess/AuxiliaryProcessProxy.cpp: Copied from Source/WebKit/UIProcess/ChildProcessProxy.cpp.
1825         (WebKit::AuxiliaryProcessProxy::AuxiliaryProcessProxy):
1826         (WebKit::AuxiliaryProcessProxy::~AuxiliaryProcessProxy):
1827         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
1828         (WebKit::AuxiliaryProcessProxy::connect):
1829         (WebKit::AuxiliaryProcessProxy::terminate):
1830         (WebKit::AuxiliaryProcessProxy::state const):
1831         (WebKit::AuxiliaryProcessProxy::sendMessage):
1832         (WebKit::AuxiliaryProcessProxy::addMessageReceiver):
1833         (WebKit::AuxiliaryProcessProxy::removeMessageReceiver):
1834         (WebKit::AuxiliaryProcessProxy::dispatchMessage):
1835         (WebKit::AuxiliaryProcessProxy::dispatchSyncMessage):
1836         (WebKit::AuxiliaryProcessProxy::didFinishLaunching):
1837         (WebKit::AuxiliaryProcessProxy::shutDownProcess):
1838         (WebKit::AuxiliaryProcessProxy::setProcessSuppressionEnabled):
1839         (WebKit::AuxiliaryProcessProxy::connectionWillOpen):
1840         (WebKit::ChildProcessProxy::ChildProcessProxy): Deleted.
1841         (WebKit::ChildProcessProxy::~ChildProcessProxy): Deleted.
1842         (WebKit::ChildProcessProxy::getLaunchOptions): Deleted.
1843         (WebKit::ChildProcessProxy::connect): Deleted.
1844         (WebKit::ChildProcessProxy::terminate): Deleted.
1845         (WebKit::ChildProcessProxy::state const): Deleted.
1846         (WebKit::ChildProcessProxy::sendMessage): Deleted.
1847         (WebKit::ChildProcessProxy::addMessageReceiver): Deleted.
1848         (WebKit::ChildProcessProxy::removeMessageReceiver): Deleted.
1849         (WebKit::ChildProcessProxy::dispatchMessage): Deleted.
1850         (WebKit::ChildProcessProxy::dispatchSyncMessage): Deleted.
1851         (WebKit::ChildProcessProxy::didFinishLaunching): Deleted.
1852         (WebKit::ChildProcessProxy::shutDownProcess): Deleted.
1853         (WebKit::ChildProcessProxy::setProcessSuppressionEnabled): Deleted.
1854         (WebKit::ChildProcessProxy::connectionWillOpen): Deleted.
1855         * UIProcess/AuxiliaryProcessProxy.h: Copied from Source/WebKit/UIProcess/ChildProcessProxy.h.
1856         (WebKit::AuxiliaryProcessProxy::send):
1857         (WebKit::AuxiliaryProcessProxy::sendSync):
1858         (WebKit::AuxiliaryProcessProxy::sendWithAsyncReply):
1859         (WebKit::ChildProcessProxy::send): Deleted.
1860         (WebKit::ChildProcessProxy::sendSync): Deleted.
1861         (WebKit::ChildProcessProxy::connection const): Deleted.
1862         (WebKit::ChildProcessProxy::hasConnection const): Deleted.
1863         (WebKit::ChildProcessProxy::processIdentifier const): Deleted.
1864         (WebKit::ChildProcessProxy::canSendMessage const): Deleted.
1865         (WebKit::ChildProcessProxy::coreProcessIdentifier const): Deleted.
1866         (WebKit::ChildProcessProxy::platformGetLaunchOptions): Deleted.
1867         (WebKit::ChildProcessProxy::sendWithAsyncReply): Deleted.
1868         * UIProcess/ChildProcessProxy.cpp: Removed.
1869         * UIProcess/ChildProcessProxy.h: Removed.
1870         * UIProcess/Downloads/DownloadProxyMap.cpp:
1871         (WebKit::DownloadProxyMap::DownloadProxyMap):
1872         * UIProcess/Downloads/DownloadProxyMap.h:
1873         * UIProcess/Network/NetworkProcessProxy.cpp:
1874         (WebKit::NetworkProcessProxy::NetworkProcessProxy):
1875         (WebKit::NetworkProcessProxy::getLaunchOptions):
1876         (WebKit::NetworkProcessProxy::createDownloadProxy):
1877         (WebKit::NetworkProcessProxy::didFinishLaunching):
1878         * UIProcess/Network/NetworkProcessProxy.h:
1879         * UIProcess/Plugins/PluginProcessProxy.cpp:
1880         (WebKit::PluginProcessProxy::getLaunchOptions):
1881         (WebKit::PluginProcessProxy::sendMemoryPressureEvent):
1882         * UIProcess/Plugins/PluginProcessProxy.h:
1883         * UIProcess/ServiceWorkerProcessProxy.h:
1884         * UIProcess/WebPageProxy.cpp:
1885         (WebKit::WebPageProxy::finishAttachingToWebProcess):
1886         * UIProcess/WebProcessPool.cpp:
1887         (WebKit::WebProcessPool::sendMemoryPressureEvent):
1888         (WebKit::WebProcessPool::registerURLSchemeServiceWorkersCanHandle):
1889         * UIProcess/WebProcessProxy.cpp:
1890         (WebKit::WebProcessProxy::WebProcessProxy):
1891         (WebKit::WebProcessProxy::getLaunchOptions):
1892         (WebKit::WebProcessProxy::didFinishLaunching):
1893         (WebKit::WebProcessProxy::maybeShutDown):
1894         (WebKit::WebProcessProxy::canTerminateAuxiliaryProcess):
1895         (WebKit::WebProcessProxy::shouldTerminate):
1896         (WebKit::WebProcessProxy::requestTermination):
1897         (WebKit::WebProcessProxy::canTerminateChildProcess): Deleted.
1898         * UIProcess/WebProcessProxy.h:
1899         * UnifiedSources-input.xcfilelist:
1900         * WebKit.xcodeproj/project.pbxproj:
1901         * WebProcess/WebProcess.cpp:
1902         (WebKit::WebProcess::initializeProcess):
1903         (WebKit::WebProcess::initializeConnection):
1904         (WebKit::WebProcess::terminate):
1905         (WebKit::WebProcess::didReceiveMessage):
1906         (WebKit::WebProcess::initializeProcessName):
1907         (WebKit::WebProcess::initializeSandbox):
1908         (WebKit::WebProcess::platformInitializeProcess):
1909         * WebProcess/WebProcess.h:
1910         * WebProcess/WebProcessSupplement.h:
1911         * WebProcess/cocoa/WebProcessCocoa.mm:
1912         (WebKit::WebProcess::initializeProcessName):
1913         (WebKit::WebProcess::platformInitializeProcess):
1914         (WebKit::WebProcess::stopRunLoop):
1915         (WebKit::WebProcess::initializeSandbox):
1916         * WebProcess/gtk/WebProcessMainGtk.cpp:
1917         (WebKit::WebProcessMainUnix):
1918         * WebProcess/win/WebProcessMainWin.cpp:
1919         (WebKit::WebProcessMainWin):
1920         * WebProcess/wpe/WebProcessMainWPE.cpp:
1921         (WebKit::WebProcessMainUnix):
1922
1923 2019-01-29  Simon Fraser  <simon.fraser@apple.com>
1924
1925         REGRESSION(r240553): [iOS] Crash in ScrollingTree::updateTreeFromStateNode when attempting to log in to icloud.com
1926         https://bugs.webkit.org/show_bug.cgi?id=193907
1927
1928         Reviewed by Frédéric Wang.
1929
1930         Remove encode/decode of removedNodes.
1931
1932         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1933         (WebKit::RemoteScrollingCoordinatorTransaction::encode const):
1934         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
1935         (WebKit::dump):
1936
1937 2019-01-29  Brent Fulgham  <bfulgham@apple.com>
1938
1939         StorageAccess API calls should be direct to the Network Process
1940         https://bugs.webkit.org/show_bug.cgi?id=193924
1941         <rdar://problem/47611249>
1942
1943         Reviewed by Alex Christensen.
1944
1945         Now that the ResourceLoadStatistics data lives in the Network Process, calls to Storage Access
1946         API should happen directly between the WebContent and Network processes.
1947
1948         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1949         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted):
1950         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1951         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1952         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
1953         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage):
1954         (WebKit::NetworkConnectionToWebProcess::logUserInteraction):
1955         (WebKit::NetworkConnectionToWebProcess::logWebSocketLoading):
1956         (WebKit::NetworkConnectionToWebProcess::logSubresourceLoading):
1957         (WebKit::NetworkConnectionToWebProcess::logSubresourceRedirect):
1958         (WebKit::NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate):
1959         (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
1960         (WebKit::NetworkConnectionToWebProcess::requestStorageAccess):
1961         * NetworkProcess/NetworkConnectionToWebProcess.h:
1962         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1963         * NetworkProcess/NetworkProcess.cpp:
1964         (WebKit::NetworkProcess::requestStorageAccess):
1965         (WebKit::NetworkProcess::requestStorageAccessGranted):
1966         * NetworkProcess/NetworkProcess.h:
1967         * UIProcess/Network/NetworkProcessProxy.cpp:
1968         (WebKit::NetworkProcessProxy::requestStorageAccessConfirm):
1969         * UIProcess/Network/NetworkProcessProxy.h:
1970         * UIProcess/Network/NetworkProcessProxy.messages.in:
1971         * UIProcess/WebPageProxy.cpp:
1972         (WebKit::WebPageProxy::requestStorageAccessConfirm):
1973         (WebKit::WebPageProxy::hasStorageAccess): Deleted.
1974         (WebKit::WebPageProxy::requestStorageAccess): Deleted.
1975         * UIProcess/WebPageProxy.h:
1976         * UIProcess/WebPageProxy.messages.in:
1977         * WebProcess/WebPage/WebPage.cpp:
1978         (WebKit::WebPage::hasStorageAccess):
1979         (WebKit::WebPage::requestStorageAccess):
1980         (WebKit::nextRequestStorageAccessContextId): Deleted.
1981         (WebKit::WebPage::storageAccessResponse): Deleted.
1982         * WebProcess/WebPage/WebPage.h:
1983         * WebProcess/WebPage/WebPage.messages.in:
1984
1985 2019-01-29  Chris Dumez  <cdumez@apple.com>
1986
1987         Regression (r240046): [PSON] Spurious changes to [WKWebView url] and [WKWebView loading] after [WKWebView loadRequest]
1988         https://bugs.webkit.org/show_bug.cgi?id=193967
1989         <rdar://problem/47635348>
1990
1991         Reviewed by Alex Christensen.
1992
1993         Update WebPageProxy::receivedPolicyDecision() to no longer clear the pending URL when we send PolicyAction::Ignore to
1994         the old process when the load is continuing in a new process due to PSON.
1995
1996         * UIProcess/WebPageProxy.cpp:
1997         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1998         (WebKit::WebPageProxy::receivedPolicyDecision):
1999         * UIProcess/WebPageProxy.h:
2000
2001 2019-01-29  Keith Rollin  <krollin@apple.com>
2002
2003         Add .xcfilelists to Run Script build phases
2004         https://bugs.webkit.org/show_bug.cgi?id=193792
2005         <rdar://problem/47201785>
2006
2007         Reviewed by Alex Christensen.
2008
2009         As part of supporting XCBuild, update the necessary Run Script build
2010         phases in their Xcode projects to refer to their associated
2011         .xcfilelist files.
2012
2013         Note that the addition of these files bumps the Xcode project version
2014         number to something that's Xcode 10 compatible. This change means that
2015         older versions of the Xcode IDE can't read these projects. Nor can it
2016         fully load workspaces that refer to these projects (the updated
2017         projects are shown as non-expandable placeholders). `xcodebuild` can
2018         still build these projects; it's just that the IDE can't open them.
2019
2020         Make special accommodations for incorporating .xcfilelists from
2021         WebKitAdditions.
2022
2023         * Configurations/Base.xcconfig:
2024         * Configurations/DebugRelease.xcconfig:
2025         * WebKit.xcodeproj/project.pbxproj:
2026
2027 2019-01-29  Antti Koivisto  <antti@apple.com>
2028
2029         REGRESSION (PSON): Flash on link navigation on Mac
2030         https://bugs.webkit.org/show_bug.cgi?id=193961
2031         <rdar://problem/47482507>
2032
2033         Reviewed by Chris Dumez.
2034
2035         The target page sends EnterAcceleratedCompositingMode message too early, before we have a valid layer tree.
2036
2037         * WebProcess/WebPage/DrawingArea.h:
2038         (WebKit::DrawingArea::attach): Deleted.
2039
2040         Not needed anymore.
2041
2042         * WebProcess/WebPage/WebPage.cpp:
2043         (WebKit::WebPage::reinitializeWebPage):
2044         (WebKit::WebPage::didCompletePageTransition):
2045         (WebKit::m_shouldAttachDrawingAreaOnPageTransition): Deleted.
2046
2047         Move message sending logic fully to TiledCoreAnimationDrawingArea.
2048         Unfreezing the layer tree is sufficient to trigger the message.
2049
2050         * WebProcess/WebPage/WebPage.h:
2051         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2052         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2053         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
2054
2055         There is no need to treat process swap case differently.
2056
2057         (WebKit::TiledCoreAnimationDrawingArea::sendEnterAcceleratedCompositingModeIfNeeded):
2058
2059         Send this after the first successful layer flush with the root layer set.
2060
2061         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
2062         (WebKit::TiledCoreAnimationDrawingArea::attach): Deleted.
2063
2064 2019-01-29  Timothy Hatcher  <timothy@apple.com>
2065
2066         Add back some includes that got removed at some point.
2067         https://bugs.webkit.org/show_bug.cgi?id=193942
2068
2069         Reviewed by Tim Horton.
2070
2071         * UIProcess/API/Cocoa/WKWebView.mm:
2072         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2073         * UIProcess/ios/PageClientImplIOS.h:
2074         * UIProcess/ios/PageClientImplIOS.mm:
2075
2076 2019-01-29  Chris Dumez  <cdumez@apple.com>
2077
2078         Make sure WTF::generateObjectIdentifier() internal counter does not get duplicated
2079         https://bugs.webkit.org/show_bug.cgi?id=193848
2080
2081         Reviewed by Youenn Fablet.
2082
2083         * Platform/IPC/Connection.cpp:
2084         (IPC::Connection::Connection):
2085         * UIProcess/ChildProcessProxy.h:
2086         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2087         (WebKit::WebUserContentControllerProxy::WebUserContentControllerProxy):
2088         * UIProcess/WebBackForwardList.cpp:
2089         (WebKit::WebBackForwardList::restoreFromState):
2090         * UIProcess/WebProcessPool.cpp:
2091         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2092         (WebKit::UserMediaPermissionRequestManager::addDeviceChangeObserver):
2093
2094 2019-01-29  Chris Dumez  <cdumez@apple.com>
2095
2096         REGRESSION (PSON): Twitter link gets stuck at t.co after navigating back in tab
2097         https://bugs.webkit.org/show_bug.cgi?id=193932
2098         <rdar://problem/47598947>
2099
2100         Reviewed by Brady Eidson.
2101
2102         When doing a client side redirect from origin A to origin B, we would swap process and
2103         create a SuspendedPageProxy and save it on the source BackForwardListItem. The issue is
2104         that the BackForwardList is locked for such redirect so we end up updating the current
2105         BackForwardListItem with origin B's URL while origin A's suspended page remained on
2106         the item. When going to another URL in the same origin A, we would not create a suspended
2107         page since no process-swap would occur. When pressing the back button, we would go back
2108         to the previous BackForwardListItem and use its SuspendedPageProxy, which is for the
2109         wrong URL (The pre-client redirect one).
2110
2111         To address the issue, we no longer create a SuspendedPageProxy for cross-site client side
2112         redirects. There will be no way no go back to this suspended page anyway since the
2113         back/forward list item will be updated with the redirection URL.
2114
2115         * UIProcess/WebPageProxy.cpp:
2116         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
2117
2118 2019-01-29  Chris Dumez  <cdumez@apple.com>
2119
2120         Regression(r240046) VoiceOver is no longer working after a process swap
2121         https://bugs.webkit.org/show_bug.cgi?id=193953
2122         <rdar://problem/47612398>
2123
2124         Reviewed by Alex Christensen.
2125
2126         ProvisionalPageProxy used to forward the RegisterWebProcessAccessibilityToken IPC from
2127         the provisional WebProcess to the WebPageProxy right away. This in turn would notify
2128         the PageClient whose logic would rely on WebPageProxy::process(), which returns the
2129         committed process instead of the provisional one.
2130
2131         To address the issue, the ProvisionalPageProxy now stores the token sent by the
2132         provisional WebProcess and we only call registerWebProcessAccessibilityToken()
2133         on the WebPageProxy *after* we've swapped to the provisional process.
2134
2135         * UIProcess/ProvisionalPageProxy.cpp:
2136         (WebKit::ProvisionalPageProxy::registerWebProcessAccessibilityToken):
2137         (WebKit::ProvisionalPageProxy::didReceiveMessage):
2138         * UIProcess/ProvisionalPageProxy.h:
2139         (WebKit::ProvisionalPageProxy::takeAccessibilityToken):
2140         * UIProcess/WebPageProxy.cpp:
2141         (WebKit::WebPageProxy::commitProvisionalPage):
2142
2143 2019-01-28  Ryosuke Niwa  <rniwa@webkit.org>
2144
2145         User agent string override for navigator.userAgent should be site specific quirks
2146         https://bugs.webkit.org/show_bug.cgi?id=193950
2147
2148         Reviewed by Brent Fulgham.
2149
2150         Renamed the various member variables, functions, properties and selectors.
2151
2152         * Shared/WebsitePoliciesData.cpp:
2153         (WebKit::WebsitePoliciesData::encode const):
2154         (WebKit::WebsitePoliciesData::decode):
2155         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2156         * Shared/WebsitePoliciesData.h:
2157         * UIProcess/API/APIWebsitePolicies.cpp:
2158         (API::WebsitePolicies::data):
2159         * UIProcess/API/APIWebsitePolicies.h:
2160         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2161         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2162         (-[_WKWebsitePolicies setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]): Renamed from setCustomJavaScriptUserAgent.
2163         (-[_WKWebsitePolicies customJavaScriptUserAgentAsSiteSpecificQuirks]): Renamed from customJavaScriptUserAgent.
2164
2165 2019-01-28  Commit Queue  <commit-queue@webkit.org>
2166
2167         Unreviewed, rolling out r240630.
2168         https://bugs.webkit.org/show_bug.cgi?id=193958
2169
2170         Broke Apple internal builds (Requested by rniwa on #webkit).
2171
2172         Reverted changeset:
2173
2174         "Add back some includes that got removed at some point."
2175         https://bugs.webkit.org/show_bug.cgi?id=193942
2176         https://trac.webkit.org/changeset/240630
2177
2178 2019-01-28  Devin Rousso  <drousso@apple.com>
2179
2180         Web Inspector: provide a way to edit page WebRTC settings on a remote target
2181         https://bugs.webkit.org/show_bug.cgi?id=193863
2182         <rdar://problem/47572764>
2183
2184         Reviewed by Joseph Pecoraro.
2185
2186         * Shared/WebPreferences.yaml:
2187         Add page-level settings for WebRTC preferences.
2188
2189 2019-01-28  Ross Kirsling  <ross.kirsling@sony.com>
2190
2191         Remove unnecessary `using namespace WTF`s (or at least restrict their scope).
2192         https://bugs.webkit.org/show_bug.cgi?id=193941
2193
2194         Reviewed by Alex Christensen.
2195
2196         * Shared/linux/WebMemorySamplerLinux.cpp:
2197
2198 2019-01-28  Fujii Hironori  <Hironori.Fujii@sony.com>
2199
2200         [Win] WebCore/platform/Process.h is conflicting with process.h
2201         https://bugs.webkit.org/show_bug.cgi?id=193944
2202
2203         Reviewed by Ross Kirsling.
2204
2205         * Shared/ChildProcess.h:
2206         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
2207         * Shared/unix/ChildProcessMain.cpp:
2208         * UIProcess/API/APINavigation.h:
2209         * UIProcess/ChildProcessProxy.h:
2210         * UIProcess/Launcher/ProcessLauncher.h:
2211         * UIProcess/WebProcessPool.cpp:
2212         * UIProcess/WebProcessProxy.h:
2213
2214 2019-01-28  Jon Lee  <jonlee@apple.com>
2215
2216         Update Screen Capture preference
2217         https://bugs.webkit.org/show_bug.cgi?id=193947
2218         rdar://problem/47620199
2219
2220         Reviewed by Youenn Fablet.
2221
2222         * Shared/WebPreferences.yaml:
2223
2224 2019-01-28  Andy Estes  <aestes@apple.com>
2225
2226         [watchOS] Enable Parental Controls content filtering
2227         https://bugs.webkit.org/show_bug.cgi?id=193939
2228         <rdar://problem/46641912>
2229
2230         Reviewed by Ryosuke Niwa.
2231
2232         * Configurations/FeatureDefines.xcconfig:
2233
2234 2019-01-28  David Kilzer  <ddkilzer@apple.com>
2235
2236         REGRESSION (r236481): Move soft-linking of LocalAuthentication.framework out of LocalAuthenticationSoftLink.h
2237         <https://webkit.org/b/193884>
2238
2239         Reviewed by Jiewen Tan.
2240
2241         * SourcesCocoa.txt:
2242         * UnifiedSources-input.xcfilelist:
2243         * WebKit.xcodeproj/project.pbxproj:
2244         - Add LocalAuthenticationSoftLink.mm to the project.
2245
2246         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h:
2247         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.mm: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h.
2248         - Move soft-linking implementation to
2249           LocalAuthenticationSoftLink.mm.
2250
2251 2019-01-28  Timothy Hatcher  <timothy@apple.com>
2252
2253         Add back some includes that got removed at some point.
2254         https://bugs.webkit.org/show_bug.cgi?id=193942
2255
2256         Reviewed by Tim Horton.
2257
2258         * UIProcess/API/Cocoa/WKWebView.mm:
2259         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2260         * UIProcess/ios/PageClientImplIOS.h:
2261         * UIProcess/ios/PageClientImplIOS.mm:
2262
2263 2019-01-28  Timothy Hatcher  <timothy@apple.com>
2264
2265         Make it easier for non-Apple ports to enable dark mode CSS support.
2266         https://bugs.webkit.org/show_bug.cgi?id=193882
2267
2268         Reviewed by Megan Gardner.
2269
2270         Make modern WebKit code for dark mode usable by other ports, to match
2271         the WebCore parts that have been cross-platform all along.
2272
2273         * Shared/WebPageCreationParameters.cpp:
2274         (WebKit::WebPageCreationParameters::encode const):
2275         (WebKit::WebPageCreationParameters::decode):
2276         * Shared/WebPageCreationParameters.h:
2277         * UIProcess/PageClient.h:
2278         (WebKit::PageClient::effectiveAppearanceIsDark const):
2279         * UIProcess/WebPageProxy.cpp:
2280         (WebKit::WebPageProxy::creationParameters):
2281         (WebKit::WebPageProxy::useDarkAppearance const):
2282         (WebKit::WebPageProxy::effectiveAppearanceDidChange):
2283         * UIProcess/WebPageProxy.h:
2284         * WebProcess/WebPage/WebPage.cpp:
2285         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
2286         (WebKit::WebPage::setUseDarkAppearance):
2287         * WebProcess/WebPage/WebPage.h:
2288         * WebProcess/WebPage/WebPage.messages.in:
2289
2290 2019-01-28  Andy Estes  <aestes@apple.com>
2291
2292         [Cocoa] Add SPI to _WKUserContentExtensionStore to retrieve its underlying WKContentRuleListStore
2293         https://bugs.webkit.org/show_bug.cgi?id=193927
2294
2295         Reviewed by Tim Horton.
2296
2297         This is useful for clients migrating from _WKUserContentExtensionStore to the modern
2298         WKContentRuleList* APIs.
2299
2300         * UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:
2301         (-[_WKUserContentExtensionStore _contentRuleListStore]):
2302         * UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
2303
2304 2019-01-28  David Kilzer  <ddkilzer@apple.com>
2305
2306         Move soft-linking of ManagedConfiguration.framework out of ManagedConfigurationSPI.h
2307         <https://webkit.org/b/193868>
2308
2309         Reviewed by Daniel Bates.
2310
2311         * Platform/spi/ios/ManagedConfigurationSPI.h:
2312         - Remove soft-linking code from header.
2313         - Add PLATFORM(IOS_FAMILY) && !PLATFORM(IOSMAC) guard.
2314
2315         * UIProcess/ios/WKContentViewInteraction.mm:
2316         (-[WKContentView canPerformActionForWebView:withSender:]):
2317         (-[WKContentView _defineForWebView:]):
2318         - Add soft-linking code formerly in ManagedConfigurationSPI.h.
2319         - Change MCFeatureDefinitionLookupAllowed to use soft-link
2320           function getMCFeatureDefinitionLookupAllowed() to remove the
2321           #define.
2322
2323 2019-01-28  Per Arne Vollan  <pvollan@apple.com>
2324
2325         REGRESSION (r240348): Loading netflix home page panics device
2326         https://bugs.webkit.org/show_bug.cgi?id=193936
2327
2328         Reviewed by Alexey Proskuryakov.
2329
2330         Temporarily enable permissive call filtering.
2331
2332         * WebProcess/com.apple.WebProcess.sb.in:
2333
2334 2019-01-28  Joseph Pecoraro  <pecoraro@apple.com>
2335
2336         [iOS] Attempting to open a Keynote document to iCloud.com from iCloud Files causes crash
2337         https://bugs.webkit.org/show_bug.cgi?id=193456
2338         <rdar://problem/47275642>
2339
2340         Reviewed by Brent Fulgham.
2341
2342         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2343         Allow access to iconservices.
2344
2345 2019-01-28  Daniel Bates  <dabates@apple.com>
2346
2347         [iOS] Make Window virtual key code computation match Mac
2348         https://bugs.webkit.org/show_bug.cgi?id=193452
2349
2350         Reviewed by Ryosuke Niwa.
2351
2352         Compute the Windows virtual key code from the WebEvent.
2353
2354         * Shared/ios/WebIOSEventFactory.mm:
2355         (WebIOSEventFactory::createWebKeyboardEvent):
2356
2357 2019-01-28  Brent Fulgham  <bfulgham@apple.com>
2358
2359         REGRESSION (r240498): Storage Access API prompts result is not remembered
2360         https://bugs.webkit.org/show_bug.cgi?id=193922
2361         <rdar://problem/47608767>
2362
2363         Reviewed by Chris Dumez.
2364
2365         The refactoring in r240498 bypassed bookkeeping in ResourceLoadStatisticsMemoryStore
2366         that kept track of whether a successful user prompt had been encountered. This
2367         patch corrects this codepath so the user is not prompted repeatedly after approving
2368         use of the Storage Access API.
2369
2370         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2371         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess): Switch from Move operator to
2372         const reference to allow the method to be called by the NetworkProcess.
2373         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2374         * NetworkProcess/NetworkProcess.cpp:
2375         (WebKit::NetworkProcess::grantStorageAccess): Request access through the WebResourceLoadStatistics
2376         object, rather than jumping directly to the NetworkStorageSession.
2377
2378 2019-01-28  Chris Dumez  <cdumez@apple.com>
2379
2380         Regression(PSON) Crash under WebPageProxy::didStartProgress()
2381         https://bugs.webkit.org/show_bug.cgi?id=193915
2382         <rdar://problem/47560907>
2383
2384         Reviewed by Alex Christensen.
2385
2386         * UIProcess/WebPageProxy.cpp:
2387         (WebKit::WebPageProxy::close):
2388         Make sure we destroy the ProvisionalPageProxy if the page gets closed as we do not want to keep receiving
2389         IPC after this or even worse, commit the provisional page.
2390
2391         (WebKit::WebPageProxy::didStartProgress):
2392         Add an assertion in didStartProgress() to make sure we do not receive this IPC after the page has been
2393         closed.
2394
2395 2019-01-28  Antoine Quint  <graouts@apple.com>
2396
2397         Limit user-agent interactions based on the touch-action property on iOS
2398         https://bugs.webkit.org/show_bug.cgi?id=193447
2399
2400         Unreviewed build fix.
2401
2402         * UIProcess/API/Cocoa/WKWebView.mm:
2403
2404 2019-01-28  Antoine Quint  <graouts@apple.com>
2405
2406         Limit user-agent interactions based on the touch-action property on iOS
2407         https://bugs.webkit.org/show_bug.cgi?id=193447
2408
2409         Unreviewed build fix.
2410
2411         * UIProcess/ios/WKContentViewInteraction.mm:
2412
2413 2019-01-28  Brent Fulgham  <bfulgham@apple.com>
2414
2415         Remove the UIProcess components of the ResourceLoadStatistics code
2416         https://bugs.webkit.org/show_bug.cgi?id=193303
2417         <rdar://problem/47160073>
2418
2419         Reviewed by Chris Dumez.
2420
2421         Now that the ResourceLoadStatistics code is running in the NetworkProcess, we can get rid
2422         of the UIProcess copies of these routines.
2423
2424         Tested by existing ResourceLoadStatistics and StorageAccess tests.
2425
2426         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2427         (WebKit::ResourceLoadStatisticsMemoryStore::updateClientSideCookiesAgeCap):
2428         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2429         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
2430         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
2431         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
2432         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
2433         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
2434         (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler):
2435         (WebKit::WebResourceLoadStatisticsStore::logTestingEvent):
2436         (WebKit::WebResourceLoadStatisticsStore::notifyResourceLoadStatisticsProcessed):
2437         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
2438         (WebKit::WebResourceLoadStatisticsStore::topPrivatelyControlledDomainsWithWebsiteData):
2439         (WebKit::WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue const):
2440         (WebKit::WebResourceLoadStatisticsStore::notifyPageStatisticsTelemetryFinished const):
2441         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2442         * UIProcess/WebProcessProxy.cpp:
2443         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): Deleted.
2444         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData): Deleted.
2445         * UIProcess/WebProcessProxy.h:
2446         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2447         (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
2448         (WebKit::WebsiteDataStore::removeData):
2449         (WebKit::WebsiteDataStore::setMaxStatisticsEntries):
2450         (WebKit::WebsiteDataStore::setPruneEntriesDownTo):
2451         (WebKit::WebsiteDataStore::setGrandfatheringTime):
2452         (WebKit::WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval):
2453         (WebKit::WebsiteDataStore::dumpResourceLoadStatistics):
2454         (WebKit::WebsiteDataStore::isPrevalentResource):
2455         (WebKit::WebsiteDataStore::setPrevalentResource):
2456         (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode):
2457         (WebKit::WebsiteDataStore::isVeryPrevalentResource):
2458         (WebKit::WebsiteDataStore::setVeryPrevalentResource):
2459         (WebKit::WebsiteDataStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2460         (WebKit::WebsiteDataStore::setSubframeUnderTopFrameOrigin):
2461         (WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder):
2462         (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameOrigin):
2463         (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder):
2464         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo):
2465         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom):
2466         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo):
2467         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom):
2468         (WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo):
2469         (WebKit::WebsiteDataStore::clearPrevalentResource):
2470         (WebKit::WebsiteDataStore::resetParametersToDefaultValues):
2471         (WebKit::WebsiteDataStore::submitTelemetry):
2472         (WebKit::WebsiteDataStore::scheduleClearInMemoryAndPersistent):
2473         (WebKit::WebsiteDataStore::scheduleCookieBlockingUpdate):
2474         (WebKit::WebsiteDataStore::scheduleStatisticsAndDataRecordsProcessing):
2475         (WebKit::WebsiteDataStore::setLastSeen):
2476         (WebKit::WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned):
2477         (WebKit::WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured):
2478         (WebKit::WebsiteDataStore::hasStorageAccess):
2479         (WebKit::WebsiteDataStore::requestStorageAccess):
2480         (WebKit::WebsiteDataStore::grantStorageAccess):
2481         (WebKit::WebsiteDataStore::setTimeToLiveUserInteraction):
2482         (WebKit::WebsiteDataStore::logUserInteraction):
2483         (WebKit::WebsiteDataStore::hasHadUserInteraction):
2484         (WebKit::WebsiteDataStore::clearUserInteraction):
2485         (WebKit::WebsiteDataStore::setGrandfathered):
2486         (WebKit::WebsiteDataStore::webProcessWillOpenConnection):
2487         (WebKit::WebsiteDataStore::webProcessDidCloseConnection):
2488         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
2489         (WebKit::WebsiteDataStore::didCreateNetworkProcess):
2490         (WebKit::WebsiteDataStore::topPrivatelyControlledDomainsWithWebsiteData): Deleted.
2491         (WebKit::WebsiteDataStore::removeDataForTopPrivatelyControlledDomains): Deleted.
2492         (WebKit::WebsiteDataStore::setCacheMaxAgeCap): Deleted.
2493         (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor): Deleted.
2494         (WebKit::WebsiteDataStore::setAgeCapForClientSideCookies): Deleted.
2495         (WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler): Deleted.
2496         (WebKit::WebsiteDataStore::grantStorageAccessHandler): Deleted.
2497         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler): Deleted.
2498         (WebKit::WebsiteDataStore::removePrevalentDomains): Deleted.
2499         (WebKit::WebsiteDataStore::isGrandfathered): Deleted.
2500         * UIProcess/WebsiteData/WebsiteDataStore.h:
2501
2502 2019-01-28  Antoine Quint  <graouts@apple.com>
2503
2504         Limit user-agent interactions based on the touch-action property on iOS
2505         https://bugs.webkit.org/show_bug.cgi?id=193447
2506         <rdar://problem/47283874>
2507
2508         Reviewed by Antti Koivisto and Simon Fraser.
2509
2510         Handle the "none", "pan-x", "pan-y" and "pinch-zoom" values for the touch-action property by querying the scrolling tree whenever a touch begins
2511         to identify whether its point is contained within the region of an element with a non-auto touch-action property. If it is, we use the list of
2512         permitted touch actions such to then customize the behavior of the nearest scroll view to pan or zoom only as instructed.
2513
2514         * Shared/WebCoreArgumentCoders.cpp:
2515         (IPC::ArgumentCoder<TouchActionData>::encode):
2516         (IPC::ArgumentCoder<TouchActionData>::decode):
2517         (IPC::ArgumentCoder<EventTrackingRegions>::encode):
2518         (IPC::ArgumentCoder<EventTrackingRegions>::decode):
2519         (IPC::ArgumentCoder<Region>::decode):
2520         * Shared/WebCoreArgumentCoders.h:
2521         * UIProcess/API/Cocoa/WKWebView.mm:
2522         (-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Account for panning constraints set on the content view to prevent deceleration
2523         to pan the view if it ought not.
2524         (-[WKWebView _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]): Implement an additional
2525         UIScrollView delegation method to apply the panning constraints set on the content view while panning.
2526         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2527         (WebKit::RemoteScrollingCoordinatorProxy::touchActionDataAtPoint const):
2528         (WebKit::RemoteScrollingCoordinatorProxy::touchActionDataForScrollNodeID const):
2529         (WebKit::RemoteScrollingCoordinatorProxy::setTouchDataForTouchIdentifier):
2530         (WebKit::RemoteScrollingCoordinatorProxy::clearTouchDataForTouchIdentifier):
2531         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
2532         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
2533         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
2534         (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]): Apply the same logic as in WKWebView.
2535         (-[WKScrollingNodeScrollViewDelegate _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]): Apply
2536         the same logic as in WKWebView.
2537         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::touchActionData const):
2538         * UIProcess/WebPageProxy.h:
2539         (WebKit::WebPageProxy::isScrollingOrZooming const):
2540         * UIProcess/ios/WKContentViewInteraction.h:
2541         * UIProcess/ios/WKContentViewInteraction.mm:
2542         (-[WKContentView preventsPanningInXAxis]):
2543         (-[WKContentView preventsPanningInYAxis]):
2544         (-[WKContentView cleanupInteraction]):
2545         (-[WKContentView _webTouchEventsRecognized:]):
2546         (-[WKContentView _handleTouchActionsForTouchEvent:]): As we process touches, check whether there are touch actions set for this touch's points' locations. Based
2547         on those touch actions, either setDefaultPrevented on the _touchEventGestureRecognizer if the touch action is "none" or selectively disable panning and zooming.
2548         (-[WKContentView _resetPanningPreventionFlags]):
2549         (-[WKContentView _didEndScrollingOrZooming]):
2550
2551 2019-01-28  Antti Koivisto  <antti@apple.com>
2552
2553         WebUserContentController::removeUserScriptMessageHandlerInternal may deref and delete itself
2554         https://bugs.webkit.org/show_bug.cgi?id=193901
2555         <rdar://problem/47338669>
2556
2557         Reviewed by David Kilzer.
2558
2559         Don't know how to repro.
2560
2561         * WebProcess/UserContent/WebUserContentController.cpp:
2562         (WebKit::WebUserContentController::removeUserScriptMessageHandlerInternal):
2563
2564         Calling userMessageHandlers.removeFirstMatching() may remove the last ref to this
2565         (because WebUserMessageHandlerDescriptorProxy refs WebUserContentController).
2566         Fix by protecting this over the function.
2567
2568 2018-12-15  Darin Adler  <darin@apple.com>
2569
2570         Replace many uses of String::format with more type-safe alternatives
2571         https://bugs.webkit.org/show_bug.cgi?id=192742
2572
2573         Reviewed by Mark Lam.
2574
2575         * Shared/WebMemorySampler.cpp:
2576         (WebKit::WebMemorySampler::writeHeaders): Use makeString.
2577
2578         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
2579         (WebKit::LocalAuthenticator::makeCredential): Use string concatentation.
2580
2581         * UIProcess/WebInspectorUtilities.cpp:
2582         (WebKit::inspectorPageGroupIdentifierForPage): Use makeString.
2583         * UIProcess/WebProcessPool.cpp:
2584         (WebKit::WebProcessPool::processDidFinishLaunching): Ditto.
2585         (WebKit::WebProcessPool::startMemorySampler): Ditto.
2586
2587 2019-01-27  Jiewen Tan  <jiewen_tan@apple.com>
2588
2589         Use a load optimizer for some sites
2590         https://bugs.webkit.org/show_bug.cgi?id=193881
2591         <rdar://problem/46325455>
2592
2593         Reviewed by Brent Fulgham.
2594
2595         We will try to speed up some sites with a dedicated load optimizer. The load optimizer lives
2596         within the WebsiteDataStore as one client instance should have only one and it should live
2597         as long as the client lives. How does the load optimizer work? It intercepts every load in
2598         the navigation state. If a request meets some requirements, it will then fetch the request
2599         from its own cache. Once the fetch succeeds, the original load will be ignored and the
2600         optimizer will display the cached content.
2601
2602         Covered by API tests.
2603
2604         * SourcesCocoa.txt:
2605         * UIProcess/Cocoa/LoadOptimizer.h: Added.
2606         * UIProcess/Cocoa/LoadOptimizer.mm: Added.
2607         * UIProcess/Cocoa/MediaCaptureUtilities.h:
2608         * UIProcess/Cocoa/NavigationState.mm:
2609         (WebKit::tryInterceptNavigation):
2610         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2611         (WebKit::tryAppLink): Deleted.
2612         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2613         (WebKit::WebsiteDataStore::WebsiteDataStore):
2614         * UIProcess/WebsiteData/WebsiteDataStore.h:
2615         (WebKit::WebsiteDataStore::loadOptimizer):
2616         * WebKit.xcodeproj/project.pbxproj:
2617
2618 2019-01-25  Brian Burg  <bburg@apple.com>
2619
2620         Web Automation: add support for simulating single touches to Automation.performInteractionSequence
2621         https://bugs.webkit.org/show_bug.cgi?id=193852
2622         <rdar://problem/28360781>
2623
2624         Reviewed by Joseph Pecoraro and Simon Fraser.
2625
2626         This patch makes it possible to simulate touches via the Actions API. The approach is to
2627         use a stripped down version of HIDEventGenerator to send HID events to the UIWindow.
2628         The initial version supports a single touch point; this may be expanded if needed, but
2629         so far it hasn't been an impediment when running desktop-oriented WebDriver test suites.
2630
2631         As part of implementing this support, I went through and added [somewhat obnoxious] ENABLE()
2632         guards so that we don't mistakenly compile mouse support on iOS and touch on Mac,
2633         and vice versa. Each of the interaction methods---touch, mouse, keyboard---can be independently
2634         compiled out. If none is supported (i.e., Windows), then we don't even try to compile
2635         platformSimulate*Interaction methods or SimulatedInputDispatcher. This allows WebAutomationSession
2636         to not include members and code that are never going to be used on a particular platform.
2637
2638         This functionality is covered by existing WebDriver test suites that use Element Click command.
2639         Additional tests that explicitly include 'touch' pointerType will be submitted to WPT later.
2640
2641         * UIProcess/Automation/Automation.json: Update comment.
2642
2643         * UIProcess/Automation/SimulatedInputDispatcher.h:
2644         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
2645         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
2646         - Add appropriate guards for code specific to each interaction type.
2647         - Handle SimulatedInputSourceType::Touch and call out to dispatch events.
2648
2649         * UIProcess/Automation/WebAutomationSession.h:
2650         * UIProcess/Automation/WebAutomationSession.cpp:
2651         (WebKit::WebAutomationSession::WebAutomationSession):
2652         (WebKit::WebAutomationSession::terminate):
2653         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
2654         (WebKit::WebAutomationSession::mouseEventsFlushedForPage):
2655         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
2656         (WebKit::WebAutomationSession::willClosePage):
2657         Add appropriate guards for code specific to each interaction type.
2658
2659         (WebKit::WebAutomationSession::isSimulatingUserInteraction const):
2660         Add new hook so that we can detect when a touch simulation is in progress.
2661         We don't rely on checking WebKit's event queue, so use a flag.
2662
2663         (WebKit::WebAutomationSession::simulateTouchInteraction):
2664         (WebKit::WebAutomationSession::performMouseInteraction):
2665         (WebKit::WebAutomationSession::performKeyboardInteractions):
2666         (WebKit::WebAutomationSession::cancelInteractionSequence):
2667         (WebKit::WebAutomationSession::performInteractionSequence):
2668         - Add appropriate guards for code specific to each interaction type.
2669         - Bail out immediately if a requested interaction type is not supported.
2670         - Shim Touch input type to Mouse if mouse is not supported but touches are.
2671         Nearly all WebDriver tests in the wild will be requesting a 'mouse' pointerType,
2672         so this is necessary for compatibility. It's easier to shim at this level than try
2673         to implement platformSimulateMouseInteraction for iOS because
2674         platformSimulateMouseinteraction does not use a completion handler but the iOS
2675         implementation would require that.
2676
2677         (WebKit::WebAutomationSession::platformSimulateMouseInteraction): Deleted.
2678         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): Deleted.
2679         - Remove these stubs. Platform methods of this class are no longer being filled
2680         with stubs on unsupported platforms because we expect the command to fail earlier.
2681
2682         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
2683         (WebKit::WebAutomationSession::platformSimulateTouchInteraction):
2684         - Add appropriate guards for code specific to each interaction type.
2685         - Implement new platform method to simulate touches. This uses _WKTouchEventGenerator.
2686
2687         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
2688         Add appropriate guards for code specific to each interaction type.
2689
2690         * UIProcess/_WKTouchEventGenerator.h: Added.
2691         * UIProcess/_WKTouchEventGenerator.mm: Added.
2692         (simpleCurveInterpolation):
2693         (calculateNextCurveLocation):
2694         (delayBetweenMove):
2695         (+[_WKTouchEventGenerator sharedTouchEventGenerator]):
2696         (+[_WKTouchEventGenerator nextEventCallbackID]):
2697         (-[_WKTouchEventGenerator init]):
2698         (-[_WKTouchEventGenerator dealloc]):
2699         (-[_WKTouchEventGenerator _createIOHIDEventType:]):
2700         (-[_WKTouchEventGenerator _sendHIDEvent:]):
2701         (-[_WKTouchEventGenerator _sendMarkerHIDEventWithCompletionBlock:]):
2702         (-[_WKTouchEventGenerator _updateTouchPoints:count:]):
2703         (-[_WKTouchEventGenerator touchDownAtPoints:touchCount:]):
2704         (-[_WKTouchEventGenerator touchDown:touchCount:]):
2705         (-[_WKTouchEventGenerator touchDown:]):
2706         (-[_WKTouchEventGenerator liftUpAtPoints:touchCount:]):
2707         (-[_WKTouchEventGenerator liftUp:touchCount:]):
2708         (-[_WKTouchEventGenerator liftUp:]):
2709         (-[_WKTouchEventGenerator moveToPoints:touchCount:duration:]):
2710         (-[_WKTouchEventGenerator touchDown:completionBlock:]):
2711         (-[_WKTouchEventGenerator liftUp:completionBlock:]):
2712         (-[_WKTouchEventGenerator moveToPoint:duration:completionBlock:]):
2713         (-[_WKTouchEventGenerator receivedHIDEvent:]):
2714         Copied and simplified from HIDEventGenerator in WebKitTestRunner.
2715
2716         * WebKit.xcodeproj/project.pbxproj:
2717         Add _WKTouchEventGenerator.{h,mm} and make it a private header. The client needs to
2718         route received HID events to -receivedHIDEvent: in order to detect when the marker
2719         HID event has been processed (and thus the interaction is completed).
2720
2721         * config.h: Add ENABLE(WEBDRIVER_*_INTERACTIONS) macros here.
2722
2723 2019-01-26  Simon Fraser  <simon.fraser@apple.com>
2724
2725         Have composited RenderIFrame layers make FrameHosting scrolling tree nodes to parent the iframe's scrolling node
2726         https://bugs.webkit.org/show_bug.cgi?id=193879
2727
2728         Reviewed by Antti Koivisto.
2729
2730         Need a specialization of dump() for ScrollingStateFrameHostingNode to avoid infinite recursion.
2731
2732         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2733         (WebKit::dump):
2734
2735 2019-01-27  Chris Fleizach  <cfleizach@apple.com>
2736
2737         AX: Introduce a static accessibility tree
2738         https://bugs.webkit.org/show_bug.cgi?id=193348
2739         <rdar://problem/47203295>
2740
2741         Reviewed by Ryosuke Niwa.
2742
2743         * Configurations/FeatureDefines.xcconfig:
2744         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
2745         (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
2746
2747 2019-01-26  Simon Fraser  <simon.fraser@apple.com>
2748
2749         Allow scrolling tree nodes to exist in a detached state
2750         https://bugs.webkit.org/show_bug.cgi?id=193754
2751
2752         Reviewed by Zalan Bujtas.
2753
2754         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2755         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
2756
2757 2019-01-25  Tim Horton  <timothy_horton@apple.com>
2758
2759         REGRESSION (r238818): Snapshot is removed too late after swiping back on Twitter
2760         https://bugs.webkit.org/show_bug.cgi?id=193860
2761         <rdar://problem/47535022>
2762
2763         Reviewed by Antti Koivisto.
2764
2765         * UIProcess/Cocoa/ViewGestureController.cpp:
2766         (WebKit::ViewGestureController::didStartProvisionalOrSameDocumentLoadForMainFrame):
2767         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
2768         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
2769         * UIProcess/Cocoa/ViewGestureController.h:
2770         Treat provisional load and same document load the same: they already both
2771         unpause the snapshot removal tracker, request render tree size notifications,
2772         but same-document navigation was missing the call to dispatchAfterEnsuringDrawing
2773         and thus would get stuck waiting for RepaintAfterNavigation.
2774
2775 2019-01-25  Ryosuke Niwa  <rniwa@webkit.org>
2776
2777         Need a mechanism to override navigator.userAgent
2778         https://bugs.webkit.org/show_bug.cgi?id=193762
2779         <rdar://problem/47504939>
2780
2781         Reviewed by Brent Fulgham.
2782
2783         This patch adds a new _WKWebsitePolicies SPI to specify the user agent string returned by
2784         navigator.userAgent without affecting the user agent string used to send network requests.
2785
2786         Tests: WebKit.WebsitePoliciesCustomJavaScriptUserAgent
2787                WebKit.WebsitePoliciesCustomUserAgents
2788
2789         * Shared/WebsitePoliciesData.cpp:
2790         (WebKit::WebsitePoliciesData::encode const):
2791         (WebKit::WebsitePoliciesData::decode):
2792         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2793         * Shared/WebsitePoliciesData.h:
2794         * UIProcess/API/APIWebsitePolicies.cpp:
2795         (API::WebsitePolicies::data):
2796         * UIProcess/API/APIWebsitePolicies.h:
2797         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2798         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2799         (-[_WKWebsitePolicies setCustomJavaScriptUserAgent:]):
2800         (-[_WKWebsitePolicies customJavaScriptUserAgent]):
2801
2802 2019-01-25  Devin Rousso  <drousso@apple.com>
2803
2804         Web Inspector: provide a way to edit page settings on a remote target
2805         https://bugs.webkit.org/show_bug.cgi?id=193813
2806         <rdar://problem/47359510>
2807
2808         Reviewed by Joseph Pecoraro.
2809
2810         * WebProcess/WebPage/WebInspectorUI.h:
2811         (WebKit::WebInspectorUI::isRemote() const): Added.
2812         * WebProcess/WebPage/RemoteWebInspectorUI.h:
2813         (WebKit::RemoteWebInspectorUI::isRemote() const): Added.
2814
2815 2019-01-25  Dean Jackson  <dino@apple.com>
2816
2817         REGRESSION: Some USDz from 3rd party websites don't go directly to AR QL
2818         https://bugs.webkit.org/show_bug.cgi?id=193831
2819         <rdar://problem/47399263>
2820
2821         Reviewed by Chris Dumez.
2822
2823         A System Preview (<a rel="ar">) displays in a modal and doesn't trigger
2824         a navigation. If the link was cross origin, it was causing a process swap,
2825         which meant that the response defaulted back to a navigation.
2826
2827         The fix is to not cause a PSON when the navigation is a system preview.
2828
2829         * UIProcess/API/APINavigation.h:
2830         (API::Navigation::shouldForceDownload const): This is now just tracking
2831         the "download" attribute, and not including System Preview.
2832         (API::Navigation::isSystemPreview const): New method to check for a
2833         navigation triggered as a System Preview.
2834         * UIProcess/WebPageProxy.cpp: Move the code from receivedPolicyDecision to
2835         receivedNavigationPolicyDecision, so that downloads and System Previews are
2836         detected before we decide to change process.
2837         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2838         (WebKit::WebPageProxy::receivedPolicyDecision):
2839
2840 2019-01-25  Tim Horton  <timothy_horton@apple.com>
2841
2842         Find-in-page on nyt.com scrolls around without touching the screen when find holes are visible
2843         https://bugs.webkit.org/show_bug.cgi?id=193853
2844
2845         Reviewed by Simon Fraser.
2846
2847         * WebProcess/WebPage/ios/FindControllerIOS.mm:
2848         (WebKit::FindController::updateFindIndicator):
2849         There is no reason to scroll/zoom to the find indicator just because the
2850         holes are up, we should only do it on initial indicator presentation.
2851         This was a mistake in r178755 that was previously never exercised because
2852         isShowingOverlay was always false.
2853
2854 2019-01-25  Keith Rollin  <krollin@apple.com>
2855
2856         Update Xcode projects with "Check .xcfilelists" build phase
2857         https://bugs.webkit.org/show_bug.cgi?id=193790
2858         <rdar://problem/47201374>
2859
2860         Reviewed by Alex Christensen.
2861
2862         Support for XCBuild includes specifying inputs and outputs to various
2863         Run Script build phases. These inputs and outputs are specified as
2864         .xcfilelist files. Once created, these .xcfilelist files need to be
2865         kept up-to-date. In order to check that they are up-to-date or not,
2866         add an Xcode build step that invokes an external script that performs
2867         the checking. If the .xcfilelists are found to be out-of-date, update
2868         them, halt the build, and instruct the developer to restart the build
2869         with up-to-date files.
2870
2871         At this time, the checking and regenerating is performed only if the
2872         WK_ENABLE_CHECK_XCFILELISTS environment variable is set to 1. People
2873         who want to use this facility can set this variable and test out the
2874         checking/regenerating. Once it seems like there are no egregious
2875         issues that upset a developer's workflow, we'll unconditionally enable
2876         this facility.
2877
2878         * Scripts/check-xcfilelists.sh: Added.
2879         * WebKit.xcodeproj/project.pbxproj:
2880
2881 2019-01-25  Alex Christensen  <achristensen@webkit.org>
2882
2883         Move logic from ChildProcess::setApplicationIsDaemon to NetworkProcess::initializeProcess
2884         https://bugs.webkit.org/show_bug.cgi?id=193844
2885
2886         Reviewed by Andy Estes.
2887
2888         This simplifies ChildProcess and removes NetworkProcess-specific code from this generic abstraction.
2889
2890         * NetworkProcess/mac/NetworkProcessMac.mm:
2891         (WebKit::NetworkProcess::initializeProcess):
2892         * Shared/ios/ChildProcessIOS.mm:
2893         (WebKit::ChildProcess::setApplicationIsDaemon): Deleted.
2894         * Shared/mac/ChildProcessMac.mm:
2895         (WebKit::ChildProcess::setApplicationIsDaemon): Deleted.
2896
2897 2019-01-25  Keith Rollin  <krollin@apple.com>
2898
2899         Update Xcode projects with "Apply Configuration to XCFileLists" build target
2900         https://bugs.webkit.org/show_bug.cgi?id=193781
2901         <rdar://problem/47201153>
2902
2903         Reviewed by Alex Christensen.
2904
2905         Part of generating the .xcfilelists used as part of adopting XCBuild
2906         includes running `make DerivedSources.make` from a standalone script.
2907         It’s important for this invocation to have the same environment as
2908         when the actual build invokes `make DerivedSources.make`. If the
2909         environments are different, then the two invocations will provide
2910         different results. In order to get the same environment in the
2911         standalone script, have the script launch xcodebuild targeting the
2912         "Apply Configuration to XCFileLists" build target, which will then
2913         re-invoke our standalone script. The script is now running again, this
2914         time in an environment with all workspace, project, target, xcconfig
2915         and other environment variables established.
2916
2917         The "Apply Configuration to XCFileLists" build target accomplishes
2918         this task via a small embedded shell script that consists only of:
2919
2920             eval "${WK_SUBLAUNCH_SCRIPT_PARAMETERS[@]}"
2921
2922         The process that invokes "Apply Configuration to XCFileLists" first
2923         sets WK_SUBLAUNCH_SCRIPT_PARAMETERS to an array of commands to be
2924         evaluated and exports it into the shell environment. When xcodebuild
2925         is invoked, it inherits the value of this variable and can `eval` the
2926         contents of that variable. Our external standalone script can then set
2927         WK_SUBLAUNCH_SCRIPT_PARAMETERS to the path to itself, along with a set
2928         of command-line parameters needed to restart itself in the appropriate
2929         state.
2930
2931         * WebKit.xcodeproj/project.pbxproj:
2932
2933 2019-01-25  Alex Christensen  <achristensen@webkit.org>
2934
2935         Add SPI to inform an application that "Go Back" has been clicked from a safe browsing warning
2936         https://bugs.webkit.org/show_bug.cgi?id=193802
2937         <rdar://problem/46010580>
2938
2939         Reviewed by Andy Estes.
2940
2941         * UIProcess/API/APIUIClient.h:
2942         (API::UIClient::didClickGoBackFromSafeBrowsingWarning):
2943         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2944         * UIProcess/Cocoa/UIDelegate.h:
2945         * UIProcess/Cocoa/UIDelegate.mm:
2946         (WebKit::UIDelegate::setDelegate):
2947         (WebKit::UIDelegate::UIClient::didClickGoBackFromSafeBrowsingWarning):
2948         * UIProcess/WebPageProxy.cpp:
2949         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2950
2951 2019-01-25  Daniel Bates  <dabates@apple.com>
2952
2953         [iOS] Pressing Tab key doesn't move to next cell with Google Sheets
2954         https://bugs.webkit.org/show_bug.cgi?id=193048
2955         <rdar://problem/46433836>
2956
2957         Reviewed by Brent Fulgham.
2958
2959         WebCore knows how interpret the Tab and Shift + Tab keys. When building with UIKit keyboard additions
2960         we do not need to register key commands for handling them from the UIProcess code. Instead UIKit will
2961         sends key events for these commands to us. This will make the behavior of these key commands when executed
2962         in an editable field match the behavior of these command when executed in a non-editable field since
2963         both code paths will now go through WebCore.
2964
2965         * UIProcess/ios/WKContentViewInteraction.mm:
2966         (-[WKContentView keyCommands]): Only compile when building with !USE(UIKIT_KEYBOARD_ADDITIONS).
2967
2968 2019-01-25  Alex Christensen  <achristensen@webkit.org>
2969
2970         Fix Linux build.
2971
2972         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2973         (WebKit::NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate):
2974
2975 2019-01-25  Keith Rollin  <krollin@apple.com>
2976
2977         Update WebKitAdditions.xcconfig with correct order of variable definitions
2978         https://bugs.webkit.org/show_bug.cgi?id=193793
2979         <rdar://problem/47532439>
2980
2981         Reviewed by Alex Christensen.
2982
2983         XCBuild changes the way xcconfig variables are evaluated. In short,
2984         all config file assignments are now considered in part of the
2985         evaluation. When using the new build system and an .xcconfig file
2986         contains multiple assignments of the same build setting:
2987
2988         - Later assignments using $(inherited) will inherit from earlier
2989           assignments in the xcconfig file.
2990         - Later assignments not using $(inherited) will take precedence over
2991           earlier assignments. An assignment to a more general setting will
2992           mask an earlier assignment to a less general setting. For example,
2993           an assignment without a condition ('FOO = bar') will completely mask
2994           an earlier assignment with a condition ('FOO[sdk=macos*] = quux').
2995
2996         This affects some of our .xcconfig files, in that sometimes platform-
2997         or sdk-specific definitions appear before the general definitions.
2998         Under the new evaluations rules, the general definitions alway take
2999         effect because they always overwrite the more-specific definitions. The
3000         solution is to swap the order, so that the general definitions are
3001         established first, and then conditionally overwritten by the
3002         more-specific definitions.
3003
3004         * Configurations/BaseTarget.xcconfig:
3005         * Configurations/Version.xcconfig:
3006         * Configurations/WebKit.xcconfig:
3007
3008 2019-01-25  Keith Rollin  <krollin@apple.com>
3009
3010         Update existing .xcfilelists
3011         https://bugs.webkit.org/show_bug.cgi?id=193791
3012         <rdar://problem/47201706>
3013
3014         Reviewed by Alex Christensen.
3015
3016         Many .xcfilelist files were added in r238824 in order to support
3017         XCBuild. Update these with recent changes to the set of build files
3018         and with the current generate-xcfilelist script.
3019
3020         * DerivedSources-input.xcfilelist:
3021         * DerivedSources-output.xcfilelist:
3022         * UnifiedSources-input.xcfilelist:
3023         * UnifiedSources-output.xcfilelist:
3024
3025 2019-01-25  Per Arne Vollan  <pvollan@apple.com>
3026
3027         [iOS] Deny mach lookups to services not used.
3028         https://bugs.webkit.org/show_bug.cgi?id=193828
3029
3030         Reviewed by Brent Fulgham.
3031
3032         Start denying mach lookups to iOS services, which were previously allowed with reporting.
3033         Living-on has indicated that these services are not used.
3034
3035         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3036
3037 2019-01-25  Brent Fulgham  <bfulgham@apple.com>
3038
3039         Activate the WebResourceLoadStatisticsStore in the NetworkProcess and deactivate it in the UIProcess.
3040         https://bugs.webkit.org/show_bug.cgi?id=193297
3041         <rdar://problem/47158841>
3042
3043         Reviewed by Alex Christensen.
3044
3045         This patch activates the ResourceLoadStatistics code in the NetworkProcess, and turns
3046         it off in the UIProcess. It also updates test infrastructure to work with this change
3047         in architecture.
3048
3049         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3050         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceLoading): Added.
3051         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceRedirect): Added.
3052         (WebKit::ResourceLoadStatisticsMemoryStore::logWebSocketLoading): Added.
3053         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3054         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading): Added.
3055         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect): Added.
3056         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading): Added.
3057         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
3058         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
3059         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCapForPrevalentResources): Deleted.
3060         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3061         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3062         (WebKit::NetworkConnectionToWebProcess::logSubresourceLoading): Added.
3063         (WebKit::NetworkConnectionToWebProcess::logSubresourceRedirect): Added.
3064         (WebKit::NetworkConnectionToWebProcess::logWebSocketLoading): Added.
3065         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3066         * NetworkProcess/NetworkSession.cpp:
3067         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
3068         * UIProcess/WebProcessPool.cpp:
3069         (WebKit::WebProcessPool::ensureNetworkProcess):
3070         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3071         (WebKit::WebsiteDataStore::parameters):
3072         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3073         (WebKit::WebsiteDataStore::removeData):
3074         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
3075         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
3076         * Webprocess/WebProcess.cpp:
3077         (WebKit::WebProcess::initializeWebProcess): Register new ResourceLoadObserver callbacks.
3078
3079 2019-01-25  Ryosuke Niwa  <rniwa@webkit.org>
3080
3081         iOS: inputmode="none" disables hardware keyboard's globe key
3082         https://bugs.webkit.org/show_bug.cgi?id=193811
3083         <rdar://problem/47406553>
3084
3085         Reviewed by Wenson Hsieh.
3086
3087         Removed the support for inputmode="none" for now since we need a new SPI from UIKit
3088         to properly implement this feature some time in the future.
3089
3090         * UIProcess/ios/WKContentViewInteraction.mm:
3091         (-[WKContentView _zoomToRevealFocusedElement]):
3092         (-[WKContentView inputView]):
3093         (-[WKContentView requiresAccessoryView]):
3094         (-[WKContentView textInputTraits]):
3095
3096 2019-01-25  David Kilzer  <ddkilzer@apple.com>
3097
3098         Move soft-linking of Lookup.framework out of LookupSPI.h
3099         <https://webkit.org/b/193815>
3100
3101         Reviewed by Tim Horton.
3102
3103         * UIProcess/Cocoa/WebViewImpl.mm:
3104         (-[WKWindowVisibilityObserver dealloc]):
3105         (-[WKWindowVisibilityObserver startObservingLookupDismissalIfNeeded]):
3106         - Move soft-linking to LookupSoftLink.{h,mm}.
3107
3108 2019-01-25  Antti Koivisto  <antti@apple.com>
3109
3110         REGRESSION (PSON): After swipe back, first few attempts to swipe forward not recognized as swipe gestures
3111         https://bugs.webkit.org/show_bug.cgi?id=193818
3112         <rdar://problem/47456584>
3113
3114         Reviewed by Tim Horton.
3115
3116         We don't hit the RenderTreeSizeThreshold milestone to remove the snapshot and allow interaction because we request it
3117         from a wrong process (the one we are leaving behind).
3118
3119         * UIProcess/Cocoa/ViewGestureController.cpp:
3120         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
3121
3122         Request the RenderTreeSizeThreshold notification when the load has started and we know the process to use.
3123
3124         (WebKit::ViewGestureController::SnapshotRemovalTracker::hasOutstandingEvent):
3125         * UIProcess/Cocoa/ViewGestureController.h:
3126         (WebKit::ViewGestureController::SnapshotRemovalTracker::renderTreeSizeThreshold const):
3127         (WebKit::ViewGestureController::SnapshotRemovalTracker::setRenderTreeSizeThreshold):
3128         * UIProcess/mac/ViewGestureControllerMac.mm:
3129         (WebKit::ViewGestureController::endSwipeGesture):
3130
3131         Don't request immediately, save the threshold to SnapshotRemovalTracker.
3132
3133         (WebKit::ViewGestureController::requestRenderTreeSizeNotificationIfNeeded):
3134
3135         Do the request to the right process.
3136
3137         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
3138         (WebKit::ViewGestureGeometryCollector::setRenderTreeSizeNotificationThreshold):
3139
3140         Ensure we send the notification even if we reached the threshold before it was requested.
3141
3142         (WebKit::ViewGestureGeometryCollector::sendDidHitRenderTreeSizeThresholdIfNeeded):
3143         (WebKit::ViewGestureGeometryCollector::mainFrameDidLayout):
3144         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
3145         (WebKit::ViewGestureGeometryCollector::setRenderTreeSizeNotificationThreshold): Deleted.
3146
3147 2019-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3148
3149         [iOS] Rename some WebKit-internal functions and variables that reference "data interaction"
3150         https://bugs.webkit.org/show_bug.cgi?id=193829
3151
3152         Reviewed by Tim Horton.
3153
3154         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3155         (WebKit::WebPageProxy::setDragCaretRect):
3156         * UIProcess/PageClient.h:
3157         * UIProcess/WebPageProxy.h:
3158         * UIProcess/WebPageProxy.messages.in:
3159         * UIProcess/ios/PageClientImplIOS.h:
3160         * UIProcess/ios/PageClientImplIOS.mm:
3161         (WebKit::PageClientImpl::didHandleDragStartRequest):
3162         (WebKit::PageClientImpl::didConcludeEditDrag):
3163         (WebKit::PageClientImpl::didChangeDragCaretRect):
3164         (WebKit::PageClientImpl::didHandleStartDataInteractionRequest): Deleted.
3165         (WebKit::PageClientImpl::didConcludeEditDataInteraction): Deleted.
3166         (WebKit::PageClientImpl::didChangeDataInteractionCaretRect): Deleted.
3167         * UIProcess/ios/WKContentViewInteraction.h:
3168         * UIProcess/ios/WKContentViewInteraction.mm:
3169         (-[WKContentView setupInteraction]):
3170         (-[WKContentView cleanupInteraction]):
3171         (-[WKContentView setupDragAndDropInteractions]):
3172         (-[WKContentView teardownDragAndDropInteractions]):
3173         (-[WKContentView _didHandleDragStartRequest:]):
3174         (-[WKContentView _didConcludeEditDrag:]):
3175         (-[WKContentView _didChangeDragCaretRect:currentRect:]):
3176         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
3177         (-[WKContentView setupDataInteractionDelegates]): Deleted.
3178         (-[WKContentView teardownDataInteractionDelegates]): Deleted.
3179         (-[WKContentView _didHandleStartDataInteractionRequest:]): Deleted.
3180         (-[WKContentView _didConcludeEditDataInteraction:]): Deleted.
3181         (-[WKContentView _didChangeDataInteractionCaretRect:currentRect:]): Deleted.
3182         * UIProcess/ios/WebPageProxyIOS.mm:
3183         (WebKit::WebPageProxy::didHandleDragStartRequest):
3184         (WebKit::WebPageProxy::requestDragStart):
3185         (WebKit::WebPageProxy::didConcludeEditDrag):
3186         (WebKit::WebPageProxy::didHandleStartDataInteractionRequest): Deleted.
3187         (WebKit::WebPageProxy::requestStartDataInteraction): Deleted.
3188         (WebKit::WebPageProxy::didConcludeEditDataInteraction): Deleted.
3189         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
3190         (WebKit::WebDragClient::didConcludeEditDrag):
3191         * WebProcess/WebPage/WebPage.h:
3192         * WebProcess/WebPage/WebPage.messages.in:
3193         * WebProcess/WebPage/ios/WebPageIOS.mm:
3194         (WebKit::WebPage::requestDragStart):
3195         (WebKit::WebPage::requestAdditionalItemsForDragSession):
3196         (WebKit::WebPage::didConcludeEditDrag):
3197         (WebKit::WebPage::requestStartDataInteraction): Deleted.
3198         (WebKit::WebPage::didConcludeEditDataInteraction): Deleted.
3199
3200 2019-01-25  Alex Christensen  <achristensen@webkit.org>
3201
3202         WKWebView.goBack should reload if there is a safe browsing warning
3203         https://bugs.webkit.org/show_bug.cgi?id=193805
3204         <rdar://problem/46908216>
3205
3206         Reviewed by Geoff Garen.
3207
3208         If a WKWebView is showing a safe browsing warning and the user clicks a back button
3209         in the app which calls WKWebView.goBack, the WKWebView is in a state where it has not navigated yet,
3210         so actually going back will appear to the user to go back twice.  We can't just do nothing because the
3211         app is in a state where it is expecting a navigation to happen.  Reloading achieves what the user expects
3212         and makes the app work like the app expects.
3213
3214         * UIProcess/API/C/WKPage.cpp:
3215         (WKPageGoBack):
3216         * UIProcess/API/Cocoa/WKWebView.mm:
3217         (-[WKWebView goBack]):
3218         * UIProcess/PageClient.h:
3219         (WebKit::PageClient::hasSafeBrowsingWarning const):
3220         * UIProcess/mac/PageClientImplMac.h:
3221         * UIProcess/mac/PageClientImplMac.mm:
3222         (WebKit::PageClientImpl::hasSafeBrowsingWarning const):
3223
3224 2019-01-25  Chris Dumez  <cdumez@apple.com>
3225
3226         Regression(PSON) cross-site provisional page is not canceled if a new same-site one is started
3227         https://bugs.webkit.org/show_bug.cgi?id=193788
3228         <rdar://problem/47531231>
3229
3230         Reviewed by Alex Christensen.
3231
3232         When the page starts a new provisional load, make sure we cancel any pending one in the provisional
3233         process, as it would have happened in the first provisional load happened in the same process.
3234         Without this, we could have 2 parallel loads happening, one in the committed process and another
3235         in the provisional one, leading to assertion failures in debug.
3236
3237         * UIProcess/WebPageProxy.cpp:
3238         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
3239
3240 2019-01-25  Chris Dumez  <cdumez@apple.com>
3241
3242         Drop WebKit::WebKitPolicyAction type as it is no longer needed
3243         https://bugs.webkit.org/show_bug.cgi?id=193827
3244
3245         Reviewed by Antti Koivisto.
3246
3247         Drop WebKit::WebKitPolicyAction type as it is no longer needed. It is now identical to
3248         WebCore::PolicyAction.
3249
3250         * Shared/WebPolicyAction.h: Removed.
3251         * UIProcess/WebFramePolicyListenerProxy.cpp:
3252         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
3253         (WebKit::WebFramePolicyListenerProxy::use):
3254         (WebKit::WebFramePolicyListenerProxy::download):
3255         (WebKit::WebFramePolicyListenerProxy::ignore):
3256         * UIProcess/WebFramePolicyListenerProxy.h:
3257         * UIProcess/WebFrameProxy.cpp:
3258         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
3259         * UIProcess/WebFrameProxy.h:
3260         * UIProcess/WebPageProxy.cpp:
3261         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3262         (WebKit::WebPageProxy::receivedPolicyDecision):
3263         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3264         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
3265         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
3266         (WebKit::WebPageProxy::decidePolicyForResponseShared):
3267         * UIProcess/WebPageProxy.h:
3268         * WebKit.xcodeproj/project.pbxproj:
3269         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3270         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
3271         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3272         * WebProcess/WebPage/WebFrame.cpp:
3273         (WebKit::WebFrame::didReceivePolicyDecision):
3274         (WebKit::toPolicyAction): Deleted.
3275         * WebProcess/WebPage/WebFrame.h:
3276         * WebProcess/WebPage/WebPage.cpp:
3277         (WebKit::WebPage::didReceivePolicyDecision):
3278         * WebProcess/WebPage/WebPage.h:
3279
3280 2019-01-25  Per Arne Vollan  <pvollan@apple.com>
3281
3282         [iOS] Add logging of calls
3283         https://bugs.webkit.org/show_bug.cgi?id=193784
3284
3285         Reviewed by Brent Fulgham.
3286
3287         Add permissive logging of calls on iOS.
3288
3289         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3290
3291 2019-01-25  Chris Dumez  <cdumez@apple.com>
3292
3293         Regression(PSON?) Crash under NavigationState::NavigationClient::decidePolicyForNavigationAction()
3294         https://bugs.webkit.org/show_bug.cgi?id=193779
3295         <rdar://problem/46170903>
3296
3297         Reviewed by Antti Koivisto.
3298
3299         * UIProcess/Cocoa/NavigationState.mm:
3300         (WebKit::tryAppLink):
3301         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3302         We were crashing when trying to get the URL of the main frame, which was sad because we never
3303         ended up using the main frame URL. Therefore, this patch drops the code in question.
3304
3305         * UIProcess/ProvisionalPageProxy.cpp:
3306         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
3307         Add assertion to make sure that the DecidePolicyForNavigationActionAsync IPC it is getting
3308         from the process is related to its main frame.
3309
3310 2019-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3311
3312         Need a way for JavaScript (or bundle) code to participate in undo
3313         https://bugs.webkit.org/show_bug.cgi?id=190009
3314         <rdar://problem/44807048>
3315
3316         Reviewed by Ryosuke Niwa.
3317
3318         Invalidate undo steps when removing them from WebPage. Invalidation is a no-op for editing actions that come
3319         from the UA, but for custom undo steps backed by an UndoItem, we clear out the custom undo step's pointer to its
3320         UndoItem and additionally disconnect the UndoItem from its UndoManager.
3321
3322         * WebProcess/WebPage/WebPage.cpp:
3323         (WebKit::WebPage::addWebUndoStep):
3324         (WebKit::WebPage::removeWebEditCommand):
3325         * WebProcess/WebPage/WebUndoStep.h:
3326         (WebKit::WebUndoStep::invalidate):
3327
3328 2019-01-25  Patrick Griffis  <pgriffis@igalia.com>
3329
3330         [GTK][WPE] Add API to add paths to sandbox
3331         https://bugs.webkit.org/show_bug.cgi?id=193571
3332
3333         This allows applications to add paths to the web process
3334         if required by web extensions.
3335
3336         Reviewed by Michael Catanzaro.
3337
3338         * UIProcess/API/glib/WebKitWebContext.cpp:
3339         (webkit_web_context_add_path_to_sandbox):
3340         * UIProcess/API/gtk/WebKitWebContext.h:
3341         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
3342         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
3343         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
3344         (WebKit::bubblewrapSpawn):
3345         * UIProcess/WebProcessPool.h:
3346         * UIProcess/glib/WebProcessProxyGLib.cpp:
3347         (WebKit::WebProcessProxy::platformGetLaunchOptions):
3348
3349 2019-01-24  Ryosuke Niwa  <rniwa@webkit.org>
3350
3351         iOS: Split keyboard should not shrink visualViewport.height
3352         https://bugs.webkit.org/show_bug.cgi?id=193798
3353
3354         Reviewed by Tim Horton.
3355
3356         Treat a split keyboard like a floating keyboard and don't consider its input view bounds in computing the visible content rects.
3357
3358         No new tests since while it's possible to transition between split and merged keyboard using some SPI,
3359         there isn't a reliable mechanism to reset the keyboard state. e.g. we need to wait for a hard-coded amount of time.
3360
3361         * Platform/spi/ios/UIKitSPI.h:
3362         * UIProcess/API/Cocoa/WKWebView.mm:
3363         (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
3364
3365 2019-01-24  Eric Carlson  <eric.carlson@apple.com>
3366
3367         [iOS] Silence MediaPlayer compile warnings
3368         https://bugs.webkit.org/show_bug.cgi?id=193780
3369         <rdar://problem/47518428>
3370
3371         Reviewed by Jer Noble.
3372
3373         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
3374
3375 2019-01-24  Truitt Savell  <tsavell@apple.com>
3376
3377         Unreviewed, rolling out r240446.
3378
3379         Casued 5 API failures
3380
3381         Reverted changeset:
3382
3383         "Activate the WebResourceLoadStatisticsStore in the
3384         NetworkProcess and deactivate it in the UIProcess."
3385         https://bugs.webkit.org/show_bug.cgi?id=193297
3386         https://trac.webkit.org/changeset/240446
3387
3388 2019-01-24  Brent Fulgham  <bfulgham@apple.com>
3389
3390         Activate the WebResourceLoadStatisticsStore in the NetworkProcess and deactivate it in the UIProcess.
3391         https://bugs.webkit.org/show_bug.cgi?id=193297
3392         <rdar://problem/47158841>
3393
3394         Reviewed by Alex Christensen.
3395
3396         This patch activates the ResourceLoadStatistics code in the NetworkProcess, and turns
3397         it off in the UIProcess. It also updates test infrastructure to work with this change
3398         in architecture.
3399
3400         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3401         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceLoading): Added.
3402         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceRedirect): Added.
3403         (WebKit::ResourceLoadStatisticsMemoryStore::logWebSocketLoading): Added.
3404         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3405         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading): Added.
3406         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect): Added.
3407         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading): Added.
3408         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
3409         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
3410         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCapForPrevalentResources): Deleted.
3411         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3412         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3413         (WebKit::NetworkConnectionToWebProcess::logSubresourceLoading): Added.
3414         (WebKit::NetworkConnectionToWebProcess::logSubresourceRedirect): Added.
3415         (WebKit::NetworkConnectionToWebProcess::logWebSocketLoading): Added.
3416         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3417         * NetworkProcess/NetworkSession.cpp:
3418         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
3419         * UIProcess/WebProcessPool.cpp:
3420         (WebKit::WebProcessPool::ensureNetworkProcess):
3421         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3422         (WebKit::WebsiteDataStore::parameters):
3423         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3424         (WebKit::WebsiteDataStore::removeData):
3425         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
3426         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
3427         * Webprocess/WebProcess.cpp:
3428         (WebKit::WebProcess::initializeWebProcess): Register new ResourceLoadObserver callbacks.
3429
3430 2019-01-24  John Wilander  <wilander@apple.com>
3431
3432         Add Ad Click Attribution as an internal/experimental feature
3433         https://bugs.webkit.org/show_bug.cgi?id=193685
3434         <rdar://problem/47450399>
3435
3436         Reviewed by Brent Fulgham.
3437
3438         * Shared/WebPreferences.yaml:
3439             Added AdClickAttributionEnabled as a runtime enabled feature, off by default.
3440
3441 2019-01-24  Antti Koivisto  <antti@apple.com>
3442
3443         [PSON] Flash on back navigation on Mac
3444         https://bugs.webkit.org/show_bug.cgi?id=193716
3445         <rdar://problem/47148458>
3446
3447         Reviewed by Chris Dumez.
3448
3449         We close the page immediately if we fail to suspend. Layers disappear and we get a flash.
3450
3451         * UIProcess/SuspendedPageProxy.cpp:
3452         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
3453         (WebKit::SuspendedPageProxy::close):
3454
3455         Track closed state so we don't send the message twice, causing unhandled message errors in web process.
3456
3457         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
3458
3459         Close the suspended page if the suspension fails.
3460         Skip this if we are using web process side compositing on Mac.
3461
3462         * UIProcess/SuspendedPageProxy.h:
3463         * UIProcess/WebPageProxy.cpp:
3464         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
3465
3466         On Mac, close the failed SuspendedPageProxy when entering compositing mode. At this point we don't need it to keep layers alive.
3467
3468         * UIProcess/WebProcessPool.cpp:
3469         (WebKit::WebProcessPool::closeFailedSuspendedPagesForPage):
3470         * UIProcess/WebProcessPool.h:
3471         * WebProcess/WebPage/WebPage.cpp:
3472         (WebKit::WebPage::suspendForProcessSwap):
3473
3474         Don't close the page on suspension failure. This is now managed by the UI process.
3475
3476 2019-01-24  Chris Dumez  <cdumez@apple.com>
3477
3478         Regression(PSON) Back/Forward list items' URL sometimes gets replaced with the URL of a subframe
3479         https://bugs.webkit.org/show_bug.cgi?id=193761
3480         <rdar://problem/47456405>
3481
3482         Reviewed by Alex Christensen.
3483
3484         When doing a history navigation cross-process, the UIProcess would first send the back/forward list items
3485         to the destination WebProcess via WebPage::updateBackForwardListForReattach(), then ask the process to
3486         navigate to the expected back/forward list item.
3487
3488         WebPage::updateBackForwardListForReattach() would call restoreSessionInternal(), which would call
3489         toHistoryItem() on each BackForwardListItem. This may end up creating more than one HistoryItem for each
3490         BackForwardListItem because HistoryItems are part of a tree (each frame has its own list of history items).
3491
3492         Note that BackForwardListItems and HistoryItem share a BackForwardItemIdentifier which is a
3493         (processIdentifier, itemIdentifier) pair. We normally generate the HistoryItem's identifier from inside
3494         its constructor like so:
3495         `{ Process::identifier(), generateObjectIdentifier<BackForwardItemIdentifier::ItemIdentifierType>() }`
3496
3497         However, when calling updateBackForwardListForReattach() and constructing children HistoryItem,
3498         applyFrameState() would generate the identifier by itself and passing it to the HistoryItem constructor.
3499         Its genegates the ID the exact same way so this would in theory not be a problem. Unfortunately, both
3500         calls to generateObjectIdentifier() get inlined and both call sites end up with their own static counter
3501         to generate ids. As a result, we may end up with conflicts as HistoryItems for child frames (restored
3502         by restoreSessionInternal()) can end up with the same identifier as HistoryItems for top frames.
3503
3504         This confusion would lead to the WebContent process sending the UIProcess bad information and the URL
3505         of subframes could end up as the WebBackForwardListItem's mainframe URL.
3506
3507         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
3508         (WebKit::applyFrameState):
3509         Stop calling generateObjectIdentifier() explicitly and let the HistoryItem constructor take care of it.
3510         Calling generateObjectIdentifier() for the same type from different places is not safe due to inlining.
3511
3512 2019-01-24  Ross Kirsling  <ross.kirsling@sony.com>
3513
3514         Move FileSystem to WTF
3515         https://bugs.webkit.org/show_bug.cgi?id=193602
3516
3517         Reviewed by Yusuke Suzuki.
3518
3519         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp:
3520         * NetworkProcess/NetworkDataTaskBlob.h:
3521         * NetworkProcess/NetworkProcess.cpp:
3522         * NetworkProcess/cache/CacheStorageEngine.cpp:
3523         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
3524         * NetworkProcess/cache/NetworkCache.cpp:
3525         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
3526         * NetworkProcess/cache/NetworkCacheData.cpp:
3527         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
3528         * NetworkProcess/cache/NetworkCacheFileSystem.h:
3529         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
3530         * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
3531         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
3532         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3533         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3534         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3535         * NetworkProcess/mac/NetworkProcessMac.mm:
3536         * NetworkProcess/soup/NetworkProcessSoup.cpp:
3537         * PluginProcess/unix/PluginProcessMainUnix.cpp:
3538         * Shared/PersistencyUtils.cpp:
3539         * Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp:
3540         * Shared/Plugins/unix/PluginSearchPath.cpp:
3541         * Shared/WebMemorySampler.h:
3542         * Shared/glib/ProcessExecutablePathGLib.cpp:
3543         * Shared/ios/ChildProcessIOS.mm:
3544         * Shared/mac/ChildProcessMac.mm:
3545         * Shared/mac/SandboxExtensionMac.mm:
3546         * UIProcess/API/APIContentRuleListStore.cpp:
3547         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
3548         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
3549         * UIProcess/API/glib/IconDatabase.cpp:
3550         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
3551         * UIProcess/API/glib/WebKitFileChooserRequest.cpp:
3552         * UIProcess/API/glib/WebKitWebContext.cpp:
3553         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
3554         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp:
3555         * UIProcess/Automation/WebAutomationSession.cpp:
3556         * UIProcess/Cocoa/DownloadClient.mm:
3557         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3558         * UIProcess/Cocoa/WebViewImpl.mm:
3559         * UIProcess/DeviceIdHashSaltStorage.cpp:
3560         * UIProcess/Downloads/DownloadProxy.cpp:
3561         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
3562         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
3563         * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
3564         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
3565         * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:
3566         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
3567         * UIProcess/ServiceWorkerProcessProxy.cpp:
3568         * UIProcess/WebStorage/LocalStorageDatabase.cpp:
3569         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
3570         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3571         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3572         * UIProcess/glib/WebProcessProxyGLib.cpp:
3573         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
3574         * UIProcess/gtk/WebProcessPoolGtk.cpp:
3575         * UIProcess/ios/WKContentViewInteraction.mm:
3576         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3577         * UIProcess/mac/WebPageProxyMac.mm:
3578         * UIProcess/win/WebProcessPoolWin.cpp:
3579         * UIProcess/win/WebView.cpp:
3580         * UIProcess/wpe/WebProcessPoolWPE.cpp:
3581         * WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.cpp:
3582         * WebProcess/InjectedBundle/glib/InjectedBundleGlib.cpp:
3583         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
3584         * WebProcess/Plugins/Netscape/NetscapePluginStream.h:
3585         * WebProcess/Plugins/PluginProcessConnection.cpp:
3586         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
3587         * WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp:
3588         * WebProcess/WebPage/win/WebInspectorUIWin.cpp:
3589         * WebProcess/cocoa/WebProcessCocoa.mm:
3590
3591 2019-01-23  Simon Fraser  <simon.fraser@apple.com>
3592
3593         Create "frame hosting" nodes for the scrolling tree
3594         https://bugs.webkit.org/show_bug.cgi?id=193753
3595
3596         Reviewed by Antti Koivisto.
3597
3598         When the scrolling tree crosses frame boundaries, mutations in the parent frame currently
3599         require the iframe's scrolling node to get reparented in a new ancestor, which requires
3600         a layer tree walk of the parent frame. This is error-prone, and not very future-proof.
3601
3602         Fix this by introducing "frame hosting" scrolling tree nodes. These are mostly inert
3603         nodes that are owned by the RenderIFrame's layer backing in the parent frame, and exist
3604         to provide a consistent parent node for the subframe's scrolling node.
3605
3606         This patch adds the node types, but does not instantiate them yet.
3607
3608         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
3609         (ArgumentCoder<ScrollingStateFrameHostingNode>::encode):
3610         (ArgumentCoder<ScrollingStateFrameHostingNode>::decode):
3611         (WebKit::encodeNodeAndDescendants):
3612         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
3613         (WebKit::dump):
3614         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
3615         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
3616         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
3617         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
3618         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
3619         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
3620
3621 2019-01-23  Ross Kirsling  <ross.kirsling@sony.com>
3622
3623         [Curl] Unreviewed build fix for r240292 and friends.
3624
3625         WinCairo test stability must be restored in subsequent patch.
3626
3627         * NetworkProcess/curl/NetworkProcessCurl.cpp:
3628         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
3629         (WebKit::NetworkProcess::setNetworkProxySettings):
3630
3631 2019-01-23  Commit Queue  <commit-queue@webkit.org>
3632
3633         Unreviewed, rolling out r240403.
3634         https://bugs.webkit.org/show_bug.cgi?id=193757
3635
3636         "Causes multiple crashes on macOS port (probably used wrong
3637         ENABLE macro)" (Requested by ddkilzer on #webkit).
3638
3639         Reverted changeset:
3640
3641         "[Curl] Unreviewed build fix for r240292 and friends."
3642         https://trac.webkit.org/changeset/240403
3643
3644 2019-01-23  Ross Kirsling  <ross.kirsling@sony.com>
3645
3646         [Curl] Unreviewed build fix for r240292 and friends.
3647
3648         WinCairo test stability must be restored in subsequent patch.
3649
3650         * NetworkProcess/curl/NetworkProcessCurl.cpp:
3651         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
3652         (WebKit::NetworkProcess::setNetworkProxySettings):
3653
3654 2019-01-23  Alex Christensen  <achristensen@webkit.org>
3655
3656         Stop using NetworkProcess::singleton
3657         https://bugs.webkit.org/show_bug.cgi?id=193700
3658
3659         Reviewed by Don Olmstead.
3660
3661         This replaces it with a NeverDestroyed<NetworkProcess> and paves the way for more interesting things.
3662
3663         * NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp:
3664         * NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm:
3665         (WebKit::initializeChildProcess<WebKit::NetworkProcess>):
3666         * NetworkProcess/NetworkProcess.cpp:
3667         (WebKit::NetworkProcess::NetworkProcess):
3668         (WebKit::NetworkProcess::singleton): Deleted.
3669         * NetworkProcess/NetworkProcess.h:
3670         * NetworkProcess/soup/NetworkProcessMainSoup.cpp:
3671         (WebKit::initializeChildProcess<WebKit::NetworkProcess>):
3672         * NetworkProcess/win/NetworkProcessMainWin.cpp:
3673         (WebKit::initializeChildProcess<WebKit::NetworkProcess>):
3674         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
3675         (WebKit::initializeChildProcess):
3676         (WebKit::XPCServiceInitializer):
3677
3678 2019-01-23  Ryan Haddad  <ryanhaddad@apple.com>
3679
3680         Unreviewed, rolling out r240343.
3681
3682         Caused 4 PSON API test failures.
3683
3684         Reverted changeset:
3685
3686         "[PSON] Flash on back navigation on Mac"
3687         https://bugs.webkit.org/show_bug.cgi?id=193716
3688         https://trac.webkit.org/changeset/240343
3689
3690 2019-01-23  Chris Dumez  <cdumez@apple.com>
3691
3692         Deprecate API to limit the maximum number of WebProcesses
3693         https://bugs.webkit.org/show_bug.cgi?id=193725
3694         <rdar://problem/47464879>
3695
3696         Reviewed by Geoff Garen.
3697
3698         Deprecate API to limit the maximum number of WebProcesses and make it a no-op. It adds
3699         complexity and is not safe (conflicts with PSON).
3700
3701         Add a new usesSingleWebProcess SPI to _WKProcessPoolConfiguration to be used by
3702         Minibrowser / Safari in order to disable process per tab (can be useful for debugging).
3703         Note that enabling the single WebProcess mode will disable PSON and process prewarming.
3704
3705         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3706         (API::ProcessPoolConfiguration::createWithLegacyOptions):
3707         (API::ProcessPoolConfiguration::copy):
3708         * UIProcess/API/APIProcessPoolConfiguration.h:
3709         * UIProcess/API/C/WKContext.cpp:
3710         (WKContextSetMaximumNumberOfProcesses):
3711         (WKContextGetMaximumNumberOfProcesses):
3712         * UIProcess/API/C/WKContext.h:
3713         * UIProcess/API/Cocoa/WKProcessPool.mm:
3714         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3715         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3716         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3717         (-[_WKProcessPoolConfiguration maximumProcessCount]):
3718         (-[_WKProcessPoolConfiguration setMaximumProcessCount:]):
3719         (-[_WKProcessPoolConfiguration usesSingleWebProcess]):
3720         (-[_WKProcessPoolConfiguration setUsesSingleWebProcess:]):
3721         (-[_WKProcessPoolConfiguration description]):
3722         * UIProcess/API/glib/WebKitWebContext.cpp:
3723         (webkitWebContextConstructed):
3724         (webkit_web_context_set_process_model):
3725         (webkit_web_context_set_web_process_count_limit):
3726         * UIProcess/WebProcessPool.cpp:
3727         (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
3728         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
3729         (WebKit::WebProcessPool::processForNavigationInternal):
3730         * UIProcess/WebProcessPool.h:
3731
3732 2019-01-23  Brent Fulgham  <bfulgham@apple.com>
3733
3734         Switch NetworkStorageSession portions of ResourceLoadStatistics to Async message passing style
3735         https://bugs.webkit.org/show_bug.cgi?id=193659
3736         <rdar://problem/47433290>
3737
3738         Reviewed by Alex Christensen.
3739
3740         Change the implementations of ResourceLoadStatistics code in NetworkStorageSession to use the
3741         'sendWithAsyncReply' so that more of the code is autogenerated. This should make test runs more
3742         consistent, and should reduce the possibility of bookkeeping errors in the message handling
3743         implementations.
3744
3745         Fix the implementation of NetworkProcessProxy::clearCallbackStates to remove the manually constructed
3746         (and incomplete) message callbacks. These errors are a big reason to move to the auto-generated
3747         'sendWithAsyncReply' implementatoin. Ditto for NetworkProcessProxy::didClose.
3748
3749         This patch also moves an initializaton call (WebsiteDataStore::didCreateNetworkProcess) from
3750         'ensureNetworkProcess' to 'processDidFinishLaunching'. In current code, the call happens before
3751         a connection is established to the network process, causing initialization messages to get dropped
3752         leading to test system flakiness.
3753
3754         Finally: The WK API test code was updated to ensure that completion handlers are always called, even
3755         when built without ENABLE_RESOURCE_LOAD_STATISTICS defined.
3756
3757         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3758         * NetworkProcess/Classifier/ShouldGrandfatherStatistics.h: Added.
3759         * NetworkProcess/Classifier/StorageAccessStatus.h: Added.
3760         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3761         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
3762         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3763         * NetworkProcess/NetworkProcess.cpp:
3764         (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
3765         (WebKit::NetworkProcess::setAgeCapForClientSideCookies):
3766         (WebKit::NetworkProcess::scheduleClearInMemoryAndPersistent):
3767         (WebKit::NetworkProcess::hasStorageAccessForFrame):
3768         (WebKit::NetworkProcess::requestStorageAccess):
3769         (WebKit::NetworkProcess::grantStorageAccess):
3770         (WebKit::NetworkProcess::removeAllStorageAccess):
3771         (WebKit::NetworkProcess::setCacheMaxAgeCapForPrevalentResources):
3772         (WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources):
3773         (WebKit::NetworkProcess::deleteWebsiteData):
3774         * NetworkProcess/NetworkProcess.h:
3775         * NetworkProcess/NetworkProcess.messages.in:
3776         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3777         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
3778         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
3779         (WKWebsiteDataStoreStatisticsResetToConsistentState):
3780         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3781         * UIProcess/Network/NetworkProcessProxy.cpp:
3782         (WebKit::NetworkProcessProxy::clearCallbackStates): Remove incomplete clean-up code that
3783         is now autogenerated.
3784         (WebKit::NetworkProcessProxy::didClose): Ditto.
3785         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
3786         (WebKit::NetworkProcessProxy::scheduleClearInMemoryAndPersistent):
3787         (WebKit::NetworkProcessProxy::setAgeCapForClientSideCookies):
3788         (WebKit::NetworkProcessProxy::hasStorageAccessForFrame):
3789         (WebKit::NetworkProcessProxy::requestStorageAccess):
3790         (WebKit::NetworkProcessProxy::grantStorageAccess):
3791         (WebKit::NetworkProcessProxy::removeAllStorageAccess):
3792         (WebKit::NetworkProcessProxy::setCacheMaxAgeCapForPrevalentResources):
3793         (WebKit::NetworkProcessProxy::setCacheMaxAgeCap):
3794         (WebKit::NetworkProcessProxy::resetCacheMaxAgeCapForPrevalentResources):
3795         (WebKit::NetworkProcessProxy::didUpdateBlockCookies): Deleted.
3796         (WebKit::NetworkProcessProxy::didSetAgeCapForClientSideCookies): Deleted.
3797         (WebKit::NetworkProcessProxy::didUpdateRuntimeSettings): Deleted.
3798         (WebKit::NetworkProcessProxy::storageAccessRequestResult): Deleted.
3799         (WebKit::NetworkProcessProxy::storageAccessOperationResult): Deleted.
3800         (WebKit::NetworkProcessProxy::didRemoveAllStorageAccess): Deleted.
3801         (WebKit::NetworkProcessProxy::didSetCacheMaxAgeCapForPrevalentResources): Deleted.
3802         * UIProcess/Network/NetworkProcessProxy.h:
3803         * UIProcess/Network/NetworkProcessProxy.messages.in:
3804         * UIProcess/WebPageProxy.cpp:
3805         * UIProcess/WebProcessPool.cpp:
3806         (WebKit::WebProcessPool::ensureNetworkProcess): Move WebsiteDataStore 'didCreateNetworkProcess'
3807         to 'processDidFinishLaunching'. Currently the call happens before a connection is established,
3808         causing initialization messages to get dropped.
3809         (WebKit::WebProcessPool::processDidFinishLaunching): Ditto.
3810         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3811         (WebKit::WebsiteDataStore::removeData):
3812         (WebKit::WebsiteDataStore::setMaxStatisticsEntries):
3813         (WebKit::WebsiteDataStore::setPruneEntriesDownTo):
3814         (WebKit::WebsiteDataStore::setGrandfatheringTime):
3815         (WebKit::WebsiteDataStore::setCacheMaxAgeCap):
3816         (WebKit::WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval):
3817         (WebKit::WebsiteDataStore::setPrevalentResource):
3818         (WebKit::WebsiteDataStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
3819         (WebKit::WebsiteDataStore::scheduleClearInMemoryAndPersistent):
3820         (WebKit::WebsiteDataStore::setAgeCapForClientSideCookies):
3821         (WebKit::WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned):
3822         (WebKit::WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured):
3823         (WebKit::WebsiteDataStore::setTimeToLiveUserInteraction):
3824         (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
3825         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
3826         * UIProcess/WebsiteData/WebsiteDataStore.h:
3827         * WebKit.xcodeproj/project.pbxproj:
3828
3829 2019-01-23  Sihui Liu  <sihui_liu@apple.com>
3830
3831         Clean up IndexedDB files between tests
3832         https://bugs.webkit.org/show_bug.cgi?id=192796
3833         <rdar://problem/46824999>
3834
3835         Reviewed by Geoffrey Garen.
3836
3837         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3838         (WKWebsiteDataStoreRemoveAllIndexedDatabases):
3839         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3840
3841 2019-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
3842
3843         [iOS] fast/events/touch/ios/hover-when-style-change-is-async.html times out
3844         https://bugs.webkit.org/show_bug.cgi?id=193182
3845         <rdar://problem/47452154>
3846
3847         Reviewed by Tim Horton.
3848
3849         Fix an existing bug where blurring an element doesn't always un-suppress text interactions.
3850
3851         * UIProcess/ios/WKContentViewInteraction.mm:
3852         (-[WKContentView _elementDidBlur]):
3853
3854 2019-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
3855
3856         Minor improvements to NetworkProcess
3857         https://bugs.webkit.org/show_bug.cgi?id=193708
3858
3859         Reviewed by Alex Christensen.
3860
3861         * NetworkProcess/NetworkProcess.cpp:
3862         (WebKit::NetworkProcess::switchToNewTestingSession): Fix a spelling error.
3863         (WebKit::NetworkProcess::ensureSession): Add useful assertion.
3864         (WebKit::NetworkProcess::defaultStorageSession const): Split into platform functions.
3865         (WebKit::NetworkProcess::destroySession): Add useful assertion.
3866         * NetworkProcess/NetworkProcess.h:
3867         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3868         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
3869         * NetworkProcess/curl/NetworkProcessCurl.cpp:
3870         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
3871         * NetworkProcess/soup/NetworkProcessSoup.cpp:
3872         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
3873
3874 2019-01-23  Daniel Bates  <dabates@apple.com>
3875
3876         Fix the Apple Internal build. See <rdar://problem/47486758>.
3877
3878         * UIProcess/ios/WKContentViewInteraction.mm:
3879         (-[WKContentView dropInteraction:previewForDroppingItem:withDefault:]):
3880
3881 2019-01-23  Per Arne Vollan  <pvollan@apple.com>
3882
3883         [macOS] Sandbox fails to compile
3884         https://bugs.webkit.org/show_bug.cgi?id=193727
3885         <rdar://problem/47476903>
3886
3887         Reviewed by Brent Fulgham.
3888
3889         Use '(with send-signal SIGKILL)' instead of '(with termination)'.
3890
3891         * WebProcess/com.apple.WebProcess.sb.in:
3892
3893 2019-01-23  Brent Fulgham  <bfulgham@apple.com>
3894
3895         REGRESSION (r240243): CrashTracer: WebKitTestRunnerApp at com.apple.WebKit: WebKit::WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue const + 32
3896         https://bugs.webkit.org/show_bug.cgi?id=193723
3897         <rdar://problem/47476802>
3898
3899         Reviewed by David Kilzer.
3900
3901         The new code added in r240243 could attempt to submit telemetry after the relevant
3902         WebResourceLoadStatisticsStore was destroyed. We should guard against this possibility.
3903
3904         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
3905         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
3906
3907 2019-01-23  Antti Koivisto  <antti@apple.com>
3908
3909         [PSON] Flash on back navigation on Mac
3910         https://bugs.webkit.org/show_bug.cgi?id=193716
3911         <rdar://problem/47148458>
3912
3913         Reviewed by Chris Dumez.
3914
3915         We close the page immediately if we fail to suspend. Layers disappear and we get a flash.
3916
3917         * UIProcess/SuspendedPageProxy.cpp:
3918         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
3919
3920         Remove the suspended page (so closing it on web process side) if the suspension fails.
3921         Skip this if we are using web process side compositing on Mac.
3922
3923         * UIProcess/WebPageProxy.cpp:
3924         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
3925
3926         On Mac, remove failed SuspendedPageProxy when entering compositing mode. At this point we don't need it to keep layers alive.
3927
3928         * UIProcess/WebProcessPool.cpp:
3929         (WebKit::WebProcessPool::removeFailedSuspendedPagesForPage):
3930         * UIProcess/WebProcessPool.h:
3931         * WebProcess/WebPage/WebPage.cpp:
3932         (WebKit::WebPage::suspendForProcessSwap):
3933
3934         Don't close the page on suspension failure.
3935
3936 2019-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
3937
3938         Introduce UndoStep::label() and adopt it in WebKitLegacy and WebKit
3939         https://bugs.webkit.org/show_bug.cgi?id=193706
3940         <rdar://problem/44807048>
3941
3942         Reviewed by Ryosuke Niwa.
3943
3944         * UIProcess/Cocoa/WebViewImpl.mm:
3945         (WebKit::WebViewImpl::registerEditCommand):
3946         * UIProcess/WebEditCommandProxy.cpp:
3947         (WebKit::WebEditCommandProxy::WebEditCommandProxy):
3948         * UIProcess/WebEditCommandProxy.h:
3949
3950         Drive-by tweak: make WebEditCommandProxy's backpointer to its WebPageProxy a WeakPtr instead of a raw pointer.
3951         Additionally, call clear() instead of setting m_page to 0 upon invalidation. Also, turn the WebPageProxy*
3952         argument into a WebPageProxy&, since the WebPageProxy must exist when it creates a new WebEditCommandProxy.
3953
3954         (WebKit::WebEditCommandProxy::create):
3955         (WebKit::WebEditCommandProxy::label const):
3956         (WebKit::WebEditCommandProxy::invalidate):
3957         (WebKit::WebEditCommandProxy::editAction const): Deleted.
3958