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