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