Occasional crashes in layout tests when firing the shrink-to-fit-content timer
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-05-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         Occasional crashes in layout tests when firing the shrink-to-fit-content timer
4         https://bugs.webkit.org/show_bug.cgi?id=197629
5         <rdar://problem/50514382>
6
7         Reviewed by Tim Horton.
8
9         Fixes several crashing layout tests by stopping the shrink-to-fit-content timer when the page closes.
10
11         * WebProcess/WebPage/WebPage.cpp:
12         (WebKit::WebPage::close):
13
14 2019-05-04  Per Arne Vollan  <pvollan@apple.com>
15
16         -[WKWebsiteDataStore removeDataOfTypes:forDataRecords:completionHandler:] doesn't delete _WKWebsiteDataTypeCredentials
17         https://bugs.webkit.org/show_bug.cgi?id=197510
18
19         Reviewed by Alex Christensen.
20
21         * NetworkProcess/NetworkProcess.cpp:
22         (WebKit::NetworkProcess::fetchWebsiteData):
23         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
24         (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
25
26 2019-05-06  Keith Rollin  <krollin@apple.com>
27
28         Temporarily disable generate-xcfilelists
29         https://bugs.webkit.org/show_bug.cgi?id=197619
30         <rdar://problem/50507392>
31
32         Reviewed by Alex Christensen.
33
34         We need to perform a significant update to the generate-xcfilelist
35         scripts. This work involves coordinated work with another facility. If
36         the work does not occur in tandem, the build will be broken. To avoid
37         this, disable the invoking of the scripts during the transition. The
38         checking will be restored once the new scripts are in place.
39
40         * Scripts/check-xcfilelists.sh:
41
42 2019-05-06  Chris Dumez  <cdumez@apple.com>
43
44         Unreviewed build fix after r244984.
45
46         * WebProcess/cocoa/WebProcessCocoa.mm:
47
48 2019-05-06  Chris Dumez  <cdumez@apple.com>
49
50         Prewarmed WebContent processes never app nap
51         https://bugs.webkit.org/show_bug.cgi?id=197630
52
53         Reviewed by Geoffrey Garen.
54
55         Do not require actually having a WebPage in the WebContent process to App Nap.
56
57         * WebProcess/WebPage/WebPage.cpp:
58         (WebKit::WebPage::updateThrottleState):
59         * WebProcess/cocoa/WebProcessCocoa.mm:
60         (WebKit::WebProcess::platformInitializeWebProcess):
61
62 2019-05-06  Daniel Bates  <dabates@apple.com>
63
64         Fix the build after r244975
65         (https://bugs.webkit.org/show_bug.cgi?id=197474)
66
67         Actually make use of the Keyboard Event when building with USE(UIKIT_KEYBOARD_ADDITIONS)
68         and substitute -> for . since it's now passed by reference.
69
70         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
71         (WebKit::WebEditorClient::handleInputMethodKeydown):
72
73 2019-05-06  Jer Noble  <jer.noble@apple.com>
74
75         Adopt AVStreamDataParser.audiovisualMIMETypes
76         https://bugs.webkit.org/show_bug.cgi?id=197581
77         <rdar://problem/50458981>
78
79         Reviewed by Eric Carlson.
80
81         * WebProcess/cocoa/WebProcessCocoa.mm:
82         (WebKit::WebProcess::platformInitializeWebProcess):
83         (WebKit::WebProcess::platformTerminate):
84         (WebKit::WebProcess::setMediaMIMETypes):
85
86 2019-05-06  Chris Dumez  <cdumez@apple.com>
87
88         Terminate service workers that use too much CPU / power
89         https://bugs.webkit.org/show_bug.cgi?id=197626
90         <rdar://problem/50374707>
91
92         Reviewed by Geoffrey Garen.
93
94         Terminate service worker processes that use over 50% CPU on average over the last 8 minutes,
95         similarly to what we do for background WebContent processes.
96
97         * UIProcess/WebProcessProxy.cpp:
98         (WebKit::WebProcessProxy::didExceedCPULimit):
99         * WebProcess/WebProcess.cpp:
100         (WebKit::WebProcess::initializeProcess):
101         * WebProcess/cocoa/WebProcessCocoa.mm:
102         (WebKit::WebProcess::updateCPULimit):
103         (WebKit::WebProcess::updateCPUMonitorState):
104
105 2019-05-06  Daniel Bates  <dabates@apple.com>
106
107         Google Docs & Yahoo! Japan: Can’t compose characters with Chinese or Japanese keyboard
108         https://bugs.webkit.org/show_bug.cgi?id=197474
109         <rdar://problem/47219324>
110
111         Reviewed by Ryosuke Niwa.
112
113         Adopt UIKit SPI (added in <rdar://problem/50181162>) to ask the Input Manager to handle
114         the key event. If the Input Manager handled it then we pass along this information to
115         WebCore, just as we do for Mac, so that it can alter its event handling logic. Otherwise,
116         we handle the event as we do now.
117
118         A large part of this patch is fixing up #if defs to compile more Mac code when building
119         on iOS.
120
121         * Platform/spi/ios/UIKitSPI.h: Expose more SPI.
122         * Shared/NativeWebKeyboardEvent.h:
123         * Shared/WebEvent.h:
124         * Shared/WebEventConversion.cpp:
125         (WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
126         * Shared/WebKeyboardEvent.cpp:
127         (WebKit::WebKeyboardEvent::WebKeyboardEvent):
128         (WebKit::WebKeyboardEvent::encode const):
129         (WebKit::WebKeyboardEvent::decode):
130         * Shared/ios/NativeWebKeyboardEventIOS.mm:
131         (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
132         * Shared/ios/WebIOSEventFactory.h:
133         * Shared/ios/WebIOSEventFactory.mm:
134         (WebIOSEventFactory::createWebKeyboardEvent):
135         Compile more Mac code on iOS. Just like on Mac we maintain some bookkeeping on
136         whether an event was handled by the Input Manager.
137
138         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
139         (WebKit::WebAutomationSession::sendSynthesizedEventsToPage): Pass NativeWebKeyboardEvent::HandledByInputMethod::No
140         to keep the behavior we have now.
141
142         * UIProcess/ios/WKContentViewInteraction.h:
143         * UIProcess/ios/WKContentViewInteraction.mm:
144         (-[WKContentView cleanupInteraction]):
145         (-[WKContentView shouldSuppressUpdateCandidateView]): Added. Used to tell UIKit whether to
146         suppress updating/showing the candidate view.
147         (-[WKContentView setMarkedText:selectedRange:]):
148         Bookkeeping to track whether we need to delay showing/updating the inline candidate view.
149         The concept in UIKit is deferment, but at the time of writing its simply a request to delay
150         the update for 0.4 seconds. We opt into this delay only for the first key that begins
151         marked text (i.e. the transition from no marked text to marked text). We do this because we
152         may not have up-to-date editor state at the time UIKit is ready to show/update the inline
153         candidate view for us to answer -textFirstRect and -textLastRect, which UIKit calls as part
154         of computing the frame rect for the inline candidate view on screen. Once we receive up-to-date
155         editor state, in -selectionChanged, we tell UIKit to layout the keyboard, which ultimately
156         causes it to re-compute the frame rect for the inline candidate view and show it.
157
158         (-[WKContentView handleKeyWebEvent:]): Pass NativeWebKeyboardEvent::HandledByInputMethod::No
159         to keep the behavior we have now. 
160         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]): Ask the keyboard to handle the
161         event using the Input Manager. If it was handled then there is no need to delay calling the
162         completion handler, call it, then tell the web process about the key event and that it was
163         already handled by the Input Manager.
164         (-[WKContentView _selectionChanged]): Tell the keyboard to update the candidate view, if needed.
165         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
166         (WebKit::WebEditorClient::handleInputMethodKeydown): Mark the event as default handled if
167         the UI process told us that the event was handled by the Input Manager just like we do on Mac.
168
169 2019-05-06  Alex Christensen  <achristensen@webkit.org>
170
171         Null check m_mainFrame in WebPageProxy.cpp
172         https://bugs.webkit.org/show_bug.cgi?id=197618
173         <rdar://problem/47463054>
174
175         Reviewed by Geoffrey Garen.
176
177         It's already null checked in some places, and the places where it isn't are causing crashes.
178         Let's fix all of them.
179
180         * UIProcess/WebPageProxy.cpp:
181         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
182         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
183         (WebKit::WebPageProxy::createNewPage):
184
185 2019-05-06  Brent Fulgham  <bfulgham@apple.com>
186
187         Use more efficient path resolution logic
188         https://bugs.webkit.org/show_bug.cgi?id=197389
189         <rdar://problem/50268491>
190
191         Reviewed by Maciej Stachowiak.
192
193         The code in SandboxExtensionsCocoa.mm 'resolveSymlinksInPath' is pretty inefficient, and tries to reproduce (badly)
194         logic that is already provided by the operating system.
195
196         To make matters worse, 'resolvePathForSandboxExtension' was effectively performing the work of fully resolving
197         symlinks twice, since NSString's 'stringByStandardizingPath' method does some of this already.
198
199         Instead, we should just use NSString's 'stringByResolvingSymlinksInPath', which does the symlink resolution
200         using more efficient logic than our 'resolveSymlinksInPath' code.
201
202         * Shared/Cocoa/SandboxExtensionCocoa.mm:
203         (WebKit::resolveSymlinksInPath): Removed.
204         (WebKit::resolvePathForSandboxExtension): Remove redundant call to 'resolveSymlinksInPath', and switches from
205         'stringByStandardizingPath' to 'stringByResolvingSymlinksInPath', which can take the place of both calls.
206         (WebKit::stringByResolvingSymlinksInPath): Switch to call 'stringByResolvingSymlinksInPath'.
207
208 2019-05-06  Wenson Hsieh  <wenson_hsieh@apple.com>
209
210         Introduce SPI to request modern compatibility mode but defer to site-specific quirks
211         https://bugs.webkit.org/show_bug.cgi?id=197614
212         <rdar://problem/50208577>
213
214         Reviewed by Tim Horton.
215
216         Add plumbing for a new _allowSiteSpecificQuirksToOverrideCompatibilityMode SPI property on
217         WKWebpagePreferences.
218
219         * UIProcess/API/APIWebsitePolicies.cpp:
220         (API::WebsitePolicies::copy const):
221         * UIProcess/API/APIWebsitePolicies.h:
222         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
223         (-[WKWebpagePreferences _allowSiteSpecificQuirksToOverrideCompatibilityMode]):
224         (-[WKWebpagePreferences _setAllowSiteSpecificQuirksToOverrideCompatibilityMode:]):
225         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
226         * UIProcess/WebPageProxy.cpp:
227
228         Use currentRequest instead of originalRequest; see internal change for more details.
229
230         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
231
232 2019-05-06  Ryan Haddad  <ryanhaddad@apple.com>
233
234         Unreviewed, rolling out r244917.
235
236         Caused
237         TestWebKitAPI.WKWebView.InitializingWebViewWithEphemeralStorageDoesNotLog
238         failure on debug bots.
239
240         Reverted changeset:
241
242         "Use more efficient path resolution logic"
243         https://bugs.webkit.org/show_bug.cgi?id=197389
244         https://trac.webkit.org/changeset/244917
245
246 2019-05-04  Alex Christensen  <achristensen@webkit.org>
247
248         Revert r244953 and r244954 because they broke internal builds.
249         https://bugs.webkit.org/show_bug.cgi?id=197534
250
251         * Platform/spi/ios/PDFKitSPI.h:
252         * Platform/spi/ios/UIKitSPI.h: Added.
253         (currentUserInterfaceIdiomIsPad):
254         * Shared/DocumentEditingContext.mm:
255         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
256         * Shared/ios/NativeWebKeyboardEventIOS.mm:
257         * Shared/ios/NativeWebTouchEventIOS.mm:
258         * Shared/ios/WebIconUtilities.mm:
259         * UIProcess/API/Cocoa/NSAttributedString.mm:
260         * UIProcess/API/Cocoa/WKWebView.mm:
261         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
262         * UIProcess/API/Cocoa/WKWebViewInternal.h:
263         * UIProcess/ApplicationStateTracker.mm:
264         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
265         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
266         * UIProcess/Cocoa/WKShareSheet.mm:
267         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
268         * UIProcess/Gamepad/ios/UIGamepadProviderIOS.mm:
269         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
270         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
271         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
272         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
273         * UIProcess/WKImagePreviewViewController.mm:
274         * UIProcess/_WKTouchEventGenerator.mm:
275         * UIProcess/ios/DragDropInteractionState.h:
276         * UIProcess/ios/InputViewUpdateDeferrer.mm:
277         * UIProcess/ios/PageClientImplIOS.mm:
278         * UIProcess/ios/SmartMagnificationController.mm:
279         * UIProcess/ios/TextCheckerIOS.mm:
280         * UIProcess/ios/ViewGestureControllerIOS.mm:
281         * UIProcess/ios/WKActionSheet.mm:
282         * UIProcess/ios/WKActionSheetAssistant.mm:
283         * UIProcess/ios/WKContentView.mm:
284         * UIProcess/ios/WKContentViewInteraction.h:
285         * UIProcess/ios/WKContentViewInteraction.mm:
286         * UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm:
287         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
288         * UIProcess/ios/WKPDFPageNumberIndicator.mm:
289         * UIProcess/ios/WKPDFView.mm:
290         * UIProcess/ios/WKPasswordView.mm:
291         * UIProcess/ios/WKScrollView.h:
292         * UIProcess/ios/WKScrollView.mm:
293         * UIProcess/ios/WKSyntheticTapGestureRecognizer.h:
294         * UIProcess/ios/WKWebEvent.mm:
295         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.h:
296         * UIProcess/ios/WebPageProxyIOS.mm:
297         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
298         * UIProcess/ios/forms/WKFileUploadPanel.mm:
299         * UIProcess/ios/forms/WKFocusedFormControlView.h:
300         * UIProcess/ios/forms/WKFormColorControl.mm:
301         * UIProcess/ios/forms/WKFormColorPicker.mm:
302         * UIProcess/ios/forms/WKFormInputControl.mm:
303         * UIProcess/ios/forms/WKFormPopover.mm:
304         * UIProcess/ios/forms/WKFormSelectControl.h:
305         * UIProcess/ios/forms/WKFormSelectControl.mm:
306         * UIProcess/ios/forms/WKFormSelectPicker.mm:
307         * UIProcess/ios/forms/WKFormSelectPopover.mm:
308         * UIProcess/ios/forms/WKNumberPadViewController.mm:
309         * UIProcess/ios/forms/WKQuickboardListViewController.h:
310         * UIProcess/ios/forms/WKSelectMenuListViewController.mm:
311         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
312         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
313         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
314         * WebKit.xcodeproj/project.pbxproj:
315         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
316         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
317         * WebProcess/WebPage/ios/WebPageIOS.mm:
318         * WebProcess/cocoa/WebProcessCocoa.mm:
319
320 2019-05-04  Alex Christensen  <achristensen@webkit.org>
321
322         Merge the three UIKitSPI.h files into a single one in PAL
323         https://bugs.webkit.org/show_bug.cgi?id=197534
324
325         Reviewed by Darin Adler.
326
327         * Platform/spi/ios/PDFKitSPI.h:
328         * Platform/spi/ios/UIKitSPI.h: Removed.
329         * Shared/DocumentEditingContext.mm:
330         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
331         * Shared/ios/NativeWebKeyboardEventIOS.mm:
332         * Shared/ios/NativeWebTouchEventIOS.mm:
333         * Shared/ios/WebIconUtilities.mm:
334         * UIProcess/API/Cocoa/NSAttributedString.mm:
335         * UIProcess/API/Cocoa/WKWebView.mm:
336         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
337         * UIProcess/API/Cocoa/WKWebViewInternal.h:
338         * UIProcess/ApplicationStateTracker.mm:
339         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
340         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
341         * UIProcess/Cocoa/WKShareSheet.mm:
342         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
343         * UIProcess/Gamepad/ios/UIGamepadProviderIOS.mm:
344         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
345         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
346         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
347         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
348         * UIProcess/WKImagePreviewViewController.mm:
349         * UIProcess/_WKTouchEventGenerator.mm:
350         * UIProcess/ios/DragDropInteractionState.h:
351         * UIProcess/ios/InputViewUpdateDeferrer.mm:
352         * UIProcess/ios/PageClientImplIOS.mm:
353         * UIProcess/ios/SmartMagnificationController.mm:
354         * UIProcess/ios/TextCheckerIOS.mm:
355         * UIProcess/ios/ViewGestureControllerIOS.mm:
356         * UIProcess/ios/WKActionSheet.mm:
357         * UIProcess/ios/WKActionSheetAssistant.mm:
358         * UIProcess/ios/WKContentView.mm:
359         * UIProcess/ios/WKContentViewInteraction.h:
360         * UIProcess/ios/WKContentViewInteraction.mm:
361         * UIProcess/ios/WKGeolocationProviderIOSObjCSecurityOrigin.mm:
362         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
363         * UIProcess/ios/WKPDFPageNumberIndicator.mm:
364         * UIProcess/ios/WKPDFView.mm:
365         * UIProcess/ios/WKPasswordView.mm:
366         * UIProcess/ios/WKScrollView.h:
367         * UIProcess/ios/WKScrollView.mm:
368         * UIProcess/ios/WKSyntheticTapGestureRecognizer.h:
369         * UIProcess/ios/WKWebEvent.mm:
370         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.h:
371         * UIProcess/ios/WebPageProxyIOS.mm:
372         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
373         * UIProcess/ios/forms/WKFileUploadPanel.mm:
374         * UIProcess/ios/forms/WKFocusedFormControlView.h:
375         * UIProcess/ios/forms/WKFormColorControl.mm:
376         * UIProcess/ios/forms/WKFormColorPicker.mm:
377         * UIProcess/ios/forms/WKFormInputControl.mm:
378         * UIProcess/ios/forms/WKFormPopover.mm:
379         * UIProcess/ios/forms/WKFormSelectControl.h:
380         * UIProcess/ios/forms/WKFormSelectControl.mm:
381         * UIProcess/ios/forms/WKFormSelectPicker.mm:
382         * UIProcess/ios/forms/WKFormSelectPopover.mm:
383         * UIProcess/ios/forms/WKNumberPadViewController.mm:
384         * UIProcess/ios/forms/WKQuickboardListViewController.h:
385         * UIProcess/ios/forms/WKSelectMenuListViewController.mm:
386         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
387         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
388         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
389         * WebKit.xcodeproj/project.pbxproj:
390         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
391         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
392         * WebProcess/WebPage/ios/WebPageIOS.mm:
393         * WebProcess/cocoa/WebProcessCocoa.mm:
394
395 2019-05-03  Wenson Hsieh  <wenson_hsieh@apple.com>
396
397         REGRESSION (r244897): Caret may appear wider than normal after zooming to focus an editable element
398         https://bugs.webkit.org/show_bug.cgi?id=197579
399
400         Reviewed by Tim Horton.
401
402         Fixes a couple of flaky tests (CaretSelectionRectAfterRestoringFirstResponderWithRetainActiveFocusedState and
403         CaretSelectionRectAfterRestoringFirstResponder) that began failing after r244897. These tests both begin by
404         focusing an editable element, which causes the web view to zoom in. The tests subsequently check that the caret
405         rect is {{ 16, 13 }, { 2, 15 }}. While the specified caret rect (coming from EditorState) is {{ 16, 13 }, { 3,
406         15 }}, the narrower caret rect is used because we take measures to preserve the width of the caret relative to
407         the view (see the inverse scaling logic in -[WKContentView selectedTextRange] for more details).
408
409         See below for more details.
410
411         * UIProcess/ios/WKContentViewInteraction.h:
412
413         Remove _isZoomingToRevealFocusedElement, now that we don't need it anymore (see -observeValueForKeyPath:).
414
415         * UIProcess/ios/WKContentViewInteraction.mm:
416         (-[WKContentView cleanupInteraction]):
417         (-[WKContentView observeValueForKeyPath:ofObject:change:context:]):
418
419         Stop bailing from a selection update when changing scale, while zooming to reveal the focused element. This
420         check was added in r239441 to prevent UIWKTextInteractionAssistant's selection scrolling logic from interfering
421         with WKContentView-driven logic for zooming to the focused element. However, since r244141, this is no longer
422         necessary since selection scrolling is only driven by code in the web process.
423
424         This new update while zooming to reveal the focused element ensures that the WKTextRange returned by
425         -selectedTextRange after zooming will have a width that is inversely scaled using the content view's current
426         scale, such that it has a consistent width (relative to the web view) across different scales.
427
428         (-[WKContentView _zoomToRevealFocusedElement]):
429         * UIProcess/ios/WebPageProxyIOS.mm:
430         (WebKit::WebPageProxy::layerTreeCommitComplete):
431
432         Remove any attempt here to notify PageClient about editor states after focus. This logic was actually incorrect,
433         since it didn't ensure that the layer tree commit that is being completed actually contained an editor state; as
434         such, the "editor state" received here could be stale.
435
436 2019-05-03  Zalan Bujtas  <zalan@apple.com>
437
438         [iOS] outlook.live.com: Compose email frame not fully visible and not scrollable
439         https://bugs.webkit.org/show_bug.cgi?id=197573
440         <rdar://problem/48008441>
441
442         Reviewed by Wenson Hsieh.
443
444         * WebProcess/WebPage/WebPage.h:
445         * WebProcess/WebPage/ios/WebPageIOS.mm:
446         (WebKit::WebPage::adjustLayoutSizeIfNeeded):
447         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
448         (WebKit::WebPage::dynamicViewportSizeUpdate):
449         (WebKit::WebPage::immediatelyShrinkToFitContent):
450
451 2019-05-03  Dean Jackson  <dino@apple.com>
452
453         Make imageForElementActionType a class method on _WKElementAction
454         https://bugs.webkit.org/show_bug.cgi?id=197588
455         <rdar://problem/50463157>
456
457         Reviewed by Wenson Hsieh.
458
459         Make this helper function a class method, so that it can
460         be more easily detected.
461
462         * UIProcess/API/Cocoa/_WKElementAction.h:
463         * UIProcess/API/Cocoa/_WKElementAction.mm:
464         (+[_WKElementAction imageForElementActionType:]):
465         (_WKUIImageForElementActionType): Deleted.
466
467 2019-05-03  Chris Dumez  <cdumez@apple.com>
468
469         Unresponsive Service Worker processes should get killed
470         https://bugs.webkit.org/show_bug.cgi?id=197580
471         <rdar://problem/50458239>
472
473         Reviewed by Geoffrey Garen.
474
475         Enable the background responsiveness logic for service worker processes so that they get
476         killed if they becomes unresponsive. The logic was previously not enabling the timer for
477         service worker processes because it required having a page.
478
479         * UIProcess/BackgroundProcessResponsivenessTimer.cpp:
480         (WebKit::BackgroundProcessResponsivenessTimer::shouldBeActive const):
481         * UIProcess/WebProcessProxy.cpp:
482         (WebKit::WebProcessProxy::didBecomeUnresponsive):
483         (WebKit::WebProcessProxy::didFinishLaunching):
484
485 2019-05-03  Youenn Fablet  <youenn@apple.com>
486
487         [iOS] set the default maximum camera count to 1 for enumerateDevices
488         https://bugs.webkit.org/show_bug.cgi?id=197566
489
490         Reviewed by Eric Carlson.
491
492         The previous number for iOS was 2 as there is a front and a back camera.
493         Since we are by default setting deviceIds to "", it is better to just have one,
494         as it might confuse applications to have two devices with the same ID.
495
496         Covered by updated test.
497
498         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
499         (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
500
501 2019-05-03  Daniel Bates  <dabates@apple.com>
502
503         Pass KeyboardEvent by reference in more places
504         https://bugs.webkit.org/show_bug.cgi?id=197480
505
506         Reviewed by Wenson Hsieh.
507
508         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
509         (WebKit::WebEditorClient::handleKeyboardEvent):
510         (WebKit::WebEditorClient::handleInputMethodKeydown):
511         * WebProcess/WebCoreSupport/WebEditorClient.h:
512         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
513         (WebKit::WebEditorClient::handleKeyboardEvent):
514         (WebKit::WebEditorClient::handleInputMethodKeydown):
515         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
516         (WebKit::WebEditorClient::handleKeyboardEvent):
517         (WebKit::WebEditorClient::handleInputMethodKeydown):
518         * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
519         (WebKit::WebEditorClient::handleKeyboardEvent):
520         (WebKit::WebEditorClient::handleInputMethodKeydown):
521         * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp:
522         (WebKit::WebEditorClient::handleKeyboardEvent):
523         (WebKit::WebEditorClient::handleInputMethodKeydown):
524         * WebProcess/WebPage/WebPage.h:
525         * WebProcess/WebPage/ios/WebPageIOS.mm:
526         (WebKit::WebPage::handleEditingKeyboardEvent):
527         * WebProcess/WebPage/mac/WebPageMac.mm:
528         (WebKit::WebPage::handleEditingKeyboardEvent):
529         * WebProcess/WebPage/win/WebPageWin.cpp:
530         (WebKit::WebPage::handleEditingKeyboardEvent):
531
532 2019-05-03  Youenn Fablet  <youenn@apple.com>
533
534         Enable Fetch Keep Alive by default
535         https://bugs.webkit.org/show_bug.cgi?id=197331
536
537         Reviewed by Geoffrey Garen.
538
539         * Shared/WebPreferences.yaml:
540
541 2019-05-03  Devin Rousso  <drousso@apple.com>
542
543         REGRESSION(r230367): a "." is prepended before cookies set without an explicit domain
544         https://bugs.webkit.org/show_bug.cgi?id=197268
545         <rdar://problem/49767847>
546
547         Reviewed by Alex Christensen.
548
549         RFC 2965 states "If an explicitly specified value does not start with a dot, the user agent
550         supplies a leading dot.", so we should only be adding a leading "." if a `domain` is provided.
551
552         In order to not regress r230367, also delete all cookies for the non-"."-prefixed domain.
553
554         * UIProcess/Automation/WebAutomationSession.cpp:
555         (WebKit::WebAutomationSession::addSingleCookie):
556         (WebKit::WebAutomationSession::deleteAllCookies):
557
558         * UIProcess/WebCookieManagerProxy.h:
559         * UIProcess/WebCookieManagerProxy.cpp:
560         (WebKit::WebCookieManagerProxy::deleteCookiesForHostnames): Added.
561         (WebKit::WebCookieManagerProxy::deleteCookiesForHostname): Deleted.
562         * UIProcess/API/C/WKCookieManager.cpp:
563         (WKCookieManagerDeleteCookiesForHostname):
564         * NetworkProcess/Cookies/WebCookieManager.messages.in:
565         * NetworkProcess/Cookies/WebCookieManager.h:
566         * NetworkProcess/Cookies/WebCookieManager.cpp:
567         (WebKit::WebCookieManager::deleteCookiesForHostnames): Added.
568         (WebKit::WebCookieManager::deleteCookiesForHostname): Deleted.
569         Since the underlying `NetworkStorageSession` accepts a list of domains, extend that support
570         to allow the IPC to send a list of domains as well, but still keep the C API the same.
571
572 2019-05-03  Sihui Liu  <sihui_liu@apple.com>
573
574         Add assertion to check whether shm files have maximum FileProtection of CompleteUnlessOpen
575         https://bugs.webkit.org/show_bug.cgi?id=197390
576         <rdar://problem/42685773>
577
578         Reviewed by Geoffrey Garen.
579
580         Move data protection check to WebCore so it can be applied to database files.
581
582         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
583         (WebKit::NetworkCache::BlobStorage::add):
584         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
585         (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath): Deleted.
586         * NetworkProcess/cache/NetworkCacheFileSystem.h:
587         * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm: Removed.
588         * SourcesCocoa.txt:
589         * UIProcess/API/APIContentRuleListStore.cpp:
590         (API::openAndMapOrCopyContentRuleList):
591         (API::compiledToFile):
592
593 2019-05-03  Chris Dumez  <cdumez@apple.com>
594
595         ASSERTION FAILED: [weakThis->m_view window] == weakThis->m_targetWindowForMovePreparation
596         https://bugs.webkit.org/show_bug.cgi?id=197574
597         <rdar://problem/50453181>
598
599         Reviewed by Tim Horton.
600
601         Tweak the assertion so that it holds even if the WebView gets closed because the completion
602         handler has been called.
603
604         * UIProcess/Cocoa/WebViewImpl.mm:
605         (WebKit::WebViewImpl::prepareForMoveToWindow):
606
607 2019-05-03  Brent Fulgham  <bfulgham@apple.com>
608
609         Use more efficient path resolution logic
610         https://bugs.webkit.org/show_bug.cgi?id=197389
611         <rdar://problem/50268491>
612
613         Reviewed by Maciej Stachowiak.
614
615         The code in SandboxExtensionsCocoa.mm 'resolveSymlinksInPath' is pretty inefficient, and tries to reproduce (badly)
616         logic that is already provided by the operating system.
617
618         To make matters worse, 'resolvePathForSandboxExtension' was effectively performing the work of fully resolving
619         symlinks twice, since NSString's 'stringByStandardizingPath' method does some of this already.
620
621         Instead, we should just use NSString's 'stringByResolvingSymlinksInPath', which does the symlink resolution
622         using more efficient logic than our 'resolveSymlinksInPath' code.
623
624         * Shared/Cocoa/SandboxExtensionCocoa.mm:
625         (WebKit::resolveSymlinksInPath): Removed.
626         (WebKit::resolvePathForSandboxExtension): Remove redundant call to 'resolveSymlinksInPath', and switches from
627         'stringByStandardizingPath' to 'stringByResolvingSymlinksInPath', which can take the place of both calls.
628         (WebKit::stringByResolvingSymlinksInPath): Switch to call 'stringByResolvingSymlinksInPath'.
629
630 2019-05-02  Dean Jackson  <dino@apple.com>
631
632         Need additional UIPreviewAction information in WKImagePreviewViewController
633         https://bugs.webkit.org/show_bug.cgi?id=197540
634         <rdar://problem/50430510>
635
636         Reviewed by Wenson Hsieh.
637
638         Include a WebKitAdditions file to provide a macro for
639         additional UIPreviewAction information.
640
641         While here, take the opportunity to move from the deprecated
642         UIViewControllerPreviewAction to the newer UIPreviewAction.
643
644         * UIProcess/WKImagePreviewViewController.mm:
645         (-[WKImagePreviewViewController previewActionItems]):
646
647 2019-05-02  Dean Jackson  <dino@apple.com>
648
649         Provide UIImages for element actions
650         https://bugs.webkit.org/show_bug.cgi?id=197539
651         <rdar://problem/50430363>
652
653         Reviewed by Wenson Hsieh.
654
655         Use an additions include to export a function that
656         relates a UIImage to a _WKElementAction.
657
658         * UIProcess/API/Cocoa/_WKElementAction.h:
659         * UIProcess/API/Cocoa/_WKElementAction.mm:
660         (_WKUIImageForElementActionType):
661
662 2019-05-03  Jay Mulani  <jmulani@apple.com>
663
664         Expose full screen controller SPI to check if full screen is open and close full screen
665         https://bugs.webkit.org/show_bug.cgi?id=197263
666
667         Reviewed by Jer Noble.
668
669         * UIProcess/API/Cocoa/WKWebView.mm:
670         (-[WKWebView closeFullScreenWindowController]):
671         (-[WKWebView fullScreenWindowController]):
672         * UIProcess/API/Cocoa/WKWebViewInternal.h:
673         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
674
675 2019-05-03  Youenn Fablet  <youenn@apple.com>
676
677         LayoutTest imported/w3c/web-platform-tests/xhr/event-upload-progress-crossorigin.htm is a flaky failure
678         https://bugs.webkit.org/show_bug.cgi?id=182849
679         <rdar://problem/50353372>
680
681         Reviewed by Alex Christensen.
682
683         In case of restarting the load after a redirection, which now happens in case
684         of following cross origin redirections with same-origin credentials, make sure to
685         update the request as would do NetworkLoad.
686         This is in particular important to preserve the request body.
687
688         Covered by WPT updated test.
689
690         * NetworkProcess/NetworkLoad.cpp:
691         (WebKit::updateRequest):
692         (WebKit::NetworkLoad::updateRequestAfterRedirection const):
693         (WebKit::NetworkLoad::continueWillSendRequest):
694         * NetworkProcess/NetworkLoad.h:
695         * NetworkProcess/NetworkResourceLoader.cpp:
696         (WebKit::NetworkResourceLoader::continueWillSendRequest):
697
698 2019-05-03  Commit Queue  <commit-queue@webkit.org>
699
700         Unreviewed, rolling out r244881.
701         https://bugs.webkit.org/show_bug.cgi?id=197559
702
703         Breaks compilation of jsconly on linux, breaking compilation
704         for jsc-i386-ews, jsc-mips-ews and jsc-armv7-ews (Requested by
705         guijemont on #webkit).
706
707         Reverted changeset:
708
709         "[CMake] Refactor WEBKIT_MAKE_FORWARDING_HEADERS into
710         WEBKIT_COPY_FILES"
711         https://bugs.webkit.org/show_bug.cgi?id=197174
712         https://trac.webkit.org/changeset/244881
713
714 2019-05-02  Wenson Hsieh  <wenson_hsieh@apple.com>
715
716         REGRESSION: Layout test editing/selection/ios/selection-after-changing-text-with-callout-menu.html is failing
717         https://bugs.webkit.org/show_bug.cgi?id=197532
718         <rdar://problem/50177144>
719
720         Reviewed by Ryosuke Niwa.
721
722         Fixes layout tests that began failing after r244546. See below for details.
723
724         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
725         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
726
727         Partially reverts a change in r244546, after which we commit the layer tree and scroll before updating the
728         page's editor state. The purpose of this change was to ensure that UI process-side element focus scrolling logic
729         would not conflict with web-process-driven scrolling logic.
730
731         Instead, we split the existing logic in WebPageProxy::editorStateChanged into two pieces: one that updates the
732         editor state (by setting m_editorState), and a second that dispatches updates to PageClient when the first
733         editor state is received after focusing an element. During a layer tree commit in the UI process, we first
734         update the editor state, then commit the layer tree and apply scroll position changes, and finally scroll to
735         reveal the focused element if necessary.
736
737         When an editor state is delivered to the UI process in an out-of-band update (i.e. not in a layer tree commit),
738         simply dispatch the initial editor state for a focused element immediately.
739
740         * UIProcess/WebPageProxy.cpp:
741         (WebKit::WebPageProxy::scheduleFullEditorStateUpdate):
742
743         Add an IPC message to schedule an editor state update in the next remote layer tree commit. See below for more
744         details.
745
746         (WebKit::WebPageProxy::editorStateChanged):
747         (WebKit::WebPageProxy::dispatchDidReceiveEditorStateAfterFocus):
748         * UIProcess/WebPageProxy.h:
749         * UIProcess/gtk/WebPageProxyGtk.cpp:
750         (WebKit::WebPageProxy::updateEditorState):
751         (WebKit::WebPageProxy::editorStateChanged): Deleted.
752         * UIProcess/ios/WKContentViewInteraction.mm:
753         (-[WKContentView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
754
755         Additionally ensure that an editor state update is scheduled. This addresses a potential source of flakiness in
756         the layout test editing/selection/ios/selection-after-changing-text-with-callout-menu.html, where an editor
757         state update may only be scheduled after the next layout timer fires (this is the case in custom callout menu
758         actions that change the DOM but do not otherwise trigger any editing commands).
759
760         In the problematic scenario, the client could make a change that triggers layout soon; but before the layout
761         timer fires, the timer for the next remote layer tree commit could fire, such that the next layer tree commit
762         would not contain the relevant editor state.
763
764         This extra step ensures that we always *schedule* an editor state update when performing a callout menu action
765         that does not automatically dismiss, so that we can prevent the callout bar from dismissing during the correct
766         scope.
767
768         * UIProcess/ios/WebPageProxyIOS.mm:
769         (WebKit::WebPageProxy::layerTreeCommitComplete):
770         (WebKit::WebPageProxy::updateEditorState):
771
772         Rename editorStateChanged to updateEditorState, and make the editorStateChanged codepath only executed when an
773         out-of-band editor state update is delivered to the UI process.
774
775         (WebKit::WebPageProxy::dispatchDidReceiveEditorStateAfterFocus):
776
777         Notify the UI process that the initial editor state has been received; this prompts us to scroll to reveal the
778         focused element, if needed.
779
780         (WebKit::WebPageProxy::editorStateChanged): Deleted.
781         * UIProcess/mac/WebPageProxyMac.mm:
782         (WebKit::WebPageProxy::updateEditorState):
783         (WebKit::WebPageProxy::editorStateChanged): Deleted.
784         * UIProcess/win/WebPageProxyWin.cpp:
785         (WebKit::WebPageProxy::updateEditorState):
786         (WebKit::WebPageProxy::editorStateChanged): Deleted.
787         * UIProcess/wpe/WebPageProxyWPE.cpp:
788         (WebKit::WebPageProxy::updateEditorState):
789         (WebKit::WebPageProxy::editorStateChanged): Deleted.
790         * WebProcess/WebPage/WebPage.h:
791         * WebProcess/WebPage/WebPage.messages.in:
792
793 2019-05-02  Timothy Hatcher  <timothy@apple.com>
794
795         NSAttributedString conversion in a loop returns nil and WKUnknownError every other time.
796         https://bugs.webkit.org/show_bug.cgi?id=197523
797
798         Reviewed by Darin Adler.
799
800         Caching the WKWebView was loading about:blank to unload the previous content.
801         This was causing subsequent rapid conversions to fail since the blank load
802         would be confused with the real content loading. Loading a blank page wasn't
803         really needed, it just helped keep the cached view in a cleaner state. Instead
804         of adding complexity to track the extra navigation, we can eliminate the blank load.
805         Ultimately a process swap will likely happen on the next navigation, and unused
806         cached views are closed quickly -- so stale content isn't held around too long.
807         This also avoids extra work and speeds up conversions a bit.
808
809         * UIProcess/API/Cocoa/NSAttributedString.mm:
810         (+[_WKAttributedStringWebViewCache cacheWebView:]): Don't load about:blank when caching.
811         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
812         (WebKit::WebPage::getContentsAsAttributedString): Use rangeOfContents() for a fail
813         safe way to get the range needed.
814
815 2019-05-02  John Wilander  <wilander@apple.com>
816
817         Make both filterForRegistrableDomains() in WebKit::NetworkProcess use WebCore::RegistrableDomain::uncheckedCreateFromHost()
818         https://bugs.webkit.org/show_bug.cgi?id=197521
819         <rdar://problem/49651503>
820
821         Reviewed by Brent Fulgham.
822
823         * NetworkProcess/NetworkProcess.cpp:
824         (WebKit::filterForRegistrableDomains):
825
826 2019-05-02  Per Arne Vollan  <pvollan@apple.com>
827
828         -[WKWebsiteDataStore removeDataOfTypes:forDataRecords:completionHandler:] doesn't delete _WKWebsiteDataTypeCredentials
829         https://bugs.webkit.org/show_bug.cgi?id=197510
830         <rdar://problem/50372338>
831
832         Reviewed by Alex Christensen.
833
834         When asked to delete persistent credentials for a set of origins, send a message to the network process with the
835         list of origins. The network process will then delete all persistent credentials from these origins from
836         NSURLCredentialStorage.
837
838         * NetworkProcess/NetworkProcess.cpp:
839         (WebKit::NetworkProcess::removeCredentialsWithOrigins):
840         * NetworkProcess/NetworkProcess.h:
841         * NetworkProcess/NetworkProcess.messages.in:
842         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
843         (WebKit::NetworkProcess::removeCredentialsWithOrigins):
844         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
845         (WebKit::WebsiteDataStore::removeData):
846
847 2019-05-02  Don Olmstead  <don.olmstead@sony.com>
848
849         [CMake] Refactor WEBKIT_MAKE_FORWARDING_HEADERS into WEBKIT_COPY_FILES
850         https://bugs.webkit.org/show_bug.cgi?id=197174
851
852         Reviewed by Alex Christensen.
853
854         Replace WEBKIT_MAKE_FORWARDING_HEADERS with WEBKIT_COPY_FILES and make dependencies
855         for framework headers explicit.
856
857         * CMakeLists.txt:
858         * PlatformWin.cmake:
859
860 2019-05-02  Per Arne Vollan  <pvollan@apple.com>
861
862         [macOS] Fix syscall sandbox violation
863         https://bugs.webkit.org/show_bug.cgi?id=197517
864         <rdar://problem/49945031>
865
866         Reviewed by Brent Fulgham.
867
868         A syscall needs to be added to the sandbox on macOS.
869
870         * WebProcess/com.apple.WebProcess.sb.in:
871
872 2019-05-02  Alex Christensen  <achristensen@webkit.org>
873
874         Safe browsing warning should update colors when a user switches between light and dark appearance
875         https://bugs.webkit.org/show_bug.cgi?id=197443
876         <rdar://problem/49883917>
877
878         Reviewed by Tim Horton.
879
880         We draw the WKSafeBrowsingExclamationPoint ourselves, so we need to call setNeedsDisplay when viewDidChangeEffectiveAppearance is called.
881         Instead of setting NSView.layer.backgroundColor we need to make an NSView subclass I call WKSafeBrowsingBox and we need to set its layer's
882         backgroundColor in updateLayer, otherwise the CGColor isn't updated from the NSColor.
883
884         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
885         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
886         (colorForItem):
887         (-[WKSafeBrowsingExclamationPoint viewDidChangeEffectiveAppearance]):
888         (-[WKSafeBrowsingBox setSafeBrowsingBackgroundColor:]):
889         (-[WKSafeBrowsingBox updateLayer]):
890         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]):
891         (-[WKSafeBrowsingWarning addContent]):
892         (-[WKSafeBrowsingWarning showDetailsClicked]):
893         (setBackground): Deleted.
894
895 2019-05-02  Frederic Wang  <fwang@igalia.com>
896
897         [GTK][WPE] Disable "thin", "thick", "medium" values of mfrac@linethickness at runtime
898         https://bugs.webkit.org/show_bug.cgi?id=196142
899
900         This patch introduces some experimental runtime flag to let users
901         disable MathML features that are removed from MathML Core [1]. For now,
902         these features are only disabled on GTK and WPE ports.
903
904         [1] https://mathml-refresh.github.io/mathml-core/
905
906         Reviewed by Rob Buis.
907
908         * Shared/WebPreferences.yaml:
909         * Shared/WebPreferencesDefaultValues.h:
910
911 2019-05-01  Wenson Hsieh  <wenson_hsieh@apple.com>
912
913         Add the ability to import WebKitAdditions snippets in WebKit.apinotes
914         https://bugs.webkit.org/show_bug.cgi?id=197487
915         <rdar://problem/50389085>
916
917         Reviewed by Tim Horton.
918
919         * Shared/API/Cocoa/WebKit.apinotes: Import a new WebKitAdditions file.
920
921         * WebKit.xcodeproj/project.pbxproj: Check all files in Headers/ and PrivateHeaders/ that need replacement, not
922         simply anything ending with ".h".
923
924         * mac/replace-webkit-additions-includes.py:
925         (main): Teach the replacement script to handle files in Headers/ or PrivateHeaders/ that don't end in ".h".
926
927 2019-05-01  Alex Christensen  <achristensen@webkit.org>
928
929         Protect against null crash in fetchDiskCacheEntries
930         https://bugs.webkit.org/show_bug.cgi?id=197399
931         <rdar://problem/47759337>
932
933         Reviewed by Antti Koivisto.
934
935         If the call to Entry::decodeStorageRecord returns nullptr in Storage::traverse, do not call the traverseHandler, which expects
936         that when it is called with nullptr that is the end of the traversal.
937
938         * NetworkProcess/cache/NetworkCache.cpp:
939         (WebKit::NetworkCache::Cache::traverse):
940
941 2019-05-01  Wenson Hsieh  <wenson_hsieh@apple.com>
942
943         [iOS] Add a version of viewport shrink-to-fit heuristics that preserves page layout
944         https://bugs.webkit.org/show_bug.cgi?id=197342
945         <rdar://problem/50063091>
946
947         Reviewed by Tim Horton.
948
949         This patch introduces a new shrink-to-fit heuristic that attempts to lay out the contents of the page at a
950         larger width in order to shrink content to fit the viewport. This is similar to existing shrink-to-fit behaviors
951         used for viewport sizing in multitasking mode, except that it not only scales the view, but additionally expands
952         the layout size, such that the overall layout of the page is preserved. In fact, the reason we ended up
953         reverting the existing flavor of shrink-to-fit in all cases except for multitasking was that page layout was not
954         preserved, which caused elements that poke out of the viewport to make the rest of the page look out of
955         proportion — see <rdar://problem/23818102> and related radars.
956
957         Covered by 5 new layout tests, and by adjusting a couple of existing layout tests. See comments below for more
958         details.
959
960         * Platform/Logging.h:
961
962         Add a new ViewportSizing logging channel. This will only log on pages that overflow the viewport and shrink to
963         fit as a result.
964
965         * Shared/WebPreferences.yaml:
966
967         Turn IgnoreViewportScalingConstraints off by default. This preference currently controls whether we allow
968         shrink-to-fit behaviors, and is only used by Safari when it is in multitasking mode. The value of this
969         preference is currenly *on* by default, and is turned off almost immediately during every page load after the
970         first visible content rect update, wherein visibleContentRectUpdateInfo.allowShrinkToFit() is false.
971
972         However, this sometimes causes a brief jitter during page load; to fix this, make the default value for
973         IgnoreViewportScalingConstraints false, and change the logic in WebPage::updateVisibleContentRects to
974         setCanIgnoreScalingConstraints to true if either the IgnoreViewportScalingConstraints preference (not only
975         affected by an internal debug switch) is true, or WKWebView SPI is used to enable the behavior.
976
977         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
978         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
979         (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad):
980
981         Add a new hook for WebFrameLoaderClient to call into WebPage when document load finishes. Also, tweak
982         dispatchDidFinishLoad to take a WebFrame& instead of a WebFrame* in a drive-by fix (the frame is assumed to be
983         non-null anyways).
984
985         * WebProcess/WebPage/WebPage.cpp:
986         (WebKit::WebPage::didCommitLoad):
987         (WebKit::WebPage::didFinishDocumentLoad):
988         (WebKit::WebPage::didFinishLoad):
989
990         When finishing document load or finishing the overall load, kick off the shrink-to-fit timer; when committing a
991         load, cancel the timer.
992
993         * WebProcess/WebPage/WebPage.h:
994         * WebProcess/WebPage/ios/WebPageIOS.mm:
995         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
996
997         Don't allow the minimum effective device width from the client to stomp over any minimum effective device width
998         set as a result of the new shrink-to-fit heuristic; on some pages that load quickly, this can result in a race
999         where the minimum effective device width (i.e. a value that lower-bounds the minimum layout width) is first set
1000         by the shrink-to-fit heuristic, and then set to an incorrect value by the client.
1001
1002         In the near future, web view SPI used to set the minimum effective device width should actually be removed
1003         altogether, since the new shrink-to-fit heuristic supersedes any need for the client to fiddle with the minimum
1004         effective device width.
1005
1006         (WebKit::WebPage::dynamicViewportSizeUpdate):
1007
1008         When performing a dynamic viewport size update, additionally re-run the shrink-to-fit heuristic. This allows
1009         the minimum layout size of the viewport to be updated, if necessary. An example of where this matters is when a
1010         web page is *below* a tablet/desktop layout breakpoint in portrait device orientation, but then exceeds this
1011         layout breakpoint in landscape orientation. In this scenario, rotating the device should swap between these two
1012         page layouts.
1013
1014         (WebKit::WebPage::resetViewportDefaultConfiguration):
1015         (WebKit::WebPage::scheduleShrinkToFitContent):
1016         (WebKit::WebPage::shrinkToFitContentTimerFired):
1017         (WebKit::WebPage::immediatelyShrinkToFitContent):
1018
1019         Leverage the existing capability for a viewport to have a "minimum effective device width" to grant the viewport
1020         a larger layout size than it would normally have, and then scale down to fit within the bounds of the view. One
1021         challenge with this overall approach is that laying out at a larger width may cause the page to lay out even
1022         wider in response, which may actually worsen horizontal scrolling. To mitigate this, we only attempt to lay out
1023         at the current content width once; if laying out at this width reduced the amount of horizontal scrolling by any
1024         amount, then proceed with this layout width; otherwise, revert to the previous layout width.
1025
1026         (WebKit::WebPage::shouldIgnoreMetaViewport const):
1027
1028         Pull some common logic out into a readonly getter.
1029
1030         (WebKit::WebPage::updateVisibleContentRects):
1031
1032         See the comment below WebPreferences.yaml, above.
1033
1034 2019-05-01  Dean Jackson  <dino@apple.com>
1035
1036         Link Previews that use WKImagePreviewViewController are not always scaled correctly
1037         https://bugs.webkit.org/show_bug.cgi?id=197450
1038         <rdar://problem/50357695>
1039
1040         Reviewed by Wenson Hsieh.
1041
1042         Tell the UIImageView that we create in WKImagePreviewViewController to use
1043         a filling scaling method.
1044
1045         * UIProcess/WKImagePreviewViewController.mm:
1046         (-[WKImagePreviewViewController initWithCGImage:defaultActions:elementInfo:]):
1047
1048 2019-05-01  Darin Adler  <darin@apple.com>
1049
1050         WebKit has too much of its own UTF-8 code and should rely more on ICU's UTF-8 support
1051         https://bugs.webkit.org/show_bug.cgi?id=195535
1052
1053         Reviewed by Alexey Proskuryakov.
1054
1055         * Shared/API/APIString.h: Removed uneeded includes and also switched to #pragma once.
1056
1057         * Shared/API/c/WKString.cpp: Moved include of UTF8Conversion.h here.
1058         (WKStringGetUTF8CStringImpl): Updated for changes to return values.
1059
1060 2019-05-01  Shawn Roberts  <sroberts@apple.com>
1061
1062         Unreviewed, rolling out r244821.
1063
1064         Causing
1065
1066         Reverted changeset:
1067
1068         "WebKit has too much of its own UTF-8 code and should rely
1069         more on ICU's UTF-8 support"
1070         https://bugs.webkit.org/show_bug.cgi?id=195535
1071         https://trac.webkit.org/changeset/244821
1072
1073 2019-05-01  Youenn Fablet  <youenn@apple.com>
1074
1075         Kept alive loaders should use the redirected request in case of redirections
1076         https://bugs.webkit.org/show_bug.cgi?id=197337
1077
1078         Reviewed by Alex Christensen.
1079
1080         Instead of using the request, the redirected request should be used in case of redirection.
1081
1082         * NetworkProcess/NetworkResourceLoader.cpp:
1083         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
1084         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
1085
1086 2019-04-29  Darin Adler  <darin@apple.com>
1087
1088         WebKit has too much of its own UTF-8 code and should rely more on ICU's UTF-8 support
1089         https://bugs.webkit.org/show_bug.cgi?id=195535
1090
1091         Reviewed by Alexey Proskuryakov.
1092
1093         * Shared/API/APIString.h: Removed uneeded includes and also switched to #pragma once.
1094
1095         * Shared/API/c/WKString.cpp: Moved include of UTF8Conversion.h here.
1096         (WKStringGetUTF8CStringImpl): Updated for changes to return values.
1097
1098 2019-04-30  Chris Dumez  <cdumez@apple.com>
1099
1100         Regression(PSON) URL scheme handlers can no longer respond asynchronously
1101         https://bugs.webkit.org/show_bug.cgi?id=197426
1102         <rdar://problem/50256169>
1103
1104         Reviewed by Brady Eidson.
1105
1106         The issue was that when committing the provisional process, we would call WebPageProxy::processDidTerminate()
1107         which would call WebPageProxy::stopAllURLSchemeTasks(). This would terminate all URL scheme tasks associated
1108         with the page, including the one associated with the provisisional page / process.
1109
1110         To address the issue, pass m_process to stopAllURLSchemeTasks() in processDidTerminate() and only stop the
1111         tasks associated with the m_process (which is the process we're about to swap away from).
1112
1113         * UIProcess/WebPageProxy.cpp:
1114         (WebKit::WebPageProxy::processDidTerminate):
1115         (WebKit::WebPageProxy::stopAllURLSchemeTasks):
1116         * UIProcess/WebPageProxy.h:
1117         * UIProcess/WebURLSchemeHandler.cpp:
1118         (WebKit::WebURLSchemeHandler::processForTaskIdentifier):
1119         (WebKit::WebURLSchemeHandler::stopAllTasksForPage):
1120         * UIProcess/WebURLSchemeHandler.h:
1121         * UIProcess/WebURLSchemeTask.h:
1122         (WebKit::WebURLSchemeTask::process const):
1123
1124 2019-04-30  John Wilander  <wilander@apple.com>
1125
1126         Add logging of Ad Click Attribution errors and events to a dedicated channel
1127         https://bugs.webkit.org/show_bug.cgi?id=197332
1128         <rdar://problem/49918800>
1129
1130         Reviewed by Youenn Fablet.
1131
1132         This patch adds an experimental Ad Click Attribution debug mode which
1133         logs information. Most changes are just log output in the various
1134         functions in WebKit::AdClickAttributionManager.
1135
1136         The constructor to WebKit::AdClickAttributionManager now takes a
1137         PAL::SessionID so that the log functions can make sure they don't
1138         output anything in ephemeral sessions.
1139
1140         WebProcessPool::platformInitializeNetworkProcess() now picks up the
1141         debug mode setting from the incoming
1142         WebKit::NetworkProcessCreationParameters object.
1143
1144         NetworkResourceLoader::handleAdClickAttributionConversion() was
1145         moved to AdClickAttributionManager::handleConversion() to keep all
1146         the logging in one file.
1147
1148         * NetworkProcess/AdClickAttributionManager.cpp:
1149         (WebKit::AdClickAttributionManager::storeUnconverted):
1150         (WebKit::AdClickAttributionManager::handleConversion):
1151         (WebKit::AdClickAttributionManager::convert):
1152         (WebKit::AdClickAttributionManager::fireConversionRequest):
1153         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
1154         (WebKit::AdClickAttributionManager::clearExpired):
1155         (WebKit::AdClickAttributionManager::debugModeEnabled const):
1156         * NetworkProcess/AdClickAttributionManager.h:
1157         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
1158         (WebKit::AdClickAttributionManager::m_sessionID):
1159         * NetworkProcess/NetworkProcess.cpp:
1160         (WebKit::NetworkProcess::initializeNetworkProcess):
1161         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1162         (WebKit::NetworkProcessCreationParameters::encode const):
1163         (WebKit::NetworkProcessCreationParameters::decode):
1164         * NetworkProcess/NetworkProcessCreationParameters.h:
1165         * NetworkProcess/NetworkResourceLoader.cpp:
1166         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
1167         (WebKit::NetworkResourceLoader::handleAdClickAttributionConversion): Deleted.
1168         * NetworkProcess/NetworkSession.cpp:
1169         (WebKit::NetworkSession::NetworkSession):
1170         (WebKit::NetworkSession::handleAdClickAttributionConversion):
1171         (WebKit::NetworkSession::convertAdClickAttribution): Deleted.
1172         * NetworkProcess/NetworkSession.h:
1173         * Platform/Logging.h:
1174         * Shared/WebPreferences.yaml:
1175         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1176         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1177
1178 2019-04-30  Devin Rousso  <drousso@apple.com>
1179
1180         Crash when running test wpt/tests/element_click/bubbling.py::test_element_disappears_during_click
1181         https://bugs.webkit.org/show_bug.cgi?id=197361
1182         <rdar://problem/49861407>
1183
1184         Reviewed by Brian Burg.
1185
1186         Don't assume that all elements have client rects (e.g. `getClientRects`). If the container
1187         element isn't visible, then the child won't be either.
1188
1189         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
1190         (WebKit::SimulatedInputDispatcher::resolveLocation):
1191         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
1192         * UIProcess/Automation/WebAutomationSession.cpp:
1193         (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
1194
1195 2019-04-30  Chris Dumez  <cdumez@apple.com>
1196
1197         Unreviewed, rolling out r244802.
1198
1199         Caused an API test failure
1200
1201         Reverted changeset:
1202
1203         "Regression(PSON) URL scheme handlers can no longer respond
1204         asynchronously"
1205         https://bugs.webkit.org/show_bug.cgi?id=197426
1206         https://trac.webkit.org/changeset/244802
1207
1208 2019-04-30  Chris Dumez  <cdumez@apple.com>
1209
1210         Regression(PSON) URL scheme handlers can no longer respond asynchronously
1211         https://bugs.webkit.org/show_bug.cgi?id=197426
1212         <rdar://problem/50256169>
1213
1214         Reviewed by Brady Eidson.
1215
1216         The issue was that when committing the provisional process, we would call WebPageProxy::processDidTerminate()
1217         which would call WebPageProxy::stopAllURLSchemeTasks(). This would terminate all URL scheme tasks associated
1218         with the page, including the one associated with the provisisional page / process.
1219
1220         To address the issue, pass m_process to stopAllURLSchemeTasks() in processDidTerminate() and only stop the
1221         tasks associated with the m_process (which is the process we're about to swap away from).
1222
1223         * UIProcess/WebPageProxy.cpp:
1224         (WebKit::WebPageProxy::processDidTerminate):
1225         (WebKit::WebPageProxy::stopAllURLSchemeTasks):
1226         * UIProcess/WebPageProxy.h:
1227         * UIProcess/WebURLSchemeHandler.cpp:
1228         (WebKit::WebURLSchemeHandler::processForTaskIdentifier):
1229         (WebKit::WebURLSchemeHandler::stopAllTasksForPage):
1230         * UIProcess/WebURLSchemeHandler.h:
1231         * UIProcess/WebURLSchemeTask.h:
1232         (WebKit::WebURLSchemeTask::process const):
1233
1234 2019-04-30  Chris Dumez  <cdumez@apple.com>
1235
1236         Only use a related page's process if that page has not been closed yet
1237         https://bugs.webkit.org/show_bug.cgi?id=197393
1238         <rdar://problem/50302423>
1239
1240         Reviewed by Tim Horton.
1241
1242         We should not attempt to use a related page's process if that related page has already been closed.
1243         Once closed, a page's process is invalid and trying to launch a new process for the closed page
1244         leads to crashes such as the one in the radar.
1245
1246         * UIProcess/WebPageProxy.cpp:
1247         (WebKit::WebPageProxy::launchProcess):
1248         * UIProcess/WebProcessPool.cpp:
1249         (WebKit::WebProcessPool::createWebPage):
1250
1251 2019-04-30  Tim Horton  <timothy_horton@apple.com>
1252
1253         Long-standing rare crash under -[WKWebView _web_immediateActionAnimationControllerForHitTestResultInternal...]
1254         https://bugs.webkit.org/show_bug.cgi?id=197404
1255         <rdar://problem/24589331>
1256
1257         Reviewed by Wenson Hsieh.
1258
1259         * UIProcess/mac/WKImmediateActionController.mm:
1260         (-[WKImmediateActionController _updateImmediateActionItem]):
1261         (-[WKImmediateActionController menuItem:previewItemAtPoint:]):
1262         (-[WKImmediateActionController menuItem:itemFrameForPoint:]):
1263         (-[WKImmediateActionController _animationControllerForDataDetectedLink]):
1264         Add some null checks; _webHitTestResult can be null if we (somehow) get
1265         an immediate action gesture without having previously gotten a
1266         mouseDidMoveOverElement from the Web Content process. Cover all our bases.
1267
1268 2019-04-30  Per Arne Vollan  <pvollan@apple.com>
1269
1270         [iOS] Fix crash caused by sandbox violation
1271         https://bugs.webkit.org/show_bug.cgi?id=197416
1272         <rdar://problem/50266257>
1273
1274         Reviewed by Brent Fulgham.
1275
1276         Add syscall to the iOS sandbox.
1277
1278         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1279
1280 2019-04-30  Zalan Bujtas  <zalan@apple.com>
1281
1282         [iOS] Double-tapping a post to like doesn't work on Instagram.com (needs 'dblclick' event)
1283         https://bugs.webkit.org/show_bug.cgi?id=197347
1284         <rdar://problem/49393423>
1285
1286         Reviewed by Wenson Hsieh.
1287
1288         This patch adds support for dispatching dblclick event as the result of the double tap gesture.
1289
1290         1. The new double tap gesture recognizer always fires regardless of what type of action the other, existing double gesture recognizers (double-tap to zoom) trigger.
1291         2. The dblclick event is dispatched on the node with registered dblclick event handler unless the node prohibits double tap gesture (touch-action != auto).
1292
1293         * UIProcess/WebPageProxy.h:
1294         * UIProcess/ios/WKContentViewInteraction.h:
1295         * UIProcess/ios/WKContentViewInteraction.mm:
1296         (-[WKContentView setupInteraction]):
1297         (-[WKContentView cleanupInteraction]):
1298         (-[WKContentView _removeDefaultGestureRecognizers]):
1299         (-[WKContentView _addDefaultGestureRecognizers]):
1300         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1301         (-[WKContentView gestureRecognizerShouldBegin:]):
1302         (-[WKContentView _doubleTapRecognizedForDoubleClick:]):
1303         * UIProcess/ios/WebPageProxyIOS.mm:
1304         (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
1305         * WebProcess/WebPage/WebPage.h:
1306         * WebProcess/WebPage/WebPage.messages.in:
1307         * WebProcess/WebPage/ios/WebPageIOS.mm:
1308         (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
1309
1310 2019-04-30  Antti Koivisto  <antti@apple.com>
1311
1312         Tighten type of ScrollingTree:rootNode() to ScrollingTreeFrameScrollingNode
1313         https://bugs.webkit.org/show_bug.cgi?id=197414
1314
1315         Reviewed by Frédéric Wang.
1316
1317         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1318
1319 2019-04-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1320
1321         REGRESSION(r244750): [GTK][WPE] Network process is crashing in all layout tests
1322         https://bugs.webkit.org/show_bug.cgi?id=197406
1323
1324         Reviewed by Žan Doberšek.
1325
1326         Do not trasnfer ownership of cachePath to traverseDirectory() lambda, since it's passed also as first argument
1327         and it can be passed as a reference.
1328
1329         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1330         (WebKit::NetworkCache::Storage::deleteOldVersions):
1331
1332 2019-04-29  Truitt Savell  <tsavell@apple.com>
1333
1334         Unreviewed, rolling out r244755.
1335
1336         Casued several test failures on iOS
1337
1338         Reverted changeset:
1339
1340         "Double-tapping a post to like doesn't work on Instagram.com
1341         (needs 'dblclick' event)"
1342         https://bugs.webkit.org/show_bug.cgi?id=197347
1343         https://trac.webkit.org/changeset/244755
1344
1345 2019-04-29  Chris Dumez  <cdumez@apple.com>
1346
1347         [iOS] The UIProcess may get killed for trying to stay runnable in the background for more than 30 seconds
1348         https://bugs.webkit.org/show_bug.cgi?id=197385
1349         <rdar://problem/50001505>
1350
1351         Reviewed by Geoffrey Garen.
1352
1353         If the UIProcess holds a background assertion for itself for 30 seconds, the assertion's invalidation handler
1354         will get called and it is our responsibility to release this assertion or the UIProcess will get killed by the
1355         system. The logic in ProcessAssertion would normally do that but it would also happily try and re-take another
1356         background process assertion shortly after the previous one expired (and before the UIProcess got suspended).
1357         When doing so, the new background assertion would expire right away and we would get killed without its
1358         invalidation handler getting called.
1359
1360         To address the issue, the logic in ProcessAssertion will now prevent taking a new background assertion after
1361         one expires and until the application becomes foreground again.
1362
1363         * UIProcess/ios/ProcessAssertionIOS.mm:
1364         (-[WKProcessAssertionBackgroundTaskManager init]):
1365         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
1366
1367 2019-04-29  Alex Christensen  <achristensen@webkit.org>
1368
1369         <rdar://problem/50299396> Fix internal High Sierra build
1370         https://bugs.webkit.org/show_bug.cgi?id=197388
1371
1372         * Configurations/Base.xcconfig:
1373
1374 2019-04-29  Zalan Bujtas  <zalan@apple.com>
1375
1376         [iOS] Double-tapping a post to like doesn't work on Instagram.com (needs 'dblclick' event)
1377         https://bugs.webkit.org/show_bug.cgi?id=197347
1378         <rdar://problem/49393423>
1379
1380         Reviewed by Wenson Hsieh.
1381
1382         This patch adds support for dispatching dblclick event as the result of the double tap gesture.
1383
1384         1. The new double tap gesture recognizer always fires regardless of what type of action the other, existing double gesture recognizers (double-tap to zoom) trigger.
1385         2. The dblclick event is dispatched on the node with registered dblclick event handler unless the node prohibits double tap gesture (touch-action != auto).
1386
1387         * UIProcess/WebPageProxy.h:
1388         * UIProcess/ios/WKContentViewInteraction.h:
1389         * UIProcess/ios/WKContentViewInteraction.mm:
1390         (-[WKContentView setupInteraction]):
1391         (-[WKContentView cleanupInteraction]):
1392         (-[WKContentView _removeDefaultGestureRecognizers]):
1393         (-[WKContentView _addDefaultGestureRecognizers]):
1394         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1395         (-[WKContentView gestureRecognizerShouldBegin:]):
1396         (-[WKContentView _doubleTapRecognizedForDoubleClick:]):
1397         * UIProcess/ios/WebPageProxyIOS.mm:
1398         (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
1399         * WebProcess/WebPage/WebPage.h:
1400         * WebProcess/WebPage/WebPage.messages.in:
1401         * WebProcess/WebPage/ios/WebPageIOS.mm:
1402         (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
1403
1404 2019-04-29  Tim Horton  <timothy_horton@apple.com>
1405
1406         REGRESSION (r244142): Fandango accounts tab crashes under Color()
1407         https://bugs.webkit.org/show_bug.cgi?id=197380
1408         <rdar://problem/50186175>
1409
1410         Reviewed by Megan Gardner.
1411
1412         * UIProcess/API/Cocoa/WKWebView.mm:
1413         (baseScrollViewBackgroundColor):
1414         We now call -_updateScrollViewBackground from -setBackgroundColor:.
1415         -setBackgroundColor: can be called from -[UIView initWithCoder:]; if it
1416         is, WKWebView's _page is not yet initialized, so we crash. Return an invalid color.
1417         Then, the caller falls back to WKContentView's backgroundColor. But WKContentView
1418         isn't initialized yet either. So add a further fallback.
1419
1420 2019-04-29  Dean Jackson  <dino@apple.com>
1421
1422         Add InteractionIsHappening to SuppressSelectionAssistantReason
1423         https://bugs.webkit.org/show_bug.cgi?id=197375
1424         <rdar://problem/50304986>
1425
1426         Reviewed by Megan Gardner.
1427
1428         Add a new reason for suppressing the selection assistant, to
1429         be used in a follow-up patch.
1430
1431         * UIProcess/ios/WKContentViewInteraction.h: Add InteractionIsHappening.
1432
1433 2019-04-29  Alex Christensen  <achristensen@webkit.org>
1434
1435         Storage::deleteOldVersions does not need to retain Storage
1436         https://bugs.webkit.org/show_bug.cgi?id=197336
1437         <rdar://problem/48679972>
1438
1439         Reviewed by Darin Adler.
1440
1441         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1442         (WebKit::NetworkCache::Storage::deleteOldVersions):
1443         Something is wrong with the lifetime of Storage, but we only need a String, not the whole Storage.
1444
1445 2019-04-29  Brent Fulgham  <bfulgham@apple.com>
1446
1447         [Cocoa] Move common sandbox files from Shared/mac to Shared/Cocoa
1448         https://bugs.webkit.org/show_bug.cgi?id=197376
1449         <rdar://problem/50305272>
1450
1451         Reviewed by Dean Jackson.
1452
1453         The Apple sandboxing logic currently lives in the inappropriate 'Shared/mac' directory. This is
1454         confusing because the code is used by all Apple ports, not just macOS.
1455
1456         This patch just moves the relevant files from 'Shared/mac' to 'Shared/Cocoa' to avoid this confusion.
1457
1458         * Shared/Cocoa/SandboxExtensionCocoa.mm: Renamed from Source/WebKit/Shared/mac/SandboxExtensionMac.mm.
1459         * Shared/Cocoa/SandboxInitialiationParametersCocoa.mm: Renamed from Source/WebKit/Shared/mac/SandboxInitialiationParametersMac.mm.
1460         * Shared/Cocoa/SandboxUtilities.h: Renamed from Source/WebKit/Shared/mac/SandboxUtilities.h.
1461         * Shared/Cocoa/SandboxUtilities.mm: Renamed from Source/WebKit/Shared/mac/SandboxUtilities.mm.
1462         * SourcesCocoa.txt:
1463         * WebKit.xcodeproj/project.pbxproj:
1464
1465 2019-04-29  Alexander Mikhaylenko  <exalm7659@gmail.com>
1466
1467         [GTK] Back/forward gesture snapshot always times out
1468         https://bugs.webkit.org/show_bug.cgi?id=197233
1469
1470         Reviewed by Michael Catanzaro.
1471
1472         Delaying web process launch caused a regression where we create ViewGestureController when the
1473         web process doesn't yet exist. The controller immediately tries to connect to it and fails,
1474         and because of that never receives DidHitRenderTreeSizeThreshold() message, so navigation
1475         snapshot always stays until timeout after performing the gesture.
1476
1477         To prevent this, create the controller in webkitWebViewBaseDidRelaunchWebProcess() instead of
1478         webkitWebViewBaseCreateWebPage(). Additionally, since settings are now created earlier than
1479         ViewGestureController, store the value of whether swipe gesture is enabled in WebKitWebViewBase
1480         and immediately apply it when creating the controller.
1481
1482         Since there is now a point where controller is null, make webkitWebViewBaseViewGestureController()
1483         return null and add null checks everywhere.
1484
1485         * UIProcess/API/glib/WebKitWebView.cpp:
1486         (enableBackForwardNavigationGesturesChanged):
1487         Move the logic into webkitWebViewBaseSetEnableBackForwardNavigationGesture().
1488         * UIProcess/API/gtk/PageClientImpl.cpp:
1489         (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): Add a null check.
1490         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1491         (webkitWebViewBaseDraw): Ditto.
1492         (webkitWebViewBaseScrollEvent): Ditto.
1493         (webkitWebViewBaseSetEnableBackForwardNavigationGesture): Added. In addition to what was in
1494         WebKitWebViewBase::enableBackForwardNavigationGesturesChanged(), store the value in a field
1495         for the case ViewGestureController doesn't exist yet.
1496         (webkitWebViewBaseViewGestureController): Return a pointer instead of reference.
1497         (webkitWebViewBaseCreateWebPage): Stop creating ViewGestureController.
1498         (webkitWebViewBaseDidRelaunchWebProcess): Move creating ViewGestureController here. Also
1499         immediately call setSwipeGestureEnabled() with the stored value.
1500         (webkitWebViewBaseDidStartProvisionalLoadForMainFrame): Add a null check.
1501         (webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame):Ditto.
1502         (webkitWebViewBaseDidFinishLoadForMainFrame): Ditto.
1503         (webkitWebViewBaseDidFailLoadForMainFrame): Ditto.
1504         (webkitWebViewBaseDidSameDocumentNavigationForMainFrame): Ditto.
1505         (webkitWebViewBaseDidRestoreScrollPosition): Ditto.
1506         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
1507
1508 2019-04-29  Chris Dumez  <cdumez@apple.com>
1509
1510         User-facing strings should use curly quotes instead of straight
1511         https://bugs.webkit.org/show_bug.cgi?id=197370
1512
1513         Reviewed by Geoffrey Garen.
1514
1515         Update localizable alert text that was recently added to use curly quotes instead of
1516         straight ones, as per our guidelines.
1517
1518         * UIProcess/Cocoa/WKOrientationAccessAlert.mm:
1519         (WebKit::presentOrientationAccessAlert):
1520         * UIProcess/Cocoa/WKStorageAccessAlert.mm:
1521         (WebKit::presentStorageAccessAlert):
1522
1523 2019-04-29  Alex Christensen  <achristensen@webkit.org>
1524
1525         Build fix.
1526
1527         * UIProcess/ios/WKActionSheet.mm:
1528         (-[WKActionSheet updateSheetPosition]):
1529
1530 2019-04-29  Commit Queue  <commit-queue@webkit.org>
1531
1532         Unreviewed, rolling out r244648.
1533         https://bugs.webkit.org/show_bug.cgi?id=197363
1534
1535          Lots of tests  are crashing (Requested by KaL on #webkit).
1536
1537         Reverted changeset:
1538
1539         "[GTK] Back/forward gesture snapshot always times out"
1540         https://bugs.webkit.org/show_bug.cgi?id=197233
1541         https://trac.webkit.org/changeset/244648
1542
1543 2019-04-29  Michael Catanzaro  <mcatanzaro@igalia.com>
1544
1545         [WPE][GTK] window-object-cleared documentation should reference webkit_frame_get_js_context_for_script_world()
1546         https://bugs.webkit.org/show_bug.cgi?id=197357
1547
1548         Reviewed by Carlos Garcia Campos.
1549
1550         We should recommend using the non-deprecated replacement for
1551         webkit_frame_get_javascript_context_for_script_world().
1552
1553         * WebProcess/InjectedBundle/API/glib/WebKitScriptWorld.cpp:
1554
1555 2019-04-27  Chris Dumez  <cdumez@apple.com>
1556
1557         Improve safety of MachMessage class
1558         https://bugs.webkit.org/show_bug.cgi?id=197323
1559         <rdar://problem/44291920>
1560
1561         Reviewed by Darin Adler.
1562
1563         Improve safety of MachMessage class and clean things up a bit.
1564
1565         * Platform/IPC/mac/ConnectionMac.mm:
1566         (IPC::Connection::sendOutgoingMessage):
1567         - Pass MessageReceiverName / MessageName when constructing the MachMessage rather
1568           than setting them afterwards since they never change for a given MachMessage.
1569         - Set header->msgh_id to the right value right away instead of setting it first
1570           to inlineBodyMessageID and then later fixing it to be outOfLineBodyMessageID
1571           when the body is out of line.
1572         - When messageBodyIsOOL was true, we would call getDescriptorAndSkip() which
1573           would advance the pointer by sizeof(mach_msg_port_descriptor_t), even though
1574           the descriptor type is mach_msg_ool_descriptor_t. This would not matter in
1575           the end because we would not use the messageData pointer after this but
1576           still.
1577
1578         * Platform/IPC/mac/MachMessage.cpp:
1579         (IPC::MachMessage::create):
1580         Use fastZeroedMalloc() instead of fastMalloc() for safety, given that this class
1581         has a mach_msg_header_t flexible array member. This is what is recommended by the
1582         mach documentation. It is much safer because it otherwize relies on the user
1583         (Connection::sendOutgoingMessage()) to initialize ALL the message members
1584         correctly. I suspect this was the cause of <rdar://problem/44291920> because
1585         Connection::sendOutgoingMessage() would fail to initialize header->msgh_voucher_port
1586         and the MachMessage destructor would then call mach_msg_destroy(header()), which
1587         would mach_msg_destroy_port(header->msgh_voucher_port).
1588
1589         (IPC::MachMessage::MachMessage):
1590         Pass MessageReceiverName / MessageName when constructing the MachMessage rather
1591         than setting them afterwards since they never change for a given MachMessage.
1592
1593         (IPC::MachMessage::messageSize):
1594         Drop if checks for portDescriptorCount and memoryDescriptorCount since the logic
1595         will do the right thing even if they are 0.
1596
1597         * Platform/IPC/mac/MachMessage.h:
1598         (IPC::MachMessage::header):
1599         (IPC::MachMessage::messageReceiverName const):
1600         (IPC::MachMessage::messageName const):
1601
1602 2019-04-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1603
1604         Rename m_LayerTreeFreezeReasons to m_layerTreeFreezeReasons
1605         https://bugs.webkit.org/show_bug.cgi?id=197343
1606
1607         Reviewed by Antti Koivisto.
1608
1609         No change in behavior.
1610
1611         * WebProcess/WebPage/WebPage.cpp:
1612         (WebKit::WebPage::freezeLayerTree):
1613         (WebKit::WebPage::unfreezeLayerTree):
1614         (WebKit::WebPage::updateDrawingAreaLayerTreeFreezeState):
1615         * WebProcess/WebPage/WebPage.h:
1616
1617 2019-04-26  Keith Rollin  <krollin@apple.com>
1618
1619         Enable new build rule for post-processing headers when using XCBuild
1620         https://bugs.webkit.org/show_bug.cgi?id=197340
1621         <rdar://problem/50226685>
1622
1623         Reviewed by Brent Fulgham.
1624
1625         In Bug 197116, we conditionally disabled the old method for
1626         post-processing header files when we are using the new XCBuild build
1627         system. This check-in conditionally enables the new post-processing
1628         facility. Note that the old system is disabled and the new system
1629         enabled only when the USE_NEW_BUILD_SYSTEM environment variable is set
1630         to YES.
1631
1632         * Configurations/WebKit.xcconfig:
1633
1634 2019-04-26  Jessie Berlin  <jberlin@webkit.org>
1635
1636         Add new mac target numbers
1637         https://bugs.webkit.org/show_bug.cgi?id=197313
1638
1639         Reviewed by Alex Christensen.
1640
1641         * Configurations/Version.xcconfig:
1642         * Configurations/WebKitTargetConditionals.xcconfig:
1643
1644 2019-04-26  Youenn Fablet  <youenn@apple.com>
1645
1646         Use kDNSServiceFlagsKnownUnique to speed up mdns name registration for ICE candidates
1647         https://bugs.webkit.org/show_bug.cgi?id=197328
1648
1649         Reviewed by Eric Carlson.
1650
1651         This allows skipping the probing step of MDNS name registration.
1652         We can do that as registered names are random UUIDs.
1653
1654         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
1655         (WebKit::NetworkMDNSRegister::registerMDNSName):
1656
1657 2019-04-26  Chris Dumez  <cdumez@apple.com>
1658
1659         [iOS] Our process assertion should not allow idle sleep
1660         https://bugs.webkit.org/show_bug.cgi?id=197317
1661         <rdar://problem/50137740>
1662
1663         Reviewed by Geoffrey Garen.
1664
1665         Our process assertion should not allow idle sleep. This is bad for power because the device
1666         may switch between sleep and awake state frequently, as it get woken up by network packages.
1667
1668         * UIProcess/ios/ProcessAssertionIOS.mm:
1669
1670 2019-04-26  Eric Carlson  <eric.carlson@apple.com>
1671
1672         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
1673         https://bugs.webkit.org/show_bug.cgi?id=197171
1674         <rdar://problem/47454979>
1675
1676         Reviewed by Youenn Fablet.
1677
1678         * Shared/ios/WebIconUtilities.mm:
1679         (WebKit::iconForVideoFile):
1680         * Shared/mac/WebCoreArgumentCodersMac.mm:
1681         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
1682         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
1683         * UIProcess/Cocoa/UIDelegate.mm:
1684         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
1685         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
1686         (WebKit::PlatformCALayerRemoteCustom::clone const):
1687
1688 2019-04-26  Commit Queue  <commit-queue@webkit.org>
1689
1690         Unreviewed, rolling out r244683.
1691         https://bugs.webkit.org/show_bug.cgi?id=197320
1692
1693         Causing crash on iOS Simulator and EWS failures (Requested by
1694         sroberts on #webkit).
1695
1696         Reverted changeset:
1697
1698         "[iOS] Add internal setting to force -webkit-text-size-adjust
1699         to "auto""
1700         https://bugs.webkit.org/show_bug.cgi?id=197275
1701         https://trac.webkit.org/changeset/244683
1702
1703 2019-04-26  Youenn Fablet  <youenn@apple.com>
1704
1705         Use normal loading path for ping loads
1706         https://bugs.webkit.org/show_bug.cgi?id=196807
1707
1708         Reviewed by Alex Christensen.
1709
1710         In case a NetworkResourceLoader has the keepAlive option we do the following:
1711         - Always use NetworkLoadChecker as we might need it to do checks after the Web context is gone.
1712         - In case of aborting a KeepAlive loader, remove it from NetworkConnectionToWebProcess map
1713         and add it to a kept-alive NetworkSession load set. The loader is only kept alive if it
1714         has not yet received a response. Mark the loader as kept-alive.
1715         - In case loader is kept-alive, cancel the load as soon as a response is gathered.
1716
1717         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1718         (WebKit::NetworkConnectionToWebProcess::transferKeptAliveLoad):
1719         * NetworkProcess/NetworkConnectionToWebProcess.h:
1720         * NetworkProcess/NetworkProcess.cpp:
1721         (WebKit::NetworkProcess::addKeptAliveLoad):
1722         (WebKit::NetworkProcess::removeKeptAliveLoad):
1723         * NetworkProcess/NetworkProcess.h:
1724         * NetworkProcess/NetworkResourceLoadMap.cpp:
1725         (WebKit::NetworkResourceLoadMap::remove):
1726         (WebKit::NetworkResourceLoadMap::take):
1727         * NetworkProcess/NetworkResourceLoadMap.h:
1728         * NetworkProcess/NetworkResourceLoader.cpp:
1729         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
1730         (WebKit::NetworkResourceLoader::cleanup):
1731         (WebKit::NetworkResourceLoader::abort):
1732         (WebKit::NetworkResourceLoader::didReceiveResponse):
1733         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
1734         * NetworkProcess/NetworkResourceLoader.h:
1735         * WebProcess/Network/WebLoaderStrategy.cpp:
1736         (WebKit::maximumBufferingTime):
1737         (WebKit::WebLoaderStrategy::usePingLoad const):
1738         * WebProcess/Network/WebLoaderStrategy.h:
1739
1740 2019-04-26  Alex Christensen  <achristensen@webkit.org>
1741
1742         Fix internal High Sierra build after r244653
1743         https://bugs.webkit.org/show_bug.cgi?id=197131
1744
1745         * DerivedSources.make:
1746         -std=gnu++17 didn't exist yet.  -std=gnu++1z did.
1747
1748 2019-04-26  Alex Christensen  <achristensen@webkit.org>
1749
1750         Fix an internal High Sierra build after r244653
1751        ​https://bugs.webkit.org/show_bug.cgi?id=197131
1752
1753         * DerivedSources.make:
1754         Apparently we can't use gnu++17 when preprocessing Platform.h in the makefile.
1755
1756 2019-04-26  Sihui Liu  <sihui_liu@apple.com>
1757
1758         Stop IDB transactions to release locked database files when network process is ready to suspend
1759         https://bugs.webkit.org/show_bug.cgi?id=196372
1760         <rdar://problem/48930116>
1761
1762         Reviewed by Brady Eidson.
1763
1764         * NetworkProcess/NetworkProcess.cpp:
1765         (WebKit::NetworkProcess::processWillSuspendImminently):
1766         (WebKit::NetworkProcess::prepareToSuspend):
1767         (WebKit::NetworkProcess::resume):
1768
1769 2019-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
1770
1771         [iOS] Add internal setting to force -webkit-text-size-adjust to "auto"
1772         https://bugs.webkit.org/show_bug.cgi?id=197275
1773         <rdar://problem/50211019>
1774
1775         Reviewed by Simon Fraser.
1776
1777         * Shared/WebPreferences.yaml:
1778         * UIProcess/WebPreferences.h:
1779
1780 2019-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
1781
1782         [iOS] Implement idempotent mode for text autosizing
1783         https://bugs.webkit.org/show_bug.cgi?id=197250
1784         <rdar://problem/50211034>
1785
1786         Reviewed by Jon Lee.
1787
1788         Push the initial scale down into the page.
1789
1790         * WebProcess/WebPage/ios/WebPageIOS.mm:
1791         (WebKit::WebPage::dynamicViewportSizeUpdate):
1792         (WebKit::WebPage::viewportConfigurationChanged):
1793
1794 2019-04-25  Alex Christensen  <achristensen@webkit.org>
1795
1796         Make NetworkCache blobs safe for mmap instead of not using blobs
1797         https://bugs.webkit.org/show_bug.cgi?id=197264
1798         <rdar://problem/49564348>
1799
1800         Reviewed by Antti Koivisto.
1801
1802         This does what r244597 did for WKContentRuleLists but for the NetworkCache's blobs.
1803         Those are the two cases where we were calling mmap and seeing crashes in apps with
1804         default file protection of NSFileProtectionComplete.
1805
1806         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
1807         (WebKit::NetworkCache::BlobStorage::add):
1808         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
1809         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath): Deleted.
1810         * NetworkProcess/cache/NetworkCacheFileSystem.h:
1811         * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm:
1812         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
1813         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1814         (WebKit::NetworkCache::Storage::Storage):
1815         (WebKit::NetworkCache::Storage::synchronize):
1816         (WebKit::NetworkCache::Storage::mayContainBlob const):
1817         (WebKit::NetworkCache::Storage::shouldStoreBodyAsBlob):
1818         (WebKit::NetworkCache::estimateRecordsSize): Deleted.
1819         * NetworkProcess/cache/NetworkCacheStorage.h:
1820
1821 2019-04-25  Simon Fraser  <simon.fraser@apple.com>
1822
1823         REGRESSION (r234330): 3 legacy-animation-engine/compositing tests are flaky failures
1824         https://bugs.webkit.org/show_bug.cgi?id=188357
1825         <rdar://problem/42986633>
1826
1827         Reviewed by Dean Jackson.
1828         
1829         DumpRenderTree had no code that set page.setCompositingPolicyOverride() to Normal, so some
1830         tests would fall into low memory mode and have different behavior.
1831         
1832         Fix by moving the code that calls setCompositingPolicyOverride(Normal) from the WK2 layer
1833         to Internals, so it's shared by DRT and WTR.
1834         
1835         We no longer need the WK2 C SPI glue.
1836
1837         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1838         (WKBundlePageSetEventThrottlingBehaviorOverride):
1839         (WKBundlePageSetCompositingPolicyOverride): Deleted.
1840         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
1841
1842 2019-04-25  Chris Dumez  <cdumez@apple.com>
1843
1844         Trying to load a main resource outside the sandbox should not crash the WebContent process
1845         https://bugs.webkit.org/show_bug.cgi?id=197299
1846         <rdar://problem/49808042>
1847
1848         Reviewed by Geoffrey Garen.
1849
1850         Trying to load a main resource outside the sandbox should not crash the WebContent process. We should
1851         simply ignore the load and log an error message.
1852
1853         * UIProcess/WebPageProxy.cpp:
1854         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1855
1856 2019-04-25  Timothy Hatcher  <timothy@apple.com>
1857
1858         Only send a synthetic mouse out event if synthetic mouse move events were sent.
1859         https://bugs.webkit.org/show_bug.cgi?id=197295
1860         rdar://problem/49040233
1861
1862         Reviewed by Zalan Bujtas.
1863
1864         * WebProcess/WebPage/ios/WebPageIOS.mm:
1865         (WebKit::WebPage::completeSyntheticClick):
1866
1867 2019-04-25  Timothy Hatcher  <timothy@apple.com>
1868
1869         Disable date and time inputs on iOSMac.
1870         https://bugs.webkit.org/show_bug.cgi?id=197287
1871         rdar://problem/46794376
1872
1873         Reviewed by Wenson Hsieh.
1874
1875         * Configurations/FeatureDefines.xcconfig:
1876
1877 2019-04-25  Brady Eidson  <beidson@apple.com>
1878
1879         REGRESSION (243388): WebProcess::shouldFreezeOnSuspension() decision is flipped
1880         <rdar://problem/49755494> and https://bugs.webkit.org/show_bug.cgi?id=197284
1881
1882         Reviewed by Chris Dumez.
1883
1884         * WebProcess/cocoa/WebProcessCocoa.mm:
1885         (WebKit::WebProcess::shouldFreezeOnSuspension const): If any non-suspended pages are in the process it should
1886           be eligible. Only if all pages are suspended should it be jetsam-able.
1887
1888 2019-04-25  Alex Christensen  <achristensen@webkit.org>
1889
1890         Start using C++17
1891         https://bugs.webkit.org/show_bug.cgi?id=197131
1892
1893         Reviewed by Darin Adler.
1894
1895         * Configurations/Base.xcconfig:
1896         * DerivedSources.make:
1897
1898 2019-04-25  Alexander Mikhaylenko  <exalm7659@gmail.com>
1899
1900         [GTK] Back/Forward gesture interferes with scrolling
1901         https://bugs.webkit.org/show_bug.cgi?id=197168
1902
1903         Reviewed by Michael Catanzaro.
1904
1905         When the gesture is released with 0 velocity close to an edge of the webview,
1906         the finishing animation is way too long, and in some cases it can look like the
1907         gesture is already over, when it's still animating. By scrolling vertically while
1908         that happens, it's possible to reset animation over and over again.
1909
1910         To reduce the duration in this case, instead of using maximum possible duration
1911         (400ms), introduce a base velocity and use it for calculating the duration if
1912         the actual velocity, relative to the end point, is equal to or less than 0.
1913
1914         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
1915         (WebKit::ViewGestureController::SwipeProgressTracker::startAnimation):
1916
1917 2019-04-25  Alexander Mikhaylenko  <exalm7659@gmail.com>
1918
1919         [GTK] Back/forward gesture snapshot always times out
1920         https://bugs.webkit.org/show_bug.cgi?id=197233
1921
1922         Reviewed by Michael Catanzaro.
1923
1924         Delaying web process launch caused a regression where we create ViewGestureController when the
1925         web process doesn't yet exist. The controller immediately tries to connect to it and fails,
1926         and because of that never receives DidHitRenderTreeSizeThreshold() message, so navigation
1927         snapshot always stays until timeout after performing the gesture.
1928
1929         To prevent this, create the controller in webkitWebViewBaseDidRelaunchWebProcess() instead of
1930         webkitWebViewBaseCreateWebPage(). Additionally, since settings are now created earlier than
1931         ViewGestureController, store the value of whether swipe gesture is enabled in WebKitWebViewBase
1932         and immediately apply it when creating the controller.
1933
1934         * UIProcess/API/glib/WebKitWebView.cpp:
1935         (enableBackForwardNavigationGesturesChanged):
1936         Move the logic into webkitWebViewBaseSetEnableBackForwardNavigationGesture().
1937         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1938         (webkitWebViewBaseSetEnableBackForwardNavigationGesture): Added. In addition to what was in
1939         WebKitWebViewBase::enableBackForwardNavigationGesturesChanged(), store the value in a field
1940         for the case ViewGestureController doesn't exist yet.
1941         (webkitWebViewBaseCreateWebPage): Stop creating ViewGestureController.
1942         (webkitWebViewBaseDidRelaunchWebProcess): Move creating ViewGestureController here. Also
1943         immediately call setSwipeGestureEnabled() with the stored value.
1944         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
1945
1946 2019-04-25  Youenn Fablet  <youenn@apple.com>
1947
1948         [Mac iOS WK2] Layout Test http/wpt/cache-storage/cache-quota-after-restart.any.html is a flaky failure
1949         https://bugs.webkit.org/show_bug.cgi?id=197040
1950         <rdar://problem/49997641>
1951
1952         Reviewed by Antti Koivisto.
1953
1954         Delay write operations in case synchronize is ongoing.
1955         This is restricted to AvoidRandomness mode which is always used by CacheAPI
1956         and is also used by network cache for layout tests.
1957
1958         Tested by cache-quota-after-restart.any.html no longer exhibiting write disk errors.
1959
1960         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1961         (WebKit::NetworkCache::Storage::synchronize):
1962         (WebKit::NetworkCache::Storage::store):
1963
1964 2019-04-25  Commit Queue  <commit-queue@webkit.org>
1965
1966         Unreviewed, rolling out r244627.
1967         https://bugs.webkit.org/show_bug.cgi?id=197282
1968
1969         Causing internal build failures (Requested by ShawnRoberts on
1970         #webkit).
1971
1972         Reverted changeset:
1973
1974         "Create AVFoundationSoftLink.{h,mm} to reduce duplicate code"
1975         https://bugs.webkit.org/show_bug.cgi?id=197171
1976         https://trac.webkit.org/changeset/244627
1977
1978 2019-04-24  Carlos Garcia Campos  <cgarcia@igalia.com>
1979
1980         [GTK] Hardcoded text color in input fields
1981         https://bugs.webkit.org/show_bug.cgi?id=126907
1982
1983         Reviewed by Michael Catanzaro.
1984
1985         Implement PageClient::effectiveAppearanceIsDark() for GTK port.
1986
1987         * UIProcess/API/gtk/PageClientImpl.cpp:
1988         (WebKit::PageClientImpl::effectiveAppearanceIsDark const): Check if gtk-application-prefer-dark-theme setting is
1989         enabled, or the theme name contains the -dark suffix or the GTK_THEME environment variable contains the :dark suffix.
1990         * UIProcess/API/gtk/PageClientImpl.h:
1991         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1992         (themeChanged): Notify the WebPageProxy that the theme has changed.
1993         (webkitWebViewBaseSetToplevelOnScreenWindow): Connect to notify::gtk-application-prefer-dark-theme and notify::gtk-theme-name.
1994         * WebProcess/WebPage/WebPage.cpp:
1995         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1996         (WebKit::WebPage::setUseDarkAppearance): Set gtk-application-prefer-dark-theme setting accordingly.
1997
1998 2019-04-24  Zalan Bujtas  <zalan@apple.com>
1999
2000         Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
2001         https://bugs.webkit.org/show_bug.cgi?id=196948
2002         <rdar://problem/49927131>
2003
2004         Reviewed by Tim Horton.
2005
2006         Move intrinsicContentSizeDidChange out of DrawingArea. Intrinsic content size is a layout concept and
2007         after r244291 there's no reason to have it in DrawingArea.
2008
2009         * UIProcess/DrawingAreaProxy.h:
2010         (WebKit::DrawingAreaProxy::didUpdateGeometry):
2011         (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
2012         * UIProcess/DrawingAreaProxy.messages.in:
2013         * UIProcess/WebPageProxy.cpp:
2014         (WebKit::WebPageProxy::didChangeIntrinsicContentSize):
2015         (WebKit::WebPageProxy::setViewLayoutSize):
2016         * UIProcess/WebPageProxy.h:
2017         * UIProcess/WebPageProxy.messages.in:
2018         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
2019         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2020         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
2021         * UIProcess/mac/WebPageProxyMac.mm:
2022         (WebKit::WebPageProxy::intrinsicContentSizeDidChange): Deleted.
2023         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2024         (WebKit::WebChromeClient::intrinsicContentsSizeChanged const):
2025         * WebProcess/WebCoreSupport/WebChromeClient.h:
2026         * WebProcess/WebPage/WebPage.cpp:
2027         (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded):
2028         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
2029         * WebProcess/WebPage/WebPage.h:
2030         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2031         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2032         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
2033         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded): Deleted.
2034
2035 2019-04-24  Commit Queue  <commit-queue@webkit.org>
2036
2037         Unreviewed, rolling out r244228.
2038         https://bugs.webkit.org/show_bug.cgi?id=197262
2039
2040         Causes compat issues (Requested by smfr on #webkit).
2041
2042         Reverted changeset:
2043
2044         "Unreviewed test gardening for Windows."
2045         https://trac.webkit.org/changeset/244228
2046
2047 2019-04-24  Eric Carlson  <eric.carlson@apple.com>
2048
2049         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
2050         https://bugs.webkit.org/show_bug.cgi?id=197171
2051         <rdar://problem/47454979>
2052
2053         Reviewed by Youenn Fablet.
2054
2055         * Shared/ios/WebIconUtilities.mm:
2056         (WebKit::iconForVideoFile):
2057         * Shared/mac/WebCoreArgumentCodersMac.mm:
2058         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
2059         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
2060         * UIProcess/Cocoa/UIDelegate.mm:
2061         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
2062         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
2063         (WebKit::PlatformCALayerRemoteCustom::clone const):
2064
2065 2019-04-24  Per Arne Vollan  <pvollan@apple.com>
2066
2067         [macOS] Fix syscall sandbox violation
2068         https://bugs.webkit.org/show_bug.cgi?id=197247
2069         <rdar://problem/50026580>
2070
2071         Reviewed by Brent Fulgham.
2072
2073         A missing syscall in the sandbox of the WebContent process is causing a crash.
2074
2075         * WebProcess/com.apple.WebProcess.sb.in:
2076
2077 2019-04-24  John Wilander  <wilander@apple.com>
2078
2079         Age out unconverted Ad Click Attributions after one week.
2080         https://bugs.webkit.org/show_bug.cgi?id=197238
2081         <rdar://problem/50177349>
2082
2083         Reviewed by Chris Dumez.
2084
2085         AdClickAttributionManager::storeUnconverted() and
2086         AdClickAttributionManager::convert() now start by calling the new
2087         AdClickAttributionManager::clearExpired() function to remove any
2088         expired, unconverted attributions before continuing.
2089
2090         The rest of the patch is infrastructure to allow tests to expire
2091         all unconverted attributions early.
2092
2093         * NetworkProcess/AdClickAttributionManager.cpp:
2094         (WebKit::AdClickAttributionManager::storeUnconverted):
2095         (WebKit::AdClickAttributionManager::convert):
2096         (WebKit::AdClickAttributionManager::clearExpired):
2097         (WebKit::AdClickAttributionManager::markAllUnconvertedAsExpiredForTesting):
2098         * NetworkProcess/AdClickAttributionManager.h:
2099         * NetworkProcess/NetworkProcess.cpp:
2100         (WebKit::NetworkProcess::markAdClickAttributionsAsExpiredForTesting):
2101         * NetworkProcess/NetworkProcess.h:
2102         * NetworkProcess/NetworkProcess.messages.in:
2103         * NetworkProcess/NetworkSession.cpp:
2104         (WebKit::NetworkSession::markAdClickAttributionsAsExpiredForTesting):
2105         * NetworkProcess/NetworkSession.h:
2106         * UIProcess/API/C/WKPage.cpp:
2107         (WKPageSetAdClickAttributionConversionURLForTesting):
2108         (WKPageMarkAdClickAttributionsAsExpiredForTesting):
2109         * UIProcess/API/C/WKPagePrivate.h:
2110         * UIProcess/WebPageProxy.cpp:
2111         (WebKit::WebPageProxy::markAdClickAttributionsAsExpiredForTesting):
2112         * UIProcess/WebPageProxy.h:
2113
2114 2019-04-24  Wenson Hsieh  <wenson_hsieh@apple.com>
2115
2116         Plumb the navigation's request when determining recommended compatibility mode
2117         https://bugs.webkit.org/show_bug.cgi?id=197225
2118         <rdar://problem/48389965>
2119
2120         Reviewed by Alex Christensen.
2121
2122         Adds a new argument to effectiveCompatibilityModeAfterAdjustingPolicies.
2123
2124         * UIProcess/WebPageProxy.cpp:
2125         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2126         (WebKit::WebPageProxy::effectiveCompatibilityModeAfterAdjustingPolicies):
2127         * UIProcess/WebPageProxy.h:
2128
2129 2019-04-24  Tim Horton  <timothy_horton@apple.com>
2130
2131         Clean up WKActionSheetAssistant's use of LaunchServices
2132         https://bugs.webkit.org/show_bug.cgi?id=194645
2133         <rdar://problem/47707952>
2134
2135         Reviewed by Andy Estes.
2136
2137         * UIProcess/ios/WKActionSheetAssistant.mm:
2138         (applicationHasAppLinkEntitlements):
2139         (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]):
2140         (-[WKActionSheetAssistant _appendOpenActionsForURL:actions:elementInfo:]):
2141         (appLinkForURL): Deleted.
2142         Make this function much more early-returny and flat.
2143         Adopt LS sync SPI instead of using a semaphore ourselves.
2144         Adopt modern open SPI.
2145
2146 2019-04-24  Simon Fraser  <simon.fraser@apple.com>
2147
2148         Make it possible to control the renderTreeAsText output by setting options on testRunner
2149         https://bugs.webkit.org/show_bug.cgi?id=197133
2150
2151         Reviewed by Sam Weinig.
2152
2153         Add testRunner.setRenderTreeDumpOptions() and expose the subset of RenderAsTextFlag flags
2154         that make sense in testing (those that don't dump unstable data like addresses), and plumb
2155         these flags through the various framework layers.
2156
2157         Convert RenderAsTextBehavior to an OptionSet<RenderAsTextFlag>.
2158
2159         Fix code generation in WebKitTestRunner to generate bindings for IDL const values,
2160         and hand-code DumpRenderTree bindings.
2161
2162         Some cleanup of the TestRunners, using member initializers.
2163
2164         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2165         (WKBundlePageCopyRenderTreeExternalRepresentation):
2166         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
2167         * WebProcess/WebPage/WebPage.cpp:
2168         (WebKit::toRenderAsTextFlags):
2169         (WebKit::WebPage::renderTreeExternalRepresentation const):
2170         (WebKit::WebPage::renderTreeExternalRepresentationForPrinting const):
2171         * WebProcess/WebPage/WebPage.h:
2172
2173 2019-04-24  Alex Christensen  <achristensen@webkit.org>
2174
2175         WKContentRuleLists should have a maximum FileProtection of CompleteUnlessOpen
2176         https://bugs.webkit.org/show_bug.cgi?id=197078
2177         <rdar://problem/49564348>
2178
2179         Reviewed by Geoff Garen.
2180
2181         r242735 was a fix for crashes when using mmap'd memory in apps with default FileProtection of NSFileProtectionComplete.
2182         It is more memory efficient and just as secure to reduce the FileProtection of these files to NSFileProtectionCompleteUnlessOpen.
2183
2184         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
2185         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
2186         (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath):
2187         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting): Deleted.
2188         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting): Deleted.
2189         * NetworkProcess/cache/NetworkCacheFileSystem.h:
2190         * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm: Added.
2191         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
2192         (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath):
2193         * Shared/WebCompiledContentRuleList.cpp:
2194         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
2195         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
2196         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
2197         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
2198         (WebKit::WebCompiledContentRuleList::actions const):
2199         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const): Deleted.
2200         * Shared/WebCompiledContentRuleList.h:
2201         * Shared/WebCompiledContentRuleListData.cpp:
2202         (WebKit::WebCompiledContentRuleListData::encode const):
2203         (WebKit::WebCompiledContentRuleListData::decode):
2204         (WebKit::WebCompiledContentRuleListData::size const): Deleted.
2205         (WebKit::WebCompiledContentRuleListData::dataPointer const): Deleted.
2206         * Shared/WebCompiledContentRuleListData.h:
2207         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
2208         * SourcesCocoa.txt:
2209         * UIProcess/API/APIContentRuleList.cpp:
2210         (API::ContentRuleList::usesCopiedMemory const): Deleted.
2211         * UIProcess/API/APIContentRuleList.h:
2212         * UIProcess/API/APIContentRuleListStore.cpp:
2213         (API::openAndMapOrCopyContentRuleList):
2214         (API::compiledToFile):
2215         (API::createExtension):
2216         (API::ContentRuleListStore::getContentRuleListSource):
2217         (API::ContentRuleListStore::readContentsOfFile): Deleted.
2218         (API::MappedOrCopiedData::dataPointer const): Deleted.
2219         * UIProcess/API/APIContentRuleListStore.h:
2220         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
2221         (API::ContentRuleListStore::readContentsOfFile): Deleted.
2222         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
2223         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]): Deleted.
2224         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
2225         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
2226         (-[_WKUserContentFilter usesCopiedMemory]): Deleted.
2227         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
2228         * WebKit.xcodeproj/project.pbxproj:
2229
2230 2019-04-24  David Kilzer  <ddkilzer@apple.com>
2231
2232         Fix build due to missing SPI declaration of kAXSFullKeyboardAccessEnabledNotification
2233
2234         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm: Import
2235         AccessibilitySupportSPI.h.
2236
2237 2019-04-24  Chris Dumez  <cdumez@apple.com>
2238
2239         URL set by document.open() is communicated with the WebPageProxy but not the WebFrameProxy
2240         https://bugs.webkit.org/show_bug.cgi?id=197214
2241         <rdar://problem/49237544>
2242
2243         Reviewed by Alex Christensen.
2244
2245         URL set by document.open() is communicated with the WebPageProxy (since r244361) but not the
2246         WebFrameProxy. This patch fixes this.
2247
2248         * UIProcess/API/Cocoa/WKWebView.mm:
2249         (-[WKWebView _mainFrameURL]):
2250         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2251         * UIProcess/FrameLoadState.cpp:
2252         (WebKit::FrameLoadState::didExplicitOpen):
2253         * UIProcess/FrameLoadState.h:
2254         * UIProcess/WebFrameProxy.cpp:
2255         (WebKit::WebFrameProxy::didExplicitOpen):
2256         * UIProcess/WebFrameProxy.h:
2257         * UIProcess/WebPageProxy.cpp:
2258         (WebKit::WebPageProxy::didExplicitOpenForFrame):
2259
2260 2019-04-24  Chris Dumez  <cdumez@apple.com>
2261
2262         X-Frame-Options header should be ignored when frame-ancestors CSP directive is present
2263         https://bugs.webkit.org/show_bug.cgi?id=197226
2264         <rdar://problem/50155649>
2265
2266         Reviewed by Alex Christensen.
2267
2268         * NetworkProcess/NetworkResourceLoader.cpp:
2269         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
2270
2271 2019-04-24  Dean Jackson  <dino@apple.com>
2272
2273         Rename _highlightLongPressCanClick and only add gesture recognizer when necessary
2274         https://bugs.webkit.org/show_bug.cgi?id=197231
2275         <rdar://problem/50164234>
2276
2277         Reviewed by Antoine Quint.
2278
2279         Rename _highlightLongPressCanClick to _longPressCanClick since it will be
2280         used in other places.
2281
2282         Only attach the _highlightLongPressGestureRecognizer when we're not
2283         using long presses for preview. This might revert in the future, if we
2284         can set up an appropriate gesture resolution between the two.
2285
2286         * UIProcess/ios/WKContentViewInteraction.h:
2287         * UIProcess/ios/WKContentViewInteraction.mm:
2288         (-[WKContentView setupInteraction]):
2289         (-[WKContentView _webTouchEvent:preventsNativeGestures:]):
2290         (-[WKContentView _highlightLongPressRecognized:]):
2291         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
2292         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
2293         (-[WKContentView _previewItemControllerDidCancelPreview:]):
2294
2295 2019-04-24  chris fleizach  <cfleizach@apple.com>
2296
2297         AX: Remove deprecated Accessibility Object Model events
2298         https://bugs.webkit.org/show_bug.cgi?id=197073
2299         <rdar://problem/50027819>
2300
2301         Reviewed by Ryosuke Niwa.
2302
2303         * Platform/spi/ios/AccessibilitySupportSPI.h:
2304         * UIProcess/API/Cocoa/WKWebView.mm:
2305         (-[WKWebView _initializeWithConfiguration:]):
2306         (-[WKWebView dealloc]):
2307         (accessibilityEventsEnabledChangedCallback): Deleted.
2308         (-[WKWebView _updateAccessibilityEventsEnabled]): Deleted.
2309         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2310         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm:
2311         * UIProcess/WebPageProxy.cpp:
2312         (WebKit::WebPageProxy::updateAccessibilityEventsEnabled): Deleted.
2313         * UIProcess/WebPageProxy.h:
2314         * WebProcess/WebPage/WebPage.cpp:
2315         (WebKit::WebPage::updateAccessibilityEventsEnabled): Deleted.
2316         * WebProcess/WebPage/WebPage.h:
2317         * WebProcess/WebPage/WebPage.messages.in:
2318
2319 2019-04-23  John Wilander  <wilander@apple.com>
2320
2321         Move Ad Click Attribution from internal feature to experimental feature
2322         https://bugs.webkit.org/show_bug.cgi?id=197218
2323         <rdar://problem/47651691>
2324
2325         Reviewed by Brent Fulgham.
2326
2327         * Shared/WebPreferences.yaml:
2328
2329 2019-04-23  Keith Rollin  <krollin@apple.com>
2330
2331         Add Xcode version check for Header post-processing scripts
2332         https://bugs.webkit.org/show_bug.cgi?id=197116
2333         <rdar://problem/50058968>
2334
2335         Reviewed by Brent Fulgham.
2336
2337         There are several places in our Xcode projects that post-process
2338         header files after they've been exported. Because of XCBuild, we're
2339         moving to a model where the post-processing is performed at the same
2340         time the header files are exported, rather than as a distinct
2341         post-processing step. This patch disables the distinct step when the
2342         inline processing is available.
2343
2344         In practice, this means prefixing appropriate post-processing Custom
2345         Build phases with:
2346
2347         if [ "${XCODE_VERSION_MAJOR}" -ge "1100" -a "${USE_NEW_BUILD_SYSTEM}" = "YES" ]; then
2348             # In this configuration, post-processing is performed at the same time as copying in the postprocess-header-rule script, so there's no need for this separate step.
2349             exit 0
2350         fi
2351
2352         * WebKit.xcodeproj/project.pbxproj:
2353
2354 2019-04-23  John Wilander  <wilander@apple.com>
2355
2356         Remove Ad Click Attribution data when removing website data
2357         https://bugs.webkit.org/show_bug.cgi?id=197215
2358         <rdar://problem/47668988>
2359
2360         Reviewed by Chris Dumez.
2361
2362         This patch adds a new WebsiteDataType called AdClickAttributions and flags
2363         it as owned by the network process.
2364
2365         The new website data type is added to the Cocoa API layer for
2366         website data records management.
2367
2368         When either of the two WebsiteDataStore::removeData() functions calls
2369         NetworkProcess::deleteWebsiteData() or
2370         NetworkProcess::deleteWebsiteDataForOrigins() over IPC, the network
2371         process now calls into AdClickAttributionManager::clear() and
2372         AdClickAttributionManager::clearForRegistrableDomain() respectively,
2373         if the website datatypes include WebsiteDataType::AdClickAttributions.
2374
2375         The patch removes a couple of completion handlers in NetworkSession function
2376         calls are because those are not asynchronous.
2377
2378         * NetworkProcess/AdClickAttributionManager.cpp:
2379         (WebKit::AdClickAttributionManager::clear):
2380         (WebKit::AdClickAttributionManager::clearForRegistrableDomain):
2381         (WebKit::AdClickAttributionManager::toString const):
2382         * NetworkProcess/AdClickAttributionManager.h:
2383         * NetworkProcess/NetworkProcess.cpp:
2384         (WebKit::NetworkProcess::deleteWebsiteData):
2385         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2386         (WebKit::NetworkProcess::clearAdClickAttribution):
2387         * NetworkProcess/NetworkSession.cpp:
2388         (WebKit::NetworkSession::clearAdClickAttribution):
2389         (WebKit::NetworkSession::clearAdClickAttributionForRegistrableDomain):
2390         * NetworkProcess/NetworkSession.h:
2391         * Shared/WebsiteData/WebsiteData.cpp:
2392         (WebKit::WebsiteData::ownerProcess):
2393         * Shared/WebsiteData/WebsiteDataType.h:
2394         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2395         (WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval):
2396         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2397         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
2398         (dataTypesToString):
2399         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
2400         (WebKit::toWebsiteDataType):
2401         (WebKit::toWKWebsiteDataTypes):
2402         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
2403         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2404         (+[WKWebsiteDataStore _allWebsiteDataTypesIncludingPrivate]):
2405
2406 2019-04-23  Tim Horton  <timothy_horton@apple.com>
2407
2408         Return annotated text checking strings via UIWKDocumentContext
2409         https://bugs.webkit.org/show_bug.cgi?id=197177
2410         <rdar://problem/49064839>
2411
2412         Reviewed by Ryosuke Niwa.
2413
2414         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h:
2415         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
2416         (WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions):
2417         * WebProcess/WebPage/ios/WebPageIOS.mm:
2418         (WebKit::WebPage::requestDocumentEditingContext):
2419         Respect the UIWKDocumentRequestAnnotation flag, returning an attributed
2420         string containing the platform text checking annotations.
2421
2422 2019-04-23  Commit Queue  <commit-queue@webkit.org>
2423
2424         Unreviewed, rolling out r244556.
2425         https://bugs.webkit.org/show_bug.cgi?id=197212
2426
2427         Causing build failures on multiple builders (Requested by
2428         ShawnRoberts on #webkit).
2429
2430         Reverted changeset:
2431
2432         "Create AVFoundationSoftLink.{h,mm} to reduce duplicate code"
2433         https://bugs.webkit.org/show_bug.cgi?id=197171
2434         https://trac.webkit.org/changeset/244556
2435
2436 2019-04-23  Remy Demarest  <rdemarest@apple.com>
2437
2438         Build fix after r244545.
2439
2440         Reviewed by Tim Horton.
2441
2442         * Platform/spi/mac/AppKitSPI.h:
2443         The SPI was an IPI in High Sierra.
2444
2445 2019-04-23  Per Arne Vollan  <pvollan@apple.com>
2446
2447         [iOS] Input field on ddg.gg is auto focused when url is entered with the software keyboard
2448         https://bugs.webkit.org/show_bug.cgi?id=196740
2449
2450         Reviewed by Megan Gardner.
2451
2452         When an url for a page with an autofocused input field  is entered with the software keyboard,
2453         the input field is auto selected, and the software keyboard reappears. This does not happen
2454         when picking the url from favorites. After using the software keyboard to enter the url, the
2455         activity state is being changed to focused. The method '_elementDidFocus' checks whether the
2456         activity state changed, and allows the software keyboard to be shown in this case. To avoid
2457         showing the software keyboard in this case, send the changing activity state bitfield to the
2458         UI process, and check if the focus flag is the only flag set.
2459   
2460         * UIProcess/ios/WKContentViewInteraction.mm:
2461         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2462
2463 2019-04-23  Guy Lewin  <guy@lewin.co.il>
2464
2465         Multiple File Input Icon Set Regardless of File List
2466         https://bugs.webkit.org/show_bug.cgi?id=195537
2467
2468         Reviewed by Alexey Proskuryakov.
2469
2470         Add WKOpenPanelResultListenerChooseMediaFiles() to choose files with
2471         icon and display string on iOS file open panels
2472
2473         * UIProcess/API/C/WKOpenPanelResultListener.cpp:
2474         (WKOpenPanelResultListenerChooseMediaFiles):
2475         * UIProcess/API/C/WKOpenPanelResultListener.h:
2476
2477 2019-04-23  Eric Carlson  <eric.carlson@apple.com>
2478
2479         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
2480         https://bugs.webkit.org/show_bug.cgi?id=197171
2481         <rdar://problem/47454979>
2482
2483         Reviewed by Youenn Fablet.
2484
2485         * Shared/ios/WebIconUtilities.mm:
2486         (WebKit::iconForVideoFile):
2487         * Shared/mac/WebCoreArgumentCodersMac.mm:
2488         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
2489         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
2490         * UIProcess/Cocoa/UIDelegate.mm:
2491         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
2492         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
2493         (WebKit::PlatformCALayerRemoteCustom::clone const):
2494
2495 2019-04-22  Dean Jackson  <dino@apple.com>
2496
2497         Use additional members and protocols from WebKitAdditions in WKContentViewInteraction
2498         https://bugs.webkit.org/show_bug.cgi?id=197184
2499         <rdar://problem/50113848>
2500
2501         Reviewed by Wenson Hsieh.
2502
2503         WebKitAdditions defines some macros to include additional members
2504         and protocols for WKContentViewInteraction.
2505
2506         It also defines some new functions. Provide empty version
2507         of those functions when WebKitAdditions is not available.
2508
2509         * UIProcess/ios/WKContentViewInteraction.h:
2510         * UIProcess/ios/WKContentViewInteraction.mm:
2511         (-[WKContentView _registerPreview]):
2512         (-[WKContentView _unregisterPreview]):
2513
2514 2019-04-23  Tim Horton  <timothy_horton@apple.com>
2515
2516         Action sheet shares a stringified URL instead of a URL object
2517         https://bugs.webkit.org/show_bug.cgi?id=197185
2518         <rdar://problem/49962249>
2519
2520         Reviewed by Darin Adler.
2521
2522         * UIProcess/Cocoa/WKShareSheet.h:
2523         * UIProcess/Cocoa/WKShareSheet.mm:
2524         (-[WKShareSheet presentWithParameters:inRect:completionHandler:]):
2525         (-[WKShareSheet presentWithParameters:completionHandler:]): Deleted.
2526         * UIProcess/Cocoa/WebViewImpl.mm:
2527         (WebKit::WebViewImpl::showShareSheet):
2528         * UIProcess/ios/PageClientImplIOS.mm:
2529         (WebKit::PageClientImpl::showShareSheet):
2530         Make it possible to optionally provide WKShareSheet with
2531         a rect to present relative to.
2532
2533         * UIProcess/ios/WKContentViewInteraction.h:
2534         * UIProcess/ios/WKContentViewInteraction.mm:
2535         (-[WKContentView _showShareSheet:inRect:completionHandler:]):
2536         (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]):
2537         (-[WKContentView _showShareSheet:completionHandler:]): Deleted.
2538         Instead of stringifying the URL and using the text selection assistant's
2539         share method, hand WKShareSheet a proper URL.
2540
2541 2019-04-23  Ryosuke Niwa  <rniwa@webkit.org>
2542
2543         [iOS] element.focus() sometimes fails to reveal the focused element when it becomes editable dynamically
2544         https://bugs.webkit.org/show_bug.cgi?id=197188
2545
2546         Reviewed by Wenson Hsieh.
2547
2548         Commit the scroll tree update before revealing the keyboard via editor state update.
2549
2550         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2551         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2552
2553 2019-04-23  Remy Demarest  <rdemarest@apple.com>
2554
2555         Fix layout issues occuring when entering full screen mode.
2556         https://bugs.webkit.org/show_bug.cgi?id=197086
2557         <rdar://problem/47733671>.
2558
2559         Reviewed by Darin Adler.
2560
2561         This issue is the result of changing the style mask of the window after entering
2562         full screen mode. Safari adds an invisible toolbar to display the URL of the page
2563         which ends up breaking the layout. Having that window use a style that includes a
2564         titlebar fixes the bug.
2565
2566         * Platform/spi/mac/AppKitSPI.h:
2567         Declare an SPI to be used in WKFullScreenWindowController.
2568
2569         * UIProcess/Cocoa/WebViewImpl.mm:
2570         (WebKit::WebViewImpl::fullScreenWindow): Make the full screen window show a titlebar
2571         and make the content view underlap the titlebar to match the current behavior.
2572         Remove NSWindowStyleMaskBorderless which has no effects since it is equal to zero.
2573
2574         * UIProcess/mac/WKFullScreenWindowController.mm:
2575         (-[WKFullScreenWindowController initWithWindow:webView:page:]): Hide the titlebar
2576         before beginning the animation to full screen.
2577         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Show the title
2578         bar when in full screen instead of a blank bar.
2579         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): Hide the title
2580         bar to restore the initial setting.
2581
2582 2019-04-23  John Wilander  <wilander@apple.com>
2583
2584         Ad Click Attribution redirects to well-known location should not trigger a conversion if they are blocked by content blockers
2585         https://bugs.webkit.org/show_bug.cgi?id=197183
2586         <rdar://problem/47763188>
2587
2588         Reviewed by Alex Christensen.
2589
2590         Ad Click Attribution conversions are picked up in the redirect handler
2591         in WebKit::NetworkResourceLoader. Content blocking typically happens in
2592         the continued redirect request handling in the web content process and
2593         a blocked request comes back empty.
2594
2595         We need to call the WebKit::NetworkLoadChecker in the network process
2596         for these specific redirects, just like we do for Ping.
2597
2598         The change makes use of the existing function
2599         NetworkLoadChecker::enableContentExtensionsCheck() for this purpose.
2600
2601         In essence, this change makes it possible to block all conversions made
2602         to a "/.well-known/ad-click-attribution/" URL.
2603
2604         * NetworkProcess/NetworkResourceLoader.cpp:
2605         (WebKit::NetworkResourceLoader::handleAdClickAttributionConversion):
2606             New convenience function.
2607         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2608             Now calls NetworkLoadChecker::enableContentExtensionsCheck() if
2609             an Ad Click Attribution conversion was found in the redirect URL.
2610         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
2611             If the request was not blocked, it will store any found conversion here.
2612         * NetworkProcess/NetworkResourceLoader.h:
2613
2614 2019-04-23  Don Olmstead  <don.olmstead@sony.com>
2615
2616         [CMake][Win] Use target oriented design for WebKit
2617         https://bugs.webkit.org/show_bug.cgi?id=197173
2618
2619         Reviewed by Alex Christensen.
2620
2621         Enumerate public framework headers for WinCairo's WebKit implementation and copy them.
2622         Migrate to use WebKit_DERIVED_SOURCES_DIR.
2623
2624         * CMakeLists.txt:
2625         * PlatformGTK.cmake:
2626         * PlatformWPE.cmake:
2627         * PlatformWin.cmake:
2628
2629 2019-04-23  Chris Dumez  <cdumez@apple.com>
2630
2631         [Process-Swap-On-Navigation] WebKit hangs when going back to a form submission's page due to Process-Swap-On-Navigation on iOS 12.2 and higher
2632         https://bugs.webkit.org/show_bug.cgi?id=197097
2633         <rdar://problem/50048318>
2634
2635         Reviewed by Alex Christensen.
2636
2637         The issue is that when doing a history navigation with form data, we try to resubmit the form.
2638         We initially use the ReturnCacheDataDontLoad cache policy without prompting the user to get
2639         cached data. If this fails, we sent a DidFailProvisionalLoadForFrame IPC to the UIProcess but
2640         the WebContent process actually retries the load with ReturnCacheDataElseLoad cache policy.
2641         This new load triggers a new decidePolicyForNavigationAction.
2642
2643         This would cause trouble with process-swapping because we normally destroy the
2644         ProvisionalPageProxy as soon as we receive a DidFailProvisionalLoadForFrame IPC from the
2645         provisional process. As a result, the provisional process would not be able to retry.
2646
2647         To address the issue, we add pass a flag with the DidFailProvisionalLoadForFrame IPC to
2648         if the load will continue or not. When this flag is set, the UIProcess does not destroy
2649         the provisional page.
2650
2651         * Scripts/webkit/messages.py:
2652         Minor IPC message handler build fix.
2653
2654         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
2655         (-[WKURLSchemeTaskImpl _onlyIfCached]):
2656         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
2657         Add new _onlyIfCached SPI to WKURLSchemeTaskPrivate to allow for API testing.
2658
2659         * UIProcess/ProvisionalPageProxy.cpp:
2660         (WebKit::ProvisionalPageProxy::cancel):
2661         Pass WillContinueLoading flag.
2662
2663         (WebKit::ProvisionalPageProxy::validateInput):
2664         Consider IPC with a navigationID of 0 as valid. When the navigation is triggered by the
2665         WebContent process, it sends us a DecidePolicyForNavigationActionAsync IPC with a navigationID
2666         of 0, until the UIProcess can generate a valid identifier.
2667
2668         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
2669
2670         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
2671         When the WebPageProxy has generated a navigationID for the new WebContent process-initiated
2672         navigation, update m_navigationID so that follow-up IPC is considered valid.
2673
2674         * UIProcess/ProvisionalPageProxy.h:
2675         * UIProcess/WebPageProxy.cpp:
2676         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
2677         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
2678         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
2679         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2680         * UIProcess/WebPageProxy.h:
2681         * UIProcess/WebPageProxy.messages.in:
2682         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2683         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
2684         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2685
2686 2019-04-22  Zalan Bujtas  <zalan@apple.com>
2687
2688         [ContentChangeObserver] Some dropdown menus may close without user gesture on americanexpress.com
2689         https://bugs.webkit.org/show_bug.cgi?id=197175
2690         <rdar://problem/49613013>
2691
2692         Reviewed by Simon Fraser.
2693
2694         Do not generate additional synthetic mouse events (e.g. mouseout in this case) when the content handles the click event. This helps cases when the synthetic mouseout ended up dismissing the dropdown menus.
2695         However it won't regress cases like youtube.com, where sending mouseout is required to have the control bar dismissed on play. 
2696
2697         * WebProcess/WebPage/ios/WebPageIOS.mm:
2698         (WebKit::WebPage::completeSyntheticClick):
2699
2700 2019-04-22  Alex Christensen  <achristensen@webkit.org>
2701
2702         Deprecate WKContextCreateWithInjectedBundlePath
2703         https://bugs.webkit.org/show_bug.cgi?id=197169
2704
2705         Reviewed by Youenn Fablet.
2706
2707         * UIProcess/API/C/WKContext.h:
2708
2709 2019-04-22  Alex Christensen  <achristensen@webkit.org>
2710
2711         REGRESSION(r230681) Do not use stored credentials if WKBundlePageResourceLoadClient.shouldUseCredentialStorage returns false
2712         https://bugs.webkit.org/show_bug.cgi?id=197093
2713         <rdar://problem/49708268>
2714
2715         Reviewed by Chris Dumez.
2716
2717         Only get the StoredCredentialsPolicy from the NetworkLoadChecker if we haven't already been told not to use credentials.
2718         Also add some test infrastructure for clearing persistent credentials added by the test.
2719
2720         * NetworkProcess/NetworkProcess.cpp:
2721         (WebKit::NetworkProcess::removeCredential):
2722         * NetworkProcess/NetworkProcess.h:
2723         * NetworkProcess/NetworkProcess.messages.in:
2724         * NetworkProcess/NetworkResourceLoader.cpp:
2725         (WebKit::NetworkResourceLoader::startNetworkLoad):
2726         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2727         (WebKit::NetworkProcess::removeCredential):
2728         * UIProcess/API/Cocoa/WKProcessPool.mm:
2729         (-[WKProcessPool _removeCredential:forProtectionSpace:completionHandler:]):
2730         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2731         * UIProcess/WebProcessPool.cpp:
2732         (WebKit::WebProcessPool::removeCredential):
2733         * UIProcess/WebProcessPool.h:
2734
2735 2019-04-22  Chris Dumez  <cdumez@apple.com>
2736
2737         Delayed WebProcessLaunch may break the _relatedWebView SPI
2738         https://bugs.webkit.org/show_bug.cgi?id=197160
2739
2740         Reviewed by Alex Christensen.
2741
2742         Delayed WebProcessLaunch may break the _relatedWebView SPI. The breakage would happen if the client
2743         would relate a WebView to another which has not launched its initial process yet.
2744
2745         To address the issue, when we need a running process for a WebView which has a related view, we need
2746         to make sure the related view has a running process and use that process. Previously, we would share
2747         the "dummy" process instead.
2748
2749         * UIProcess/WebPageProxy.cpp:
2750         (WebKit::WebPageProxy::launchProcess):
2751         (WebKit::WebPageProxy::ensureRunningProcess):
2752         * UIProcess/WebPageProxy.h:
2753         * UIProcess/WebProcessPool.cpp:
2754         (WebKit::WebProcessPool::createWebPage):
2755
2756 2019-04-22  David Quesada  <david_quesada@apple.com>
2757
2758         Remove linked-on-or-after check for download attribute handling
2759         https://bugs.webkit.org/show_bug.cgi?id=197176
2760         rdar://problem/48459714
2761
2762         Reviewed by Alex Christensen.
2763
2764         There are no apps linked prior to this SDK version that are using the _WKDownload SPI,
2765         so it doesn't make sense to preserve the old behavior of forcing download-attribute
2766         links to start downloads.
2767
2768         * UIProcess/Cocoa/VersionChecks.h:
2769         * UIProcess/WebPageProxy.cpp:
2770         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2771
2772 2019-04-22  Chris Dumez  <cdumez@apple.com>
2773
2774         Unreviewed, rolling out r244502.
2775
2776         Caused crashes on the bots
2777
2778         Reverted changeset:
2779
2780         "Delayed WebProcessLaunch may break the _relatedWebView SPI"
2781         https://bugs.webkit.org/show_bug.cgi?id=197160
2782         https://trac.webkit.org/changeset/244502
2783
2784 2019-04-22  Ryan Haddad  <ryanhaddad@apple.com>
2785
2786         Unreviewed, rolling out r244437.
2787
2788         Still breaks internal tests.
2789
2790         Reverted changeset:
2791
2792         "InjectedBundle parameters often need initialization function
2793         called before unarchiving"
2794         https://bugs.webkit.org/show_bug.cgi?id=189709
2795         https://trac.webkit.org/changeset/244437
2796
2797 2019-04-22  Chris Dumez  <cdumez@apple.com>
2798
2799         Delayed WebProcessLaunch may break the _relatedWebView SPI
2800         https://bugs.webkit.org/show_bug.cgi?id=197160
2801
2802         Reviewed by Alex Christensen.
2803
2804         Delayed WebProcessLaunch may break the _relatedWebView SPI. The breakage would happen if the client
2805         would relate a WebView to another which has not launched its initial process yet.
2806
2807         To address the issue, when we need a running process for a WebView which has a related view, we need
2808         to make sure the related view has a running process and use that process. Previously, we would share
2809         the "dummy" process instead.
2810
2811         * UIProcess/WebPageProxy.cpp:
2812         (WebKit::WebPageProxy::launchProcess):
2813         (WebKit::WebPageProxy::ensureRunningProcess):
2814         * UIProcess/WebPageProxy.h:
2815         * UIProcess/WebProcessPool.cpp:
2816         (WebKit::WebProcessPool::createWebPage):
2817
2818 2019-04-22  Ludovico de Nittis  <ludovico.denittis@collabora.com>
2819
2820         [GTK] fix gtk_style_context_set_background deprecation
2821         https://bugs.webkit.org/show_bug.cgi?id=196912
2822
2823         Reviewed by Carlos Garcia Campos.
2824
2825         Since gtk 3.18 gtk_style_context_set_background has been deprecated.
2826         Backgrounds are not rendered in the UI process, so it can be
2827         simply removed.
2828
2829         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2830         (webkitWebViewBaseRealize):
2831
2832 2019-04-21  Wenson Hsieh  <wenson_hsieh@apple.com>
2833
2834         Defer EditorState updates until the next layer tree flush in a few additional circumstances
2835         https://bugs.webkit.org/show_bug.cgi?id=197145
2836         <rdar://problem/50078170>
2837
2838         Reviewed by Darin Adler.
2839
2840         Gets rid of sendPartialEditorStateAndSchedulePostLayoutUpdate(), in favor of always scheduling a full editor
2841         state update after the next compositing flush.
2842
2843         * WebProcess/WebPage/WebPage.cpp:
2844         (WebKit::WebPage::updateEditorStateAfterLayoutIfEditabilityChanged):
2845         (WebKit::WebPage::setNeedsFontAttributes):
2846         (WebKit::WebPage::didChangeOverflowScrollPosition):
2847         (WebKit::WebPage::didChangeSelection):
2848         (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
2849         (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate): Deleted.
2850         * WebProcess/WebPage/WebPage.h:
2851         * WebProcess/WebPage/ios/WebPageIOS.mm:
2852         (WebKit::WebPage::platformEditorState const):
2853         (WebKit::WebPage::updateVisibleContentRects):
2854
2855 2019-04-21  Chris Dumez  <cdumez@apple.com>
2856
2857         Regression(r243767) WebFrame::m_navigationIsContinuingInAnotherProcess flag is never reset
2858         https://bugs.webkit.org/show_bug.cgi?id=197144
2859
2860         Reviewed by Darin Adler.
2861
2862         WebFrame::m_navigationIsContinuingInAnotherProcess flag is never reset since it was introduced in
2863         r243767. This leads to leaking Navigation objects in the UIProcess when reusing a previously
2864         suspended process because such process will no longer send the DidDestroyNavigation IPC.
2865
2866         It turns out that resetting the flags causes API tests such as ProcessSwap.QuickBackForwardNavigationWithPSON
2867         to ASSERT. This is because when the UIProcess quickly navigate back and forth without waiting for policy
2868         decisions, we may end up getting the policy decision for a particular navigation *after* we've sent the
2869         DidDestroyNavigation.
2870
2871         As a result, this patch reverts r243767 and fixes in the assertion in http/tests/adClickAttribution/store-ad-click-attribution.html
2872         another way. We initially assumed that the logic in WebPageProxy::didDestroyNavigation() was failing to
2873         ignore the DidDestroyNavigation from the previous process after a swap due to a race, maybe because it was
2874         sometimes received too late and m_provisionalPage was already cleared. However, this would not make sense
2875         since the test is crashing consistently and the page would no longer be able to receive IPC from the
2876         previous process *after* we've committed the provisional process/page.
2877
2878         The real issue was that the DidDestroyNavigation IPC was received *before* we could construct the
2879         provisional page, which is why the logic in WebPageProxy::didDestroyNavigation() was failing to ignore
2880         the bad IPC. In WebPageProxy::receivedNavigationPolicyDecision(), we were calling receivedPolicyDecision()
2881         (which would send the DidReceivePolicyDecision to the previous WebProcess) and then continueNavigationInNewProcess()
2882         in order to construct the provisional page. I personally did not expect we could receive IPC between the
2883         calls to receivedNavigationPolicyDecision() and receivedPolicyDecision(), since we are not yielding and since
2884         the DidReceivePolicyDecision IPC is asynchronous. However, this is exactly what was happening in the context
2885         of this test. The reason is that the DidReceivePolicyDecision IPC was getting wrapped in a synchronous message
2886         and sent as synchronous message due to the Connection::m_inDispatchMessageMarkedToUseFullySynchronousModeForTesting
2887         flag which seems to get set in the test due to some EventSender IPC. I believe this is because the test uses
2888         EventSender to do a click on a link which triggers the navigation.
2889
2890         To address the issue, I now call receivedNavigationPolicyDecision() *after* continueNavigationInNewProcess()
2891         to make sure that we always start the provisional load in the new process before we tell the previous process
2892         to stop loading. This way, there is no way we get IPC from the previous process about the current navigation
2893         before we have a provisional page.
2894
2895         * UIProcess/WebPageProxy.cpp:
2896         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2897         (WebKit::WebPageProxy::didDestroyNavigation):
2898         * WebProcess/WebPage/WebFrame.cpp:
2899         (WebKit::WebFrame::didReceivePolicyDecision):
2900         (WebKit::WebFrame::documentLoaderDetached):
2901         * WebProcess/WebPage/WebFrame.h:
2902
2903 2019-04-20  Chris Dumez  <cdumez@apple.com>
2904
2905         Unreviewed, fix iOS build with recent SDKs.
2906
2907         * UIProcess/API/Cocoa/WKWebView.mm:
2908         (deviceOrientation):
2909         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
2910         (-[WKFullScreenViewController initWithWebView:]):
2911         (-[WKFullScreenViewController viewWillTransitionToSize:withTransitionCoordinator:]):
2912         (-[WKFullScreenViewController _statusBarFrameDidChange:]):
2913
2914 2019-04-19  John Wilander  <wilander@apple.com>
2915
2916         Disable Ad Click Attribution in ephemeral sessions and make sure conversion requests use an ephemeral, stateless session
2917         https://bugs.webkit.org/show_bug.cgi?id=197108
2918         <rdar://problem/49918702>
2919
2920         Reviewed by Alex Christensen.
2921
2922         This patch introduces a new NSURLSession in WebKit::NetworkSessionCocoa called
2923         m_ephemeralStatelessCookielessSession. As its name implies, it's ephemeral, 
2924         stateless, and has a NSHTTPCookieAcceptPolicyNever cookie policy.
2925
2926         The new session can be invoked with the new enum value of
2927         WebCore::StoredCredentialsPolicy called EphemeralStatelessCookieless.
2928
2929         WebKit::AdClickAttributionManager::fireConversionRequest() makes use of
2930         the new session for its conversion requests.
2931
2932         This patch also makes sure that Ad Click Attributions cannot be stored in
2933         ephemeral sessions and already stored attributions cannot be converted in
2934         ephemeral sessions.
2935
2936         * NetworkProcess/AdClickAttributionManager.cpp:
2937         (WebKit::AdClickAttributionManager::fireConversionRequest):
2938         (WebKit::AdClickAttributionManager::toString const):
2939         * NetworkProcess/NetworkLoadChecker.h:
2940         * NetworkProcess/NetworkProcess.h:
2941         * NetworkProcess/NetworkProcess.messages.in:
2942         * NetworkProcess/NetworkResourceLoader.cpp:
2943         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2944         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2945         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2946             Calls NetworkSessionCocoa::initializeEphemeralStatelessCookielessSession() lazily.
2947         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
2948         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2949         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
2950         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2951         (WebKit::NetworkSessionCocoa::initializeEphemeralStatelessCookielessSession):
2952         (WebKit::NetworkSessionCocoa::invalidateAndCancel):
2953         * Shared/WebCoreArgumentCoders.h:
2954
2955 2019-04-19  Daniel Bates  <dabates@apple.com>
2956
2957         Use RetainPtr and rename +autocorrectionRectsWithRects:lastRect: to +autocorrectionRectsWithFirstCGRect:lastCGRect:
2958         https://bugs.webkit.org/show_bug.cgi?id=197122
2959
2960         Reviewed by Wenson Hsieh.
2961
2962         * UIProcess/ios/WKContentViewInteraction.mm:
2963         (-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]): Renamed; formerly named +autocorrectionRectsWithRects:lastRect:.
2964         While I am here use else-branch to initialize firstRect and lastRect just to make the code closer to the optimal
2965         assembly. Also use Vector::{isEmpty, first, last}() instead of using the index operator overload and size() for
2966         emptiness checks. The code is more readable at the cost being ever so slightly slower (due to the overflow checks
2967         in first() and last()), but this code is likely not hot enough for it to matter.
2968         (-[WKContentView applyAutocorrection:toString:withCompletionHandler:]): Update for renaming.
2969         (+[WKAutocorrectionRects autocorrectionRectsWithFirstCGRect:lastCGRect:]): Ditto.
2970         (+[WKAutocorrectionRects autocorrectionRectsWithRects:lastRect:]): Deleted.
2971
2972 2019-04-19  Daniel Bates  <dabates@apple.com>
2973
2974         -[WKAutocorrectionContext emptyAutocorrectionContext:] generates invalid empty context
2975         https://bugs.webkit.org/show_bug.cgi?id=197119
2976
2977         Reviewed by Wenson Hsieh.
2978
2979         Use the existing EditingRange type to represent the location and length of the marked text
2980         range for an autocorrection instead of managing integers. This type avoid the need to handle
2981         the special case for an empty range represented as NSMakeRange(NSNotFound, 0). Currently
2982         WKAutocorrectionContext incorrectly represents the empty range as NSMakeRange(WTF::notFound, 0).
2983
2984         While I am here, simplify the existing WebAutocorrectionContext encoder/decoder code and rename
2985         +[WKAutocorrectionContext autocorrectionContextWithContext:] to +autocorrectionContextWithWebContext
2986         to better reflect the expected source of the conversion: a Web-type.
2987
2988         * Shared/ios/WebAutocorrectionContext.h:
2989         (WebKit::WebAutocorrectionContext::encode const): Reformat while I am here to make this logic easy
2990         to amend without losing SVN history.
2991         (WebKit::WebAutocorrectionContext::decode): Simplify the code while I am here.
2992         * UIProcess/ios/WKContentViewInteraction.mm:
2993         (-[WKContentView _handleAutocorrectionContext:]): Update for renaming.
2994         (+[WKAutocorrectionContext emptyAutocorrectionContext]): Update for renaming.
2995         (+[WKAutocorrectionContext autocorrectionContextWithWebContext:]): Renamed; formerly named autocorrectionContextWithContext.
2996         (+[WKAutocorrectionContext autocorrectionContextWithContext:]): Deleted.
2997         * WebProcess/WebPage/ios/WebPageIOS.mm:
2998         (WebKit::WebPage::autocorrectionContext): Update to make use of EditingRange. Also instantiate
2999         the struct and return it, initializing its fields individually instead of using the constructor to
3000         make this code less error prone. It's easy to introduce an error with the constructor notation when
3001         amending the the struct because so many of the arguments are of the same data type. Individually
3002         initializing the struct fields makes it less likely for an ordering mistake to be introduced.
3003
3004 2019-04-19  Dean Jackson  <dino@apple.com>
3005
3006         Add more _WKElementActionTypes and provide API to create with custom types
3007         https://bugs.webkit.org/show_bug.cgi?id=197117
3008         <rdar://problem/50059548>
3009
3010         Reviewed by Tim Horton.
3011
3012         We were missing a few obvious types that are well-known
3013         browser actions, and/or should be visible in share sheets.
3014         Also, clean up the API for constructing new types.
3015
3016         * UIProcess/API/Cocoa/_WKElementAction.h: Add new types for opening
3017         in new tabs, windows and downloading.
3018         * UIProcess/API/Cocoa/_WKElementAction.mm:
3019         (+[_WKElementAction elementActionWithType:title:actionHandler:]): New constructor
3020         with type, title and action.
3021         (+[_WKElementAction elementActionWithType:]): Call new method.
3022
3023 2019-04-18  Daniel Bates  <dabates@apple.com>
3024
3025         Use existing KeyEventCodesIOS constants instead of duplicating them
3026         https://bugs.webkit.org/show_bug.cgi?id=197081
3027
3028         Rubber-stamped by Wenson Hsieh.
3029
3030         * UIProcess/ios/WKContentViewInteraction.mm:
3031         (-[WKContentView _interpretKeyEvent:isCharEvent:]): While I am here, remove the case for the space key
3032         as it is identical to the default switch case.
3033
3034 2019-04-19  Keith Rollin  <krollin@apple.com>
3035
3036         Add postprocess-header-rule scripts
3037         https://bugs.webkit.org/show_bug.cgi?id=197072
3038         <rdar://problem/50027299>
3039
3040         Reviewed by Brent Fulgham.
3041
3042         Several projects have post-processing build phases where exported
3043         headers are tweaked after they've been copied. This post-processing is
3044         performed via scripts called postprocess-headers.sh. For reasons
3045         related to XCBuild, we are now transitioning to a build process where
3046         the post-processing is performed at the same time as the
3047         exporting/copying. To support this process, add similar scripts named
3048         postprocess-header-rule, which are geared towards processing a single
3049         file at a time rather than all exported files at once. Also add a
3050         build rule that makes use of these scripts. These scripts and build
3051         rules are not used at the moment; they will come into use in an
3052         imminent patch.
3053
3054         Note that I've named these postprocess-header-rule rather than
3055         postprocess-header-rule.sh. Scripts in Tools/Scripts do not have
3056         suffixes indicating how the tool is implemented. Scripts in
3057         per-project Scripts folders appear to be mixed regarding the use of
3058         suffixes. I'm opting here to follow the Tools/Scripts convention, with
3059         the expectation that over time we completely standardize on that.
3060
3061         * Scripts/postprocess-header-rule: Added.
3062         * WebKit.xcodeproj/project.pbxproj:
3063
3064 2019-04-19  Brady Eidson  <beidson@apple.com>
3065
3066         Deprecate WebKit2 plug-in support.
3067         <rdar://problem/43812306> and https://bugs.webkit.org/show_bug.cgi?id=197080
3068
3069         Reviewed by Andy Estes.
3070
3071         * UIProcess/API/Cocoa/WKPreferences.h:
3072         * UIProcess/API/Cocoa/WKPreferences.mm:
3073         (-[WKPreferences encodeWithCoder:]):
3074         (-[WKPreferences initWithCoder:]):
3075         (-[WKPreferences javaEnabled]):
3076         (-[WKPreferences setJavaEnabled:]):
3077         (-[WKPreferences plugInsEnabled]):
3078         (-[WKPreferences setPlugInsEnabled:]):
3079
3080 2019-04-19  Chris Dumez  <cdumez@apple.com>
3081
3082         Minor PSON release logging improvements
3083         https://bugs.webkit.org/show_bug.cgi?id=197104
3084
3085         Reviewed by Darin Adler.
3086
3087         * UIProcess/SuspendedPageProxy.cpp:
3088         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
3089         * UIProcess/WebPageProxy.cpp:
3090         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3091
3092 2019-04-19  Tim Horton  <timothy_horton@apple.com>
3093
3094         YouTube and Twitter embeds don't load in News
3095         https://bugs.webkit.org/show_bug.cgi?id=197111
3096         <rdar://problem/50010081>
3097
3098         Reviewed by Timothy Hatcher.
3099
3100         * WebProcess/com.apple.WebProcess.sb.in:
3101         Adjust this sandbox exception to include both platforms.
3102
3103 2019-04-19  Wenson Hsieh  <wenson_hsieh@apple.com>
3104
3105         [iOS] Add quirks to disable autocorrection and autocapitalization in hidden editable areas on some websites
3106         https://bugs.webkit.org/show_bug.cgi?id=197102
3107         <rdar://problem/49864669>
3108
3109         Reviewed by Ryosuke Niwa.
3110
3111         If the quirk for disabling autocorrection and autocapitalization in hidden editable areas is active, then check
3112         whether the focused element is hidden, and turn off autocorrection and autocapitalization if needed.
3113
3114         * WebProcess/WebPage/ios/WebPageIOS.mm:
3115         (WebKit::WebPage::getFocusedElementInformation):
3116
3117 2019-04-19  Commit Queue  <commit-queue@webkit.org>
3118
3119         Unreviewed, rolling out r244447.
3120         https://bugs.webkit.org/show_bug.cgi?id=197103
3121
3122         Caused build failures with Internal and Opensource builders
3123         (Requested by ShawnRoberts on #webkit).
3124
3125         Reverted changeset:
3126
3127         "Deprecate WebKit2 plug-in support."
3128         https://bugs.webkit.org/show_bug.cgi?id=197080
3129         https://trac.webkit.org/changeset/244447
3130
3131 2019-04-18  Brady Eidson  <beidson@apple.com>
3132
3133         Deprecate WebKit2 plug-in support.
3134         <rdar://problem/43812306> and https://bugs.webkit.org/show_bug.cgi?id=197080
3135
3136         Reviewed by Andy Estes.
3137
3138         * UIProcess/API/Cocoa/WKPreferences.h:
3139         * UIProcess/API/Cocoa/WKPreferences.mm:
3140         (-[WKPreferences encodeWithCoder:]):
3141         (-[WKPreferences initWithCoder:]):
3142         (-[WKPreferences javaEnabled]):
3143         (-[WKPreferences setJavaEnabled:]):
3144         (-[WKPreferences plugInsEnabled]):
3145         (-[WKPreferences setPlugInsEnabled:]):
3146
3147 2019-04-18  Commit Queue  <commit-queue@webkit.org>
3148
3149         Unreviewed, rolling out r244434.
3150         https://bugs.webkit.org/show_bug.cgi?id=197089
3151
3152         caused 1 API test failure (Requested by zalan on #webkit).
3153
3154         Reverted changeset:
3155
3156         "Regression (r244291): Broken API Test
3157         AutoLayoutRenderingProgressRelativeOrdering"
3158         https://bugs.webkit.org/show_bug.cgi?id=196948
3159         https://trac.webkit.org/changeset/244434
3160
3161 2019-04-18  Wenson Hsieh  <wenson_hsieh@apple.com>
3162
3163         Add new compatibility mode API on WKNavigation
3164         https://bugs.webkit.org/show_bug.cgi?id=197069
3165         <rdar://problem/50025800>
3166
3167         Reviewed by Tim Horton.
3168
3169         Adds a new property on WKNavigation.
3170
3171         * Shared/WebCompatibilityMode.h:
3172
3173         Drive-by fix: make this enum class 8 bits wide.
3174
3175         * UIProcess/API/APINavigation.h:
3176         (API::Navigation::setEffectiveCompatibilityMode):
3177         (API::Navigation::effectiveCompatibilityMode const):
3178
3179         Add a new member variable to API::Navigation.
3180
3181         * UIProcess/API/Cocoa/WKNavigation.h:
3182         * UIProcess/API/Cocoa/WKNavigation.mm:
3183         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
3184         * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h:
3185
3186         Add various hooks into WebKitAdditions.
3187
3188         * UIProcess/WebPageProxy.cpp:
3189         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3190
3191         Set API::Navigation's effective compatibility mode.
3192
3193         (WebKit::WebPageProxy::effectiveCompatibilityModeAfterAdjustingPolicies):
3194
3195         Renamed and refactored this method to return the effective compatibility mode, chosen while adjusting website
3196         policies.
3197
3198         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode): Deleted.
3199         * UIProcess/WebPageProxy.h:
3200
3201 2019-04-18  Don Olmstead  <don.olmstead@sony.com>
3202
3203         [CMake] Make WebCore headers copies
3204         https://bugs.webkit.org/show_bug.cgi?id=182512
3205         <rdar://problem/37510435>
3206
3207         Reviewed by Alex Christensen.
3208
3209         WebCore now uses WebCore_PRIVATE_INCLUDE_DIRECTORIES for all ports. This revealed
3210         problems with WebKit's usage of WebCore headers. All include directories directly
3211         referencing the WebCore source tree we're removed from the CMake files. Any includes
3212         of WebCore headers using "*.h" were modified to <WebCore/*.h>
3213
3214         Removed generation of forwarding headers for WebCore using the perl script.
3215
3216         * CMakeLists.txt:
3217         * NetworkProcess/curl/NetworkDataTaskCurl.h:
3218         * PlatformWPE.cmake:
3219         * PlatformWin.cmake:
3220         * Scripts/generate-forwarding-headers.pl:
3221         * UIProcess/API/glib/WebKitUserContentFilterStore.cpp:
3222         * UIProcess/API/wpe/WebKitColorPrivate.h:
3223         * UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp:
3224         * UIProcess/win/PageClientImpl.cpp:
3225
3226 2019-04-18  Chris Dumez  <cdumez@apple.com>
3227
3228         [iOS] Improve detection of when web views go to background / foreground
3229         https://bugs.webkit.org/show_bug.cgi?id=197035
3230         <rdar://problem/45281182>
3231
3232         Reviewed by Tim Horton.
3233
3234         Improve detection of when web views go to background / foreground on iOS.
3235
3236         * UIProcess/ApplicationStateTracker.mm:
3237         (WebKit::ApplicationStateTracker::ApplicationStateTracker): Deleted.
3238         (WebKit::ApplicationStateTracker::~ApplicationStateTracker): Deleted.
3239         (WebKit::ApplicationStateTracker::applicationDidEnterBackground): Deleted.
3240         (WebKit::ApplicationStateTracker::applicationDidFinishSnapshottingAfterEnteringBackground): Deleted.
3241         (WebKit::ApplicationStateTracker::applicationWillEnterForeground): Deleted.
3242
3243 2019-04-18  Jer Noble  <jer.noble@apple.com>
3244
3245         Refactoring: Pull all fullscreen code out of Document and into its own helper class
3246         https://bugs.webkit.org/show_bug.cgi?id=197017
3247
3248         Reviewed by Eric Carlson.
3249
3250         * WebProcess/FullScreen/WebFullScreenManager.cpp:
3251         (WebKit::WebFullScreenManager::willEnterFullScreen):
3252         (WebKit::WebFullScreenManager::didEnterFullScreen):
3253         (WebKit::WebFullScreenManager::willExitFullScreen):
3254         (WebKit::WebFullScreenManager::didExitFullScreen):
3255         (WebKit::WebFullScreenManager::setAnimatingFullScreen):
3256         (WebKit::WebFullScreenManager::requestExitFullScreen):
3257         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
3258         (webkit_dom_document_webkit_cancel_fullscreen):
3259         (webkit_dom_document_webkit_exit_fullscreen):
3260         (webkit_dom_document_get_webkit_is_fullscreen):
3261         (webkit_dom_document_get_webkit_fullscreen_keyboard_input_allowed):
3262         (webkit_dom_document_get_webkit_current_fullscreen_element):
3263         (webkit_dom_document_get_webkit_fullscreen_element):
3264         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3265         (WebKit::WebChromeClient::createWindow):
3266
3267 2019-04-18  Megan Gardner  <megan_gardner@apple.com>
3268
3269         Update UIKit when a cut causes a selection change
3270         https://bugs.webkit.org/show_bug.cgi?id=197047
3271         <rdar://problem/36311563>
3272
3273         Reviewed by Wenson Hsieh.
3274
3275         We need to let UIKit know when a cut causes a selection change (always),
3276         so that is can appropriately update the button on the keyboard bar.
3277
3278         * UIProcess/ios/WKContentViewInteraction.mm:
3279         (-[WKContentView cutForWebView:]):
3280
3281 2019-04-18  Brent Fulgham  <bfulgham@apple.com>
3282
3283         InjectedBundle parameters often need initialization function called before unarchiving
3284         https://bugs.webkit.org/show_bug.cgi?id=189709
3285         <rdar://problem/44573653>
3286
3287         Reviewed by Ryosuke Niwa.
3288
3289         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
3290         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
3291         after the bundle initialiation function runs, which gives the embedding program the opportunity to
3292         register additional classes that are safe for serialization.
3293
3294         Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need
3295         to be serialized by the InjectedBundle.
3296         
3297         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
3298         Revise 'initialize' to call this new method.
3299
3300         * WebProcess/InjectedBundle/InjectedBundle.h:
3301         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
3302         (WebKit::InjectedBundle::initialize): Use the new method.
3303         (WebKit::InjectedBundle::decodeBundleParameters): Added.
3304         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
3305         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
3306         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
3307         NSDictionary object may itself hold other kinds of objects.
3308         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
3309         (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added.
3310
3311 2019-04-18  Zalan Bujtas  <zalan@apple.com>
3312
3313         Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
3314         https://bugs.webkit.org/show_bug.cgi?id=196948
3315         <rdar://problem/49927131>
3316
3317         Reviewed by Tim Horton.
3318
3319         Move intrinsicContentSizeDidChange out of DrawingArea. Intrinsic content size is a layout concept and
3320         after r244291 there's no reason to have it in DrawingArea.
3321
3322         * UIProcess/DrawingAreaProxy.h:
3323         (WebKit::DrawingAreaProxy::didUpdateGeometry):
3324         (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
3325         * UIProcess/DrawingAreaProxy.messages.in:
3326         * UIProcess/WebPageProxy.cpp:
3327         (WebKit::WebPageProxy::didChangeIntrinsicContentSize):
3328         (WebKit::WebPageProxy::setViewLayoutSize):
3329         * UIProcess/WebPageProxy.h:
3330         * UIProcess/WebPageProxy.messages.in:
3331         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
3332         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
3333         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
3334         * UIProcess/mac/WebPageProxyMac.mm:
3335         (WebKit::WebPageProxy::intrinsicContentSizeDidChange): Deleted.
3336         * WebProcess/WebPage/WebPage.cpp:
3337         (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded):
3338         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
3339         * WebProcess/WebPage/WebPage.h:
3340         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
3341         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3342         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3343         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded): Deleted.
3344
3345 2019-04-18  Ryan Haddad  <ryanhaddad@apple.com>
3346
3347         Unreviewed, rolling out r244299.
3348
3349         Breaks internal tests.
3350
3351         Reverted changeset:
3352
3353         "InjectedBundle parameters often need initialization function
3354         called before unarchiving"
3355         https://bugs.webkit.org/show_bug.cgi?id=189709
3356         https://trac.webkit.org/changeset/244299
3357
3358 2019-04-18  Shawn Roberts  <sroberts@apple.com>
3359
3360         Unreviewed manual rollout of r244248 and r244409
3361         Causing assertion failures on Mac WK2 Debug builds
3362         https://bugs.webkit.org/show_bug.cgi?id=195623
3363
3364         * NetworkProcess/NetworkProcess.cpp:
3365         (WebKit::NetworkProcess::lowMemoryHandler):
3366         * NetworkProcess/NetworkProcess.h:
3367         (WebKit::NetworkProcess::prefetchCache): Deleted.
3368         * NetworkProcess/NetworkResourceLoader.cpp:
3369         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
3370         (WebKit::NetworkResourceLoader::didReceiveResponse):
3371         (WebKit::NetworkResourceLoader::didReceiveBuffer):
3372         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
3373         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const): Deleted.
3374         * NetworkProcess/NetworkResourceLoader.h:
3375         * NetworkProcess/cache/PrefetchCache.cpp: Removed.
3376         * NetworkProcess/cache/PrefetchCache.h: Removed.
3377         * Shared/WebPreferences.yaml:
3378         * Sources.txt:
3379         * WebKit.xcodeproj/project.pbxproj:
3380
3381 2019-04-18  Devin Rousso  <drousso@apple.com>
3382
3383         Web Inspector: Canvas: enable WebGL2 for inspector page
3384         https://bugs.webkit.org/show_bug.cgi?id=196932
3385         <rdar://problem/49916213>
3386
3387         Reviewed by Timothy Hatcher.
3388
3389         * WebProcess/WebPage/WebInspectorUI.cpp:
3390         (WebKit::WebInspectorUI::WebInspectorUI):
3391
3392 2019-04-17  Devin Rousso  <drousso@apple.com>
3393
3394         Web Inspector: InspectorFrontendHost::inspectionLevel returns wrong value for inspector3
3395         https://bugs.webkit.org/show_bug.cgi?id=197044
3396
3397         Reviewed by Joseph Pecoraro.
3398
3399         * UIProcess/WebInspectorUtilities.h:
3400         * UIProcess/WebInspectorUtilities.cpp:
3401         (WebKit::trackInspectorPage):
3402         (WebKit::untrackInspectorPage):
3403         Determine the level of the inspector page by looking to see if the page being inspected is
3404         in the inspector page map. If so, we must be inspecting an inspector page and should use
3405         that inspector page's inspection level as the value to increment.
3406
3407         * UIProcess/WebInspectorProxy.cpp:
3408         (WebKit::WebInspectorProxy::createFrontendPage):
3409         * UIProcess/RemoteWebInspectorProxy.cpp:
3410         (WebKit::RemoteWebInspectorProxy::createFrontendPageAndWindow):
3411
3412 2019-04-17  Tim Horton  <timothy_horton@apple.com>
3413
3414         Adopt different scroll view flashing SPI
3415         https://bugs.webkit.org/show_bug.cgi?id=197043
3416         <rdar://problem/49996476>
3417
3418         Reviewed by Wenson Hsieh.
3419
3420         * Platform/spi/ios/UIKitSPI.h:
3421         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
3422         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
3423
3424 2019-04-17  Tim Horton  <timothy_horton@apple.com>
3425
3426         REGRESSION (r241988): Switching tabs is slow
3427         https://bugs.webkit.org/show_bug.cgi?id=197037
3428         <rdar://problem/49951473>
3429
3430         Reviewed by Simon Fraser.
3431
3432         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
3433         (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
3434         r241988 changed to wait for a WebPageProxy message to a given DrawingArea ID,
3435         but WebPageProxy messages are identified by their WebPageProxy ID.
3436         Revert that one change. The rest of the patch looks OK.
3437
3438 2019-04-17  Rob Buis  <rbuis@igalia.com>
3439
3440         Link prefetch not useful for top-level navigation
3441         https://bugs.webkit.org/show_bug.cgi?id=195623
3442
3443         Reviewed by Alex Christensen.
3444
3445         Fix macOS and iOS Debug WK2 bots ASSERTS after r367404, by simply
3446         not sending the DidReceiveResponse message.
3447
3448         * NetworkProcess/NetworkResourceLoader.cpp:
3449         (WebKit::NetworkResourceLoader::didReceiveResponse):
3450
3451 2019-04-17  Truitt Savell  <tsavell@apple.com>
3452
3453         Unreviewed, rolling out r244400.
3454
3455         Caused testing to exit early with assertionon Debug WK2
3456
3457         Reverted changeset:
3458
3459         "UI↔Web deadlock when printing with a JavaScript alert
3460         visible"
3461         https://bugs.webkit.org/show_bug.cgi?id=196839
3462         https://trac.webkit.org/changeset/244400
3463
3464 2019-04-17  Brady Eidson  <beidson@apple.com>
3465
3466         Link clicks in PDFs shouldn't send referrer headers.
3467         <rdar://problem/21142581> and https://bugs.webkit.org/show_bug.cgi?id=196980
3468
3469         Reviewed by Tim Horton.
3470
3471         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3472         (WebKit::PDFPlugin::clickedLink):
3473         * WebProcess/WebPage/WebPage.cpp:
3474         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
3475
3476 2019-04-17  Andy Estes  <aestes@apple.com>
3477
3478         [iOS] Support multiple file selection in UIDocumentPickerViewController
3479         https://bugs.webkit.org/show_bug.cgi?id=197014
3480         <rdar://problem/49963514>
3481
3482         Reviewed by Tim Horton.
3483
3484         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3485         (-[WKFileUploadPanel _showDocumentPickerMenu]):
3486         Allowed multiple file selection in our UIDocumentPickerViewController when
3487         _allowMultipleFiles is YES.
3488
3489         (displayStringForDocumentsAtURLs):
3490         (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
3491         Changed to support multiple file selection. When more than one file is selected, use
3492         WebCore::multipleFileUploadText() as the display string.
3493
3494 2019-04-17  Alex Christensen  <achristensen@webkit.org>
3495
3496         Make WebCompiledContentRuleListData non-default-constructible, move its nonserialized member to API::ContentRuleList
3497         https://bugs.webkit.org/show_bug.cgi?id=197033
3498
3499         Reviewed by Tim Horton.
3500
3501         This is just cleanup that makes the code nicer without changing behavior.
3502
3503         * Shared/WebCompiledContentRuleListData.cpp:
3504         (WebKit::WebCompiledContentRuleListData::encode const):
3505         (WebKit::WebCompiledContentRuleListData::decode):
3506         * Shared/WebCompiledContentRuleListData.h:
3507         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
3508         * UIProcess/API/APIContentRuleList.h:
3509         * UIProcess/API/APIContentRuleListStore.cpp:
3510         (API::createExtension):
3511
3512 2019-04-17  John Wilander  <wilander@apple.com>
3513
3514         Add prioritization of ad click conversions and cleaning of sent ad click conversions
3515         https://bugs.webkit.org/show_bug.cgi?id=196934
3516         <rdar://problem/49917773>
3517
3518         Reviewed by Chris Dumez.
3519
3520         In this description, by "pair" I mean { AdClickAttribution::Source, AdClickAttribution::Destination }.
3521
3522         This patch adds handling of prioritization of conversions according to these rules:
3523         - If we have a matching unconverted attribution, convert it. This consumes the conversion.
3524         - If we have no previously converted attribution for this pair, just store.
3525         - If we have a previously converted attribution for this pair, replace it if the new one has higher priority.
3526         - If we had no matching unconverted attribution but do have a previously converted attribution for this
3527         pair, re-convert the previously converted attribution to make sure the highest priority gets set.
3528
3529         This handling is in part done by dividing the previous m_adClickAttributionMap into 
3530         m_unconvertedAdClickAttributionMap and m_convertedAdClickAttributionMap, which now use a std::pair
3531         as key instead of a nested HashMap.
3532
3533         This patch also changes AdClickAttributionManager::firePendingConversionRequests() so that it now
3534         removes attributions which have been sent out.
3535
3536         Finally, AdClickAttributionManager::clear() no longer clears m_conversionBaseURLForTesting and
3537         m_isRunningTest since doing so caused test flakiness. It is now up to the test case that sets these
3538         members to also clear them when done.
3539
3540         * NetworkProcess/AdClickAttributionManager.cpp:
3541         (WebKit::AdClickAttributionManager::storeUnconverted):
3542         (WebKit::AdClickAttributionManager::convert):
3543         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
3544         (WebKit::AdClickAttributionManager::clear):
3545         (WebKit::AdClickAttributionManager::toString const):
3546         (WebKit::AdClickAttributionManager::setConversionURLForTesting):
3547         (WebKit::AdClickAttributionManager::ensureDestinationMapForSource): Deleted.
3548         (WebKit::AdClickAttributionManager::store): Deleted.
3549         * NetworkProcess/AdClickAttributionManager.h:
3550         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
3551         (WebKit::AdClickAttributionManager::setConversionURLForTesting): Deleted.
3552         * NetworkProcess/NetworkSession.cpp:
3553         (WebKit::NetworkSession::storeAdClickAttribution):
3554
3555 2019-04-17  Tim Horton  <timothy_horton@apple.com>
3556
3557         UI↔Web deadlock when printing with a JavaScript alert visible
3558         https://bugs.webkit.org/show_bug.cgi?id=196839
3559         <rdar://problem/49157642>
3560
3561         Reviewed by Andy Estes.
3562
3563         * Platform/IPC/Connection.cpp:
3564         (IPC::Connection::dispatchWorkQueueMessageReceiverMessage):
3565         (IPC::Connection::sendSyncReply):
3566         (IPC::Connection::dispatchSyncMessage):
3567         * Platform/IPC/Connection.h:
3568         (IPC::Connection::hasOutstandingOutgoingSynchronousReplies const):
3569         Keep track of whether we owe the other side of the connection any
3570         delayed sync replies.
3571
3572         * UIProcess/API/Cocoa/WKWebView.mm:
3573         (-[WKWebView _webViewPrintFormatter]):
3574         Most actions one can take with a _WKWebViewPrintFormatter involve
3575         synchronously messaging the Web Content process with an infinite timeout.
3576         Doing so while the Web Content process is awaiting a reply to a deferred-reply
3577         synchronous message (like, say, an alert()) results in an app-destroying deadlock.
3578         Instead of that, return a nil _WKWebViewPrintFormatter, indicating to the client
3579         that we can't print right now.
3580
3581         * UIProcess/ios/WKContentView.mm:
3582         (-[WKContentView _wk_pageCountForPrintFormatter:]):
3583         (-[WKContentView _wk_printedDocument]):
3584         The above isn't sufficient, though, because a sync message could arrive and
3585         be handled between creation and use of the _WKWebViewPrintFormatter.
3586         So, we also bail with a zero page count and null CGPDFDocument immediately
3587         before we would send a sync message to the Web Content process. Clients
3588         handle this less gracefully (e.g. showing a zero page PDF), but it is
3589         very rare compared to the above case.
3590
3591 2019-04-17  Zalan Bujtas  <zalan@apple.com>
3592
3593         [ContentChangeObserver] Use aria role as a hint whether a tap should result in a synthetic click
3594         https://bugs.webkit.org/show_bug.cgi?id=196988
3595         <rdar://problem/49955328>
3596
3597         Reviewed by Simon Fraser.
3598
3599         Tapping on elements with cretain aria role attributes should trigger synthetic click the same way it does on form control elements. 
3600
3601         * WebProcess/WebPage/ios/WebPageIOS.mm:
3602         (WebKit::isAriaRoleForImmediateClick):
3603         (WebKit::nodeAlwaysRequiresClick):
3604         (WebKit::WebPage::handleSyntheticClick):
3605
3606 2019-04-17  Alex Christensen  <achristensen@webkit.org>
3607
3608         WKRetainPtr's adoption constructor should be private
3609         https://bugs.webkit.org/show_bug.cgi?id=197019
3610
3611         Reviewed by Tim Horton.
3612
3613         RefPtr and RetainPtr have already done this.  It makes us use nicer syntax.
3614
3615         * UIProcess/API/C/WKContext.cpp:
3616         (WKContextSetDownloadClient):
3617         * UIProcess/API/cpp/WKRetainPtr.h:
3618         (WebKit::WKRetainPtr::WKRetainPtr):
3619         (WebKit::adoptWK):
3620
3621 2019-04-17  Alex Christensen  <achristensen@webkit.org>
3622
3623         Fix crash during teardown of PingLoad
3624         https://bugs.webkit.org/show_bug.cgi?id=197024
3625         <rdar://problem/49973077>
3626
3627         Reviewed by Jer Noble.
3628
3629         * NetworkProcess/PingLoad.cpp:
3630         (WebKit::PingLoad::initialize):
3631         Early return if weakThis is null.
3632
3633 2019-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
3634
3635         REGRESSION (r243926): [iOS] Release assertion when computing editor state during an overflow scroll triggered by layout
3636         https://bugs.webkit.org/show_bug.cgi?id=197012
3637         <rdar://problem/49908848>
3638
3639         Reviewed by Simon Fraser.
3640
3641         We hit the release assertion due to the following sequence of events:
3642         - Dispatch a queued event (in this case, a scroll event)
3643         - Invoke the scroll event listener, which modifies layout in some way
3644         - This scrolls an overflow scrollable container under the scope of layout
3645         - Overflow scrolling then calls didChangeSelection and triggers an editor state update, which updates layout
3646
3647         In the case where the selection is in the main frame, we bail early due to the check for recursive layout (i.e.
3648         frameView->layoutContext().isInRenderTreeLayout()). However, in the case where the selection is inside a
3649         subframe, we end up skipping past this check, since the subframe's FrameView isn't currently laying out, and so
3650         we end up hitting the release assertion underneath the early return.
3651
3652         To fix this, simply defer editor state updates due to overflow scrolling until the next remote layer tree commit
3653         instead of computing and sending the information immediately. While this only defers editor state updates during
3654         overflow scrolling, <rdar://problem/47258878> tracks making editor state updates deferred in the general case.
3655
3656         Test: editing/selection/overflow-scroll-while-selecting-text.html
3657
3658         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
3659         (WebKit::WebEditorClient::overflowScrollPositionChanged):
3660         * WebProcess/WebPage/WebPage.cpp:
3661         (WebKit::WebPage::didChangeOverflowScrollPosition):
3662         (WebKit::WebPage::didChangeSelection):
3663         (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
3664         * WebProcess/WebPage/WebPage.h:
3665
3666 2019-04-17  Chris Dumez  <cdumez@apple.com>
3667
3668         Remember device orientation permission for the duration of the browsing session
3669         https://bugs.webkit.org/show_bug.cgi?id=196992
3670         <rdar://problem/49946067>
3671
3672         Reviewed by Alex Christensen.
3673
3674         Implement caching of device orientation permission decisions on the WebDeviceOrientationAndMotionAccessController,
3675         which is owned by the WebsiteDataStore. This way, if we already prompted the user of a given origin, we will
3676         remember the previous decision for the duration of the session and not prompt again.
3677
3678         * Shared/WebsitePoliciesData.cpp:
3679         (WebKit::WebsitePoliciesData::encode const):
3680         (WebKit::WebsitePoliciesData::decode):
3681         * Shared/WebsitePoliciesData.h:
3682         * UIProcess/API/APIWebsitePolicies.cpp:
3683         (API::WebsitePolicies::copy const):
3684         (API::WebsitePolicies::data):
3685         * UIProcess/API/APIWebsitePolicies.h:
3686         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
3687         (toDeviceOrientationOrMotionPermissionState):
3688         (-[WKWebpagePreferences _setDeviceOrientationAndMotionAccessPolicy:]):
3689         (toWKWebsiteDeviceOrientationAndMotionAccessPolicy):
3690         (-[WKWebpagePreferences _deviceOrientationAndMotionAccessPolicy]):
3691         * UIProcess/WebPageProxy.cpp:
3692         (WebKit::WebPageProxy::shouldAllowDeviceOrientationAndMotionAccess):
3693         * UIProcess/WebPageProxy.h:
3694         * UIProcess/WebPageProxy.messages.in:
3695         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.cpp: Added.
3696         (WebKit::WebDeviceOrientationAndMotionAccessController::shouldAllowDeviceOrientationAndMotionAccess):
3697         (WebKit::WebDeviceOrientationAndMotionAccessController::deviceOrientationPermission const):
3698         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.h: Copied from Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h.
3699         * UIProcess/WebsiteData/WebsiteDataStore.h:
3700         (WebKit::WebsiteDataStore::deviceOrientationAndMotionAccessController):
3701         * WebKit.xcodeproj/project.pbxproj:
3702         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3703         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
3704         * WebProcess/WebCoreSupport/WebChromeClient.h:
3705         * WebProcess/WebPage/WebPage.cpp:
3706         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
3707         * WebProcess/WebPage/WebPage.h:
3708
3709 2019-04-16  Andy Estes  <aestes@apple.com>
3710
3711         [iOSMac] Use UIDocumentPickerViewController for picking files
3712         https://bugs.webkit.org/show_bug.cgi?id=196999
3713         <rdar://problem/49961414>
3714
3715         Reviewed by Tim Horton.
3716
3717         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3718         (-[WKFileUploadPanel _showDocumentPickerMenu]):
3719         Changed to present a UIDocumentPickerViewController on iOSMac.
3720
3721         (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
3722         (-[WKFileUploadPanel documentPicker:didPickDocumentAtURL:]):
3723         Replaced a deprecated delegate method implementation.
3724
3725 2019-04-16  Wenson Hsieh  <wenson_hsieh@apple.com>
3726
3727         [iOS] [WebKit2] Add support for honoring -[UIMenuItem dontDismiss]
3728         https://bugs.webkit.org/show_bug.cgi?id=196919
3729         <rdar://problem/41630459>
3730
3731         Reviewed by Tim Horton.
3732
3733         Adds modern WebKit support for -dontDismiss by implementing a couple of new platform hooks. Covered by a new
3734         layout test: editing/selection/ios/selection-after-changing-text-with-callout-menu.html.
3735
3736         * Platform/spi/ios/UIKitSPI.h:
3737
3738         Declare the private -dontDismiss property of UIMenuItem.
3739
3740         * UIProcess/API/Cocoa/WKWebView.mm:
3741         (-[WKWebView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
3742
3743         Additionally teach the web view (not just the content view) to respond to the hook. This matters in the case
3744         where the WebKit client (most notably, Mail) overrides WKWebView methods to define custom actions in the menu
3745         controller. This scenario is exercised by the new layout test.
3746
3747         * UIProcess/ios/WKContentViewInteraction.h:
3748         * UIProcess/ios/WKContentViewInteraction.mm:
3749         (-[WKContentView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
3750
3751         If an action was performed where callout bar fading was ignored, then in WebKit, don't allow selection changes
3752         to fade the callout bar until after the next remote layer tree commit.
3753
3754         (-[WKContentView _updateChangedSelection:]):
3755
3756         Stop suppressing selection updates when showing B/I/U controls, now that we can properly honor the -dontDismiss
3757         property. This was originally introduced in <rdar://problem/15199925>, presumably to ensure that B/I/U buttons
3758         (which have -dontDismiss set to YES) don't trigger selection change and end up dismissing themselves; however,
3759         if triggering B/I/U actually changes the selection rects, this also means that the selection rects on-screen
3760         would be stale after triggering these actions. This effect is most noticeable when bolding text.
3761
3762         (-[WKContentView shouldAllowHidingSelectionCommands]):
3763
3764 2019-04-16  Ross Kirsling  <ross.kirsling@sony.com>
3765
3766         Unreviewed non-unified build fix after r244307.
3767
3768         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
3769
3770 2019-04-16  Megan Gardner  <megan_gardner@apple.com>
3771
3772         Allow sharing from imageSheet on an image document
3773         https://bugs.webkit.org/show_bug.cgi?id=196891
3774         <rdar://problem/25377386>
3775
3776         Reviewed by Tim Horton.
3777
3778         Allow sharing from an image sheet generated from an image document
3779         by storing the image URL and using it as a fallback for the URL.
3780         Store it as an image on WKElementAction to not accidentally trigger
3781         any actions that should actually be associated with pure URLs.
3782
3783         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
3784         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
3785         (-[_WKActivatedElementInfo _initWithInteractionInformationAtPosition:]):
3786         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:]):
3787         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:userInfo:]):
3788         (-[_WKActivatedElementInfo imageURL]):
3789         (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:]): Deleted.
3790         (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:userInfo:]): Deleted.
3791         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
3792         * UIProcess/API/Cocoa/_WKElementAction.mm:
3793         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
3794         * UIProcess/ios/WKActionSheetAssistant.mm:
3795         (-[WKActionSheetAssistant showImageSheet]):
3796         (-[WKActionSheetAssistant defaultActionsForImageSheet:]):
3797         (-[WKActionSheetAssistant showLinkSheet]):
3798         * UIProcess/ios/WKContentViewInteraction.mm:
3799         (-[WKContentView _showAttachmentSheet]):
3800         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
3801         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
3802
3803 2019-04-16  Wenson Hsieh  <wenson_hsieh@apple.com>
3804
3805         [Cocoa] Add a way for Apple-internal clients to opt into recommended compatibility mode
3806         https://bugs.webkit.org/show_bug.cgi?id=196977
3807         <rdar://problem/49871194>
3808
3809         Reviewed by Tim Horton.
3810
3811         Add a helper method to query whether the navigation client should bypass policy safeguards when determining the
3812         recommended compatibility mode. We bypass policy safeguards in Cocoa platforms if the navigation delegate
3813         implements the new navigation delegate API.
3814
3815         * UIProcess/API/APINavigationClient.h:
3816         (API::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
3817         * UIProcess/Cocoa/NavigationState.h:
3818         * UIProcess/Cocoa/NavigationState.mm:
3819         (WebKit::NavigationState::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
3820
3821 2019-04-16  Per Arne Vollan  <pvollan@apple.com>
3822
3823         -[WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:] never returns _WKWebsiteDataTypeCredentials
3824         https://bugs.webkit.org/show_bug.cgi?id=196991
3825         <rdar://problem/45507423>
3826
3827         Reviewed by Brent Fulgham.
3828
3829         The credentials are stored in the Network process. To enable fetching credentials from the Network process,
3830         a proper process access type needs to be set for the credential Website data type.
3831
3832         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3833         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
3834
3835 2019-04-16  Alex Christensen  <achristensen@webkit.org>
3836
3837         REGRESSION(r244162) Clearing website data from ephemeral WKWebsiteDataStore should finish instead of asserting or hanging
3838         https://bugs.webkit.org/show_bug.cgi?id=196995
3839
3840         Reviewed by Brady Eidson.
3841
3842         Always call CompletionHandlers.  Otherwise things hang or assert.
3843         I added an API test that asserts without this change so we don't regress this again.
3844
3845         * NetworkProcess/cache/CacheStorageEngine.cpp:
3846         (WebKit::CacheStorage::Engine::clearAllCaches):
3847         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
3848
3849 2019-04-16  Chris Dumez  <cdumez@apple.com>
3850
3851         URL set by document.open() is not communicated to the UIProcess
3852         https://bugs.webkit.org/show_bug.cgi?id=196941
3853         <rdar://problem/49237544>
3854
3855         Reviewed by Geoff Garen.
3856
3857         Whenever the UIProcess is notified of an explicit document.open() call, update the
3858         PageLoadState to make sure the URL is up-to-date. Also make sure the page / process
3859         knows it committed a load (i.e. It is no longer showing the initially empty document).
3860
3861         * UIProcess/PageLoadState.cpp:
3862         (WebKit::PageLoadState::didExplicitOpen):
3863         * UIProcess/PageLoadState.h:
3864         * UIProcess/WebPageProxy.cpp:
3865         (WebKit::WebPageProxy::didExplicitOpenForFrame):
3866         * UIProcess/WebPageProxy.h:
3867         * UIProcess/WebPageProxy.messages.in:
3868         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3869         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
3870         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3871
3872 2019-04-16  Chris Dumez  <cdumez@apple.com>
3873
3874         Show prompt for device orientation access if the client does not implement the corresponding API delegate
3875         https://bugs.webkit.org/show_bug.cgi?id=196971
3876         <rdar://problem/49945840>
3877
3878         Reviewed by Alex Christensen.
3879
3880         Show prompt for device orientation access if the client does not implement the corresponding
3881         API delegate, instead of rejecting access by default.
3882
3883         * UIProcess/Cocoa/UIDelegate.mm:
3884         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
3885         * UIProcess/Cocoa/WKOrientationAccessAlert.h: Added.
3886         * UIProcess/Cocoa/WKOrientationAccessAlert.mm: Added.
3887         (WebKit::presentOrientationAccessAlert):
3888         * WebKit.xcodeproj/project.pbxproj:
3889
3890 2019-04-16  Zalan Bujtas  <zalan@apple.com>
3891
3892         REGRESSION(r243557)[ContentChangeObserver] Need to double tap text formatting elements in MS Word web app
3893         https://bugs.webkit.org/show_bug.cgi?id=196975
3894         <rdar://problem/49489849>
3895
3896         Reviewed by Simon Fraser.
3897
3898         This patch ensures that we always proceed with synthetic click on form elements.
3899
3900         Covered by existing tests.
3901
3902         * WebProcess/WebPage/ios/WebPageIOS.mm:
3903         (WebKit::WebPage::handleSyntheticClick):
3904
3905 2019-04-16  Timothy Hatcher  <timothy@apple.com>
3906
3907         FrameView base background color always starts white.
3908         https://bugs.webkit.org/show_bug.cgi?id=196976
3909
3910         Reviewed by Beth Dakin.
3911
3912         * WebProcess/WebPage/WebPage.cpp:
3913         (WebKit::WebPage::WebPage): Set m_backgroundColor before calling
3914         WebFrame::createWithCoreMainFrame so the call to create the FrameView
3915         for the empty page in transitionToCommittedForNewPage() gets
3916         the correct color from WebPage.
3917
3918 2019-04-16  Ryan Haddad  <ryanhaddad@apple.com>
3919
3920         Unreviewed, fix the build with recent SDKs.
3921
3922         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3923         (WebKit::WKWebViewState::store):
3924
3925 2019-04-16  Commit Queue  <commit-queue@webkit.org>
3926
3927         Unreviewed, rolling out r244321.
3928         https://bugs.webkit.org/show_bug.cgi?id=196968
3929
3930         Causing all WK2 Debug builds to exit early after Assertion
3931         failures. (Requested by ShawnRoberts on #webkit).
3932
3933         Reverted changeset:
3934
3935         "URL set by document.open() is not communicated to the
3936         UIProcess"
3937         https://bugs.webkit.org/show_bug.cgi?id=196941
3938         https://trac.webkit.org/changeset/244321
3939
3940 2019-04-15  Joseph Pecoraro  <pecoraro@apple.com>
3941
3942         Web Inspector: CRASH when reopening tab with docked inspector on crashed page
3943         https://bugs.webkit.org/show_bug.cgi?id=196954
3944         <rdar://problem/48716433>
3945
3946         Reviewed by Ryosuke Niwa.
3947
3948         * UIProcess/mac/WebInspectorProxyMac.mm:
3949         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
3950
3951 2019-04-15  Chris Dumez  <cdumez@apple.com>
3952
3953         URL set by document.open() is not communicated to the UIProcess
3954         https://bugs.webkit.org/show_bug.cgi?id=196941
3955         <rdar://problem/49237544>
3956
3957         Reviewed by Geoffrey Garen.
3958
3959         Whenever the UIProcess is notified of an explicit document.open() call, update the
3960         PageLoadState to make sure the URL is up-to-date. Also make sure the page / process
3961         knows it committed a load (i.e. It is no longer showing the initially empty document).
3962
3963         * UIProcess/PageLoadState.cpp:
3964         (WebKit::PageLoadState::didExplicitOpen):
3965         * UIProcess/PageLoadState.h:
3966         * UIProcess/WebPageProxy.cpp:
3967         (WebKit::WebPageProxy::didExplicitOpenForFrame):
3968         * UIProcess/WebPageProxy.h:
3969         * UIProcess/WebPageProxy.messages.in:
3970         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3971         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
3972         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3973
3974 2019-04-15  Alex Christensen  <achristensen@webkit.org>
3975
3976         Stop using hyphenationFactor
3977         https://bugs.webkit.org/show_bug.cgi?id=196949
3978         <rdar://problem/49779594>
3979
3980         Reviewed by Geoffrey Garen.
3981
3982         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
3983         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
3984         I added this use of hyphenationFactor in r241124 but the other changes in that revision make the use of hyphenationFactor redundant.
3985         There is a reason to remove it in the radar.
3986
3987 2019-04-15  Alex Christensen  <achristensen@webkit.org>
3988
3989         Forward declare WKWebView in _WKDiagnosticLoggingDelegate.h
3990
3991         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
3992         This fixes builds where _WKDiagnosticLoggingDelegate.h is the only WebKit header included, such as my work on rdar://problem/35175989
3993
3994 2019-04-15  Jer Noble  <jer.noble@apple.com>
3995
3996         Add a DiagnosticLogging method taking an arbitrary dictionary of values.
3997         https://bugs.webkit.org/show_bug.cgi?id=196773
3998
3999         Reviewed by Alex Christensen.
4000
4001         In addition to adding the new logging delegate method (and piping everything into it), 
4002         add a new APIObject class to represent a signed integer.
4003
4004         * Shared/API/APINumber.h:
4005         * Shared/API/APIObject.h:
4006         * Shared/Cocoa/APIObject.mm:
4007         (API::Object::newObject):
4008         * Shared/Cocoa/WKNSNumber.mm:
4009         (-[WKNSNumber dealloc]):