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