[macOS] Select element doesn't show popup if select element had lost focus while...
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-03-27  Ryosuke Niwa  <rniwa@webkit.org>
2
3         [macOS] Select element doesn't show popup if select element had lost focus while popup was previosuly shown
4         https://bugs.webkit.org/show_bug.cgi?id=196336
5
6         Reviewed by Tim Horton.
7
8         The bug was caused by WebPopupMenu::hide never notifying PopupClient that the popup had been dismissed.
9         This resulted in RenderMenuList::m_popupIsVisible to be never reset.
10
11         Also fixed a bug in WebPopupMenuProxyMac::hidePopupMenu that this function was never dismissing
12         the popup as the selector "dismissPopUp", on the contrary to its name, does not dimiss the popup.
13         Send cancelTracking to NSMenu instead, which DOES dismiss the popup.
14
15         Tests: fast/forms/select/mac-wk2/blur-dismisses-select-popup.html
16                fast/forms/select/mac-wk2/open-select-popup-after-dismissing-by-blur.html
17
18         * UIProcess/mac/WebPopupMenuProxyMac.mm:
19         (WebKit::WebPopupMenuProxyMac::hidePopupMenu):
20         * WebProcess/WebCoreSupport/WebPopupMenu.cpp:
21         (WebKit::WebPopupMenu::hide):
22
23 2019-03-27  Dean Jackson  <dino@apple.com>
24
25         [ARKit] Black view when opening a 3D model usdz file in new tab
26         https://bugs.webkit.org/show_bug.cgi?id=196333
27         <rdar://problem/47693367>
28
29         Reviewed by Tim Horton.
30
31         When opening a new WKSystemPreviewView, we were exiting if there was no
32         presentingViewController. This code was unnecessary, and causing blank
33         content when opening a new tab.
34
35         * UIProcess/ios/WKSystemPreviewView.mm:
36         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
37         Remove the code looking for a presentingViewController.
38
39 2019-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
40
41         Need a way to include WebKitAdditions code in WebKit API headers
42         https://bugs.webkit.org/show_bug.cgi?id=196173
43
44         Reviewed by Tim Horton.
45
46         Introduce a mechanism that allows us to insert code from WebKitAdditions into public or private SDK headers
47         using `#import`s of the form:
48
49         ```
50         #if USE(APPLE_INTERNAL_SDK)
51         #import <WebKitAdditions/WKWebViewConfigurationAdditions.h>
52         #endif
53         ```
54
55         The resulting header in the built products directory will contain the contents of the imported file inserted in
56         place of the `#if USE(APPLE_INTERNAL_SDK) … #endif` block; however, when building with the Apple internal SDK,
57         the additions header content will be imported by the usual means.
58
59         * mac/postprocess-framework-headers.sh:
60         * mac/replace-webkit-additions-includes.py: Added.
61
62         Add a step when post-processing framework headers to replace instances of `#if USE(APPLE_INTERNAL_SDK) … #endif`
63         with the text content of the additions files. The replacement script first searches in the built products
64         directory for the matching additions file, and falls back to the SDK if no matching file is found. If neither
65         are present (e.g. a build using the public SDK), then the block is simply replaced by the empty string.
66
67         (read_content_from_webkit_additions):
68         (main):
69
70 2019-03-27  Andy Estes  <aestes@apple.com>
71
72         REGRESSION (r242686): package-root creates roots with broken symlinks in WebKit.framework/XPCServices/
73         https://bugs.webkit.org/show_bug.cgi?id=196317
74
75         Reviewed by Dan Bernstein.
76
77         Removed some remnants of the Storage Process.
78
79         * Configurations/BaseTarget.xcconfig:
80         * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb: Removed.
81         * WebKit.xcodeproj/project.pbxproj:
82
83 2019-03-27  Keith Rollin  <krollin@apple.com>
84
85         Include the CFNetworking task UUID to the NSError when a resource-load fails
86         https://bugs.webkit.org/show_bug.cgi?id=196156
87
88         Reviewed by Alex Christensen.
89
90         In order to help track the connection between a failed resource-load
91         and a user-visible error message, include the CFNetworking task UUID
92         in the associated error as an element of the userInfo property. This
93         can then be pulled out and reported in the logging at the point the
94         error is reported to the user.
95
96         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
97         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
98
99 2019-03-27  Chris Dumez  <cdumez@apple.com>
100
101         [ iOS Sim ] REGRESSION (r242277) Layout Test http/tests/cookies/same-site/lax-samesite-cookie-after-cross-site-history-load.php is a flaky timeout
102         https://bugs.webkit.org/show_bug.cgi?id=195425
103         <rdar://problem/48682403>
104
105         Reviewed by Alex Christensen.
106
107         When process-swapping on history navigation, we lookup the WebProcessProxy we'd like to use from the
108         process identifier that is saved on the WebBackForwardListItem, to try and load the item in the process
109         in which it was previously loaded. However, we were failing to check if the WebProcess in question was
110         still running so we could potentially try to use a process that's already exited.
111
112         * UIProcess/WebProcessPool.cpp:
113         (WebKit::WebProcessPool::processForNavigationInternal):
114
115 2019-03-27  Zalan Bujtas  <zalan@apple.com>
116
117         [ContentChangeObserver] Always dispatch the synthetic click asynchronously
118         https://bugs.webkit.org/show_bug.cgi?id=196278
119         <rdar://problem/49299968>
120
121         Reviewed by Simon Fraser.
122
123         This patch ensures that all completeSyntheticClick() calls happen in an asynchronous manner (unless the feature is turned off).
124
125         * WebProcess/WebPage/ios/WebPageIOS.mm:
126         (WebKit::dispatchSyntheticMouseMove):
127         (WebKit::WebPage::handleSyntheticClick):
128
129 2019-03-27  Tim Horton  <timothy_horton@apple.com>
130
131         Fix some more deprecation warnings in WKDrawingView
132         https://bugs.webkit.org/show_bug.cgi?id=196282
133         <rdar://problem/47637608>
134
135         Reviewed by Wenson Hsieh.
136
137         * Platform/spi/ios/PencilKitSPI.h:
138         * SourcesCocoa.txt:
139         * UIProcess/ios/PencilKitSoftLink.h:
140         * UIProcess/ios/PencilKitSoftLink.mm:
141         * UIProcess/ios/WKContentViewInteraction.mm:
142         * UIProcess/ios/WKDrawingCoordinator.h:
143         * UIProcess/ios/WKDrawingCoordinator.mm:
144         (-[WKDrawingCoordinator initWithContentView:]):
145         (-[WKDrawingCoordinator currentInk]):
146         (-[WKDrawingCoordinator undoManagerForInkPicker:]):
147         (-[WKDrawingCoordinator containingViewForInkPicker:]):
148         (-[WKDrawingCoordinator inkPickerDidToggleRuler:]):
149         (-[WKDrawingCoordinator inkPickerDidChangeInk:]):
150         (-[WKDrawingCoordinator installInkPickerForDrawing:]):
151         (-[WKDrawingCoordinator uninstallInkPicker]):
152         (-[WKDrawingCoordinator inkPicker]): Deleted.
153         (-[WKDrawingCoordinator didChangeRulerState:]): Deleted.
154         (-[WKDrawingCoordinator didChangeInk:]): Deleted.
155         * UIProcess/ios/WKDrawingView.mm:
156         (-[WKDrawingView _canvasViewWillBeginDrawing:]):
157         * UIProcess/ios/WKInkPickerView.h: Removed.
158         * UIProcess/ios/WKInkPickerView.mm: Removed.
159         * WebKit.xcodeproj/project.pbxproj:
160         Adopt the new names.
161
162 2019-03-27  Carlos Garcia Campos  <cgarcia@igalia.com>
163
164         Geolocation request not complete when watch request was started in a different web process
165         https://bugs.webkit.org/show_bug.cgi?id=195996
166
167         Reviewed by Alex Christensen.
168
169         In WebGeolocationManagerProxy::startUpdating() we do nothing when the provider is already updating. We should
170         reply with a DidChangePosition using the last known position, if available. If we are updating, but we still
171         don't have a known position, the request will be completed when
172         WebGeolocationManagerProxy::providerDidChangePosition() is called since it always notifies all web
173         processes.
174
175         * UIProcess/WebGeolocationManagerProxy.cpp:
176         (WebKit::WebGeolocationManagerProxy::providerDidChangePosition): Cache the position.
177         (WebKit::WebGeolocationManagerProxy::startUpdating): Reply using cached position if already known.
178         * UIProcess/WebGeolocationManagerProxy.h:
179         (WebKit::WebGeolocationManagerProxy::lastPosition const): Return cached position.
180         * WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
181         (WebKit::WebGeolocationClient::lastPosition): Remove the FIXME since we don't want this feature.
182
183 2019-03-26  Brent Fulgham  <bfulgham@apple.com>
184
185         [macOS] Correct kerberos-related sandbox violations
186         https://bugs.webkit.org/show_bug.cgi?id=196279
187         <rdar://problem/48622502>
188
189         Reviewed by Per Arne Vollan.
190
191         We need to allow communications with a Kerberos-related service on macOS
192         until <rdar://problem/35542803> is fixed.
193
194         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
195
196 2019-03-26  Chris Dumez  <cdumez@apple.com>
197
198         [macOS] The network process is not exiting reliably when the WebProcessPool is destroyed
199         https://bugs.webkit.org/show_bug.cgi?id=196277
200         <rdar://problem/49127581>
201
202         Reviewed by Alex Christensen.
203
204         When, an AuxiliaryProcess receives the AuxiliaryProcess::Terminate IPC, it calls stopRunLoop()
205         to exit. WebProcess overrides AuxiliaryProcess::stopRunLoop() to call exit(0) on the main
206         thread. Other auxiliary processes such as the NetworkProcess would end up calling
207         platformStopRunLoop(). On iOS and iOSMac, platformStopRunLoop() calls XPCServiceExit(), which
208         makes sense since auxiliary processes run their run loop by calling xpc_main(). However, on
209         macOS, platformStopRunLoop() was calling RunLoop::main().stop() to exit instead, which was
210         unreliable as demonstrated by the test app attached to the radar.
211
212         Updating platformStopRunLoop() to call XPCServiceExit() on macOS fixes the problem and I now
213         see the NetworkProcess exiting reliably there. This is the approach I have chosen in this
214         patch since it appears to be reliable and it makes the code consistent on all Cocoa platforms.
215
216         * Shared/AuxiliaryProcess.cpp:
217         * Shared/Cocoa/AuxiliaryProcessCocoa.mm:
218         (WebKit::AuxiliaryProcess::platformStopRunLoop):
219         * Shared/ios/AuxiliaryProcessIOS.mm:
220         (WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted.
221         * Shared/mac/AuxiliaryProcessMac.mm:
222         (WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted.
223
224 2019-03-26  Keith Rollin  <krollin@apple.com>
225
226         Inhibit CFNetwork logging in private sessions
227         https://bugs.webkit.org/show_bug.cgi?id=196268
228         <rdar://problem/48210793>
229
230         Reviewed by Alex Christensen.
231
232         Before performing any logging, the NetworkProcess checks to see if
233         it's performing an operation associated with a private (ephemeral)
234         browsing session. If so, it skips the logging. However, networking
235         layers below the NetworkProcess don't know about private browsing, so
236         they would still perform their own logging. CFNetwork now has a flag
237         that lets us control that, so set it to False if private browsing.
238
239         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
240         (WebKit::configurationForSessionID):
241
242 2019-03-26  Chris Dumez  <cdumez@apple.com>
243
244         Add basic layout test coverage for File Picker on iOS
245         https://bugs.webkit.org/show_bug.cgi?id=196265
246
247         Reviewed by Wenson Hsieh.
248
249         Add layout test infrastructure to test the file picker on iOS.
250
251         * UIProcess/API/Cocoa/WKWebView.mm:
252         (-[WKWebView _dismissFilePicker]):
253         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
254         * UIProcess/ios/WKContentViewInteraction.h:
255         * UIProcess/ios/WKContentViewInteraction.mm:
256         (-[WKContentView dismissFilePicker]):
257         (-[WKContentView _contentsOfUserInterfaceItem:]):
258         * UIProcess/ios/forms/WKFileUploadPanel.h:
259         * UIProcess/ios/forms/WKFileUploadPanel.mm:
260         (-[WKFileUploadPanel currentAvailableActionTitles]):
261
262 2019-03-26  Daniel Bates  <dabates@apple.com>
263
264         [iOS][WK2] Use a better concept to describe the reason we defer zooming a focused element: selectabiltiy
265         https://bugs.webkit.org/show_bug.cgi?id=196264
266
267         Reviewed by Wenson Hsieh.
268
269         Rename shouldDeferZoomingToSelectionWhenRevealingFocusedElement() to mayContainSelectableText() to describe
270         the criterion that we will use to decide whether to defer zooming or not. We defer zooming only for elements
271         that may support text selection on initial focus because we do not have an up-to-date selection rect at that
272         time. For element, like <select>, that do not support text selection, we can zoom them immediately when focused.
273
274         * UIProcess/ios/WKContentViewInteraction.mm:
275         (mayContainSelectableText): Renamed from shouldDeferZoomingToSelectionWhenRevealingFocusedElement.
276         List all the input types in the switch block and remove the default case to force the compiler to check that we
277         covered all cases. This will prevent unforseen keyboard issues (why isn't the keyboard shown? or why is the keyboard shown?)
278         for future input types that we may add.
279         (rectToRevealWhenZoomingToFocusedElement): Update for renaming.
280         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): Add a
281         comment to explain why we may need to defer the zoom: the focused element supports text selection and we need
282         to wait for the web process to call back to provide an up-to-date selection rect for us to zoom and reveal.
283         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]): Update for renaming.
284         (shouldDeferZoomingToSelectionWhenRevealingFocusedElement): Deleted.
285
286 2019-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
287
288         Implement async paste method on UIWKInteractionViewProtocol
289         https://bugs.webkit.org/show_bug.cgi?id=196267
290         <rdar://problem/49236346>
291
292         Reviewed by Tim Horton.
293
294         Implement a new UIWKInteractionViewProtocol hook to perform a paste command, and invoke the given completion
295         handler when pasting is finished.
296
297         Test: UIPasteboardTests.PasteWithCompletionHandler
298
299         * UIProcess/ios/WKContentViewInteraction.mm:
300         (-[WKContentView pasteWithCompletionHandler:]):
301
302 2019-03-26  Per Arne Vollan  <pvollan@apple.com>
303
304         [macOS] Fix sandbox violations
305         https://bugs.webkit.org/show_bug.cgi?id=196262
306         <rdar://problem/47738015>
307
308         Reviewed by Brent Fulgham.
309
310         Fix various observed sandbox violations.
311
312         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
313         * WebProcess/com.apple.WebProcess.sb.in:
314
315 2019-03-26  Tomoki Imai  <Tomoki.Imai@sony.com>
316
317         Assertion failure !isInAcceleratedCompositingMode() in DrawingAreaProxyCoordinatedGraphics::incorporateUpdate when forceCompositingMode is turned on
318         https://bugs.webkit.org/show_bug.cgi?id=195879
319
320         Reviewed by Carlos Garcia Campos.
321
322         The root cause is that DrawingAreaProxyCoordinatedGraphics::isInAcceleratedCompositingMode checks both of alwaysUseCompositing() and !m_layerTreeContext.isEmpty().
323         alwaysUseCompositing() refers preferences, which is written by the application (UIProcess).
324         On the other hand, m_layerTreeContext is changed when it receives enterAcceleratedCompositingMode/exitAcceleratedCompositingMode from WebProcess.
325
326         It results when we set forceCompositingMode and acceleratedCompositingEnabled to true, WebProcess and UIProcess is out of sync until WebProcess sends enterAcceleratedCompositingMode message.
327         In such situation, WebProcess sends incorporateUpdate to UIProcess because WebProcess is in non-AC mode, but isInAcceleratedCompositingMode becomes true in UIProcess side.
328
329         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
330         (WebKit::DrawingAreaProxyCoordinatedGraphics::~DrawingAreaProxyCoordinatedGraphics): Should call exitAcceleratedCompositingMode even when alwaysUseCompositing is true.
331         (WebKit::DrawingAreaProxyCoordinatedGraphics::enterAcceleratedCompositingMode): enterAcceleratedCompositingMode should check enterAcceleratedCompositingMode is not called twice.
332         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h: Remove alwaysUseCompositing from isInAcceleratedCompositingMode
333
334 2019-03-26  Antoine Quint  <graouts@apple.com>
335
336         Remove mousemoveEventHandlingPreventsDefault internal setting and quirk
337         https://bugs.webkit.org/show_bug.cgi?id=196254
338         <rdar://problem/49124334>
339
340         Reviewed by Dean Jackson.
341
342         * Shared/WebPreferences.yaml:
343
344 2019-03-26  Philippe Normand  <pnormand@igalia.com>
345
346         [WPE][Qt] Uninitialized racy ViewBackend
347         https://bugs.webkit.org/show_bug.cgi?id=196247
348
349         Reviewed by Carlos Garcia Campos.
350
351         * UIProcess/API/wpe/qt/WPEQtView.h: Initialize the backend pointer to nullptr.
352
353 2019-03-26  Carlos Garcia Campos  <cgarcia@igalia.com>
354
355         Unreviewed. Fix typo in GLib geolocation API after r243285.
356
357         gelocation -> geolocation.
358
359         * UIProcess/API/glib/WebKitGeolocationManager.cpp:
360         (webkit_geolocation_manager_class_init):
361         (webkit_geolocation_manager_update_position):
362         (webkit_geolocation_manager_failed):
363         (webkit_gelocation_manager_update_position): Deleted.
364         (webkit_gelocation_manager_failed): Deleted.
365         * UIProcess/API/gtk/WebKitGeolocationManager.h:
366         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
367         * UIProcess/API/wpe/WebKitGeolocationManager.h:
368         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
369
370 2019-03-26  Patrick Griffis  <pgriffis@igalia.com>
371
372         [GTK][WPE] Disable process warming
373         https://bugs.webkit.org/show_bug.cgi?id=196208
374
375         Reviewed by Chris Dumez.
376
377         Fixes crash caused by r243384.
378
379         Process warming is incompatible with our launcher as it expects a valid
380         WebsiteDataStore at initialization time for sandbox permissions.
381
382         * UIProcess/glib/WebProcessPoolGLib.cpp:
383         (WebKit::WebProcessPool::platformInitialize):
384
385 2019-03-25  Alex Christensen  <achristensen@webkit.org>
386
387         Do not terminate the NetworkProcess if a third party application sends a NSCredential with a SecIdentityRef
388         https://bugs.webkit.org/show_bug.cgi?id=196213
389
390         Reviewed by Geoff Garen.
391
392         A release assertion added in r230225 was reachable.  I reached it in a unit test that responds to a challenge
393         with a SecIdentityRef wrapped in an NSCredential.
394
395         * Shared/cf/ArgumentCodersCF.cpp:
396         (IPC::decode):
397
398 2019-03-25  Chris Dumez  <cdumez@apple.com>
399
400         Regression(r242369) Trying to change profile picture on linked in shows file picker, not the image picker
401         https://bugs.webkit.org/show_bug.cgi?id=196205
402         <rdar://problem/49083324>
403
404         Reviewed by Geoffrey Garen.
405
406         Update our FileUploadPanel code on iOS to properly deal with the MIME types containing
407         wild cards (e.g. "image/*") that are defined in the HTML specification:
408         - https://html.spec.whatwg.org/multipage/input.html#attr-input-accept
409
410         Previously, we would fail to convert those to UTIs.
411
412         * UIProcess/ios/forms/WKFileUploadPanel.mm:
413
414 2019-03-25  Tim Horton  <timothy_horton@apple.com>
415
416         Remove some now-unnecessary dynamic class lookup
417         https://bugs.webkit.org/show_bug.cgi?id=196237
418
419         Reviewed by Simon Fraser.
420
421         * Shared/DocumentEditingContext.mm:
422         (WebKit::DocumentEditingContext::toPlatformContext):
423
424 2019-03-25  Tim Horton  <timothy_horton@apple.com>
425
426         Get rid of ENABLE(ANIMATED_KEYBOARD_SCROLLING)
427         https://bugs.webkit.org/show_bug.cgi?id=196224
428
429         Reviewed by Simon Fraser.
430
431         * Platform/spi/ios/AccessibilitySupportSPI.h:
432         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
433         (-[WKKeyboardScrollingAnimator invalidate]):
434         (perpendicularAbsoluteUnitVector):
435         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
436         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
437         (-[WKKeyboardScrollingAnimator willStartInteractiveScroll]):
438         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
439         (-[WKKeyboardScrollViewAnimator scrollWithScrollToExtentAnimationTo:]):
440         (-[WKKeyboardScrollingAnimator startRepeatTimerIfNeeded]): Deleted.
441         (-[WKKeyboardScrollingAnimator stopRepeatTimer]): Deleted.
442         (-[WKKeyboardScrollingAnimator performDiscreteScroll]): Deleted.
443
444 2019-03-25  Fujii Hironori  <Hironori.Fujii@sony.com>
445
446         Enable IPC sending and receiving non-default-constructible types
447         https://bugs.webkit.org/show_bug.cgi?id=196132
448         <rdar://problem/49229221>
449
450         Unreviewed build fix for WinCairo port.
451
452         error C2440: '=': cannot convert from 'int' to 'HANDLE'
453
454         * Platform/win/SharedMemoryWin.cpp:
455         (WebKit::SharedMemory::Handle::Handle): std::exchange HANDLE with nullptr, not 0.
456         (WebKit::SharedMemory::Handle::operator=): Ditto.
457
458 2019-03-25  Fujii Hironori  <Hironori.Fujii@sony.com>
459
460         [Coordinated Graphics][WinCairo] ASSERTION FAILED: state.id == m_nicosia.state.id
461         https://bugs.webkit.org/show_bug.cgi?id=196190
462
463         Reviewed by Žan Doberšek.
464
465         This assertion assumes the pre-committed and the committed scenes
466         are identical. But, the pre-committed scene is updated in the main
467         thread. Removed the false assertion.
468
469         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
470         (WebKit::CoordinatedGraphicsScene::purgeGLResources): Remove the
471         assertion. Removed layers of committed scene, not pre-committed
472         scene.
473
474 2019-03-25  Brady Eidson  <beidson@apple.com>
475
476         Add socket-delegate to another entitlements config
477         rdar://problem/48090350 and https://bugs.webkit.org/show_bug.cgi?id=196227
478
479         Reviewed by Geoffrey Garen.
480
481         * Configurations/Network-iOSMac.entitlements:
482
483 2019-03-25  Commit Queue  <commit-queue@webkit.org>
484
485         Unreviewed, rolling out r243465.
486         https://bugs.webkit.org/show_bug.cgi?id=196226
487
488         the test doesn't build (Requested by thorton on #webkit).
489
490         Reverted changeset:
491
492         "Do not terminate the NetworkProcess if a third party
493         application sends a NSCredential with a SecIdentityRef"
494         https://bugs.webkit.org/show_bug.cgi?id=196213
495         https://trac.webkit.org/changeset/243465
496
497 2019-03-25  Simon Fraser  <simon.fraser@apple.com>
498
499         REGRESSION (r242687): Flicker when pinch-zooming pages in macOS Safari
500         https://bugs.webkit.org/show_bug.cgi?id=196126
501         rdar://problem/49095791
502
503         Reviewed by Tim Horton.
504         
505         I fumbled the commit after the enum rename. Make this actually work.
506
507         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
508         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
509
510 2019-03-25  Simon Fraser  <simon.fraser@apple.com>
511
512         Zoom on macOS is centered around a point lower than the cursor
513         https://bugs.webkit.org/show_bug.cgi?id=196225
514         rdar://problem/49213574
515
516         Reviewed by Tim Horton.
517         
518         The origin handed to ViewGestureController::handleMagnificationGestureEvent is in WKWebView
519         coordinates, but we end up setting the transform on the RenderView's layer, so we need
520         to subtract the topContentInset.
521
522         * UIProcess/mac/ViewGestureControllerMac.mm:
523         (WebKit::ViewGestureController::handleMagnificationGestureEvent):
524
525 2019-03-25  Alex Christensen  <achristensen@webkit.org>
526
527         Do not terminate the NetworkProcess if a third party application sends a NSCredential with a SecIdentityRef
528         https://bugs.webkit.org/show_bug.cgi?id=196213
529
530         Reviewed by Geoff Garen.
531
532         A release assertion added in r230225 was reachable.  I reached it in a unit test that responds to a challenge
533         with a SecIdentityRef wrapped in an NSCredential.
534
535         * Shared/cf/ArgumentCodersCF.cpp:
536         (IPC::decode):
537
538 2019-03-25  Chris Dumez  <cdumez@apple.com>
539
540         Get rid of WebPage::m_shouldResetDrawingAreaAfterSuspend flag
541         https://bugs.webkit.org/show_bug.cgi?id=196210
542         <rdar://problem/48681326>
543
544         Reviewed by Geoffrey Garen.
545
546         Get rid of WebPage::m_shouldResetDrawingAreaAfterSuspend flag and use the drawing area identifier
547         instead to reset the DrawingArea in the WebProcess whenever the UIProcess did.
548
549         This is less error-prone and guarantees that the WebProcess and the UIProcess can reliably
550         communicate via DrawingArea IPC.
551
552         * WebProcess/WebPage/WebPage.cpp:
553         (WebKit::WebPage::reinitializeWebPage):
554         (WebKit::WebPage::setIsSuspended):
555         * WebProcess/WebPage/WebPage.h:
556
557 2019-03-25  Alex Christensen  <achristensen@webkit.org>
558
559         Enable IPC sending and receiving non-default-constructible types
560         https://bugs.webkit.org/show_bug.cgi?id=196132
561
562         Reviewed by Geoff Garen.
563
564         * Platform/IPC/ArgumentCoder.h:
565         * Platform/IPC/ArgumentCoders.h:
566         (IPC::TupleEncoder::encode):
567         (IPC::tupleFromTupleAndObject):
568         (IPC::TupleDecoderImpl::decode):
569         (IPC::TupleDecoderImpl<Type>::decode):
570         (IPC::TupleDecoder::decode):
571         (IPC::TupleDecoder<0>::decode):
572         (IPC::TupleCoder::encode): Deleted.
573         (IPC::TupleCoder::decode): Deleted.
574         * Platform/IPC/Connection.h:
575         (IPC::Connection::sendWithReply):
576         (IPC::TupleMover::move):
577         (IPC::moveTuple):
578         (IPC::Connection::sendSync):
579         * Platform/IPC/Decoder.h:
580         (IPC::Decoder::decode):
581         (IPC::Decoder::operator>>):
582         * Platform/IPC/HandleMessage.h:
583         (IPC::handleMessage):
584         (IPC::handleMessageSynchronous):
585         (IPC::handleMessageSynchronousWantsConnection):
586         (IPC::handleMessageAsync):
587         * Platform/SharedMemory.h:
588         * Scripts/webkit/LegacyMessages-expected.h:
589         * Scripts/webkit/Messages-expected.h:
590         * Scripts/webkit/MessagesSuperclass-expected.h:
591         * Scripts/webkit/messages.py:
592         * Shared/Databases/IndexedDB/WebIDBResult.h:
593         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
594         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
595         * Shared/ShareableBitmap.h:
596         * Shared/ShareableResource.h:
597         * Shared/UpdateInfo.h:
598         * Shared/WebEvent.h:
599         * Shared/WebProcessCreationParameters.cpp:
600         * Shared/WebProcessCreationParameters.h:
601         * Shared/mac/SecItemResponseData.cpp:
602         (WebKit::SecItemResponseData::SecItemResponseData):
603         (WebKit::SecItemResponseData::decode):
604         * Shared/mac/SecItemResponseData.h:
605         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h:
606
607 2019-03-25  Tim Horton  <timothy_horton@apple.com>
608
609         Animated keyboard scrolling is extremely chaotic
610         https://bugs.webkit.org/show_bug.cgi?id=196164
611         <rdar://problem/48702444>
612
613         Reviewed by Simon Fraser.
614
615         * UIProcess/ios/WKContentViewInteraction.mm:
616         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
617         Consume keyboard events instead of interpreting them traditionally
618         if WKKeyboardScrollingAnimator is animating.
619
620         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
621         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
622         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
623         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
624         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
625         (-[WKKeyboardScrollingAnimator scrollTriggeringKeyIsPressed]):
626         (-[WKKeyboardScrollingAnimator displayLinkFired:]):
627         (-[WKKeyboardScrollViewAnimator scrollTriggeringKeyIsPressed]):
628         Expose the current state of interactive scrolling, and rename the related member.
629
630 2019-03-25  Keith Rollin  <krollin@apple.com>
631
632         Add WebKit logging for first paint and other interesting layout milestones
633         https://bugs.webkit.org/show_bug.cgi?id=196159
634         <rdar://problem/49128952>
635
636         Reviewed by Simon Fraser.
637
638         Add some logging to indicate what layout milestones have been reached.
639         This should help us determine if there's a client, rendering, layout,
640         or some other issue when page content does not appear in the client
641         window.
642
643         The logging is being added to
644         WebFrameLoaderClient::dispatchDidReachLayoutMilestone. This seems like
645         a nice central place to capture layout milestones. However, it will
646         only log notifications that are being sent to clients. It does not
647         indicate all milestones that have occurred. That is, it does not
648         report milestones that are filtered out due to client disinterest.
649         There doesn't seem to be a good central place to capture all
650         milestones, regardless of client interest.
651
652         * Platform/Logging.h:
653         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
654         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
655
656 2019-03-25  Patrick Griffis  <pgriffis@igalia.com>
657
658         [GTK][WPE] Remove network access from web process sandbox
659         https://bugs.webkit.org/show_bug.cgi?id=189967
660
661         Reviewed by Michael Catanzaro.
662
663         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
664         (WebKit::createFlatpakInfo):
665         (WebKit::bubblewrapSpawn):
666         * UIProcess/Launcher/glib/FlatpakLauncher.cpp:
667         (WebKit::flatpakSpawn):
668
669 2019-03-25  Andy Estes  <aestes@apple.com>
670
671         [Apple Pay] Call +canMakePayments on a work queue
672         https://bugs.webkit.org/show_bug.cgi?id=196179
673         <rdar://problem/45388749>
674
675         Reviewed by Brady Eidson.
676
677         Calling +canMakePayments on either PKPaymentAuthorizationController or
678         PKPaymentAuthorizationViewController results in synchronous IPC and is therefore very
679         expensive to call on the main thread. On iOS, these calls are made in the network process,
680         and on Mac in the UI process.
681
682         Call these methods on a work queue to avoid main thread spins.
683
684         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
685         (WebKit::WebPaymentCoordinatorProxy::canMakePayments):
686         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
687         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
688         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
689         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
690         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
691
692 2019-03-25  Andy Estes  <aestes@apple.com>
693
694         [Apple Pay] Remove the AvailablePaymentNetworks synchronous message
695         https://bugs.webkit.org/show_bug.cgi?id=196180
696
697         Reviewed by Youenn Fablet.
698
699         Unlike many PassKit interactions, it's ok to call +[PKPaymentRequest availableNetworks]
700         without an entitlement. Therefore, we can call it from the web process directly rather than
701         synchronously messaging the entitled UI or networking process.
702
703         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
704         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
705         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
706         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
707         * SourcesCocoa.txt:
708         * WebKit.xcodeproj/project.pbxproj:
709         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
710         (WebKit::WebPaymentCoordinator::availablePaymentNetworks):
711         * WebProcess/ApplePay/WebPaymentCoordinator.h:
712         * WebProcess/ApplePay/cocoa/WebPaymentCoordinatorCocoa.mm: Added.
713         (WebKit::WebPaymentCoordinator::platformAvailablePaymentNetworks const):
714         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
715         (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
716         (-[WKAccessibilityWebPageObjectBase setWebPage:]):
717
718 2019-03-25  Chris Dumez  <cdumez@apple.com>
719
720         Unreviewed, tiny fix after r243388 to address API test failures on iOS
721
722         m_processType was properly initialized on macOS but not iOS.
723
724         * WebProcess/cocoa/WebProcessCocoa.mm:
725         (WebKit::WebProcess::platformInitializeProcess):
726
727 2019-03-25  Carlos Garcia Campos  <cgarcia@igalia.com>
728
729         [GTK][WPE] Do not allow changes in active URI before provisional load starts for non-API requests
730         https://bugs.webkit.org/show_bug.cgi?id=194208
731
732         Reviewed by Michael Catanzaro.
733
734         * UIProcess/API/glib/WebKitWebView.cpp:
735         (webkitWebViewWillStartLoad): Block updates of active URL.
736         (webkitWebViewLoadChanged): Unblock updates of active URL on WEBKIT_LOAD_STARTED.
737
738 2019-03-25  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
739
740         Remove NavigatorContentUtils in WebCore/Modules
741         https://bugs.webkit.org/show_bug.cgi?id=196070
742
743         Reviewed by Alex Christensen.
744
745         NavigatorContentUtils was to support the custom scheme spec [1].
746         However, in WebKit side, no port has supported the feature in
747         WebKit layer after EFL port was removed. So there has been the
748         only IDL implementation of the NavigatorContentUtils in WebCore.
749         So we don't need to keep the implementation in WebCore anymore.
750
751         [1] https://html.spec.whatwg.org/multipage/system-state.html#custom-handlers
752
753         * Configurations/FeatureDefines.xcconfig:
754         * WebProcess/WebCoreSupport/WebNavigatorContentUtilsClient.h: Removed.
755
756 2019-03-24  Zan Dobersek  <zdobersek@igalia.com>
757
758         Unreviewed WPE build fix.
759
760         * UIProcess/wpe/WebPasteboardProxyWPE.cpp:
761         Add an explicit CompletionHandler.h include to avoid a trip-up in
762         unified builds.
763
764 2019-03-24  Fujii Hironori  <Hironori.Fujii@sony.com>
765
766         [WinCairo] WebProcessDataStoreParameters.h(32): error C2653: 'SandboxExtension': is not a class or namespace name
767         https://bugs.webkit.org/show_bug.cgi?id=196192
768
769         Unreviewed for WinCairo port.
770
771         * Shared/WebProcessDataStoreParameters.h: Added #include "SandboxExtension.h".
772
773 2019-03-24  Andy Estes  <aestes@apple.com>
774
775         [watchOS] Remove unused Proximity Networking code
776         https://bugs.webkit.org/show_bug.cgi?id=196188
777
778         Reviewed by Tim Horton.
779
780         * Configurations/WebKit.xcconfig:
781         * NetworkProcess/NetworkProcess.cpp:
782         (WebKit::NetworkProcess::NetworkProcess):
783         * NetworkProcess/NetworkProcess.h:
784         * NetworkProcess/NetworkProcessCreationParameters.cpp:
785         (WebKit::NetworkProcessCreationParameters::encode const):
786         (WebKit::NetworkProcessCreationParameters::decode):
787         * NetworkProcess/NetworkProcessCreationParameters.h:
788         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
789         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
790         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
791         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
792         (WebKit::NetworkProcess::platformPrepareToSuspend):
793         (WebKit::NetworkProcess::platformProcessDidResume):
794         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
795         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
796         * NetworkProcess/watchos/NetworkProximityAssertion.h: Removed.
797         * NetworkProcess/watchos/NetworkProximityAssertion.mm: Removed.
798         * NetworkProcess/watchos/NetworkProximityManager.h: Removed.
799         * NetworkProcess/watchos/NetworkProximityManager.mm: Removed.
800         * SourcesCocoa.txt:
801         * UIProcess/API/APIProcessPoolConfiguration.cpp:
802         (API::ProcessPoolConfiguration::copy):
803         * UIProcess/API/APIProcessPoolConfiguration.h:
804         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
805         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
806         (-[_WKProcessPoolConfiguration wirelessContextIdentifier]):
807         (-[_WKProcessPoolConfiguration setWirelessContextIdentifier:]):
808         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
809         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
810         * WebKit.xcodeproj/project.pbxproj:
811
812 2019-03-23  Chris Dumez  <cdumez@apple.com>
813
814         Unreviewed, fix typo in comment added in r243379.
815
816         * UIProcess/API/Cocoa/WKProcessGroup.mm:
817         (-[WKProcessGroup setDelegate:]):
818
819 2019-03-23  Simon Fraser  <simon.fraser@apple.com>
820
821         REGRESSION (iOS 8): Scrollbar can't be hidden when webkit-overflow-scrolling is set to touch
822         https://bugs.webkit.org/show_bug.cgi?id=137043
823         rdar://problem/16595330
824
825         Reviewed by Zalan Bujtas.
826
827         Plumb horizontalScrollbarHiddenByStyle/verticalScrollbarHiddenByStyle through ScrollableAreaParameters
828         to the UI process, and use it to set UIScrollView indicators visible or not.
829         
830         The scroll snap changes in ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren() fix a bug
831         where hasChangedProperty(HorizontalSnapOffsets) was nested inside another set of hasChangedProperty()
832         tests, so would never get called.
833
834         * Shared/WebCoreArgumentCoders.cpp:
835         (IPC::ArgumentCoder<ScrollableAreaParameters>::encode):
836         (IPC::ArgumentCoder<ScrollableAreaParameters>::decode):
837         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
838         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
839
840 2019-03-23  Zalan Bujtas  <zalan@apple.com>
841
842         [ContentChangeObserver] Taping on a form control should always result in click.
843         https://bugs.webkit.org/show_bug.cgi?id=196177
844
845         Reviewed by Simon Fraser.
846
847         This patch enures that we send a synthetic click when the traget node is a form control (button, edit field etc) even if
848         the mousemove brings up some hover content.
849
850         * WebProcess/WebPage/ios/WebPageIOS.mm:
851         (WebKit::WebPage::handleSyntheticClick):
852
853 2019-03-23  Andy Estes  <aestes@apple.com>
854
855         [Apple Pay] Stop calling PKPaymentAuthorizationViewController class methods on iOS
856         https://bugs.webkit.org/show_bug.cgi?id=196163
857         <rdar://problem/48787564>
858
859         Reviewed by Anders Carlsson.
860
861         Now that we've transitioned to PKPaymentAuthorizationController on iOS, we should stop
862         calling PKPaymentAuthorizationViewController class methods on iOS in favor of their
863         PKPaymentAuthorizationController alternatives.
864
865         While we're here, we should also transition to calling
866         +paymentServicesMerchantURLForAPIType:completion: on both
867         PKPaymentAuthorizationViewController and PKPaymentAuthorizationController.
868
869         * Platform/cocoa/PaymentAuthorizationViewController.mm:
870         (-[WKPaymentAuthorizationViewControllerDelegate _paymentServicesMerchantURLForAPIType:completion:]):
871         * Platform/cocoa/WKPaymentAuthorizationDelegate.h:
872         * Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
873         (-[WKPaymentAuthorizationDelegate _initWithRequest:presenter:]):
874         (-[WKPaymentAuthorizationDelegate _paymentServicesMerchantURLForAPIType:completion:]):
875         * Platform/ios/PaymentAuthorizationController.mm:
876         (-[WKPaymentAuthorizationControllerDelegate _paymentServicesMerchantURLForAPIType:completion:]):
877         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
878         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments): Deleted.
879         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
880         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
881         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
882         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
883
884 2019-03-23  Carlos Garcia Campos  <cgarcia@igalia.com>
885
886         Unreviewed. Fix GTK build after r243409.
887
888         Build failure is actually unrelated to r243409, it's yet another unified build failure that happens when source
889         file list changes.
890
891         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
892         (WebKit::WebInspectorProxy::platformShowCertificate): Use WebCore namespace for CertificateInfo parameter.
893
894 2019-03-23  Carlos Garcia Campos  <cgarcia@igalia.com>
895
896         [GTK] Remove build time dependency on Geoclue2
897         https://bugs.webkit.org/show_bug.cgi?id=195994
898
899         Reviewed by Michael Catanzaro.
900
901         Add GeoclueGeolocationProvider class to provide geolocation position updates using Geoclue2 DBus service.
902
903         * PlatformGTK.cmake:
904         * PlatformWPE.cmake:
905         * SourcesGTK.txt:
906         * SourcesWPE.txt:
907         * UIProcess/API/glib/WebKitGeolocationManager.cpp:
908         (_WebKitGeolocationPosition::_WebKitGeolocationPosition):
909         (webkitGeolocationManagerStop):
910         (webkitGeolocationManagerSetEnableHighAccuracy):
911         (webkitGeolocationManagerDispose):
912         (webkit_geolocation_manager_class_init):
913         * UIProcess/geoclue/GeoclueGeolocationProvider.cpp: Added.
914         (WebKit::GeoclueGeolocationProvider::GeoclueGeolocationProvider):
915         (WebKit::GeoclueGeolocationProvider::~GeoclueGeolocationProvider):
916         (WebKit::GeoclueGeolocationProvider::start):
917         (WebKit::GeoclueGeolocationProvider::stop):
918         (WebKit::GeoclueGeolocationProvider::setEnableHighAccuracy):
919         (WebKit::GeoclueGeolocationProvider::destroyManagerLater):
920         (WebKit::GeoclueGeolocationProvider::destroyManager):
921         (WebKit::GeoclueGeolocationProvider::setupManager):
922         (WebKit::GeoclueGeolocationProvider::createClient):
923         (WebKit::GeoclueGeolocationProvider::setupClient):
924         (WebKit::GeoclueGeolocationProvider::startClient):
925         (WebKit::GeoclueGeolocationProvider::stopClient):
926         (WebKit::GeoclueGeolocationProvider::requestAccuracyLevel):
927         (WebKit::GeoclueGeolocationProvider::clientLocationUpdatedCallback):
928         (WebKit::GeoclueGeolocationProvider::createLocation):
929         (WebKit::GeoclueGeolocationProvider::locationUpdated):
930         (WebKit::GeoclueGeolocationProvider::didFail):
931         * UIProcess/geoclue/GeoclueGeolocationProvider.h: Added.
932
933 2019-03-22  Simon Fraser  <simon.fraser@apple.com>
934
935         Undo collision with r243390.
936
937         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
938         (stringForSSLProtocol):
939
940 2019-03-22  Simon Fraser  <simon.fraser@apple.com>
941
942         Fix internal builds.
943
944         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
945         (stringForSSLProtocol):
946
947 2019-03-22  Keith Rollin  <krollin@apple.com>
948
949         Enable ThinLTO support in Production builds
950         https://bugs.webkit.org/show_bug.cgi?id=190758
951         <rdar://problem/45413233>
952
953         Reviewed by Daniel Bates.
954
955         Enable building with Thin LTO in Production when using Xcode 10.2 or
956         later. This change results in a 1.45% progression in PLT5. Full
957         Production build times increase about 2-3%. Incremental build times
958         are more severely affected, and so LTO is not enabled for local
959         engineering builds.
960
961         LTO is enabled only on macOS for now, until rdar://problem/49013399,
962         which affects ARM builds, is fixed.
963
964         To change the LTO setting when building locally:
965
966         - If building with `make`, specify WK_LTO_MODE={none,thin,full} on the
967           command line.
968         - If building with `build-webkit`, specify --lto-mode={none,thin,full}
969           on the command line.
970         - If building with `build-root`, specify --lto={none,thin,full} on the
971           command line.
972         - If building with Xcode, create a LocalOverrides.xcconfig file at the
973           top level of your repository directory (if needed) and define
974           WK_LTO_MODE to full, thin, or none.
975
976         * Configurations/Base.xcconfig:
977
978 2019-03-22  Chris Dumez  <cdumez@apple.com>
979
980         Unreviewed build fix after r243388.
981
982         * WebProcess/WebProcess.h:
983
984 2019-03-22  Per Arne Vollan  <pvollan@apple.com>
985
986         [macOS] Fix sandbox violation
987         https://bugs.webkit.org/show_bug.cgi?id=196153
988         <rdar://problem/49123855>
989
990         Reviewed by Brent Fulgham.
991
992         The sandbox on macOS is blocking the mach lookup.
993
994         * WebProcess/com.apple.WebProcess.sb.in:
995
996 2019-03-21  Ryan Haddad  <ryanhaddad@apple.com>
997
998         Unreviewed, fix the build with recent SDKs.
999
1000         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1001         (stringForSSLProtocol):
1002
1003 2019-03-22  Chris Dumez  <cdumez@apple.com>
1004
1005         Implement WebProcess freezer opt-in completely on WebContent process side
1006         https://bugs.webkit.org/show_bug.cgi?id=196149
1007
1008         Reviewed by Brady Eidson.
1009
1010         Implement WebProcess freezer opt-in completely on WebContent process side, we do not need
1011         to involve the UIProcess with this and rely on IPC which may be fragile.
1012
1013         In the future, we may want to set freezable state from the UIProcess when the API supports
1014         it. We can move the logic to be fully on the UIProcess side then. In the mean time, it is
1015         likely best not to rely on IPC and process coordination for this.
1016
1017         * UIProcess/WebProcessProxy.cpp:
1018         (WebKit::globalPageMap):
1019         (WebKit::WebProcessProxy::WebProcessProxy):
1020         (WebKit::WebProcessProxy::setIsInProcessCache):
1021         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
1022         (WebKit::WebProcessProxy::didFinishLaunching):
1023         (WebKit::WebProcessProxy::validateFreezerStatus): Deleted.
1024         * UIProcess/WebProcessProxy.h:
1025         (WebKit::WebProcessProxy::removeProvisionalPageProxy):
1026         (WebKit::WebProcessProxy::WebPageProxyMap::WebPageProxyMap): Deleted.
1027         (WebKit::WebProcessProxy::WebPageProxyMap::size const): Deleted.
1028         (WebKit::WebProcessProxy::WebPageProxyMap::values): Deleted.
1029         (WebKit::WebProcessProxy::WebPageProxyMap::values const): Deleted.
1030         (WebKit::WebProcessProxy::WebPageProxyMap::begin): Deleted.
1031         (WebKit::WebProcessProxy::WebPageProxyMap::end): Deleted.
1032         (WebKit::WebProcessProxy::WebPageProxyMap::get): Deleted.
1033         (WebKit::WebProcessProxy::WebPageProxyMap::contains const): Deleted.
1034         (WebKit::WebProcessProxy::WebPageProxyMap::isEmpty const): Deleted.
1035         (WebKit::WebProcessProxy::WebPageProxyMap::set): Deleted.
1036         (WebKit::WebProcessProxy::WebPageProxyMap::take): Deleted.
1037         * WebProcess/WebProcess.cpp:
1038         (WebKit::WebProcess::setIsInProcessCache):
1039         (WebKit::WebProcess::markIsNoLongerPrewarmed):
1040         (WebKit::WebProcess::actualPrepareToSuspend):
1041         (WebKit::WebProcess::setFreezable): Deleted.
1042         * WebProcess/WebProcess.h:
1043         * WebProcess/WebProcess.messages.in:
1044         * WebProcess/cocoa/WebProcessCocoa.mm:
1045         (WebKit::WebProcess::updateProcessName):
1046         (WebKit::WebProcess::shouldFreezeOnSuspension const):
1047         (WebKit::WebProcess::updateFreezerStatus):
1048
1049 2019-03-22  Chris Dumez  <cdumez@apple.com>
1050
1051         Prewarmed processes should be usable with any website data store
1052         https://bugs.webkit.org/show_bug.cgi?id=196104
1053
1054         Reviewed by Alex Christensen.
1055
1056         Split WebsiteDataStore-specific data out of WebProcessCreationParameters and into a new
1057         WebProcessDataStoreParameters struct so that we do not need a WebsiteDataStore in order
1058         to lauch and initialize a WebProcess. When the process finally gets used and we thus
1059         know which WebsiteDataStore they will be used for, we send the WebProcessDataStoreParameters
1060         to the process to that it can do its data store-specific initialization.
1061
1062         This allows prewarmed processes not not have a WebsiteDataStore assocated with them. They
1063         can then be used for any WebsiteDataStore when we need them.
1064
1065         This is also used by our dummy WebProcessProxy since it does not have a backing process and
1066         thus has no associated WebsiteDataStore.
1067
1068         * Shared/WebProcessCreationParameters.cpp:
1069         (WebKit::WebProcessCreationParameters::encode const):
1070         (WebKit::WebProcessCreationParameters::decode):
1071         * Shared/WebProcessCreationParameters.h:
1072         * Shared/WebProcessDataStoreParameters.h: Added.
1073         (WebKit::WebProcessDataStoreParameters::encode const):
1074         (WebKit::WebProcessDataStoreParameters::decode):
1075         * UIProcess/API/C/WKContext.cpp:
1076         (WKContextWarmInitialProcess):
1077         * UIProcess/API/Cocoa/WKProcessPool.mm:
1078         (-[WKProcessPool _warmInitialProcess]):
1079         * UIProcess/ServiceWorkerProcessProxy.cpp:
1080         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
1081         * UIProcess/WebPageProxy.cpp:
1082         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
1083         * UIProcess/WebProcessPool.cpp:
1084         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
1085         (WebKit::WebProcessPool::createNewWebProcess):
1086         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
1087         (WebKit::WebProcessPool::sendWebProcessDataStoreParameters):
1088         (WebKit::WebProcessPool::initializeNewWebProcess):
1089         (WebKit::WebProcessPool::prewarmProcess):
1090         (WebKit::WebProcessPool::processForRegistrableDomain):
1091         (WebKit::WebProcessPool::createWebPage):
1092         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
1093         * UIProcess/WebProcessPool.h:
1094         (WebKit::WebProcessPool::sendToOneProcess):
1095         * UIProcess/WebProcessProxy.cpp:
1096         (WebKit::WebProcessProxy::create):
1097         (WebKit::WebProcessProxy::WebProcessProxy):
1098         (WebKit::WebProcessProxy::setWebsiteDataStore):
1099         (WebKit::WebProcessProxy::addExistingWebPage):
1100         * UIProcess/WebProcessProxy.h:
1101         (WebKit::WebProcessProxy::websiteDataStore const):
1102         * WebKit.xcodeproj/project.pbxproj:
1103         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
1104         (WebKit::WebMediaKeyStorageManager::setWebsiteDataStore):
1105         * WebProcess/MediaCache/WebMediaKeyStorageManager.h:
1106         * WebProcess/WebProcess.cpp:
1107         (WebKit::WebProcess::initializeWebProcess):
1108         (WebKit::WebProcess::setWebsiteDataStoreParameters):
1109         * WebProcess/WebProcess.h:
1110         * WebProcess/WebProcess.messages.in:
1111         * WebProcess/WebProcessSupplement.h:
1112         (WebKit::WebProcessSupplement::initialize):
1113         (WebKit::WebProcessSupplement::setWebsiteDataStore):
1114         * WebProcess/cocoa/WebProcessCocoa.mm:
1115         (WebKit::WebProcess::platformInitializeWebProcess):
1116         (WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
1117         * WebProcess/win/WebProcessWin.cpp:
1118         (WebKit::WebProcess::platformInitializeWebProcess):
1119         (WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
1120
1121 2019-03-22  Simon Fraser  <simon.fraser@apple.com>
1122
1123         REGRESSION (r242687): Flicker when pinch-zooming pages in macOS Safari
1124         https://bugs.webkit.org/show_bug.cgi?id=196126
1125         rdar://problem/49095791
1126
1127         Reviewed by Antti Koivisto.
1128
1129         The scrolling tree doesn't have an accurate picture of the main view's scroll position
1130         during pinch-zooming, so don't have it apply layer positions if a transient zoom is
1131         in progress.
1132
1133         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1134         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1135         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1136         (WebKit::TiledCoreAnimationDrawingArea::applyTransientZoomToPage):
1137
1138 2019-03-22  Antti Koivisto  <antti@apple.com>
1139
1140         Handle UI side hit testing for ScrollPositioningBehavior::Stationary positioned nodes
1141         https://bugs.webkit.org/show_bug.cgi?id=196100
1142         <rdar://problem/49117933>
1143
1144         Reviewed by Simon Fraser.
1145
1146         Test: fast/scrolling/ios/overflow-scroll-overlap-6.html
1147
1148         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
1149         (WebKit::RemoteLayerTreeNode::relatedScrollContainerIDs const):
1150         (WebKit::RemoteLayerTreeNode::relatedScrollContainerPositioningBehavior const):
1151
1152         Make more generic and save the associated positioning behavior.
1153
1154         (WebKit::RemoteLayerTreeNode::nonAncestorScrollContainerIDs const): Deleted.
1155         (WebKit::RemoteLayerTreeNode::addNonAncestorScrollContainerID): Deleted.
1156         (WebKit::RemoteLayerTreeNode::clearNonAncestorScrollContainerIDs): Deleted.
1157         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
1158         (WebKit::RemoteLayerTreeNode::setRelatedScrollContainerBehaviorAndIDs):
1159         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
1160         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1161         (WebKit::isScrolledBy):
1162
1163         Stationary relationship means the layer won't scroll the scroller.
1164
1165         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1166         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
1167
1168 2019-03-22  Chris Dumez  <cdumez@apple.com>
1169
1170         REGRESSION (r243094): ePub files do not render or open in Books
1171         https://bugs.webkit.org/show_bug.cgi?id=196119
1172         <rdar://problem/49121686>
1173
1174         Reviewed by Brady Eidson.
1175
1176         Do not delay the WebProcess launch until a load when contructing a web view and the client
1177         may observe when its injected bundle is loaded via WKProcessGroupDelegate's
1178         didCreateConnectionToWebProcessPlugIn.
1179
1180         * UIProcess/API/Cocoa/WKProcessGroup.mm:
1181         (-[WKProcessGroup setDelegate:]):
1182         * UIProcess/WebInspectorUtilities.cpp:
1183         (WebKit::inspectorProcessPool):
1184         * UIProcess/WebProcessPool.cpp:
1185         (WebKit::WebProcessPool::createWebPage):
1186         * UIProcess/WebProcessPool.h:
1187
1188 2019-03-22  Carlos Garcia Campos  <cgarcia@igalia.com>
1189
1190         REGRESSION(r243094): Automation: browser crash in WebAutomationSession::exitFullscreenWindowForPage()
1191         https://bugs.webkit.org/show_bug.cgi?id=196140
1192
1193         Reviewed by Chris Dumez.
1194
1195         Since r243094, the WebPageProxy fullscreen manager is not created in the constructor, but once the page has a
1196         process launched.
1197
1198         * UIProcess/Automation/WebAutomationSession.cpp:
1199         (WebKit::WebAutomationSession::exitFullscreenWindowForPage): Null check WebPageProxy::fullScreenManager() before
1200         using it.
1201
1202 2019-03-22  Timothy Hatcher  <timothy@apple.com>
1203
1204         Change macosx() to macos() in WK_API... and JSC_API... macros.
1205         https://bugs.webkit.org/show_bug.cgi?id=196106
1206
1207         Reviewed by Brian Burg.
1208
1209         * Shared/API/Cocoa/WKBrowsingContextHandle.h:
1210         * Shared/API/Cocoa/WKDragDestinationAction.h:
1211         * Shared/API/Cocoa/WKMain.h:
1212         * Shared/API/Cocoa/_WKFrameHandle.h:
1213         * Shared/API/Cocoa/_WKHitTestResult.h:
1214         * Shared/API/Cocoa/_WKNSWindowExtras.h:
1215         * Shared/API/Cocoa/_WKRemoteObjectInterface.h:
1216         * Shared/API/Cocoa/_WKRemoteObjectRegistry.h:
1217         * Shared/API/Cocoa/_WKRenderingProgressEvents.h:
1218         * Shared/API/Cocoa/_WKSameDocumentNavigationType.h:
1219         * UIProcess/API/C/WKPage.h:
1220         * UIProcess/API/Cocoa/NSAttributedString.h:
1221         * UIProcess/API/Cocoa/WKBackForwardList.h:
1222         * UIProcess/API/Cocoa/WKBackForwardListItem.h:
1223         * UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h:
1224         * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegate.h:
1225         * UIProcess/API/Cocoa/WKContentRuleList.h:
1226         * UIProcess/API/Cocoa/WKContentRuleListStore.h:
1227         * UIProcess/API/Cocoa/WKError.h:
1228         * UIProcess/API/Cocoa/WKErrorPrivate.h:
1229         * UIProcess/API/Cocoa/WKFrameInfo.h:
1230         * UIProcess/API/Cocoa/WKFrameInfoPrivate.h:
1231         * UIProcess/API/Cocoa/WKHTTPCookieStore.h:
1232         * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
1233         * UIProcess/API/Cocoa/WKNavigation.h:
1234         * UIProcess/API/Cocoa/WKNavigationAction.h:
1235         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
1236         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
1237         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1238         * UIProcess/API/Cocoa/WKNavigationResponse.h:
1239         * UIProcess/API/Cocoa/WKOpenPanelParameters.h:
1240         * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h:
1241         * UIProcess/API/Cocoa/WKPreferences.h:
1242         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1243         * UIProcess/API/Cocoa/WKProcessPool.h:
1244         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1245         * UIProcess/API/Cocoa/WKScriptMessage.h:
1246         * UIProcess/API/Cocoa/WKSecurityOrigin.h:
1247         * UIProcess/API/Cocoa/WKSnapshotConfiguration.h:
1248         * UIProcess/API/Cocoa/WKUIDelegate.h:
1249         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1250         * UIProcess/API/Cocoa/WKURLSchemeHandler.h:
1251         * UIProcess/API/Cocoa/WKURLSchemeTask.h:
1252         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
1253         * UIProcess/API/Cocoa/WKUserContentController.h:
1254         * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
1255         * UIProcess/API/Cocoa/WKUserScript.h:
1256         * UIProcess/API/Cocoa/WKUserScriptPrivate.h:
1257         * UIProcess/API/Cocoa/WKViewPrivate.h:
1258         * UIProcess/API/Cocoa/WKWebView.h:
1259         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
1260         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1261         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1262         * UIProcess/API/Cocoa/WKWebsiteDataRecord.h:
1263         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
1264         * UIProcess/API/Cocoa/WKWebsiteDataStore.h:
1265         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1266         * UIProcess/API/Cocoa/WKWindowFeatures.h:
1267         * UIProcess/API/Cocoa/WKWindowFeaturesPrivate.h:
1268         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
1269         * UIProcess/API/Cocoa/_WKApplicationManifest.h:
1270         * UIProcess/API/Cocoa/_WKAttachment.h:
1271         * UIProcess/API/Cocoa/_WKAutomationDelegate.h:
1272         * UIProcess/API/Cocoa/_WKAutomationSession.h:
1273         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h:
1274         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
1275         * UIProcess/API/Cocoa/_WKContextMenuElementInfo.h:
1276         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
1277         * UIProcess/API/Cocoa/_WKDownload.h:
1278         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
1279         * UIProcess/API/Cocoa/_WKElementAction.h:
1280         * UIProcess/API/Cocoa/_WKExperimentalFeature.h:
1281         * UIProcess/API/Cocoa/_WKFindOptions.h:
1282         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
1283         * UIProcess/API/Cocoa/_WKFormInputSession.h:
1284         * UIProcess/API/Cocoa/_WKFullscreenDelegate.h:
1285         * UIProcess/API/Cocoa/_WKGeolocationCoreLocationProvider.h:
1286         * UIProcess/API/Cocoa/_WKInspector.h:
1287         * UIProcess/API/Cocoa/_WKInspectorWindow.h:
1288         * UIProcess/API/Cocoa/_WKInternalDebugFeature.h:
1289         * UIProcess/API/Cocoa/_WKLayoutMode.h:
1290         * UIProcess/API/Cocoa/_WKLinkIconParameters.h:
1291         * UIProcess/API/Cocoa/_WKOverlayScrollbarStyle.h:
1292         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1293         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h:
1294         * UIProcess/API/Cocoa/_WKSessionState.h:
1295         * UIProcess/API/Cocoa/_WKTextInputContext.h:
1296         * UIProcess/API/Cocoa/_WKThumbnailView.h:
1297         * UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:
1298         * UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
1299         * UIProcess/API/Cocoa/_WKUserContentFilter.h:
1300         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
1301         * UIProcess/API/Cocoa/_WKUserContentWorld.h:
1302         * UIProcess/API/Cocoa/_WKUserInitiatedAction.h:
1303         * UIProcess/API/Cocoa/_WKUserStyleSheet.h:
1304         * UIProcess/API/Cocoa/_WKVisitedLinkStore.h:
1305         * UIProcess/API/Cocoa/_WKWebsiteDataSize.h:
1306         * UIProcess/API/Cocoa/_WKWebsiteDataStore.h:
1307         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
1308         * UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h:
1309         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
1310         * WebProcess/API/Cocoa/WKWebProcess.h:
1311         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h:
1312         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
1313         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.h:
1314         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h:
1315         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
1316         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInPageGroup.h:
1317         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h:
1318         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.h:
1319         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h:
1320         * WebProcess/InjectedBundle/API/mac/WKDOMElement.h:
1321         * WebProcess/InjectedBundle/API/mac/WKDOMNode.h:
1322         * WebProcess/InjectedBundle/API/mac/WKDOMRange.h:
1323         * WebProcess/InjectedBundle/API/mac/WKDOMText.h:
1324         * WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.h:
1325         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
1326         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.h:
1327         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:
1328
1329 2019-03-22  Yousuke Kimoto  <Yousuke.Kimoto@sony.com>
1330
1331         Unreviewed build fix.
1332
1333         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1334
1335 2019-03-22  Tim Horton  <timothy_horton@apple.com>
1336
1337         Fix the build after r243354
1338         https://bugs.webkit.org/show_bug.cgi?id=196138
1339         <rdar://problem/49145951>
1340
1341         * Platform/spi/ios/UIKitSPI.h:
1342         * Shared/DocumentEditingContext.mm:
1343         (WebKit::DocumentEditingContext::toPlatformContext):
1344         * UIProcess/ios/WKContentViewInteraction.mm:
1345
1346 2019-03-21  Simon Fraser  <simon.fraser@apple.com>
1347
1348         Clean up some TiledCoreAnimationDrawingArea members
1349         https://bugs.webkit.org/show_bug.cgi?id=196124
1350
1351         Reviewed by Tim Horton.
1352
1353         The giant m_transform was unused.
1354         
1355         Group the bools etc.
1356
1357         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1358         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1359         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
1360         (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer):
1361
1362 2019-03-21  Brady Eidson  <beidson@apple.com>
1363
1364         Certain WebProcesses should opt-out of the freezer.
1365         <rdar://problem/42846139> and https://bugs.webkit.org/show_bug.cgi?id=196062
1366
1367         Reviewed by Andy Estes.
1368
1369         WebProcesses should opt-in and opt-out of the freezer as is appropriate.
1370         By default a WebProcess is freezer eligible.
1371         If any of the following become true then it should become ineligible:
1372         - The WebProcess is a pre-warmed process.
1373         - The WebProcess is in the process cache.
1374         - The WebProcess is not actively hosting any web pages (e.g. it only has suspending web pages)
1375
1376         The most complicated part of the above is guaranteeing that any operation that changes
1377         the active pages hosted by the process causes a recalculation of the freezer opt-in state.
1378
1379         To do that this replaces the basic WebPageProxyMap with a custom class.
1380
1381         * UIProcess/WebProcessProxy.cpp:
1382         (WebKit::globalPageMap):
1383         (WebKit::WebProcessProxy::WebProcessProxy):
1384         (WebKit::WebProcessProxy::validateFreezerStatus):
1385         (WebKit::WebProcessProxy::setIsInProcessCache):
1386         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
1387         (WebKit::WebProcessProxy::didFinishLaunching):
1388         * UIProcess/WebProcessProxy.h:
1389         (WebKit::WebProcessProxy::WebPageProxyMap::WebPageProxyMap):
1390         (WebKit::WebProcessProxy::WebPageProxyMap::size const):
1391         (WebKit::WebProcessProxy::WebPageProxyMap::values):
1392         (WebKit::WebProcessProxy::WebPageProxyMap::values const):
1393         (WebKit::WebProcessProxy::WebPageProxyMap::begin):
1394         (WebKit::WebProcessProxy::WebPageProxyMap::end):
1395         (WebKit::WebProcessProxy::WebPageProxyMap::get):
1396         (WebKit::WebProcessProxy::WebPageProxyMap::contains const):
1397         (WebKit::WebProcessProxy::WebPageProxyMap::isEmpty const):
1398         (WebKit::WebProcessProxy::WebPageProxyMap::set):
1399         (WebKit::WebProcessProxy::WebPageProxyMap::take):
1400
1401         * WebProcess/WebProcess.cpp:
1402         (WebKit::WebProcess::setFreezable):
1403         * WebProcess/WebProcess.h:
1404         * WebProcess/WebProcess.messages.in:
1405
1406 2019-03-21  Tim Horton  <timothy_horton@apple.com>
1407
1408         Adopt UIWKDocumentContext
1409         https://bugs.webkit.org/show_bug.cgi?id=196040
1410         <rdar://problem/48642440>
1411
1412         Reviewed by Ryosuke Niwa.
1413
1414         * Platform/spi/ios/UIKitSPI.h:
1415         * Scripts/webkit/messages.py:
1416         * Shared/DocumentEditingContext.h: Added.
1417         * Shared/DocumentEditingContext.mm: Added.
1418         (WebKit::toNSRange):
1419         (WebKit::DocumentEditingContext::toPlatformContext):
1420         (IPC::ArgumentCoder<WebKit::DocumentEditingContext::Range>::encode):
1421         (IPC::ArgumentCoder<WebKit::DocumentEditingContext::Range>::decode):
1422         (IPC::ArgumentCoder<WebKit::DocumentEditingContext::TextRect>::encode):
1423         (IPC::ArgumentCoder<WebKit::DocumentEditingContext::TextRect>::decode):
1424         (IPC::ArgumentCoder<WebKit::DocumentEditingContext>::encode):
1425         (IPC::ArgumentCoder<WebKit::DocumentEditingContext>::decode):
1426         (IPC::ArgumentCoder<WebKit::DocumentEditingContextRequest>::encode):
1427         (IPC::ArgumentCoder<WebKit::DocumentEditingContextRequest>::decode):
1428         Add DocumentEditingContext(Request), and coders.
1429         Also expose DocumentEditingContext::toPlatformContext, which populates
1430         a UIWKDocumentContext with the relevant values.
1431
1432         * SourcesCocoa.txt:
1433         * UIProcess/WebPageProxy.h:
1434         * UIProcess/ios/WKContentViewInteraction.mm:
1435         (toWebDocumentRequestOptions):
1436         (toWebRequest):
1437         (-[WKContentView adjustSelectionWithDelta:completionHandler:]):
1438         (-[WKContentView requestDocumentContext:completionHandler:]):
1439         (-[WKContentView selectPositionAtPoint:withContextRequest:completionHandler:]):
1440         * UIProcess/ios/WebPageProxyIOS.mm:
1441         (WebKit::WebPageProxy::adjustSelectionWithDelta):
1442         (WebKit::WebPageProxy::requestDocumentEditingContext):
1443         * WebKit.xcodeproj/project.pbxproj:
1444         * WebProcess/WebPage/WebPage.h:
1445         * WebProcess/WebPage/WebPage.messages.in:
1446         Plumb DocumentEditingContext(Request) around.
1447
1448         * WebProcess/WebPage/ios/WebPageIOS.mm:
1449         (WebKit::WebPage::adjustSelectionWithDelta):
1450         Adjust the current selection given deltas to apply to the location and length.
1451
1452         (WebKit::visiblePositionAdjacentToVisiblePosition):
1453         (WebKit::visiblePositionForPointInRootViewCoordinates):
1454         (WebKit::WebPage::requestDocumentEditingContext):
1455         Retrieve the relevant part of the selection, as well as the context,
1456         given either the selection, or a rect.
1457         If we're collecting context for a rect, we split the context between
1458         before and after (except for the part that intersects the selection).
1459         The three strings will always be directly adjacent, and any of the three
1460         can sometimes be null.
1461
1462 2019-03-21  James Magahern  <jmagahern@apple.com>
1463
1464         Long press gesture recognizers in WKWebView are conflicting with internal scroll view long press gesture recognizers
1465         https://bugs.webkit.org/show_bug.cgi?id=195726
1466         rdar://problem/48582449
1467
1468         Reviewed by Megan Gardner.
1469
1470         We just need to add another clause to WKContentViewInteraction's
1471         canPreventGestureRecognizer whitelist. 
1472
1473         * UIProcess/ios/WKContentViewInteraction.mm:
1474         (-[WKContentView gestureRecognizer:canPreventGestureRecognizer:]):
1475
1476 2019-03-21  Simon Fraser  <simon.fraser@apple.com>
1477
1478         [iOS WK2] Turn on async overflow scrolling by default
1479         https://bugs.webkit.org/show_bug.cgi?id=196011
1480         rdar://problem/48453859
1481
1482         Reviewed by Antti Koivisto.
1483
1484         * Shared/WebPreferences.yaml:
1485         * Shared/WebPreferencesDefaultValues.h:
1486
1487 2019-03-21  Alex Christensen  <achristensen@webkit.org>
1488
1489         Remove last use of LegacySync IPC messages
1490         https://bugs.webkit.org/show_bug.cgi?id=196113
1491
1492         Reviewed by Chris Dumez.
1493
1494         Also rename "Delayed" to "Synchronous" now that there's only one type of synchronous message.
1495
1496         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1497         * NetworkProcess/NetworkProcess.messages.in:
1498         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1499         (WebKit::WebSWServerConnection::syncTerminateWorkerFromClient):
1500         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
1501         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
1502         * Platform/IPC/Connection.cpp:
1503         (IPC::Connection::dispatchMessage):
1504         * Platform/IPC/HandleMessage.h:
1505         (IPC::handleMessageSynchronous):
1506         (IPC::handleMessageSynchronousWantsConnection):
1507         (IPC::handleMessageLegacySync): Deleted.
1508         (IPC::handleMessageDelayed): Deleted.
1509         (IPC::handleMessageDelayedWantsConnection): Deleted.
1510         * PluginProcess/PluginControllerProxy.messages.in:
1511         * PluginProcess/WebProcessConnection.messages.in:
1512         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
1513         (WebKit::WebPage::didReceiveSyncWebPageMessage):
1514         * Scripts/webkit/MessageReceiver-expected.cpp:
1515         (WebKit::WebPage::didReceiveSyncMessage):
1516         * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
1517         (Messages::WebPage::TestSyncMessage::send):
1518         (Messages::WebPage::TestSynchronousMessage::send):
1519         (WebKit::WebPage::didReceiveSyncMessage):
1520         (Messages::WebPage::TestDelayedMessage::send): Deleted.
1521         * Scripts/webkit/MessagesSuperclass-expected.h:
1522         (Messages::WebPage::TestSynchronousMessage::name):
1523         (Messages::WebPage::TestSynchronousMessage::TestSynchronousMessage):
1524         (Messages::WebPage::TestDelayedMessage::receiverName): Deleted.
1525         (Messages::WebPage::TestDelayedMessage::name): Deleted.
1526         (Messages::WebPage::TestDelayedMessage::TestDelayedMessage): Deleted.
1527         (Messages::WebPage::TestDelayedMessage::arguments const): Deleted.
1528         * Scripts/webkit/messages.py:
1529         * Scripts/webkit/messages_unittest.py:
1530         * Scripts/webkit/test-legacy-messages.in:
1531         * Scripts/webkit/test-messages.in:
1532         * Scripts/webkit/test-superclass-messages.in:
1533         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
1534         * Shared/Plugins/NPObjectMessageReceiver.messages.in:
1535         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
1536         * UIProcess/Plugins/PluginProcessProxy.messages.in:
1537         * UIProcess/WebFullScreenManagerProxy.messages.in:
1538         * UIProcess/WebPageProxy.messages.in:
1539         * UIProcess/WebPasteboardProxy.messages.in:
1540         * UIProcess/WebProcessPool.messages.in:
1541         * UIProcess/WebProcessProxy.messages.in:
1542         * UIProcess/WebStorage/StorageManager.messages.in:
1543         * UIProcess/mac/SecItemShimProxy.messages.in:
1544         * WebProcess/Plugins/PluginProcessConnection.messages.in:
1545         * WebProcess/Plugins/PluginProxy.messages.in:
1546         * WebProcess/Storage/WebSWClientConnection.cpp:
1547         (WebKit::WebSWClientConnection::syncTerminateWorker):
1548         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1549         * WebProcess/WebPage/WebPage.messages.in:
1550         * WebProcess/WebProcess.messages.in:
1551
1552 2019-03-21  Brian Burg  <bburg@apple.com>
1553
1554         Web Automation: support uploading non-local file paths
1555         https://bugs.webkit.org/show_bug.cgi?id=196081
1556         <rdar://problem/45819897>
1557
1558         Reviewed by Devin Rousso and Joseph Pecoraro.
1559
1560         To support cases where supplied file paths do not exist on the session host, add support for
1561         receiving file contents via Automation.setFilesToSelectForFileUpload.
1562
1563         * UIProcess/Automation/Automation.json: Add new parameter.
1564
1565         * UIProcess/Automation/WebAutomationSession.h:
1566         * UIProcess/Automation/WebAutomationSession.cpp:
1567         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload):
1568         Add support for receiving and saving file contents to a temporary directory. Rewrite the used paths so
1569         that WebCore knows to look at the revised paths where the file contents have been saved.
1570
1571         (WebKit::WebAutomationSession::platformGenerateLocalFilePathForRemoteFile):
1572         Since WebKit does not have usable FileSystem implementations for all ports, shell out the actual
1573         saving of base64-encoded file data. Provide a Cocoa implementation, since that's what I can test.
1574
1575         * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
1576         (WebKit::WebAutomationSession::platformGenerateLocalFilePathForRemoteFile):
1577         Use WTF::FileSystem to create a temporary directory, and use Cocoa methods to actually write the file.
1578
1579 2019-03-21  Youenn Fablet  <youenn@apple.com>
1580
1581         Cache API and IDB space usages should be initialized on first quota check
1582         https://bugs.webkit.org/show_bug.cgi?id=195707
1583
1584         Reviewed by Chris Dumez.
1585
1586         When the quota manager is created, make sure it delays quota check decisions until IDB and Cache API quota users are initialized.
1587         For IDB, the creation is synchronous but it may not be synchronous for Cache API.
1588         For that purpose, add a temporary quota user that will stay uninitialized until these two quota users are added.
1589         Once added, the temporary quota user is removed.
1590         The addition of the real users is made asynchronously as this is triggered by the creation of one of the two quota users.
1591
1592         In the case of a Cache API caches being cleared, make sure to reset the size to zero and to redo the quota user initialization dance.
1593
1594         * NetworkProcess/NetworkProcess.cpp:
1595         (WebKit::QuotaUserInitializer::initialize):
1596         (WebKit::QuotaUserInitializer::~QuotaUserInitializer):
1597         (WebKit::QuotaUserInitializer::QuotaUserInitializer):
1598         (WebKit::NetworkProcess::storageQuotaManager):
1599         * NetworkProcess/cache/CacheStorageEngine.cpp:
1600         (WebKit::CacheStorage::Engine::initializeQuotaUser):
1601         * NetworkProcess/cache/CacheStorageEngine.h:
1602         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1603         (WebKit::CacheStorage::Caches::clear):
1604
1605 2019-03-21  Per Arne Vollan  <pvollan@apple.com>
1606
1607         [iOS][macOS] Fix sandbox call violations
1608         https://bugs.webkit.org/show_bug.cgi?id=195809
1609         <rdar://problem/48829655>
1610
1611         Reviewed by Brent Fulgham.
1612
1613         An additional syscall needs to be added to the sandbox allow list.
1614
1615         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1616         * WebProcess/com.apple.WebProcess.sb.in:
1617
1618 2019-03-21  Eric Carlson  <eric.carlson@apple.com>
1619
1620         Add UI process WebRTC runtime logging.
1621         https://bugs.webkit.org/show_bug.cgi?id=196020
1622         <rdar://problem/49071443>
1623
1624         Reviewed by Youenn Fablet.
1625
1626         * Platform/Logging.cpp:
1627         (WebKit::getLogChannel): New.
1628         * Platform/Logging.h:
1629         * Shared/WebCoreArgumentCoders.h: Add coders for WTFLogChannelState and WTFLogLevel.
1630
1631         Add runtime logging.
1632         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1633         (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy):
1634         (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture):
1635         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
1636         (WebKit::UserMediaPermissionRequestManagerProxy::clearCachedState):
1637         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
1638         (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest):
1639         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
1640         (WebKit::UserMediaPermissionRequestManagerProxy::resetAccess):
1641         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess):
1642         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
1643         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
1644         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest):
1645         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest):
1646         (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
1647         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
1648         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
1649         (WebKit::UserMediaPermissionRequestManagerProxy::watchdogTimerFired):
1650         (WebKit::UserMediaPermissionRequestManagerProxy::logChannel const):
1651         (WebKit::convertEnumerationToString):
1652
1653         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1654         (WTF::LogArgument<WebKit::UserMediaPermissionRequestManagerProxy::RequestAction>::toString):
1655         * UIProcess/UserMediaPermissionRequestProxy.cpp:
1656         (WebKit::convertEnumerationToString): Add an enum specialization for logging.
1657
1658         * UIProcess/UserMediaPermissionRequestProxy.h:
1659         (WTF::LogArgument<WebKit::UserMediaPermissionRequestProxy::UserMediaAccessDenialReason>::toString): Ditto.
1660
1661         * UIProcess/WebPageProxy.cpp:
1662         (WebKit::WebPageProxy::logger):
1663         (WebKit::WebPageProxy::configureLoggingChannel):
1664         * UIProcess/WebPageProxy.h:
1665         * UIProcess/WebPageProxy.messages.in:
1666
1667         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1668         (WebKit::WebChromeClient::configureLoggingChannel):
1669         * WebProcess/WebCoreSupport/WebChromeClient.h:
1670         * WebProcess/WebPage/WebPage.cpp:
1671         (WebKit::WebPage::configureLoggingChannel):
1672         * WebProcess/WebPage/WebPage.h:
1673
1674 2019-03-21  Alex Christensen  <achristensen@webkit.org>
1675
1676         Stop using LegacySync messages in WebPageProxy
1677         https://bugs.webkit.org/show_bug.cgi?id=196056
1678
1679         Reviewed by Chris Dumez.
1680
1681         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1682         (WebKit::WebPageProxy::loadRecentSearches):
1683         * UIProcess/ProvisionalPageProxy.cpp:
1684         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
1685         (WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
1686         * UIProcess/ProvisionalPageProxy.h:
1687         * UIProcess/WebPageProxy.cpp:
1688         (WebKit::WebPageProxy::handleSynchronousMessage):
1689         (WebKit::WebPageProxy::hasInsecureContent):
1690         (WebKit::WebPageProxy::accessibilityScreenToRootView):
1691         (WebKit::WebPageProxy::rootViewToAccessibilityScreen):
1692         (WebKit::WebPageProxy::printFrame):
1693         (WebKit::WebPageProxy::backForwardGoToItem):
1694         (WebKit::WebPageProxy::backForwardGoToItemShared):
1695         (WebKit::WebPageProxy::backForwardItemAtIndex):
1696         (WebKit::WebPageProxy::backForwardBackListCount):
1697         (WebKit::WebPageProxy::backForwardForwardListCount):
1698         (WebKit::WebPageProxy::canUndoRedo):
1699         (WebKit::WebPageProxy::executeUndoRedo):
1700         (WebKit::WebPageProxy::checkTextOfParagraph):
1701         (WebKit::WebPageProxy::checkSpellingOfString):
1702         (WebKit::WebPageProxy::checkGrammarOfString):
1703         (WebKit::WebPageProxy::spellingUIIsShowing):
1704         (WebKit::WebPageProxy::getGuessesForWord):
1705         (WebKit::WebPageProxy::substitutionsPanelIsShowing):
1706         (WebKit::WebPageProxy::showCorrectionPanel):
1707         (WebKit::WebPageProxy::dismissCorrectionPanel):
1708         (WebKit::WebPageProxy::dismissCorrectionPanelSoon):
1709         (WebKit::WebPageProxy::recordAutocorrectionResponse):
1710         (WebKit::WebPageProxy::dictationAlternatives):
1711         (WebKit::WebPageProxy::wrapCryptoKey):
1712         (WebKit::WebPageProxy::unwrapCryptoKey):
1713         (WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
1714         (WebKit::WebPageProxy::serializedAttachmentDataForIdentifiers):
1715         (WebKit::WebPageProxy::speechSynthesisVoiceList):
1716         (WebKit::WebPageProxy::printMainFrame): Deleted.
1717         * UIProcess/WebPageProxy.h:
1718         * UIProcess/WebPageProxy.messages.in:
1719         * UIProcess/gtk/WebPageProxyGtk.cpp:
1720         (WebKit::WebPageProxy::createPluginContainer):
1721         * UIProcess/ios/WebPageProxyIOS.mm:
1722         (WebKit::WebPageProxy::interpretKeyEvent):
1723         * UIProcess/mac/WebPageProxyMac.mm:
1724         (WebKit::WebPageProxy::getIsSpeaking):
1725         (WebKit::WebPageProxy::executeSavedCommandBySelector):
1726         (WebKit::WebPageProxy::showPDFContextMenu):
1727
1728 2019-03-21  Alex Christensen  <achristensen@webkit.org>
1729
1730         Stop using LegacySync messages in WebPage
1731         https://bugs.webkit.org/show_bug.cgi?id=196057
1732
1733         Reviewed by Chris Dumez.
1734
1735         * WebProcess/WebPage/WebPage.h:
1736         (WebKit::WebPage::markLayersVolatile):
1737         * WebProcess/WebPage/WebPage.messages.in:
1738         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1739         (WebKit::WebPage::getCenterForZoomGesture):
1740         * WebProcess/WebPage/ios/WebPageIOS.mm:
1741         (WebKit::WebPage::readSelectionFromPasteboard):
1742         (WebKit::WebPage::getStringSelectionForPasteboard):
1743         (WebKit::WebPage::getDataSelectionForPasteboard):
1744         (WebKit::WebPage::shouldDelayWindowOrderingEvent):
1745         (WebKit::WebPage::acceptsFirstMouse):
1746         * WebProcess/WebPage/mac/WebPageMac.mm:
1747         (WebKit::WebPage::replaceSelectionWithPasteboardData):
1748         (WebKit::WebPage::readSelectionFromPasteboard):
1749         (WebKit::WebPage::getStringSelectionForPasteboard):
1750         (WebKit::WebPage::getDataSelectionForPasteboard):
1751         (WebKit::WebPage::shouldDelayWindowOrderingEvent):
1752         (WebKit::WebPage::acceptsFirstMouse):
1753
1754 2019-03-21  Alex Christensen  <achristensen@webkit.org>
1755
1756         Stop using LegacySync messages in WebPasteboardProxy
1757         https://bugs.webkit.org/show_bug.cgi?id=196060
1758
1759         Reviewed by Chris Dumez.
1760
1761         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
1762         (WebKit::WebPasteboardProxy::getPasteboardTypes):
1763         (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType):
1764         (WebKit::WebPasteboardProxy::getPasteboardStringForType):
1765         (WebKit::WebPasteboardProxy::getPasteboardStringsForType):
1766         (WebKit::WebPasteboardProxy::getPasteboardBufferForType):
1767         (WebKit::WebPasteboardProxy::pasteboardCopy):
1768         (WebKit::WebPasteboardProxy::getPasteboardChangeCount):
1769         (WebKit::WebPasteboardProxy::getPasteboardUniqueName):
1770         (WebKit::WebPasteboardProxy::getPasteboardColor):
1771         (WebKit::WebPasteboardProxy::getPasteboardURL):
1772         (WebKit::WebPasteboardProxy::addPasteboardTypes):
1773         (WebKit::WebPasteboardProxy::setPasteboardTypes):
1774         (WebKit::WebPasteboardProxy::setPasteboardURL):
1775         (WebKit::WebPasteboardProxy::setPasteboardColor):
1776         (WebKit::WebPasteboardProxy::setPasteboardStringForType):
1777         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
1778         (WebKit::WebPasteboardProxy::getNumberOfFiles):
1779         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
1780         (WebKit::WebPasteboardProxy::writeCustomData):
1781         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
1782         (WebKit::WebPasteboardProxy::readURLFromPasteboard):
1783         (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
1784         (WebKit::WebPasteboardProxy::getPasteboardItemsCount):
1785         (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
1786         (WebKit::WebPasteboardProxy::informationForItemAtIndex):
1787         * UIProcess/WebPasteboardProxy.cpp:
1788         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
1789         (WebKit::WebPasteboardProxy::writeCustomData):
1790         * UIProcess/WebPasteboardProxy.h:
1791         * UIProcess/WebPasteboardProxy.messages.in:
1792         * UIProcess/gtk/WebPasteboardProxyGtk.cpp:
1793         (WebKit::WebPasteboardProxy::writeToClipboard):
1794         (WebKit::WebPasteboardProxy::readFromClipboard):
1795         * UIProcess/wpe/WebPasteboardProxyWPE.cpp:
1796         (WebKit::WebPasteboardProxy::getPasteboardTypes):
1797         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
1798         (WebKit::WebPasteboardProxy::writeWebContentToPasteboard):
1799         (WebKit::WebPasteboardProxy::writeStringToPasteboard):
1800
1801 2019-03-21  Andy Estes  <aestes@apple.com>
1802
1803         [iOS] Apple Pay should be available in documents with no user agent scripts
1804         https://bugs.webkit.org/show_bug.cgi?id=196061
1805         <rdar://problem/48649391>
1806
1807         Reviewed by Brady Eidson.
1808
1809         * Shared/AuxiliaryProcess.h:
1810         * Shared/Cocoa/AuxiliaryProcessCocoa.mm:
1811         (WebKit::AuxiliaryProcess::parentProcessHasEntitlement):
1812
1813         Added a convenience function for checking parent process entitlements.
1814
1815         * Shared/WebPreferences.yaml:
1816         * Shared/WebPreferencesDefaultValues.h:
1817         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1818         (-[WKWebViewConfiguration init]):
1819
1820         Enabled Apple Pay by default on platforms that enable APPLE_PAY_REMOTE_UI.
1821
1822         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1823         (WebKit::WebPaymentCoordinator::supportsUnrestrictedApplePay const):
1824         * WebProcess/ApplePay/WebPaymentCoordinator.h:
1825
1826         Implemented supportsUnrestrictedApplePay by checking for the
1827         com.apple.private.WebKit.UnrestrictedApplePay entitlement on platforms that enable
1828         APPLE_PAY_REMOTE_UI.
1829
1830         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
1831         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1832         (didClearWindowObjectForFrame):
1833         (setUpPageLoaderClient):
1834
1835         Added injected bundle SPI that TestWebKitAPI uses to inject the WebCore Internals interface.
1836
1837         * WebProcess/WebPage/WebPage.cpp:
1838         (WebKit::WebPage::runJavaScript):
1839
1840         Changed to call ScriptController::executeUserAgentScriptInWorld.
1841
1842 2019-03-21  Chris Dumez  <cdumez@apple.com>
1843
1844         WebKit should throw when trying to create a WKWebView with a related view that is using a different data store
1845         https://bugs.webkit.org/show_bug.cgi?id=196041
1846         <rdar://problem/49083230>
1847
1848         Reviewed by Alex Christensen.
1849
1850         WebKit should throw when trying to create a WKWebView with a related view that is using a different data store.
1851         We do not support having several WebsiteDataStores sharing the same WebProcess.
1852
1853         * UIProcess/API/Cocoa/WKWebView.mm:
1854         (-[WKWebView _initializeWithConfiguration:]):
1855         * UIProcess/WebProcessPool.cpp:
1856         (WebKit::WebProcessPool::createWebPage):
1857
1858 2019-03-21  Alex Christensen  <achristensen@webkit.org>
1859
1860         Add SPI to inform applications of WKContentRuleList actions
1861         https://bugs.webkit.org/show_bug.cgi?id=195965
1862         <rdar://problem/42664365>
1863
1864         Reviewed by Geoff Garen.
1865
1866         * NetworkProcess/NetworkLoadChecker.cpp:
1867         (WebKit::NetworkLoadChecker::checkRequest):
1868         (WebKit::NetworkLoadChecker::processContentRuleListsForLoad):
1869         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad): Deleted.
1870         * NetworkProcess/NetworkLoadChecker.h:
1871         * UIProcess/API/APINavigationClient.h:
1872         (API::NavigationClient::contentRuleListNotification):
1873         * UIProcess/API/C/WKPage.cpp:
1874         (WKPageSetPageNavigationClient):
1875         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1876         * UIProcess/Cocoa/NavigationState.h:
1877         * UIProcess/Cocoa/NavigationState.mm:
1878         (WebKit::NavigationState::setNavigationDelegate):
1879         (WebKit::NavigationState::NavigationClient::contentRuleListNotification):
1880         * UIProcess/WebPageProxy.cpp:
1881         (WebKit::WebPageProxy::contentRuleListNotification):
1882         * UIProcess/WebPageProxy.h:
1883         * UIProcess/WebPageProxy.messages.in:
1884         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1885         (WebKit::WebChromeClient::contentRuleListNotification):
1886         * WebProcess/WebCoreSupport/WebChromeClient.h:
1887
1888 2019-03-21  Simon Fraser  <simon.fraser@apple.com>
1889
1890         Add an internal feature flag to disable the -webkit-overflow-scrolling CSS property
1891         https://bugs.webkit.org/show_bug.cgi?id=196058
1892         rdar://problem/49078202
1893
1894         Reviewed by Antti Koivisto.
1895
1896         Add an internal feature flag called "LegacyOverflowScrollingTouchEnabled", initially
1897         on by default.
1898
1899         * Shared/WebPreferences.yaml:
1900
1901 2019-03-21  Antti Koivisto  <antti@apple.com>
1902
1903         UI-process hit-testing needs to know about containing block relationships
1904         https://bugs.webkit.org/show_bug.cgi?id=195845
1905         <rdar://problem/48949633>
1906
1907         Reviewed by Simon Fraser.
1908
1909         Test: fast/scrolling/ios/overflow-scroll-overlap-5.html
1910
1911         When an overflow scroller contains a positioned element the element may not be on a descendant layer of the scroller,
1912         yet should move along with it. This needs to be taken into account in UI-side hit testing.
1913
1914         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
1915         (WebKit::RemoteLayerTreeNode::nonAncestorScrollContainerIDs const):
1916         (WebKit::RemoteLayerTreeNode::addNonAncestorScrollContainerID):
1917         (WebKit::RemoteLayerTreeNode::clearNonAncestorScrollContainerIDs):
1918
1919         Maintain non-ancestor scrolling relationships for layers.
1920
1921         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1922         (WebKit::RemoteScrollingCoordinatorProxy::commitScrollingTreeState):
1923         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
1924         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
1925         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1926         (WebKit::isScrolledBy):
1927
1928         Helper to figure out who scrolls who.
1929
1930         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
1931         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1932         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
1933
1934         After commit, pull the non-ancestor scrolling relationships from the scrolling tree and update the layer tree.
1935
1936 2019-03-21  Daniel Bates  <dabates@apple.com>
1937
1938         [iOS] Inline -_ensureFormAccessoryView into -formAccessoryView and have -_updateAccessory ensure we have a form accessory
1939         https://bugs.webkit.org/show_bug.cgi?id=196021
1940
1941         Reviewed by Wenson Hsieh.
1942
1943         Every caller of -_ensureFormAccessoryView, except -formAccessoryView, immediately follows the call
1944         with a call to -_updateAccessory. Let's just have -_updateAccessory ensure we have a form accessory
1945         view and inline the implementation of -_ensureFormAccessoryView into -formAccessoryView so we can
1946         remove one method.
1947
1948         * UIProcess/ios/WKContentViewInteraction.mm:
1949         (-[WKContentView inputView]): Remove call to -_ensureFormAccessoryView, -_updateAccessory will do
1950         the equivalent work for us.
1951         (-[WKContentView formAccessoryView]): Moved implementation of -_ensureFormAccessoryView into here.
1952         (-[WKContentView _updateAccessory]): Call self.formAccessoryView to ensure we have a form accessory view.
1953         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1954         Remove call to -_ensureFormAccessoryView, -_updateAccessory will do
1955         the equivalent work for us.
1956         (-[WKContentView _ensureFormAccessoryView]): Deleted.
1957
1958 2019-03-21  Shawn Roberts  <sroberts@apple.com>
1959
1960         Unreviewed, rolling out r243250.
1961
1962         Causing 109 Failures and 2 crashes on iOS Sim Debug
1963         OpenSource/Internal queues
1964
1965         Reverted changeset:
1966
1967         "[iOS WK2] Turn on async overflow scrolling by default"
1968         https://bugs.webkit.org/show_bug.cgi?id=196011
1969         https://trac.webkit.org/changeset/243250
1970
1971 2019-03-21  Brent Fulgham  <bfulgham@apple.com>
1972
1973         Fix possible memory leak when dismissing a color picker
1974         https://bugs.webkit.org/show_bug.cgi?id=196026
1975         <rdar://problem/48778568>
1976
1977         Reviewed by Wenson Hsieh.
1978
1979         Fix a problem with WebPageProxy::endColorPicker where an early return could leave a color picker
1980         with a +1 reference count after dismissing it.
1981
1982         * UIProcess/WebColorPicker.cpp:
1983         (WebKit::WebColorPicker::endPicker):
1984         * UIProcess/WebPageProxy.cpp:
1985         (WebKit::WebPageProxy::endColorPicker):
1986         (WebKit::WebPageProxy::didEndColorPicker):
1987
1988 2019-03-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1989
1990         [GTK][WPE] Add API to provide geolocation information
1991         https://bugs.webkit.org/show_bug.cgi?id=195940
1992
1993         Reviewed by Michael Catanzaro.
1994
1995         Add WebKitGeolocationManager public class to handle geolocation position updates. WebKitGeolocationProvider has
1996         been removed and the default implementation based on GeoClue is done by WebKitGeolocationManager.
1997
1998         * PlatformGTK.cmake:
1999         * PlatformWPE.cmake:
2000         * SourcesGTK.txt:
2001         * SourcesWPE.txt:
2002         * UIProcess/API/glib/WebKitGeolocationManager.cpp: Added.
2003         (_WebKitGeolocationPosition::_WebKitGeolocationPosition):
2004         (webkit_geolocation_position_new):
2005         (webkit_geolocation_position_copy):
2006         (webkit_geolocation_position_free):
2007         (webkit_geolocation_position_set_timestamp):
2008         (webkit_geolocation_position_set_altitude):
2009         (webkit_geolocation_position_set_altitude_accuracy):
2010         (webkit_geolocation_position_set_heading):
2011         (webkit_geolocation_position_set_speed):
2012         (webkitGeolocationManagerStop):
2013         (webkitGeolocationManagerSetEnableHighAccuracy):
2014         (webkitGeolocationManagerCreate):
2015         (webkitGeolocationManagerGetProperty):
2016         (webkit_geolocation_manager_class_init):
2017         (webkit_gelocation_manager_update_position):
2018         (webkit_gelocation_manager_failed):
2019         (webkit_geolocation_manager_get_enable_high_accuracy):
2020         * UIProcess/API/glib/WebKitGeolocationManagerPrivate.h: Copied from Source/WebCore/platform/geoclue/GeolocationProviderGeoclueClient.h.
2021         * UIProcess/API/glib/WebKitGeolocationProvider.cpp: Removed.
2022         * UIProcess/API/glib/WebKitGeolocationProvider.h: Removed.
2023         * UIProcess/API/glib/WebKitWebContext.cpp:
2024         (webkitWebContextConstructed): Create a WebKitGeolocationManager instead of a WebKitGeolocationProvider.
2025         (webkit_web_context_get_geolocation_manager): Get the WebKitGeolocationManager.
2026         * UIProcess/API/gtk/WebKitGeolocationManager.h: Added.
2027         * UIProcess/API/gtk/WebKitWebContext.h:
2028         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2029         * UIProcess/API/gtk/docs/webkit2gtk-4.0.types:
2030         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
2031         * UIProcess/API/gtk/webkit2.h:
2032         * UIProcess/API/wpe/WebKitGeolocationManager.h: Added.
2033         * UIProcess/API/wpe/WebKitWebContext.h:
2034         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
2035         * UIProcess/API/wpe/docs/wpe-docs.sgml:
2036         * UIProcess/API/wpe/webkit.h:
2037
2038 2019-03-20  Youenn Fablet  <youenn@apple.com>
2039
2040         Compute quota after network process restart based on default quota and space used
2041         https://bugs.webkit.org/show_bug.cgi?id=195804
2042
2043         Reviewed by Chris Dumez.
2044
2045         Make sure that Cache Storage quota user waits to declare as initialized to its manager
2046         until all data is loaded so that it can report a valid space used from the start.
2047
2048         Add test API to reset the quota to its default value and compute it according current space use.
2049
2050         * NetworkProcess/NetworkProcess.cpp:
2051         (WebKit::NetworkProcess::updateQuotaBasedOnSpaceUsageForTesting):
2052         * NetworkProcess/NetworkProcess.h:
2053         * NetworkProcess/NetworkProcess.messages.in:
2054         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2055         (WebKit::CacheStorage::Caches::create):
2056         (WebKit::CacheStorage::Caches::Caches):
2057         (WebKit::CacheStorage::Caches::whenInitialized):
2058         * NetworkProcess/cache/CacheStorageEngineCaches.h:
2059         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
2060         (WebKit::CacheStorageEngineConnection::dereference):
2061         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2062         (WebKit::WebCacheStorageConnection::setQuotaBasedOnSpaceUsage):
2063         * WebProcess/Cache/WebCacheStorageConnection.h:
2064
2065 2019-03-20  Simon Fraser  <simon.fraser@apple.com>
2066
2067         Rename ENABLE_ACCELERATED_OVERFLOW_SCROLLING macro to ENABLE_OVERFLOW_SCROLLING_TOUCH
2068         https://bugs.webkit.org/show_bug.cgi?id=196049
2069
2070         Reviewed by Tim Horton.
2071
2072         This macro is about the -webkit-overflow-scrolling CSS property, not accelerated
2073         overflow scrolling in general, so rename it.
2074
2075         * Configurations/FeatureDefines.xcconfig:
2076
2077 2019-03-20  Jiewen Tan  <jiewen_tan@apple.com>
2078
2079         Extend Networking Process sandbox for some system frameworks
2080         https://bugs.webkit.org/show_bug.cgi?id=196036
2081         <rdar://problem/47594150>
2082
2083         Reviewed by Brent Fulgham.
2084
2085         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2086         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2087
2088 2019-03-20  Alex Christensen  <achristensen@webkit.org>
2089
2090         Reduce use of LegacySync IPC message type
2091         https://bugs.webkit.org/show_bug.cgi?id=194835
2092
2093         Reviewed by Darin Adler.
2094
2095         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2096         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
2097         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
2098         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
2099         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
2100         (WebKit::NetworkConnectionToWebProcess::blobSize):
2101         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
2102         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
2103         * NetworkProcess/NetworkConnectionToWebProcess.h:
2104         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadInformationRequest):
2105         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadInformationResponse):
2106         (WebKit::NetworkConnectionToWebProcess::getNetworkLoadIntermediateInformation):
2107         (WebKit::NetworkConnectionToWebProcess::takeNetworkLoadInformationMetrics):
2108         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2109         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2110         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
2111         (WebKit::UserMediaCaptureManagerProxy::capabilities):
2112         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
2113         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
2114         * UIProcess/Plugins/PluginProcessProxy.h:
2115         * UIProcess/Plugins/PluginProcessProxy.messages.in:
2116         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
2117         (WebKit::PluginProcessProxy::launchProcess):
2118         (WebKit::PluginProcessProxy::launchApplicationAtURL):
2119         (WebKit::PluginProcessProxy::openURL):
2120         (WebKit::PluginProcessProxy::openFile):
2121         * UIProcess/WebFullScreenManagerProxy.cpp:
2122         (WebKit::WebFullScreenManagerProxy::supportsFullScreen):
2123         * UIProcess/WebFullScreenManagerProxy.h:
2124         * UIProcess/WebFullScreenManagerProxy.messages.in:
2125         * WebProcess/WebProcess.cpp:
2126         (WebKit::WebProcess::fetchWebsiteData):
2127         (WebKit::WebProcess::deleteWebsiteData):
2128         (WebKit::WebProcess::deleteWebsiteDataForOrigins):
2129         (WebKit::WebProcess::processWillSuspendImminently):
2130         * WebProcess/WebProcess.h:
2131         * WebProcess/WebProcess.messages.in:
2132
2133 2019-03-20  Keith Rollin  <krollin@apple.com>
2134
2135         Update checks that determine if WebKit is system WebKit
2136         https://bugs.webkit.org/show_bug.cgi?id=195756
2137
2138         Unreviewed tweak of r243251 after unreviewed build fix after r243230.
2139
2140         * Shared/mac/AuxiliaryProcessMac.mm:
2141         (WebKit::AuxiliaryProcess::isSystemWebKit):
2142
2143 2019-03-20  Keith Rollin  <krollin@apple.com>
2144
2145         Update checks that determine if WebKit is system WebKit
2146         https://bugs.webkit.org/show_bug.cgi?id=195756
2147
2148         Unreviewed build fix after r243230.
2149
2150         * Shared/mac/AuxiliaryProcessMac.mm:
2151         (WebKit::AuxiliaryProcess::isSystemWebKit):
2152
2153 2019-03-20  Simon Fraser  <simon.fraser@apple.com>
2154
2155         [iOS WK2] Turn on async overflow scrolling by default
2156         https://bugs.webkit.org/show_bug.cgi?id=196011
2157         rdar://problem/48453859
2158
2159         Reviewed by Antti Koivisto.
2160
2161         Turn async overflow scroll on by default for iOS WK2.
2162
2163         * Shared/WebPreferences.yaml:
2164         * Shared/WebPreferencesDefaultValues.h:
2165
2166 2019-03-20  Youenn Fablet  <youenn@apple.com>
2167
2168         Have smaller default quotas for third party frames
2169         https://bugs.webkit.org/show_bug.cgi?id=195841
2170
2171         Reviewed by Geoffrey Garen.
2172
2173         * NetworkProcess/NetworkProcess.cpp:
2174         (WebKit::NetworkProcess::storageQuotaManager):
2175         For third party iframes, use the default quota divided by 10.
2176
2177 2019-03-20  Dean Jackson  <dino@apple.com>
2178
2179         [iOS] Enable fast clicking everywhere
2180         https://bugs.webkit.org/show_bug.cgi?id=196023
2181         <rdar://problem/49073589>
2182
2183         Reviewed by Wenson Hsieh.
2184
2185         Set FastClicksEverywhere to on by default for iPhone & iPad.
2186
2187         * Shared/WebPreferences.yaml:
2188         * Shared/WebPreferencesDefaultValues.h:
2189
2190 2019-03-20  Chris Dumez  <cdumez@apple.com>
2191
2192         Regression(PSON): ViewGestureController is not properly notified of process swaps on iOS
2193         https://bugs.webkit.org/show_bug.cgi?id=196029
2194         <rdar://problem/48954651>
2195
2196         Reviewed by Tim Horton.
2197
2198         If there is a ViewGestureController when process swapping, make sure we disconnect it
2199         from the old process and reconnect it to the new one. This matches what is done in
2200         WebViewImpl for macOS (see r238356).
2201
2202         * UIProcess/API/Cocoa/WKWebView.mm:
2203         (-[WKWebView _processWillSwap]):
2204         (-[WKWebView _processDidExit]):
2205         (-[WKWebView _didRelaunchProcess]):
2206
2207 2019-03-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2208
2209         [GTK] REGRESSION(r243094): crash when launching minibrowser
2210         https://bugs.webkit.org/show_bug.cgi?id=195951
2211
2212         Reviewed by Joseph Pecoraro.
2213
2214         Always return the inspector from WebPageProxy::inspector() when the page hasn't been closed. The inspector is
2215         created in WebPageProxy constructor and it's safe to use even before a process has been launched, because
2216         m_inspectedPage is null-checked everywhere.
2217
2218         * UIProcess/WebPageProxy.cpp:
2219         (WebKit::WebPageProxy::inspector const):
2220
2221 2019-03-20  Keith Rollin  <krollin@apple.com>
2222
2223         Update checks that determine if WebKit is system WebKit
2224         https://bugs.webkit.org/show_bug.cgi?id=195756
2225
2226         Reviewed by Alexey Proskuryakov.
2227
2228         The system WebKit can be installed in additional locations, so check
2229         for and allow those, too.
2230
2231         * Shared/mac/AuxiliaryProcessMac.mm:
2232         (WebKit::AuxiliaryProcess::isSystemWebKit):
2233
2234 2019-03-20  Per Arne Vollan  <pvollan@apple.com>
2235
2236         [iOS] Unable to PiP web videos in Safari due to sandbox violation
2237         https://bugs.webkit.org/show_bug.cgi?id=196015
2238         <rdar://problem/48867037>
2239
2240         Reviewed by Brent Fulgham.
2241
2242         The sandbox should allow getting the iokit property 'ui-pip'.
2243
2244         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2245
2246 2019-03-20  John Wilander  <wilander@apple.com>
2247
2248         (Test fix) Override minimumTimeBetweenDataRecordsRemoval in ResourceLoadStatisticsStore::shouldRemoveDataRecord() during layout tests
2249         https://bugs.webkit.org/show_bug.cgi?id=196017
2250
2251         Unreviewed test fix.
2252
2253         This patch adds a check of parameters().isRunningTest to the return of
2254         ResourceLoadStatisticsStore::shouldRemoveDataRecord() to allow successive
2255         layout tests to remove website data, effectively overriding the
2256         minimumTimeBetweenDataRecordsRemoval setting.
2257
2258         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
2259         (WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords const):
2260
2261 2019-03-20  Daniel Bates  <dabates@apple.com>
2262
2263         [iOS] Group UIWebFormAccessoryDelegate-related code and tighten it up a bit
2264         https://bugs.webkit.org/show_bug.cgi?id=196018
2265
2266         Reviewed by Wenson Hsieh.
2267
2268         * UIProcess/ios/WKContentViewInteraction.mm:
2269         (-[WKContentView accessoryClear]): Use uniform initializer syntax. Code could send the empty
2270         string, but I resisted since null string, as we do now, likely encodes more compactly and we
2271         avoid a per-process alloc.
2272         (-[WKContentView accessoryTab:]): Fix style nit; missing space between capture list and arguments
2273         in lambda. Also use lamdba capture initializer syntax and remove a local.
2274         (-[WKContentView _updateAccessory]): Remove a FIXME as it can't be satified with the current
2275         design without more bookkeeping. The design for showing and hiding an AutoFill button added in
2276         r166933 requires knowing the title for the button when showing it via -setAccessoryViewCustomButtonTitle.
2277         We could re-implement such that -setAccessoryViewCustomButtonTitle: stores the title and calls
2278         -_updateAccessory, but that has the disadvantage of increasing the memory footprint of WKContentView
2279         for the stored title and that seems worse than centralizing the logic in _updateAccessory. So,
2280         let's not fix this FIXME. Now that we are removing the FIXME, change to use an early return style.
2281         (-[WKContentView _hideKeyboard]): Micro optimization; only call _updateAccessory if we have
2282         a form accessory view. This method is called everytime we load a page (more precisely when we
2283         commit the load for a page) in addition to everytime we blur (defocus) an element. No need to
2284         update an accessory if we don't have one.
2285  
2286 2019-03-20  Olivier Robin  <olivierrobin@chromium.org>
2287
2288         Fix _getContentsAsAttributedStringWithCompletionHandler availability for iOS.
2289         https://bugs.webkit.org/show_bug.cgi?id=195999
2290
2291         Reviewed by Tim Horton.
2292
2293         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2294
2295 2019-03-20  Brent Fulgham  <bfulgham@apple.com>
2296
2297         Adopt RegistrableDomain in the Storage Access API prompt code paths
2298         https://bugs.webkit.org/show_bug.cgi?id=195957
2299         <rdar://problem/49048028>
2300
2301         Reviewed by Chris Dumez.
2302
2303         While making the code changes in Bug 195866 we noticed that strings were being
2304         used to pass the origins for the API calls. We should adopt the RegistrableDomain
2305         class to improve type safety and avoid introducing bugs in the future.
2306
2307         * UIProcess/API/APIUIClient.h:
2308         (API::UIClient::requestStorageAccessConfirm):
2309         * UIProcess/API/C/WKPage.cpp:
2310         (WKPageSetPageUIClient):
2311         * UIProcess/Cocoa/UIDelegate.h:
2312         * UIProcess/Cocoa/UIDelegate.mm:
2313         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
2314         * UIProcess/Cocoa/WKStorageAccessAlert.h:
2315         * UIProcess/Cocoa/WKStorageAccessAlert.mm:
2316         (WebKit::presentStorageAccessAlert):
2317         * UIProcess/WebPageProxy.cpp:
2318         (WebKit::WebPageProxy::requestStorageAccessConfirm):
2319
2320 2019-03-20  Chris Dumez  <cdumez@apple.com>
2321
2322         Unreviewed, fix typo in comment added in r243156.
2323
2324         * UIProcess/WebPageProxy.cpp:
2325         (WebKit::WebPageProxy::postMessageToInjectedBundle):
2326
2327 2019-03-20  Chris Dumez  <cdumez@apple.com>
2328
2329         Unreviewed, drop invalid assertions landed in r243163.
2330
2331         Those assertions were causing some API tests to crash.
2332         Also include some post-review suggestions from Darin.
2333
2334         * Shared/CallbackID.h:
2335         (WebKit::CallbackID::operator=):
2336         * Shared/OptionalCallbackID.h:
2337         (WebKit::OptionalCallbackID::operator=):
2338
2339 2019-03-20  Chris Dumez  <cdumez@apple.com>
2340
2341         Unreviewed, fix assertion failures in API tests after r243159.
2342
2343         * UIProcess/VisitedLinkStore.cpp:
2344         (WebKit::VisitedLinkStore::removeProcess):
2345
2346 2019-03-20  Tim Horton  <timothy_horton@apple.com>
2347
2348         Add an platform-driven spell-checking mechanism
2349         https://bugs.webkit.org/show_bug.cgi?id=195795
2350
2351         Reviewed by Ryosuke Niwa.
2352
2353         * DerivedSources-input.xcfilelist:
2354         * DerivedSources-output.xcfilelist:
2355         * DerivedSources.make:
2356         * SourcesCocoa.txt:
2357         * UIProcess/Cocoa/TextCheckingController.h: Added.
2358         * UIProcess/Cocoa/TextCheckingController.mm: Added.
2359         (WebKit::TextCheckingController::TextCheckingController):
2360         (WebKit::TextCheckingController::replaceRelativeToSelection):
2361         (WebKit::TextCheckingController::removeAnnotationRelativeToSelection):
2362         * UIProcess/ios/WKContentViewInteraction.h:
2363         * UIProcess/ios/WKContentViewInteraction.mm:
2364         (-[WKContentView setupInteraction]):
2365         (-[WKContentView replaceSelectionOffset:length:withAnnotatedString:relativeReplacementRange:]):
2366         (-[WKContentView removeAnnotation:forSelectionOffset:length:]):
2367         * WebKit.xcodeproj/project.pbxproj:
2368         * WebProcess/WebPage/WebPage.cpp:
2369         * WebProcess/WebPage/WebPage.h:
2370         (WebKit::WebPage::textCheckingController):
2371         Plumb two UITextInput methods through to the Web Content process.
2372         I added a new object instead of just sticking things on WebPage
2373         because there are quite a few more related ones coming down the pipeline,
2374         and will also end up being messages going in the opposite direction.
2375
2376         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h: Added.
2377         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.messages.in: Added.
2378         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm: Added.
2379         (WebKit::TextCheckingControllerProxy::TextCheckingControllerProxy):
2380         (WebKit::TextCheckingControllerProxy::~TextCheckingControllerProxy):
2381         (WebKit::relevantMarkerTypes):
2382         (WebKit::TextCheckingControllerProxy::rangeAndOffsetRelativeToSelection):
2383         (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection):
2384         (WebKit::TextCheckingControllerProxy::removeAnnotationRelativeToSelection):
2385         Make it possible for the platform to maintain arbitrary key-value pairs
2386         attached to document ranges, as a way for it to keep track of various
2387         text checking context (e.g. if something has been checked, replaced,
2388         what language it might be, ...).
2389
2390         Allow it to replace the text of a range and the annotations in that range,
2391         or remove annotations in a range. Ranges are specified relative to
2392         the selection.
2393
2394         One large missing piece is giving the platform the ability to retrieve
2395         annotations in a range; that is coming in a future patch.
2396
2397         We translate certain annotations into traditional WebCore spelling
2398         and grammar document markers, for normal display-time treatment.
2399
2400         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
2401         (-[WKAccessibilityWebPageObject convertScreenPointToRootView:]):
2402         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
2403         Unified sources fixes.
2404
2405 2019-03-19  Jiewen Tan  <jiewen_tan@apple.com>
2406
2407         [WebAuthN] Implement FIDO AppID extension
2408         https://bugs.webkit.org/show_bug.cgi?id=143491
2409         <rdar://problem/48298273>
2410
2411         Reviewed by Brent Fulgham.
2412
2413         In U2fHidAuthenticator::continueSignCommandAfterResponseReceived, it will retry the current command
2414         with the AppID if it exists when SW_WRONG_DATA is received from devices. Noted, it will not set
2415         the AuthenticationExtensionsClientOutputs::appid to false in any circumstances. In other words, the
2416         field will be empty if AppID is supplied in AuthenticationExtensionsClientInputs and not used.
2417
2418         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
2419         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
2420         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
2421         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp:
2422         (WebKit::U2fHidAuthenticator::issueSignCommand):
2423         (WebKit::U2fHidAuthenticator::continueSignCommandAfterResponseReceived):
2424         * UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h:
2425
2426 2019-03-19  Ross Kirsling  <ross.kirsling@sony.com>
2427
2428         Unreviewed adjustment to r242842 per Darin's request.
2429
2430         * Platform/win/LoggingWin.cpp:
2431         (WebKit::logLevelString):
2432
2433 2019-03-19  Gyuyoung Kim  <gyuyoung.kim@lge.com>
2434
2435         [WPE] Fix build warnings because of missing an argument when initializing wpe_input_axis_event
2436         https://bugs.webkit.org/show_bug.cgi?id=195931
2437
2438         Reviewed by Michael Catanzaro.
2439
2440         There are still build warnings when building wpe port. It looks like
2441         these build warnings have been caused by missing to set an argument
2442         for the modifier parameter of wpe_input_axis_event. This patch sets 0
2443         for the modifier argument to avoid the build warnings.
2444
2445         * UIProcess/API/wpe/ScrollGestureController.cpp:
2446         (WebKit::ScrollGestureController::handleEvent):
2447
2448 2019-03-19  John Wilander  <wilander@apple.com>
2449
2450         Resource Load Statistics (experimental): Clear non-cookie website data for sites that have been navigated to, with link decoration, by a prevalent resource
2451         https://bugs.webkit.org/show_bug.cgi?id=195923
2452         <rdar://problem/49001272>
2453
2454         Reviewed by Alex Christensen.
2455
2456         Cross-site trackers abuse link query parameters to transport user identifiers and then store
2457         them in first-party storage space. To address this, we've done three things:
2458         - r236448 capped all persistent client-side cookies to seven days of storage.
2459         - r242288 further capped persistent client-side cookies for navigations with link decoration from prevalent resources.
2460         - r242603 added logging of navigations with link decoration from prevalent resources.
2461
2462         This patch introduces an experimental feature that removes non-cookie website data for sites
2463         that have been navigated to, with link decoration, by a prevalent resource.
2464
2465         To achieve this, resource domains to remove website data for are now marked with an enum called
2466         WebsiteDataToRemove with values All, AllButHttpOnlyCookies, AllButCookies. As resources are
2467         iterated, they are marked for either of these values and the new function
2468         ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor() leads to the marking with
2469         WebsiteDataToRemove::AllButCookies.
2470
2471         Then NetworkProcess::deleteWebsiteDataForRegistrableDomains() looks at this setting and removes
2472         website data accordingly.
2473
2474         The thinking behind this is that the lifetime cap applied in r236448 and r242288 take care of
2475         script writable cookies, and this patch takes care of all other script writable storage.
2476
2477         The infrastructure to handle user interaction expiration is now parameterized so that multiple
2478         expiries can be applied. In this particular case, seven days of browser use.
2479
2480         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2481         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess):
2482         (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
2483         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction):
2484         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllWebsiteDataFor const):
2485         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllButCookiesFor const):
2486         (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor):
2487         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
2488         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2489         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUserInteraction):
2490         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUnexpiredRecentUserInteraction const):
2491         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllWebsiteDataFor const):
2492         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor const):
2493         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor):
2494         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
2495         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
2496         (WebKit::domainsToString):
2497         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
2498         (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const):
2499         (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates):
2500         (WebKit::ResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary):
2501         (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const):
2502         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
2503         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2504         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
2505         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomains):
2506         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
2507            Renamed to reflect that it actually takes a parameter for which types of data to remove.
2508         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2509         * NetworkProcess/NetworkProcess.cpp:
2510         (WebKit::NetworkProcess::initializeNetworkProcess):
2511         (WebKit::NetworkProcess::setCrossSiteLoadWithLinkDecorationForTesting):
2512         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
2513         (WebKit::NetworkProcess::deleteCookiesForTesting):
2514         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
2515            Renamed to reflect that it actually takes a parameter for which types of data to remove.
2516         * NetworkProcess/NetworkProcess.h:
2517         * NetworkProcess/NetworkProcess.messages.in:
2518         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2519         (WebKit::NetworkProcessCreationParameters::encode const):
2520         (WebKit::NetworkProcessCreationParameters::decode):
2521         * NetworkProcess/NetworkProcessCreationParameters.h:
2522         * NetworkProcess/NetworkSession.cpp:
2523         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomains):
2524         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomainsInAllPersistentDataStores): Deleted.
2525            Renamed to reflect that it actually takes a parameter for which types of data to remove.
2526         * NetworkProcess/NetworkSession.h:
2527         * Shared/WebPreferences.yaml:
2528         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2529         (WKWebsiteDataStoreSetStatisticsCrossSiteLoadWithLinkDecoration):
2530         (WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction):
2531         (WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords):
2532         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2533         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2534         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2535         * UIProcess/Network/NetworkProcessProxy.cpp:
2536         (WebKit::NetworkProcessProxy::setCrossSiteLoadWithLinkDecorationForTesting):
2537         * UIProcess/Network/NetworkProcessProxy.h:
2538         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2539         (WebKit::WebsiteDataStore::setCrossSiteLoadWithLinkDecorationForTesting):
2540         * UIProcess/WebsiteData/WebsiteDataStore.h:
2541
2542 2019-03-19  Chris Dumez  <cdumez@apple.com>
2543
2544         Unreviewed build fix after r243173.
2545
2546         * UIProcess/Cocoa/UIDelegate.mm:
2547         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
2548
2549 2019-03-19  Brent Fulgham  <bfulgham@apple.com>
2550
2551         Add default prompt implementation for the Storage Access API
2552         https://bugs.webkit.org/show_bug.cgi?id=195866
2553         <rdar://problem/45150009>
2554
2555         Reviewed by Chris Dumez.
2556
2557         This patch revises the UIDelegate implementation with a default permission dialog
2558         for the Storage Access API. This allows us to use and test the API in MiniBrowser,
2559         rather than requiring a full-fledged web browser to drive testing.
2560  
2561         * UIProcess/Cocoa/UIDelegate.h:
2562         * UIProcess/Cocoa/UIDelegate.mm:
2563         (WebKit::UIDelegate::UIClient::presentStorageAccessConfirmDialog): Added.
2564         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): Modify to call new default
2565         implementation if the WKWebVIew client doesn't implement the necessary SPI.
2566         * UIProcess/Cocoa/WKStorageAccessAlert.h: Added.
2567         * UIProcess/Cocoa/WKStorageAccessAlert.mm: Added.
2568         (WebKit::presentStorageAccessAlert):
2569         * WebKit.xcodeproj/project.pbxproj:
2570
2571 2019-03-19  Conrad Shultz  <conrad_shultz@apple.com>
2572
2573         REGRESSION (r242369): Only use picker-supported UTIs when creating image picker
2574         https://bugs.webkit.org/show_bug.cgi?id=195955
2575
2576         Reviewed by Chris Dumez and Wenson Hsieh.
2577
2578         r242369 started passing UTIs to -[UIImagePickerController setMediaTypes:] that correspond to types accepted by the
2579         file input element. However, UIImagePickerController expects a specific subset of UTIs. In the worst case, if no
2580         expected types are passed, this can cause a crash.
2581
2582         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2583         (UTIsForMIMETypes):
2584         Return a set rather than an array.
2585         (-[WKFileUploadPanel _mediaTypesForPickerSourceType:]):
2586         Rather than hardcode specific UTIs, ask UIImagePickerController for its available types. If an accepted type
2587         is in the list of available types, use it. Otherwise, if an accepted type conforms to an available type,
2588         use the available type. This is an O(n^2) process, but there typically are only a handful of types, so
2589         this seems acceptable.
2590         (-[WKFileUploadPanel _showDocumentPickerMenu]):
2591         Convert the set from UTIsForMIMETypes() to an array.
2592
2593 2019-03-19  Michael Catanzaro  <mcatanzaro@igalia.com>
2594
2595         Build cleanly with GCC 9
2596         https://bugs.webkit.org/show_bug.cgi?id=195920
2597
2598         Reviewed by Chris Dumez.
2599
2600         WebKit triggers three new GCC 9 warnings:
2601
2602         """
2603         -Wdeprecated-copy, implied by -Wextra, warns about the C++11 deprecation of implicitly
2604         declared copy constructor and assignment operator if one of them is user-provided.
2605         """
2606
2607         Solution is to either add a copy constructor or copy assignment operator, if required, or
2608         else remove one if it is redundant.
2609
2610         """
2611         -Wredundant-move, implied by -Wextra, warns about redundant calls to std::move.
2612         -Wpessimizing-move, implied by -Wall, warns when a call to std::move prevents copy elision.
2613         """
2614
2615         These account for most of this patch. Solution is to just remove the bad WTFMove().
2616
2617         Additionally, -Wclass-memaccess has been enhanced to catch a few cases that GCC 8 didn't.
2618         These are solved by casting nontrivial types to void* before using memcpy. (Of course, it
2619         would be safer to not use memcpy on nontrivial types, but that's too complex for this
2620         patch. Searching for memcpy used with static_cast<void*> will reveal other cases to fix.)
2621
2622         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
2623         (WebKit::CacheStorage::Cache::decode):
2624         * Platform/IPC/ArgumentCoders.h:
2625         * Shared/CallbackID.h:
2626         (WebKit::CallbackID::operator=):
2627         * Shared/OptionalCallbackID.h:
2628         (WebKit::OptionalCallbackID::operator=):
2629         * Shared/Plugins/NPIdentifierData.cpp:
2630         (WebKit::NPIdentifierData::decode):
2631         * Shared/Plugins/NPVariantData.cpp:
2632         (WebKit::NPVariantData::decode):
2633         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
2634         (WebKit::NetscapePluginModule::getOrCreate):
2635         * Shared/RTCNetwork.cpp:
2636         (WebKit::RTCNetwork::IPAddress::decode):
2637         * Shared/SessionState.cpp:
2638         (WebKit::HTTPBody::Element::decode):
2639         (WebKit::FrameState::decode):
2640         (WebKit::BackForwardListItemState::decode):
2641         * Shared/WebCompiledContentRuleListData.cpp:
2642         (WebKit::WebCompiledContentRuleListData::decode):
2643         * Shared/WebCoreArgumentCoders.cpp:
2644         (IPC::ArgumentCoder<FloatPoint>::decode):
2645         (IPC::ArgumentCoder<FloatRect>::decode):
2646         (IPC::ArgumentCoder<FloatQuad>::decode):
2647         (IPC::ArgumentCoder<ViewportArguments>::decode):
2648         (IPC::ArgumentCoder<IntPoint>::decode):
2649         (IPC::ArgumentCoder<IntRect>::decode):
2650         (IPC::ArgumentCoder<IntSize>::decode):
2651         (IPC::ArgumentCoder<MimeClassInfo>::decode):
2652         (IPC::ArgumentCoder<PluginInfo>::decode):
2653         (IPC::ArgumentCoder<SelectionRect>::decode):
2654         (IPC::ArgumentCoder<CompositionUnderline>::decode):
2655         (IPC::ArgumentCoder<BlobPart>::decode):
2656         (IPC::ArgumentCoder<TextIndicatorData>::decode):
2657         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
2658         (IPC::ArgumentCoder<ScrollOffsetRange<float>>::decode):
2659         * Shared/WebPageCreationParameters.cpp:
2660         (WebKit::WebPageCreationParameters::decode):
2661         * Shared/WebPlatformTouchPoint.cpp:
2662         (WebKit::WebPlatformTouchPoint::decode):
2663         * Shared/WebsiteData/WebsiteData.cpp:
2664         (WebKit::WebsiteData::Entry::decode):
2665         * Shared/WebsiteDataStoreParameters.cpp:
2666         (WebKit::WebsiteDataStoreParameters::decode):
2667         * UIProcess/API/APIContentRuleListStore.cpp:
2668         (API::decodeContentRuleListMetaData):
2669         * UIProcess/WebPageProxy.cpp:
2670         (WebKit::WebPageProxy::launchProcessForReload):
2671         (WebKit::WebPageProxy::launchProcessWithItem):
2672         (WebKit::WebPageProxy::loadRequest):
2673         (WebKit::WebPageProxy::loadFile):
2674         (WebKit::WebPageProxy::loadData):
2675         (WebKit::WebPageProxy::reload):
2676         * UIProcess/WebProcessCache.cpp:
2677         (WebKit::WebProcessCache::takeProcess):
2678         * UIProcess/WebProcessPool.cpp:
2679         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
2680         * WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp:
2681         (WebKit::InjectedBundleCSSStyleDeclarationHandle::getOrCreate):
2682         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
2683         (WebKit::InjectedBundleRangeHandle::getOrCreate):
2684         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2685         (WebKit::InjectedBundle::create):
2686         * WebProcess/Network/WebLoaderStrategy.cpp:
2687         (WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
2688         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2689         (WebKit::CompositingCoordinator::createGraphicsLayer):
2690         * WebProcess/WebPage/WebPage.cpp:
2691         (WebKit::WebPage::pdfSnapshotAtSize):
2692         (WebKit::WebPage::createDocumentLoader):
2693         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
2694         (WebKit::StorageNamespaceImpl::copy):
2695
2696 2019-03-19  Chris Dumez  <cdumez@apple.com>
2697
2698         Spew: Unhandled web process message 'VisitedLinkTableController:VisitedLinkStateChanged'
2699         https://bugs.webkit.org/show_bug.cgi?id=194787
2700         <rdar://problem/48175520>
2701
2702         Reviewed by Geoff Garen.
2703
2704         The unhandled 'VisitedLinkTableController:VisitedLinkStateChanged' message logging happens
2705         when IPC is sent to a WebProcess which does not have a VisitedLinkTableController with the
2706         given identifier. VisitedLinkTableController are kept alive by the WebPage in the WebProcess
2707         side so this indicates that there is no WebPage using this VisitedLinkTableController anymore.
2708
2709         In the UIProcess side, our tracking of who is using which VisitedLinkStore was very poor.
2710         WebPageProxy objects would ask their process to register itself with the page's visitedLinkStore
2711         as soon as the WebPage object has been created on the WebProcess side. This part was fine.
2712         However, unregistration from the visitedLinkStores would only happen when either the
2713         visitedLinkStore would get destroyed or when the WebProcess would shutdown. This means that
2714         WebProcess could stay registered with a visitedLinkStore even after the page that was using it
2715         has been closed, which would lead to such logging.
2716
2717         To address the issue, the WebProcessProxy now keeps track for which pages are using which
2718         visitedLinkStore. When a visitedLinkStore is used by a page for the first time, the
2719         WebProcessProxy will register itself with the visitedLinkStore. Similarly, when the last page
2720         using a given visitedLinkStore is closed, the process unregisters itself from the
2721         visitedLinkStore, thus avoiding the bug.
2722
2723         I also simplified a lot the logic for having a page telling the WebProcessProxy it started
2724         using a visitedLinkStore. Previously, it would have to wait until the process is done launching
2725         before notifying the WebProcessProxy. Now, the WebPageProxy merely tells the WebProcessProxy
2726         that it is starting to use a visitedLinkStore as soon as it sent the CreateWebPage IPC to the
2727         WebProcess (no matter if the process is still launching or not). At this point, the
2728         WebProcessProxy registers the page as a user of the visitedLinkStore and takes care of waiting
2729         until it is done launching before registering itself with the visitedLinkStore.
2730
2731         * UIProcess/ProvisionalPageProxy.cpp:
2732         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
2733         (WebKit::ProvisionalPageProxy::initializeWebPage):
2734         (WebKit::ProvisionalPageProxy::processDidFinishLaunching): Deleted.
2735         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
2736         * UIProcess/ProvisionalPageProxy.h:
2737         * UIProcess/VisitedLinkStore.cpp:
2738         (WebKit::VisitedLinkStore::~VisitedLinkStore):
2739         (WebKit::VisitedLinkStore::addProcess):
2740         * UIProcess/WebPageProxy.cpp:
2741         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2742         (WebKit::WebPageProxy::initializeWebPage):
2743         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2744         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
2745         (WebKit::WebPageProxy::processDidFinishLaunching): Deleted.
2746         * UIProcess/WebPageProxy.h:
2747         * UIProcess/WebProcessProxy.cpp:
2748         (WebKit::WebProcessProxy::shutDown):
2749         (WebKit::WebProcessProxy::removeWebPage):
2750         (WebKit::WebProcessProxy::addVisitedLinkStoreUser):
2751         (WebKit::WebProcessProxy::removeVisitedLinkStoreUser):
2752         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
2753         (WebKit::WebProcessProxy::didFinishLaunching):
2754         (WebKit::WebProcessProxy::addVisitedLinkStore): Deleted.
2755         (WebKit::WebProcessProxy::didDestroyVisitedLinkStore): Deleted.
2756         * UIProcess/WebProcessProxy.h:
2757
2758 2019-03-19  Chris Dumez  <cdumez@apple.com>
2759
2760         REGRESSION (r243094): internal media test fairplay-hls-error.html is failing
2761         https://bugs.webkit.org/show_bug.cgi?id=195954
2762         <rdar://problem/49005981>
2763
2764         Reviewed by Geoffrey Garen.
2765
2766         TestController::resetStateToConsistentValues() tries to send a "reset" message to its
2767         injected bundle. Part of the "reset" message sets the external hosts that we're allowed
2768         to load. If there is no WebProcess yet when WKPagePostMessageToInjectedBundle() is called,
2769         then this message does not get sent and the allowed hosts do not get set, causing this
2770         test failure.
2771
2772         To address the issue, make sure we launch the initial process if necessary when
2773         WebPageProxy::postMessageToInjectedBundle() is called, in order to maintain backward
2774         compatibility.
2775
2776         * UIProcess/WebPageProxy.cpp:
2777         (WebKit::WebPageProxy::postMessageToInjectedBundle):
2778
2779 2019-03-19  Chris Dumez  <cdumez@apple.com>
2780
2781         Unreviewed, rolling out r243142.
2782
2783         Caused assertion hits in WK2 Debug
2784
2785         Reverted changeset:
2786
2787         "Spew: Unhandled web process message
2788         'VisitedLinkTableController:VisitedLinkStateChanged'"
2789         https://bugs.webkit.org/show_bug.cgi?id=194787
2790         https://trac.webkit.org/changeset/243142
2791
2792 2019-03-19  Daniel Bates  <dabates@apple.com>
2793
2794         [iOS] Focus not preserved when switching between tabs
2795         https://bugs.webkit.org/show_bug.cgi?id=195820
2796         <rdar://problem/43614450>
2797
2798         Reviewed by Brent Fulgham.
2799
2800         Fixes a usability annoyance when using a hardware keyboard; focus is not preserved when switching between tabs.
2801         Do not unconditionally tell the WebProcess to blur the currently focused element when the content view (WKContentView)
2802         resigns first responder. Instead only tell it to blur when the content view is resigning because either the
2803         accessory view was dismissed (Done button was pressed) or the keyboard was dismissed (the hide keyboard button
2804         was pressed).
2805
2806         * UIProcess/ios/WKContentViewInteraction.h:
2807         * UIProcess/ios/WKContentViewInteraction.mm: Add new ivar to track whether the content view is resigning
2808         first responder status because the accessory view is being dismissed.
2809         (-[WKContentView resignFirstResponderForWebView]): Only tell WebKit to blur the focused element if we are
2810         resigning because the accessory view is being dismissed or the keyboard was hidden. We continue to do all
2811         other steps when resigning, including hiding the keyboard. Note that by not telling WebKit to blur the
2812         focused element we let it's focus controller manage the focused element with respect to the current
2813         page activation state (i.e. whether the content view is first responder or not). When the content view
2814         becomes the first responder then WebKit's focus controller will be told that the page has become activated
2815         and will tell the UIProcess to focus the currently focused element, which will bring up the keyboard.
2816         (-[WKContentView accessoryDone]): Update state so we know that a subsequent call to resign first responder
2817         was due to the accessory view being dismissed.
2818
2819 2019-03-19  Per Arne Vollan  <pvollan@apple.com>
2820
2821         [iOS] Remove overridden rules in sandbox
2822         https://bugs.webkit.org/show_bug.cgi?id=193840
2823         <rdar://problem/47558526>
2824
2825         Reviewed by Brent Fulgham.
2826
2827         On iOS, there are some rules overridden in the same sandbox file. The overridden rules
2828         should be removed.
2829
2830         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2831
2832 2019-03-19  Timothy Hatcher  <timothy@apple.com>
2833
2834         Make WebKit/NSAttributedString.h a public header.
2835         https://bugs.webkit.org/show_bug.cgi?id=195944
2836
2837         Reviewed by Dean Jackson.
2838
2839         * WebKit.xcodeproj/project.pbxproj:
2840
2841 2019-03-19  Chris Dumez  <cdumez@apple.com>
2842
2843         Drop NetworkCacheStatistics code
2844         https://bugs.webkit.org/show_bug.cgi?id=195910
2845
2846         Reviewed by Antti Koivisto.
2847
2848         Drop NetworkCacheStatistics code. It was a temporary experiment and has not been used in a long time.
2849
2850         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2851         (WebKit::NetworkProcessCreationParameters::encode const):
2852         (WebKit::NetworkProcessCreationParameters::decode):
2853         * NetworkProcess/NetworkProcessCreationParameters.h:
2854         * NetworkProcess/cache/NetworkCache.cpp:
2855         (WebKit::NetworkCache::Cache::Cache):
2856         (WebKit::NetworkCache::Cache::retrieve):
2857         (WebKit::NetworkCache::Cache::store):
2858         (WebKit::NetworkCache::Cache::storeRedirect):
2859         (WebKit::NetworkCache::Cache::update):
2860         (WebKit::NetworkCache::Cache::clear):
2861         * NetworkProcess/cache/NetworkCache.h:
2862         * NetworkProcess/cache/NetworkCacheStatistics.cpp: Removed.
2863         * NetworkProcess/cache/NetworkCacheStatistics.h: Removed.
2864         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2865         (WebKit::NetworkCache::traverseRecordsFiles):
2866         * NetworkProcess/cache/NetworkCacheStorage.h:
2867         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2868         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2869         * NetworkProcess/soup/NetworkProcessSoup.cpp:
2870         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
2871         * Sources.txt:
2872         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2873         (WebKit::registerUserDefaultsIfNeeded):
2874         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2875         * UIProcess/soup/WebProcessPoolSoup.cpp:
2876         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2877         * WebKit.xcodeproj/project.pbxproj:
2878
2879 2019-03-19  Chris Dumez  <cdumez@apple.com>
2880
2881         Spew: Unhandled web process message 'VisitedLinkTableController:VisitedLinkStateChanged'
2882         https://bugs.webkit.org/show_bug.cgi?id=194787
2883         <rdar://problem/48175520>
2884
2885         Reviewed by Geoffrey Garen.
2886
2887         The unhandled 'VisitedLinkTableController:VisitedLinkStateChanged' message logging happens
2888         when IPC is sent to a WebProcess which does not have a VisitedLinkTableController with the
2889         given identifier. VisitedLinkTableController are kept alive by the WebPage in the WebProcess
2890         side so this indicates that there is no WebPage using this VisitedLinkTableController anymore.
2891
2892         In the UIProcess side, our tracking of who is using which VisitedLinkStore was very poor.
2893         WebPageProxy objects would ask their process to register itself with the page's visitedLinkStore
2894         as soon as the WebPage object has been created on the WebProcess side. This part was fine.
2895         However, unregistration from the visitedLinkStores would only happen when either the
2896         visitedLinkStore would get destroyed or when the WebProcess would shutdown. This means that
2897         WebProcess could stay registered with a visitedLinkStore even after the page that was using it
2898         has been closed, which would lead to such logging.
2899
2900         To address the issue, the WebProcessProxy now keeps track for which pages are using which
2901         visitedLinkStore. When a visitedLinkStore is used by a page for the first time, the
2902         WebProcessProxy will register itself with the visitedLinkStore. Similarly, when the last page
2903         using a given visitedLinkStore is closed, the process unregisters itself from the
2904         visitedLinkStore, thus avoiding the bug.
2905
2906         I also simplified a lot the logic for having a page telling the WebProcessProxy it started
2907         using a visitedLinkStore. Previously, it would have to wait until the process is done launching
2908         before notifying the WebProcessProxy. Now, the WebPageProxy merely tells the WebProcessProxy
2909         that it is starting to use a visitedLinkStore as soon as it sent the CreateWebPage IPC to the
2910         WebProcess (no matter if the process is still launching or not). At this point, the
2911         WebProcessProxy registers the page as a user of the visitedLinkStore and takes care of waiting
2912         until it is done launching before registering itself with the visitedLinkStore.
2913
2914         * UIProcess/ProvisionalPageProxy.cpp:
2915         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
2916         (WebKit::ProvisionalPageProxy::initializeWebPage):
2917         (WebKit::ProvisionalPageProxy::processDidFinishLaunching): Deleted.
2918         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
2919         * UIProcess/ProvisionalPageProxy.h:
2920         * UIProcess/VisitedLinkStore.cpp:
2921         (WebKit::VisitedLinkStore::~VisitedLinkStore):
2922         (WebKit::VisitedLinkStore::addProcess):
2923         * UIProcess/WebPageProxy.cpp:
2924         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2925         (WebKit::WebPageProxy::initializeWebPage):
2926         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2927         (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch): Deleted.
2928         (WebKit::WebPageProxy::processDidFinishLaunching): Deleted.
2929         * UIProcess/WebPageProxy.h:
2930         * UIProcess/WebProcessProxy.cpp:
2931         (WebKit::WebProcessProxy::shutDown):
2932         (WebKit::WebProcessProxy::removeWebPage):
2933         (WebKit::WebProcessProxy::addVisitedLinkStoreUser):
2934         (WebKit::WebProcessProxy::removeVisitedLinkStoreUser):
2935         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
2936         (WebKit::WebProcessProxy::didFinishLaunching):
2937         (WebKit::WebProcessProxy::addVisitedLinkStore): Deleted.
2938         (WebKit::WebProcessProxy::didDestroyVisitedLinkStore): Deleted.
2939         * UIProcess/WebProcessProxy.h:
2940
2941 2019-03-19  Alex Christensen  <achristensen@webkit.org>
2942
2943         Make WTFLogChannelState and WTFLogLevel enum classes
2944         https://bugs.webkit.org/show_bug.cgi?id=195904
2945
2946         Reviewed by Eric Carlson.
2947
2948         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2949         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
2950         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
2951         (WebKit::NetworkRTCProvider::NetworkRTCProvider):
2952
2953 2019-03-19  Michael Catanzaro  <mcatanzaro@igalia.com>
2954
2955         Unreviewed, rolling out r243132.
2956
2957         Broke GTK build
2958
2959         Reverted changeset:
2960
2961         "Make WTFLogChannelState and WTFLogLevel enum classes"
2962         https://bugs.webkit.org/show_bug.cgi?id=195904
2963         https://trac.webkit.org/changeset/243132
2964
2965 2019-03-19  Antti Koivisto  <antti@apple.com>
2966
2967         Layer with no backing store should still hit-test over a scroller
2968         https://bugs.webkit.org/show_bug.cgi?id=195378
2969         <rdar://problem/48652078>
2970
2971         Reviewed by Simon Fraser.
2972
2973         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
2974         (WebKit::RemoteLayerTreeHost::makeNode):
2975         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
2976         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
2977         (WebKit::collectDescendantViewsAtPoint):
2978
2979         No need for special WKTiledBackingView, tiled views now have correct event regions.
2980
2981 2019-03-18  Alex Christensen  <achristensen@webkit.org>
2982
2983         Make WTFLogChannelState and WTFLogLevel enum classes
2984         https://bugs.webkit.org/show_bug.cgi?id=195904
2985
2986         Reviewed by Eric Carlson.
2987
2988         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
2989         (WebKit::NetworkCache::logSpeculativeLoadingDiagnosticMessage):
2990         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
2991         (WebKit::NetworkRTCProvider::NetworkRTCProvider):
2992
2993 2019-03-18  Commit Queue  <commit-queue@webkit.org>
2994
2995         Unreviewed, rolling out r243092 and r243096.
2996         https://bugs.webkit.org/show_bug.cgi?id=195926
2997
2998         Caused assertions in tests (Requested by smfr on #webkit).
2999
3000         Reverted changesets:
3001
3002         "Layer with no backing store should still hit-test over a
3003         scroller"
3004         https://bugs.webkit.org/show_bug.cgi?id=195378
3005         https://trac.webkit.org/changeset/243092
3006
3007         "Try to fix Windows build."
3008         https://trac.webkit.org/changeset/243096
3009
3010 2019-03-18  Timothy Hatcher  <timothy@apple.com>
3011
3012         WKWebView.GetContentsShouldReturnAttributedString is crashing on iOS Simulator.
3013         https://bugs.webkit.org/show_bug.cgi?id=195916
3014
3015         Reviewed by Tim Horton.
3016
3017         Add direct support for UIColor so it does not try to use the NSSecureCoding path.
3018         This avoids needs to list the classes when decoding the attributes NSDictionary
3019         and matches the macOS NSColor encoder/decoder.
3020
3021         * Shared/Cocoa/ArgumentCodersCocoa.mm:
3022         (IPC::typeFromObject):
3023         (IPC::encodeColorInternal):
3024         (IPC::decodeColorInternal):
3025         (IPC::encodeObject):
3026         (IPC::decodeObject):
3027
3028 2019-03-18  Timothy Hatcher  <timothy@apple.com>
3029
3030         Add new NSAttributedString API for converting HTML.
3031         https://bugs.webkit.org/show_bug.cgi?id=195636
3032         rdar://problem/45055697
3033
3034         Reviewed by Tim Horton.
3035
3036         * Platform/spi/ios/UIKitSPI.h:
3037         * SourcesCocoa.txt:
3038         * UIProcess/API/Cocoa/NSAttributedString.h: Added.
3039         * UIProcess/API/Cocoa/NSAttributedString.mm: Added.
3040         (-[_WKAttributedStringNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
3041         (-[_WKAttributedStringNavigationDelegate webView:didFailProvisionalNavigation:withError:]):
3042         (-[_WKAttributedStringNavigationDelegate webView:didFailNavigation:withError:]):
3043         (-[_WKAttributedStringNavigationDelegate webView:didFinishNavigation:]):
3044         (+[_WKAttributedStringWebViewCache cache]):
3045         (+[_WKAttributedStringWebViewCache configuration]):
3046         (+[_WKAttributedStringWebViewCache clearConfiguration]):
3047         (+[_WKAttributedStringWebViewCache retrieveOrCreateWebView]):
3048         (+[_WKAttributedStringWebViewCache cacheWebView:]):
3049         (+[_WKAttributedStringWebViewCache resetPurgeDelay]):
3050         (+[_WKAttributedStringWebViewCache purgeSingleWebView]):
3051         (+[_WKAttributedStringWebViewCache purgeAllWebViews]):
3052         (+[NSAttributedString _loadFromHTMLWithOptions:contentLoader:completionHandler:]):
3053         (+[NSAttributedString loadFromHTMLWithRequest:options:completionHandler:]):
3054         (+[NSAttributedString loadFromHTMLWithFileURL:options:completionHandler:]):
3055         (+[NSAttributedString loadFromHTMLWithString:options:completionHandler:]):
3056         (+[NSAttributedString loadFromHTMLWithData:options:completionHandler:]):
3057         * UIProcess/API/Cocoa/NSAttributedStringPrivate.h: Copied from Source/WebKit/UIProcess/API/Cocoa/WKErrorInternal.h.
3058         * UIProcess/API/Cocoa/WKError.h:
3059         * UIProcess/API/Cocoa/WKError.mm:
3060         (localizedDescriptionForErrorCode):
3061         (createNSError):
3062         * UIProcess/API/Cocoa/WKErrorInternal.h:
3063         * WebKit.xcodeproj/project.pbxproj:
3064         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
3065         (WebKit::WebPage::getContentsAsAttributedString):
3066
3067 2019-03-18  Alex Christensen  <achristensen@webkit.org>
3068
3069         Implement DownloadMonitor to prevent long-running slow downloads from background apps
3070         https://bugs.webkit.org/show_bug.cgi?id=195785
3071
3072         Reviewed by Geoffrey Garen.
3073
3074         This is similar to what was updated in <rdar://problem/42677685> but for WebKit Downloads.
3075         To test it I implemented a throttled TCP server, SPI to speed up DownloadMonitor's timer,
3076         and SPI to synthesize the application going into the background and foreground, which
3077         NSNotificationCenter does on iOS.
3078
3079         * NetworkProcess/Downloads/Download.cpp:
3080         (WebKit::Download::didReceiveData):
3081         (WebKit::Download::didFinish):
3082         (WebKit::Download::didFail):
3083         (WebKit::Download::didCancel):
3084         * NetworkProcess/Downloads/Download.h:
3085         (WebKit::Download::applicationEnteredBackground):
3086         (WebKit::Download::applicationEnteredForeground):
3087         (WebKit::Download::manager const):
3088         * NetworkProcess/Downloads/DownloadManager.cpp:
3089         (WebKit::DownloadManager::downloadFinished):
3090         (WebKit::DownloadManager::applicationDidEnterBackground):
3091         (WebKit::DownloadManager::applicationWillEnterForeground):
3092         * NetworkProcess/Downloads/DownloadManager.h:
3093         * NetworkProcess/Downloads/DownloadMap.cpp:
3094         (WebKit::DownloadMap::values):
3095         * NetworkProcess/Downloads/DownloadMap.h:
3096         * NetworkProcess/Downloads/DownloadMonitor.cpp: Added.
3097         (WebKit::operator _kbps):
3098         (WebKit::timeUntilNextInterval):
3099         (WebKit::DownloadMonitor::DownloadMonitor):
3100         (WebKit::DownloadMonitor::measuredThroughputRate const):
3101         (WebKit::DownloadMonitor::downloadReceivedBytes):
3102         (WebKit::DownloadMonitor::applicationEnteredForeground):
3103         (WebKit::DownloadMonitor::applicationEnteredBackground):
3104         (WebKit::DownloadMonitor::speedMultiplier const):
3105         (WebKit::DownloadMonitor::timerFired):
3106         * NetworkProcess/Downloads/DownloadMonitor.h: Added.
3107         * NetworkProcess/NetworkProcess.cpp:
3108         (WebKit::NetworkProcess::initializeNetworkProcess):
3109         (WebKit::NetworkProcess::applicationDidEnterBackground):
3110         (WebKit::NetworkProcess::applicationWillEnterForeground):
3111         * NetworkProcess/NetworkProcess.h:
3112         * NetworkProcess/NetworkProcess.messages.in:
3113         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3114         (WebKit::NetworkProcessCreationParameters::encode const):
3115         (WebKit::NetworkProcessCreationParameters::decode):
3116         * NetworkProcess/NetworkProcessCreationParameters.h:
3117         * Sources.txt:
3118         * SourcesCocoa.txt:
3119         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3120         (API::ProcessPoolConfiguration::copy):
3121         * UIProcess/API/APIProcessPoolConfiguration.h:
3122         * UIProcess/API/C/WKContext.cpp:
3123         (WKContextDownloadURLRequest):
3124         (WKContextResumeDownload):
3125         * UIProcess/API/Cocoa/WKProcessPool.mm:
3126         (-[WKProcessPool _synthesizeAppIsBackground:]):
3127         (-[WKProcessPool _downloadURLRequest:originatingWebView:]):
3128         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3129         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3130         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3131         (-[_WKProcessPoolConfiguration downloadMonitorSpeedMultiplier]):
3132         (-[_WKProcessPoolConfiguration setDownloadMonitorSpeedMultiplier:]):
3133         * UIProcess/Cocoa/DownloadProxyMapCocoa.mm: Added.
3134         (WebKit::DownloadProxyMap::platformCreate):
3135         (WebKit::DownloadProxyMap::platformDestroy):
3136         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3137         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3138         * UIProcess/Downloads/DownloadProxy.cpp:
3139         (WebKit::DownloadProxy::didFinish):
3140         (WebKit::DownloadProxy::didFail):
3141         (WebKit::DownloadProxy::didCancel):
3142         * UIProcess/Downloads/DownloadProxyMap.cpp:
3143         (WebKit::DownloadProxyMap::DownloadProxyMap):
3144         (WebKit::DownloadProxyMap::~DownloadProxyMap):
3145         (WebKit::DownloadProxyMap::platformCreate):
3146         (WebKit::DownloadProxyMap::platformDestroy):
3147         (WebKit::DownloadProxyMap::applicationDidEnterBackground):
3148         (WebKit::DownloadProxyMap::applicationWillEnterForeground):
3149         (WebKit::DownloadProxyMap::createDownloadProxy):
3150         (WebKit::DownloadProxyMap::downloadFinished):
3151         * UIProcess/Downloads/DownloadProxyMap.h:
3152         * UIProcess/Network/NetworkProcessProxy.cpp:
3153         (WebKit::NetworkProcessProxy::synthesizeAppIsBackground):
3154         (WebKit::NetworkProcessProxy::createDownloadProxy):
3155         * UIProcess/Network/NetworkProcessProxy.h:
3156         * UIProcess/PageClient.h:
3157         * UIProcess/WebPageProxy.cpp:
3158         (WebKit::WebPageProxy::receivedPolicyDecision):
3159         (WebKit::WebPageProxy::handleDownloadRequest):
3160         * UIProcess/WebPageProxy.h:
3161         * UIProcess/WebProcessPool.cpp:
3162         (WebKit::WebProcessPool::download):
3163         (WebKit::WebProcessPool::resumeDownload):
3164         (WebKit::WebProcessPool::createDownloadProxy):
3165         (WebKit::WebProcessPool::synthesizeAppIsBackground):
3166         * UIProcess/WebProcessPool.h:
3167         * UIProcess/ios/PageClientImplIOS.h:
3168         * UIProcess/ios/PageClientImplIOS.mm:
3169         (WebKit::PageClientImpl::handleDownloadRequest):
3170         * UIProcess/mac/PageClientImplMac.h:
3171         * UIProcess/mac/PageClientImplMac.mm:
3172         (WebKit::PageClientImpl::handleDownloadRequest):
3173         * WebKit.xcodeproj/project.pbxproj:
3174
3175 2019-03-18  Wenson Hsieh  <wenson_hsieh@apple.com>
3176
3177         [iOS] Native selection views sometimes appear in hidden editable areas after losing focus
3178         https://bugs.webkit.org/show_bug.cgi?id=195894
3179         <rdar://problem/48849989>
3180
3181         Reviewed by Tim Horton.
3182
3183         On certain websites, focus is moved away from an editable element while maintaining a selection inside the
3184         editable element. In the case where the editable element is hidden, this currently breaks our text interaction
3185         suppression heuristics, which suppress text selection gestures and overlays inside focused hidden editable
3186         elements. To fix this, we refactor our text interaction suppression heuristics, such that they are not dependent
3187         on an editable element being focused. See changes below for more details.
3188
3189         Test: editing/selection/ios/hide-selection-in-non-focused-element.html
3190
3191         * Shared/EditorState.cpp:
3192         (WebKit::EditorState::PostLayoutData::encode const):
3193         (WebKit::EditorState::PostLayoutData::decode):
3194         * Shared/EditorState.h:
3195
3196         Rename elementIsTransparentOrFullyClipped to editableRootIsTransparentOrFullyClipped, and additionally compute
3197         this flag by checking whether the root editable element containing the selection is transparent or clipped,
3198         instead of using the currently focused element.
3199
3200         * Shared/FocusedElementInformation.cpp:
3201         (WebKit::FocusedElementInformation::encode const):
3202         (WebKit::FocusedElementInformation::decode):
3203         * Shared/FocusedElementInformation.h:
3204
3205         Remove the elementIsTransparentOrFullyClipped flag from FocusedElementInformation (see below for more detail).
3206
3207         * UIProcess/ios/WKContentViewInteraction.h:
3208
3209         Rename FocusedElementIsTransparentOrFullyClipped to EditableRootIsTransparentOrFullyClipped.
3210
3211         * UIProcess/ios/WKContentViewInteraction.mm:
3212         (-[WKContentView _zoomToRevealFocusedElement]):
3213         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3214
3215         Remove logic that currently uses state on FocusedElementInformation to determine whether to suppress platform
3216         text interactions; instead, only use EditorState to make this determination. This logic was originally added in
3217         the initial implementation of the text interaction suppression heuristic as a way to begin suppressing text
3218         selection state before zooming to reveal the focused element; however, since we now zoom to reveal the text
3219         selection when focusing editable elements, zooming is deferred until the next complete EditorState update
3220         arrives in the UI process so we don't need to worry about beginning to suppress text interactions prior to this
3221         initial editor state update.
3222
3223         (-[WKContentView _elementDidBlur]):
3224         (-[WKContentView _updateSelectionAssistantSuppressionState]):
3225
3226         Add a helper method that updates text selection suppression state using the current EditorState.
3227
3228         (-[WKContentView _selectionChanged]):
3229         (-[WKContentView _updateChangedSelection:]):
3230
3231         Always update text suppression state when receiving an EditorState, instead of only doing so when processing a
3232         text selection gesture.
3233
3234         (-[WKContentView _startSuppressingSelectionAssistantForReason:]):
3235
3236         Renamed from _beginSuppressingSelectionAssistantForReason:, to better match "start/end" terminology of
3237         _endSuppressingSelectionAssistantForReason:.
3238
3239         (-[WKContentView dropInteraction:performDrop:]):
3240         (-[WKContentView _beginSuppressingSelectionAssistantForReason:]): Deleted.
3241         * UIProcess/ios/WebPageProxyIOS.mm:
3242         (WebKit::WebPageProxy::editorStateChanged):
3243
3244         Ensure that we run logic to zoom to the focused element *after* updating text selection suppression state, so we
3245         don't erroneously zoom to reveal hidden editable elements.
3246
3247         * WebProcess/WebPage/ios/WebPageIOS.mm:
3248         (WebKit::WebPage::platformEditorState const):
3249         (WebKit::WebPage::getFocusedElementInformation):
3250
3251 2019-03-18  Chris Dumez  <cdumez@apple.com>
3252
3253         Delay WebProcess launch until a load is triggered in a Web view
3254         https://bugs.webkit.org/show_bug.cgi?id=195758
3255         <rdar://problem/48126013>
3256
3257         Reviewed by Geoff Garen.
3258
3259         This is achieved by constructing WebPageProxy objects with a WebProcessProxy that is in
3260         terminated state (because it never launched its process). This is convenient because
3261         it is a state that the WebPageProxy supports, which normally happened by the WebProcess
3262         crashes. When trying to do a load, we were already checking if the WebPageProxy's process
3263         was running (via an isValid() check) and we would re-launch the WebProcess if necessary
3264         by calling reattachToWebProcess(). For clarity, given that this state is no longer
3265         indicating that the WebProcess crashed, I renamed isValid() to hasRunningProcess() and
3266         reattachToWebProcess() to launchProcess().
3267
3268         The reason delaying the WebProcess launch until the first load is useful is because it
3269         allows us to leverage the WebProcessCache given that we now know which registrable
3270         domain is going to be loaded in the process.
3271
3272         This is a progression from a power usage standpoint. When it comes to page load time,
3273         it would be a progression if we found a suitable process in the cache. I do not expect
3274         a performance hit when no process is found in the cache because of process prewarming.
3275
3276         * Shared/API/Cocoa/RemoteObjectRegistry.h:
3277         * Shared/API/Cocoa/RemoteObjectRegistry.mm:
3278         (WebKit::m_launchInitialProcessIfNecessary):
3279         (WebKit::RemoteObjectRegistry::sendInvocation):
3280         * UIProcess/API/Cocoa/WKProcessPool.mm:
3281         (-[WKProcessPool _processCacheSize]):
3282         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3283         * UIProcess/API/Cocoa/WKWebView.mm:
3284         (-[WKWebView _isValid]):
3285         * UIProcess/Automation/WebAutomationSession.cpp:
3286         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
3287         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3288         (WebKit::WebPageProxy::performDictionaryLookupAtLocation):
3289         (WebKit::WebPageProxy::performDictionaryLookupOfCurrentSelection):
3290         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
3291         (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState):
3292         (WebKit::DrawingAreaProxyCoordinatedGraphics::waitForAndDispatchDidUpdateBackingStoreState):
3293         (WebKit::DrawingAreaProxyCoordinatedGraphics::dispatchAfterEnsuringDrawing):
3294         * UIProcess/DrawingAreaProxy.cpp:
3295         (WebKit::DrawingAreaProxy::setViewExposedRect):
3296         (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired):
3297         * UIProcess/GeolocationPermissionRequestManagerProxy.cpp:
3298         (WebKit::GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision):
3299         * UIProcess/InspectorTargetProxy.cpp:
3300         (WebKit::InspectorTargetProxy::connect):
3301         (WebKit::InspectorTargetProxy::disconnect):
3302         (WebKit::InspectorTargetProxy::sendMessageToTargetBackend):
3303         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
3304         (WebKit::RemoteLayerTreeDrawingAreaProxy::sizeDidChange):
3305         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
3306         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
3307         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3308         (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged):
3309         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
3310         (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest):
3311         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
3312         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
3313         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
3314         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
3315         (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
3316         * UIProcess/ViewGestureController.cpp:
3317         (WebKit::ViewGestureController::ViewGestureController):
3318         * UIProcess/WebBackForwardList.cpp:
3319         (WebKit::WebBackForwardList::~WebBackForwardList):
3320         * UIProcess/WebCookieManagerProxy.cpp:
3321         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
3322         * UIProcess/WebEditCommandProxy.cpp:
3323         (WebKit::WebEditCommandProxy::unapply):
3324         (WebKit::WebEditCommandProxy::reapply):
3325         * UIProcess/WebFrameProxy.cpp:
3326         (WebKit::WebFrameProxy::stopLoading const):
3327         * UIProcess/WebInspectorProxy.cpp:
3328         (WebKit::WebInspectorProxy::WebInspectorProxy):
3329         * UIProcess/WebPageProxy.cpp:
3330         (WebKit::m_resetRecentCrashCountTimer):
3331         (WebKit::WebPageProxy::hasRunningProcess const):
3332         (WebKit::WebPageProxy::setUIClient):
3333         (WebKit::WebPageProxy::setIconLoadingClient):
3334         (WebKit::WebPageProxy::launchProcess):
3335         (WebKit::WebPageProxy::swapToWebProcess):
3336         (WebKit::WebPageProxy::finishAttachingToWebProcess):
3337         (WebKit::WebPageProxy::didAttachToRunningProcess):
3338         (WebKit::WebPageProxy::launchProcessForReload):
3339         (WebKit::WebPageProxy::launchProcessWithItem):
3340         (WebKit::WebPageProxy::initializeWebPage):
3341         (WebKit::WebPageProxy::tryClose):
3342         (WebKit::WebPageProxy::loadRequest):
3343         (WebKit::WebPageProxy::loadFile):
3344         (WebKit::WebPageProxy::loadData):
3345         (WebKit::WebPageProxy::loadAlternateHTML):
3346         (WebKit::WebPageProxy::loadWebArchiveData):
3347         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
3348         (WebKit::WebPageProxy::stopLoading):
3349         (WebKit::WebPageProxy::reload):
3350         (WebKit::WebPageProxy::goToBackForwardItem):
3351         (WebKit::WebPageProxy::tryRestoreScrollPosition):
3352         (WebKit::WebPageProxy::setControlledByAutomation):
3353         (WebKit::WebPageProxy::setIndicating):
3354         (WebKit::WebPageProxy::setBackgroundColor):
3355         (WebKit::WebPageProxy::setTopContentInset):
3356         (WebKit::WebPageProxy::setUnderlayColor):
3357         (WebKit::WebPageProxy::viewWillStartLiveResize):
3358         (WebKit::WebPageProxy::viewWillEndLiveResize):
3359         (WebKit::WebPageProxy::dispatchActivityStateChange):
3360         (WebKit::WebPageProxy::layerHostingModeDidChange):
3361         (WebKit::WebPageProxy::waitForDidUpdateActivityState):
3362         (WebKit::WebPageProxy::setInitialFocus):
3363         (WebKit::WebPageProxy::clearSelection):
3364         (WebKit::WebPageProxy::restoreSelectionInFocusedEditableElement):
3365         (WebKit::WebPageProxy::validateCommand):
3366         (WebKit::WebPageProxy::increaseListLevel):
3367         (WebKit::WebPageProxy::decreaseListLevel):
3368         (WebKit::WebPageProxy::changeListType):
3369         (WebKit::WebPageProxy::setBaseWritingDirection):
3370         (WebKit::WebPageProxy::setNeedsFontAttributes):
3371         (WebKit::WebPageProxy::executeEditCommand):
3372         (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart):
3373         (WebKit::WebPageProxy::setEditable):
3374         (WebKit::WebPageProxy::performDragControllerAction):
3375         (WebKit::WebPageProxy::dragEnded):
3376         (WebKit::WebPageProxy::didStartDrag):
3377         (WebKit::WebPageProxy::dragCancelled):
3378         (WebKit::WebPageProxy::handleMouseEvent):
3379         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
3380         (WebKit::WebPageProxy::handleWheelEvent):
3381         (WebKit::WebPageProxy::handleKeyboardEvent):
3382         (WebKit::WebPageProxy::handleGestureEvent):
3383         (WebKit::WebPageProxy::handleTouchEventSynchronously):
3384         (WebKit::WebPageProxy::handleTouchEventAsynchronously):
3385         (WebKit::WebPageProxy::handleTouchEvent):
3386         (WebKit::WebPageProxy::scrollBy):
3387         (WebKit::WebPageProxy::centerSelectionInVisibleArea):
3388         (WebKit::WebPageProxy::receivedPolicyDecision):
3389         (WebKit::WebPageProxy::setUserAgent):
3390         (WebKit::WebPageProxy::resumeActiveDOMObjectsAndAnimations):
3391         (WebKit::WebPageProxy::suspendActiveDOMObjectsAndAnimations):
3392         (WebKit::WebPageProxy::setCustomTextEncodingName):
3393         (WebKit::WebPageProxy::setTextZoomFactor):
3394         (WebKit::WebPageProxy::setPageZoomFactor):
3395         (WebKit::WebPageProxy::setPageAndTextZoomFactors):
3396         (WebKit::WebPageProxy::scalePage):
3397         (WebKit::WebPageProxy::scalePageInViewCoordinates):
3398         (WebKit::WebPageProxy::scaleView):
3399         (WebKit::WebPageProxy::windowScreenDidChange):
3400         (WebKit::WebPageProxy::setCustomDeviceScaleFactor):
3401         (WebKit::WebPageProxy::accessibilitySettingsDidChange):
3402         (WebKit::WebPageProxy::updateAccessibilityEventsEnabled):
3403         (WebKit::WebPageProxy::setUseFixedLayout):
3404         (WebKit::WebPageProxy::setFixedLayoutSize):
3405         (WebKit::WebPageProxy::setAlwaysShowsHorizontalScroller):
3406         (WebKit::WebPageProxy::setAlwaysShowsVerticalScroller):
3407         (WebKit::WebPageProxy::listenForLayoutMilestones):
3408         (WebKit::WebPageProxy::setSuppressScrollbarAnimations):
3409         (WebKit::WebPageProxy::setEnableVerticalRubberBanding):
3410         (WebKit::WebPageProxy::setEnableHorizontalRubberBanding):
3411         (WebKit::WebPageProxy::setBackgroundExtendsBeyondPage):
3412         (WebKit::WebPageProxy::setPaginationMode):
3413         (WebKit::WebPageProxy::setPaginationBehavesLikeColumns):
3414         (WebKit::WebPageProxy::setPageLength):
3415         (WebKit::WebPageProxy::setGapBetweenPages):
3416         (WebKit::WebPageProxy::setPaginationLineGridEnabled):
3417         (WebKit::WebPageProxy::countStringMatches):
3418         (WebKit::WebPageProxy::replaceMatches):