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