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