Unreviewed, rolling out r244627.
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-04-25  Commit Queue  <commit-queue@webkit.org>
2
3         Unreviewed, rolling out r244627.
4         https://bugs.webkit.org/show_bug.cgi?id=197282
5
6         Causing internal build failures (Requested by ShawnRoberts on
7         #webkit).
8
9         Reverted changeset:
10
11         "Create AVFoundationSoftLink.{h,mm} to reduce duplicate code"
12         https://bugs.webkit.org/show_bug.cgi?id=197171
13         https://trac.webkit.org/changeset/244627
14
15 2019-04-24  Carlos Garcia Campos  <cgarcia@igalia.com>
16
17         [GTK] Hardcoded text color in input fields
18         https://bugs.webkit.org/show_bug.cgi?id=126907
19
20         Reviewed by Michael Catanzaro.
21
22         Implement PageClient::effectiveAppearanceIsDark() for GTK port.
23
24         * UIProcess/API/gtk/PageClientImpl.cpp:
25         (WebKit::PageClientImpl::effectiveAppearanceIsDark const): Check if gtk-application-prefer-dark-theme setting is
26         enabled, or the theme name contains the -dark suffix or the GTK_THEME environment variable contains the :dark suffix.
27         * UIProcess/API/gtk/PageClientImpl.h:
28         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
29         (themeChanged): Notify the WebPageProxy that the theme has changed.
30         (webkitWebViewBaseSetToplevelOnScreenWindow): Connect to notify::gtk-application-prefer-dark-theme and notify::gtk-theme-name.
31         * WebProcess/WebPage/WebPage.cpp:
32         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
33         (WebKit::WebPage::setUseDarkAppearance): Set gtk-application-prefer-dark-theme setting accordingly.
34
35 2019-04-24  Zalan Bujtas  <zalan@apple.com>
36
37         Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
38         https://bugs.webkit.org/show_bug.cgi?id=196948
39         <rdar://problem/49927131>
40
41         Reviewed by Tim Horton.
42
43         Move intrinsicContentSizeDidChange out of DrawingArea. Intrinsic content size is a layout concept and
44         after r244291 there's no reason to have it in DrawingArea.
45
46         * UIProcess/DrawingAreaProxy.h:
47         (WebKit::DrawingAreaProxy::didUpdateGeometry):
48         (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
49         * UIProcess/DrawingAreaProxy.messages.in:
50         * UIProcess/WebPageProxy.cpp:
51         (WebKit::WebPageProxy::didChangeIntrinsicContentSize):
52         (WebKit::WebPageProxy::setViewLayoutSize):
53         * UIProcess/WebPageProxy.h:
54         * UIProcess/WebPageProxy.messages.in:
55         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
56         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
57         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
58         * UIProcess/mac/WebPageProxyMac.mm:
59         (WebKit::WebPageProxy::intrinsicContentSizeDidChange): Deleted.
60         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
61         (WebKit::WebChromeClient::intrinsicContentsSizeChanged const):
62         * WebProcess/WebCoreSupport/WebChromeClient.h:
63         * WebProcess/WebPage/WebPage.cpp:
64         (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded):
65         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
66         * WebProcess/WebPage/WebPage.h:
67         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
68         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
69         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
70         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded): Deleted.
71
72 2019-04-24  Commit Queue  <commit-queue@webkit.org>
73
74         Unreviewed, rolling out r244228.
75         https://bugs.webkit.org/show_bug.cgi?id=197262
76
77         Causes compat issues (Requested by smfr on #webkit).
78
79         Reverted changeset:
80
81         "Unreviewed test gardening for Windows."
82         https://trac.webkit.org/changeset/244228
83
84 2019-04-24  Eric Carlson  <eric.carlson@apple.com>
85
86         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
87         https://bugs.webkit.org/show_bug.cgi?id=197171
88         <rdar://problem/47454979>
89
90         Reviewed by Youenn Fablet.
91
92         * Shared/ios/WebIconUtilities.mm:
93         (WebKit::iconForVideoFile):
94         * Shared/mac/WebCoreArgumentCodersMac.mm:
95         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
96         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
97         * UIProcess/Cocoa/UIDelegate.mm:
98         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
99         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
100         (WebKit::PlatformCALayerRemoteCustom::clone const):
101
102 2019-04-24  Per Arne Vollan  <pvollan@apple.com>
103
104         [macOS] Fix syscall sandbox violation
105         https://bugs.webkit.org/show_bug.cgi?id=197247
106         <rdar://problem/50026580>
107
108         Reviewed by Brent Fulgham.
109
110         A missing syscall in the sandbox of the WebContent process is causing a crash.
111
112         * WebProcess/com.apple.WebProcess.sb.in:
113
114 2019-04-24  John Wilander  <wilander@apple.com>
115
116         Age out unconverted Ad Click Attributions after one week.
117         https://bugs.webkit.org/show_bug.cgi?id=197238
118         <rdar://problem/50177349>
119
120         Reviewed by Chris Dumez.
121
122         AdClickAttributionManager::storeUnconverted() and
123         AdClickAttributionManager::convert() now start by calling the new
124         AdClickAttributionManager::clearExpired() function to remove any
125         expired, unconverted attributions before continuing.
126
127         The rest of the patch is infrastructure to allow tests to expire
128         all unconverted attributions early.
129
130         * NetworkProcess/AdClickAttributionManager.cpp:
131         (WebKit::AdClickAttributionManager::storeUnconverted):
132         (WebKit::AdClickAttributionManager::convert):
133         (WebKit::AdClickAttributionManager::clearExpired):
134         (WebKit::AdClickAttributionManager::markAllUnconvertedAsExpiredForTesting):
135         * NetworkProcess/AdClickAttributionManager.h:
136         * NetworkProcess/NetworkProcess.cpp:
137         (WebKit::NetworkProcess::markAdClickAttributionsAsExpiredForTesting):
138         * NetworkProcess/NetworkProcess.h:
139         * NetworkProcess/NetworkProcess.messages.in:
140         * NetworkProcess/NetworkSession.cpp:
141         (WebKit::NetworkSession::markAdClickAttributionsAsExpiredForTesting):
142         * NetworkProcess/NetworkSession.h:
143         * UIProcess/API/C/WKPage.cpp:
144         (WKPageSetAdClickAttributionConversionURLForTesting):
145         (WKPageMarkAdClickAttributionsAsExpiredForTesting):
146         * UIProcess/API/C/WKPagePrivate.h:
147         * UIProcess/WebPageProxy.cpp:
148         (WebKit::WebPageProxy::markAdClickAttributionsAsExpiredForTesting):
149         * UIProcess/WebPageProxy.h:
150
151 2019-04-24  Wenson Hsieh  <wenson_hsieh@apple.com>
152
153         Plumb the navigation's request when determining recommended compatibility mode
154         https://bugs.webkit.org/show_bug.cgi?id=197225
155         <rdar://problem/48389965>
156
157         Reviewed by Alex Christensen.
158
159         Adds a new argument to effectiveCompatibilityModeAfterAdjustingPolicies.
160
161         * UIProcess/WebPageProxy.cpp:
162         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
163         (WebKit::WebPageProxy::effectiveCompatibilityModeAfterAdjustingPolicies):
164         * UIProcess/WebPageProxy.h:
165
166 2019-04-24  Tim Horton  <timothy_horton@apple.com>
167
168         Clean up WKActionSheetAssistant's use of LaunchServices
169         https://bugs.webkit.org/show_bug.cgi?id=194645
170         <rdar://problem/47707952>
171
172         Reviewed by Andy Estes.
173
174         * UIProcess/ios/WKActionSheetAssistant.mm:
175         (applicationHasAppLinkEntitlements):
176         (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]):
177         (-[WKActionSheetAssistant _appendOpenActionsForURL:actions:elementInfo:]):
178         (appLinkForURL): Deleted.
179         Make this function much more early-returny and flat.
180         Adopt LS sync SPI instead of using a semaphore ourselves.
181         Adopt modern open SPI.
182
183 2019-04-24  Simon Fraser  <simon.fraser@apple.com>
184
185         Make it possible to control the renderTreeAsText output by setting options on testRunner
186         https://bugs.webkit.org/show_bug.cgi?id=197133
187
188         Reviewed by Sam Weinig.
189
190         Add testRunner.setRenderTreeDumpOptions() and expose the subset of RenderAsTextFlag flags
191         that make sense in testing (those that don't dump unstable data like addresses), and plumb
192         these flags through the various framework layers.
193
194         Convert RenderAsTextBehavior to an OptionSet<RenderAsTextFlag>.
195
196         Fix code generation in WebKitTestRunner to generate bindings for IDL const values,
197         and hand-code DumpRenderTree bindings.
198
199         Some cleanup of the TestRunners, using member initializers.
200
201         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
202         (WKBundlePageCopyRenderTreeExternalRepresentation):
203         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
204         * WebProcess/WebPage/WebPage.cpp:
205         (WebKit::toRenderAsTextFlags):
206         (WebKit::WebPage::renderTreeExternalRepresentation const):
207         (WebKit::WebPage::renderTreeExternalRepresentationForPrinting const):
208         * WebProcess/WebPage/WebPage.h:
209
210 2019-04-24  Alex Christensen  <achristensen@webkit.org>
211
212         WKContentRuleLists should have a maximum FileProtection of CompleteUnlessOpen
213         https://bugs.webkit.org/show_bug.cgi?id=197078
214         <rdar://problem/49564348>
215
216         Reviewed by Geoff Garen.
217
218         r242735 was a fix for crashes when using mmap'd memory in apps with default FileProtection of NSFileProtectionComplete.
219         It is more memory efficient and just as secure to reduce the FileProtection of these files to NSFileProtectionCompleteUnlessOpen.
220
221         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
222         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
223         (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath):
224         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting): Deleted.
225         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting): Deleted.
226         * NetworkProcess/cache/NetworkCacheFileSystem.h:
227         * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm: Added.
228         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
229         (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath):
230         * Shared/WebCompiledContentRuleList.cpp:
231         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
232         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
233         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
234         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
235         (WebKit::WebCompiledContentRuleList::actions const):
236         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const): Deleted.
237         * Shared/WebCompiledContentRuleList.h:
238         * Shared/WebCompiledContentRuleListData.cpp:
239         (WebKit::WebCompiledContentRuleListData::encode const):
240         (WebKit::WebCompiledContentRuleListData::decode):
241         (WebKit::WebCompiledContentRuleListData::size const): Deleted.
242         (WebKit::WebCompiledContentRuleListData::dataPointer const): Deleted.
243         * Shared/WebCompiledContentRuleListData.h:
244         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
245         * SourcesCocoa.txt:
246         * UIProcess/API/APIContentRuleList.cpp:
247         (API::ContentRuleList::usesCopiedMemory const): Deleted.
248         * UIProcess/API/APIContentRuleList.h:
249         * UIProcess/API/APIContentRuleListStore.cpp:
250         (API::openAndMapOrCopyContentRuleList):
251         (API::compiledToFile):
252         (API::createExtension):
253         (API::ContentRuleListStore::getContentRuleListSource):
254         (API::ContentRuleListStore::readContentsOfFile): Deleted.
255         (API::MappedOrCopiedData::dataPointer const): Deleted.
256         * UIProcess/API/APIContentRuleListStore.h:
257         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
258         (API::ContentRuleListStore::readContentsOfFile): Deleted.
259         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
260         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]): Deleted.
261         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
262         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
263         (-[_WKUserContentFilter usesCopiedMemory]): Deleted.
264         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
265         * WebKit.xcodeproj/project.pbxproj:
266
267 2019-04-24  David Kilzer  <ddkilzer@apple.com>
268
269         Fix build due to missing SPI declaration of kAXSFullKeyboardAccessEnabledNotification
270
271         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm: Import
272         AccessibilitySupportSPI.h.
273
274 2019-04-24  Chris Dumez  <cdumez@apple.com>
275
276         URL set by document.open() is communicated with the WebPageProxy but not the WebFrameProxy
277         https://bugs.webkit.org/show_bug.cgi?id=197214
278         <rdar://problem/49237544>
279
280         Reviewed by Alex Christensen.
281
282         URL set by document.open() is communicated with the WebPageProxy (since r244361) but not the
283         WebFrameProxy. This patch fixes this.
284
285         * UIProcess/API/Cocoa/WKWebView.mm:
286         (-[WKWebView _mainFrameURL]):
287         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
288         * UIProcess/FrameLoadState.cpp:
289         (WebKit::FrameLoadState::didExplicitOpen):
290         * UIProcess/FrameLoadState.h:
291         * UIProcess/WebFrameProxy.cpp:
292         (WebKit::WebFrameProxy::didExplicitOpen):
293         * UIProcess/WebFrameProxy.h:
294         * UIProcess/WebPageProxy.cpp:
295         (WebKit::WebPageProxy::didExplicitOpenForFrame):
296
297 2019-04-24  Chris Dumez  <cdumez@apple.com>
298
299         X-Frame-Options header should be ignored when frame-ancestors CSP directive is present
300         https://bugs.webkit.org/show_bug.cgi?id=197226
301         <rdar://problem/50155649>
302
303         Reviewed by Alex Christensen.
304
305         * NetworkProcess/NetworkResourceLoader.cpp:
306         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
307
308 2019-04-24  Dean Jackson  <dino@apple.com>
309
310         Rename _highlightLongPressCanClick and only add gesture recognizer when necessary
311         https://bugs.webkit.org/show_bug.cgi?id=197231
312         <rdar://problem/50164234>
313
314         Reviewed by Antoine Quint.
315
316         Rename _highlightLongPressCanClick to _longPressCanClick since it will be
317         used in other places.
318
319         Only attach the _highlightLongPressGestureRecognizer when we're not
320         using long presses for preview. This might revert in the future, if we
321         can set up an appropriate gesture resolution between the two.
322
323         * UIProcess/ios/WKContentViewInteraction.h:
324         * UIProcess/ios/WKContentViewInteraction.mm:
325         (-[WKContentView setupInteraction]):
326         (-[WKContentView _webTouchEvent:preventsNativeGestures:]):
327         (-[WKContentView _highlightLongPressRecognized:]):
328         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
329         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
330         (-[WKContentView _previewItemControllerDidCancelPreview:]):
331
332 2019-04-24  chris fleizach  <cfleizach@apple.com>
333
334         AX: Remove deprecated Accessibility Object Model events
335         https://bugs.webkit.org/show_bug.cgi?id=197073
336         <rdar://problem/50027819>
337
338         Reviewed by Ryosuke Niwa.
339
340         * Platform/spi/ios/AccessibilitySupportSPI.h:
341         * UIProcess/API/Cocoa/WKWebView.mm:
342         (-[WKWebView _initializeWithConfiguration:]):
343         (-[WKWebView dealloc]):
344         (accessibilityEventsEnabledChangedCallback): Deleted.
345         (-[WKWebView _updateAccessibilityEventsEnabled]): Deleted.
346         * UIProcess/API/Cocoa/WKWebViewInternal.h:
347         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm:
348         * UIProcess/WebPageProxy.cpp:
349         (WebKit::WebPageProxy::updateAccessibilityEventsEnabled): Deleted.
350         * UIProcess/WebPageProxy.h:
351         * WebProcess/WebPage/WebPage.cpp:
352         (WebKit::WebPage::updateAccessibilityEventsEnabled): Deleted.
353         * WebProcess/WebPage/WebPage.h:
354         * WebProcess/WebPage/WebPage.messages.in:
355
356 2019-04-23  John Wilander  <wilander@apple.com>
357
358         Move Ad Click Attribution from internal feature to experimental feature
359         https://bugs.webkit.org/show_bug.cgi?id=197218
360         <rdar://problem/47651691>
361
362         Reviewed by Brent Fulgham.
363
364         * Shared/WebPreferences.yaml:
365
366 2019-04-23  Keith Rollin  <krollin@apple.com>
367
368         Add Xcode version check for Header post-processing scripts
369         https://bugs.webkit.org/show_bug.cgi?id=197116
370         <rdar://problem/50058968>
371
372         Reviewed by Brent Fulgham.
373
374         There are several places in our Xcode projects that post-process
375         header files after they've been exported. Because of XCBuild, we're
376         moving to a model where the post-processing is performed at the same
377         time the header files are exported, rather than as a distinct
378         post-processing step. This patch disables the distinct step when the
379         inline processing is available.
380
381         In practice, this means prefixing appropriate post-processing Custom
382         Build phases with:
383
384         if [ "${XCODE_VERSION_MAJOR}" -ge "1100" -a "${USE_NEW_BUILD_SYSTEM}" = "YES" ]; then
385             # 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.
386             exit 0
387         fi
388
389         * WebKit.xcodeproj/project.pbxproj:
390
391 2019-04-23  John Wilander  <wilander@apple.com>
392
393         Remove Ad Click Attribution data when removing website data
394         https://bugs.webkit.org/show_bug.cgi?id=197215
395         <rdar://problem/47668988>
396
397         Reviewed by Chris Dumez.
398
399         This patch adds a new WebsiteDataType called AdClickAttributions and flags
400         it as owned by the network process.
401
402         The new website data type is added to the Cocoa API layer for
403         website data records management.
404
405         When either of the two WebsiteDataStore::removeData() functions calls
406         NetworkProcess::deleteWebsiteData() or
407         NetworkProcess::deleteWebsiteDataForOrigins() over IPC, the network
408         process now calls into AdClickAttributionManager::clear() and
409         AdClickAttributionManager::clearForRegistrableDomain() respectively,
410         if the website datatypes include WebsiteDataType::AdClickAttributions.
411
412         The patch removes a couple of completion handlers in NetworkSession function
413         calls are because those are not asynchronous.
414
415         * NetworkProcess/AdClickAttributionManager.cpp:
416         (WebKit::AdClickAttributionManager::clear):
417         (WebKit::AdClickAttributionManager::clearForRegistrableDomain):
418         (WebKit::AdClickAttributionManager::toString const):
419         * NetworkProcess/AdClickAttributionManager.h:
420         * NetworkProcess/NetworkProcess.cpp:
421         (WebKit::NetworkProcess::deleteWebsiteData):
422         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
423         (WebKit::NetworkProcess::clearAdClickAttribution):
424         * NetworkProcess/NetworkSession.cpp:
425         (WebKit::NetworkSession::clearAdClickAttribution):
426         (WebKit::NetworkSession::clearAdClickAttributionForRegistrableDomain):
427         * NetworkProcess/NetworkSession.h:
428         * Shared/WebsiteData/WebsiteData.cpp:
429         (WebKit::WebsiteData::ownerProcess):
430         * Shared/WebsiteData/WebsiteDataType.h:
431         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
432         (WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval):
433         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
434         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
435         (dataTypesToString):
436         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
437         (WebKit::toWebsiteDataType):
438         (WebKit::toWKWebsiteDataTypes):
439         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
440         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
441         (+[WKWebsiteDataStore _allWebsiteDataTypesIncludingPrivate]):
442
443 2019-04-23  Tim Horton  <timothy_horton@apple.com>
444
445         Return annotated text checking strings via UIWKDocumentContext
446         https://bugs.webkit.org/show_bug.cgi?id=197177
447         <rdar://problem/49064839>
448
449         Reviewed by Ryosuke Niwa.
450
451         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h:
452         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
453         (WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions):
454         * WebProcess/WebPage/ios/WebPageIOS.mm:
455         (WebKit::WebPage::requestDocumentEditingContext):
456         Respect the UIWKDocumentRequestAnnotation flag, returning an attributed
457         string containing the platform text checking annotations.
458
459 2019-04-23  Commit Queue  <commit-queue@webkit.org>
460
461         Unreviewed, rolling out r244556.
462         https://bugs.webkit.org/show_bug.cgi?id=197212
463
464         Causing build failures on multiple builders (Requested by
465         ShawnRoberts on #webkit).
466
467         Reverted changeset:
468
469         "Create AVFoundationSoftLink.{h,mm} to reduce duplicate code"
470         https://bugs.webkit.org/show_bug.cgi?id=197171
471         https://trac.webkit.org/changeset/244556
472
473 2019-04-23  Remy Demarest  <rdemarest@apple.com>
474
475         Build fix after r244545.
476
477         Reviewed by Tim Horton.
478
479         * Platform/spi/mac/AppKitSPI.h:
480         The SPI was an IPI in High Sierra.
481
482 2019-04-23  Per Arne Vollan  <pvollan@apple.com>
483
484         [iOS] Input field on ddg.gg is auto focused when url is entered with the software keyboard
485         https://bugs.webkit.org/show_bug.cgi?id=196740
486
487         Reviewed by Megan Gardner.
488
489         When an url for a page with an autofocused input field  is entered with the software keyboard,
490         the input field is auto selected, and the software keyboard reappears. This does not happen
491         when picking the url from favorites. After using the software keyboard to enter the url, the
492         activity state is being changed to focused. The method '_elementDidFocus' checks whether the
493         activity state changed, and allows the software keyboard to be shown in this case. To avoid
494         showing the software keyboard in this case, send the changing activity state bitfield to the
495         UI process, and check if the focus flag is the only flag set.
496   
497         * UIProcess/ios/WKContentViewInteraction.mm:
498         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
499
500 2019-04-23  Guy Lewin  <guy@lewin.co.il>
501
502         Multiple File Input Icon Set Regardless of File List
503         https://bugs.webkit.org/show_bug.cgi?id=195537
504
505         Reviewed by Alexey Proskuryakov.
506
507         Add WKOpenPanelResultListenerChooseMediaFiles() to choose files with
508         icon and display string on iOS file open panels
509
510         * UIProcess/API/C/WKOpenPanelResultListener.cpp:
511         (WKOpenPanelResultListenerChooseMediaFiles):
512         * UIProcess/API/C/WKOpenPanelResultListener.h:
513
514 2019-04-23  Eric Carlson  <eric.carlson@apple.com>
515
516         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
517         https://bugs.webkit.org/show_bug.cgi?id=197171
518         <rdar://problem/47454979>
519
520         Reviewed by Youenn Fablet.
521
522         * Shared/ios/WebIconUtilities.mm:
523         (WebKit::iconForVideoFile):
524         * Shared/mac/WebCoreArgumentCodersMac.mm:
525         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
526         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
527         * UIProcess/Cocoa/UIDelegate.mm:
528         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
529         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
530         (WebKit::PlatformCALayerRemoteCustom::clone const):
531
532 2019-04-22  Dean Jackson  <dino@apple.com>
533
534         Use additional members and protocols from WebKitAdditions in WKContentViewInteraction
535         https://bugs.webkit.org/show_bug.cgi?id=197184
536         <rdar://problem/50113848>
537
538         Reviewed by Wenson Hsieh.
539
540         WebKitAdditions defines some macros to include additional members
541         and protocols for WKContentViewInteraction.
542
543         It also defines some new functions. Provide empty version
544         of those functions when WebKitAdditions is not available.
545
546         * UIProcess/ios/WKContentViewInteraction.h:
547         * UIProcess/ios/WKContentViewInteraction.mm:
548         (-[WKContentView _registerPreview]):
549         (-[WKContentView _unregisterPreview]):
550
551 2019-04-23  Tim Horton  <timothy_horton@apple.com>
552
553         Action sheet shares a stringified URL instead of a URL object
554         https://bugs.webkit.org/show_bug.cgi?id=197185
555         <rdar://problem/49962249>
556
557         Reviewed by Darin Adler.
558
559         * UIProcess/Cocoa/WKShareSheet.h:
560         * UIProcess/Cocoa/WKShareSheet.mm:
561         (-[WKShareSheet presentWithParameters:inRect:completionHandler:]):
562         (-[WKShareSheet presentWithParameters:completionHandler:]): Deleted.
563         * UIProcess/Cocoa/WebViewImpl.mm:
564         (WebKit::WebViewImpl::showShareSheet):
565         * UIProcess/ios/PageClientImplIOS.mm:
566         (WebKit::PageClientImpl::showShareSheet):
567         Make it possible to optionally provide WKShareSheet with
568         a rect to present relative to.
569
570         * UIProcess/ios/WKContentViewInteraction.h:
571         * UIProcess/ios/WKContentViewInteraction.mm:
572         (-[WKContentView _showShareSheet:inRect:completionHandler:]):
573         (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]):
574         (-[WKContentView _showShareSheet:completionHandler:]): Deleted.
575         Instead of stringifying the URL and using the text selection assistant's
576         share method, hand WKShareSheet a proper URL.
577
578 2019-04-23  Ryosuke Niwa  <rniwa@webkit.org>
579
580         [iOS] element.focus() sometimes fails to reveal the focused element when it becomes editable dynamically
581         https://bugs.webkit.org/show_bug.cgi?id=197188
582
583         Reviewed by Wenson Hsieh.
584
585         Commit the scroll tree update before revealing the keyboard via editor state update.
586
587         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
588         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
589
590 2019-04-23  Remy Demarest  <rdemarest@apple.com>
591
592         Fix layout issues occuring when entering full screen mode.
593         https://bugs.webkit.org/show_bug.cgi?id=197086
594         <rdar://problem/47733671>.
595
596         Reviewed by Darin Adler.
597
598         This issue is the result of changing the style mask of the window after entering
599         full screen mode. Safari adds an invisible toolbar to display the URL of the page
600         which ends up breaking the layout. Having that window use a style that includes a
601         titlebar fixes the bug.
602
603         * Platform/spi/mac/AppKitSPI.h:
604         Declare an SPI to be used in WKFullScreenWindowController.
605
606         * UIProcess/Cocoa/WebViewImpl.mm:
607         (WebKit::WebViewImpl::fullScreenWindow): Make the full screen window show a titlebar
608         and make the content view underlap the titlebar to match the current behavior.
609         Remove NSWindowStyleMaskBorderless which has no effects since it is equal to zero.
610
611         * UIProcess/mac/WKFullScreenWindowController.mm:
612         (-[WKFullScreenWindowController initWithWindow:webView:page:]): Hide the titlebar
613         before beginning the animation to full screen.
614         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Show the title
615         bar when in full screen instead of a blank bar.
616         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): Hide the title
617         bar to restore the initial setting.
618
619 2019-04-23  John Wilander  <wilander@apple.com>
620
621         Ad Click Attribution redirects to well-known location should not trigger a conversion if they are blocked by content blockers
622         https://bugs.webkit.org/show_bug.cgi?id=197183
623         <rdar://problem/47763188>
624
625         Reviewed by Alex Christensen.
626
627         Ad Click Attribution conversions are picked up in the redirect handler
628         in WebKit::NetworkResourceLoader. Content blocking typically happens in
629         the continued redirect request handling in the web content process and
630         a blocked request comes back empty.
631
632         We need to call the WebKit::NetworkLoadChecker in the network process
633         for these specific redirects, just like we do for Ping.
634
635         The change makes use of the existing function
636         NetworkLoadChecker::enableContentExtensionsCheck() for this purpose.
637
638         In essence, this change makes it possible to block all conversions made
639         to a "/.well-known/ad-click-attribution/" URL.
640
641         * NetworkProcess/NetworkResourceLoader.cpp:
642         (WebKit::NetworkResourceLoader::handleAdClickAttributionConversion):
643             New convenience function.
644         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
645             Now calls NetworkLoadChecker::enableContentExtensionsCheck() if
646             an Ad Click Attribution conversion was found in the redirect URL.
647         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
648             If the request was not blocked, it will store any found conversion here.
649         * NetworkProcess/NetworkResourceLoader.h:
650
651 2019-04-23  Don Olmstead  <don.olmstead@sony.com>
652
653         [CMake][Win] Use target oriented design for WebKit
654         https://bugs.webkit.org/show_bug.cgi?id=197173
655
656         Reviewed by Alex Christensen.
657
658         Enumerate public framework headers for WinCairo's WebKit implementation and copy them.
659         Migrate to use WebKit_DERIVED_SOURCES_DIR.
660
661         * CMakeLists.txt:
662         * PlatformGTK.cmake:
663         * PlatformWPE.cmake:
664         * PlatformWin.cmake:
665
666 2019-04-23  Chris Dumez  <cdumez@apple.com>
667
668         [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
669         https://bugs.webkit.org/show_bug.cgi?id=197097
670         <rdar://problem/50048318>
671
672         Reviewed by Alex Christensen.
673
674         The issue is that when doing a history navigation with form data, we try to resubmit the form.
675         We initially use the ReturnCacheDataDontLoad cache policy without prompting the user to get
676         cached data. If this fails, we sent a DidFailProvisionalLoadForFrame IPC to the UIProcess but
677         the WebContent process actually retries the load with ReturnCacheDataElseLoad cache policy.
678         This new load triggers a new decidePolicyForNavigationAction.
679
680         This would cause trouble with process-swapping because we normally destroy the
681         ProvisionalPageProxy as soon as we receive a DidFailProvisionalLoadForFrame IPC from the
682         provisional process. As a result, the provisional process would not be able to retry.
683
684         To address the issue, we add pass a flag with the DidFailProvisionalLoadForFrame IPC to
685         if the load will continue or not. When this flag is set, the UIProcess does not destroy
686         the provisional page.
687
688         * Scripts/webkit/messages.py:
689         Minor IPC message handler build fix.
690
691         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
692         (-[WKURLSchemeTaskImpl _onlyIfCached]):
693         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
694         Add new _onlyIfCached SPI to WKURLSchemeTaskPrivate to allow for API testing.
695
696         * UIProcess/ProvisionalPageProxy.cpp:
697         (WebKit::ProvisionalPageProxy::cancel):
698         Pass WillContinueLoading flag.
699
700         (WebKit::ProvisionalPageProxy::validateInput):
701         Consider IPC with a navigationID of 0 as valid. When the navigation is triggered by the
702         WebContent process, it sends us a DecidePolicyForNavigationActionAsync IPC with a navigationID
703         of 0, until the UIProcess can generate a valid identifier.
704
705         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
706
707         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
708         When the WebPageProxy has generated a navigationID for the new WebContent process-initiated
709         navigation, update m_navigationID so that follow-up IPC is considered valid.
710
711         * UIProcess/ProvisionalPageProxy.h:
712         * UIProcess/WebPageProxy.cpp:
713         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
714         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
715         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
716         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
717         * UIProcess/WebPageProxy.h:
718         * UIProcess/WebPageProxy.messages.in:
719         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
720         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
721         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
722
723 2019-04-22  Zalan Bujtas  <zalan@apple.com>
724
725         [ContentChangeObserver] Some dropdown menus may close without user gesture on americanexpress.com
726         https://bugs.webkit.org/show_bug.cgi?id=197175
727         <rdar://problem/49613013>
728
729         Reviewed by Simon Fraser.
730
731         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.
732         However it won't regress cases like youtube.com, where sending mouseout is required to have the control bar dismissed on play. 
733
734         * WebProcess/WebPage/ios/WebPageIOS.mm:
735         (WebKit::WebPage::completeSyntheticClick):
736
737 2019-04-22  Alex Christensen  <achristensen@webkit.org>
738
739         Deprecate WKContextCreateWithInjectedBundlePath
740         https://bugs.webkit.org/show_bug.cgi?id=197169
741
742         Reviewed by Youenn Fablet.
743
744         * UIProcess/API/C/WKContext.h:
745
746 2019-04-22  Alex Christensen  <achristensen@webkit.org>
747
748         REGRESSION(r230681) Do not use stored credentials if WKBundlePageResourceLoadClient.shouldUseCredentialStorage returns false
749         https://bugs.webkit.org/show_bug.cgi?id=197093
750         <rdar://problem/49708268>
751
752         Reviewed by Chris Dumez.
753
754         Only get the StoredCredentialsPolicy from the NetworkLoadChecker if we haven't already been told not to use credentials.
755         Also add some test infrastructure for clearing persistent credentials added by the test.
756
757         * NetworkProcess/NetworkProcess.cpp:
758         (WebKit::NetworkProcess::removeCredential):
759         * NetworkProcess/NetworkProcess.h:
760         * NetworkProcess/NetworkProcess.messages.in:
761         * NetworkProcess/NetworkResourceLoader.cpp:
762         (WebKit::NetworkResourceLoader::startNetworkLoad):
763         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
764         (WebKit::NetworkProcess::removeCredential):
765         * UIProcess/API/Cocoa/WKProcessPool.mm:
766         (-[WKProcessPool _removeCredential:forProtectionSpace:completionHandler:]):
767         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
768         * UIProcess/WebProcessPool.cpp:
769         (WebKit::WebProcessPool::removeCredential):
770         * UIProcess/WebProcessPool.h:
771
772 2019-04-22  Chris Dumez  <cdumez@apple.com>
773
774         Delayed WebProcessLaunch may break the _relatedWebView SPI
775         https://bugs.webkit.org/show_bug.cgi?id=197160
776
777         Reviewed by Alex Christensen.
778
779         Delayed WebProcessLaunch may break the _relatedWebView SPI. The breakage would happen if the client
780         would relate a WebView to another which has not launched its initial process yet.
781
782         To address the issue, when we need a running process for a WebView which has a related view, we need
783         to make sure the related view has a running process and use that process. Previously, we would share
784         the "dummy" process instead.
785
786         * UIProcess/WebPageProxy.cpp:
787         (WebKit::WebPageProxy::launchProcess):
788         (WebKit::WebPageProxy::ensureRunningProcess):
789         * UIProcess/WebPageProxy.h:
790         * UIProcess/WebProcessPool.cpp:
791         (WebKit::WebProcessPool::createWebPage):
792
793 2019-04-22  David Quesada  <david_quesada@apple.com>
794
795         Remove linked-on-or-after check for download attribute handling
796         https://bugs.webkit.org/show_bug.cgi?id=197176
797         rdar://problem/48459714
798
799         Reviewed by Alex Christensen.
800
801         There are no apps linked prior to this SDK version that are using the _WKDownload SPI,
802         so it doesn't make sense to preserve the old behavior of forcing download-attribute
803         links to start downloads.
804
805         * UIProcess/Cocoa/VersionChecks.h:
806         * UIProcess/WebPageProxy.cpp:
807         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
808
809 2019-04-22  Chris Dumez  <cdumez@apple.com>
810
811         Unreviewed, rolling out r244502.
812
813         Caused crashes on the bots
814
815         Reverted changeset:
816
817         "Delayed WebProcessLaunch may break the _relatedWebView SPI"
818         https://bugs.webkit.org/show_bug.cgi?id=197160
819         https://trac.webkit.org/changeset/244502
820
821 2019-04-22  Ryan Haddad  <ryanhaddad@apple.com>
822
823         Unreviewed, rolling out r244437.
824
825         Still breaks internal tests.
826
827         Reverted changeset:
828
829         "InjectedBundle parameters often need initialization function
830         called before unarchiving"
831         https://bugs.webkit.org/show_bug.cgi?id=189709
832         https://trac.webkit.org/changeset/244437
833
834 2019-04-22  Chris Dumez  <cdumez@apple.com>
835
836         Delayed WebProcessLaunch may break the _relatedWebView SPI
837         https://bugs.webkit.org/show_bug.cgi?id=197160
838
839         Reviewed by Alex Christensen.
840
841         Delayed WebProcessLaunch may break the _relatedWebView SPI. The breakage would happen if the client
842         would relate a WebView to another which has not launched its initial process yet.
843
844         To address the issue, when we need a running process for a WebView which has a related view, we need
845         to make sure the related view has a running process and use that process. Previously, we would share
846         the "dummy" process instead.
847
848         * UIProcess/WebPageProxy.cpp:
849         (WebKit::WebPageProxy::launchProcess):
850         (WebKit::WebPageProxy::ensureRunningProcess):
851         * UIProcess/WebPageProxy.h:
852         * UIProcess/WebProcessPool.cpp:
853         (WebKit::WebProcessPool::createWebPage):
854
855 2019-04-22  Ludovico de Nittis  <ludovico.denittis@collabora.com>
856
857         [GTK] fix gtk_style_context_set_background deprecation
858         https://bugs.webkit.org/show_bug.cgi?id=196912
859
860         Reviewed by Carlos Garcia Campos.
861
862         Since gtk 3.18 gtk_style_context_set_background has been deprecated.
863         Backgrounds are not rendered in the UI process, so it can be
864         simply removed.
865
866         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
867         (webkitWebViewBaseRealize):
868
869 2019-04-21  Wenson Hsieh  <wenson_hsieh@apple.com>
870
871         Defer EditorState updates until the next layer tree flush in a few additional circumstances
872         https://bugs.webkit.org/show_bug.cgi?id=197145
873         <rdar://problem/50078170>
874
875         Reviewed by Darin Adler.
876
877         Gets rid of sendPartialEditorStateAndSchedulePostLayoutUpdate(), in favor of always scheduling a full editor
878         state update after the next compositing flush.
879
880         * WebProcess/WebPage/WebPage.cpp:
881         (WebKit::WebPage::updateEditorStateAfterLayoutIfEditabilityChanged):
882         (WebKit::WebPage::setNeedsFontAttributes):
883         (WebKit::WebPage::didChangeOverflowScrollPosition):
884         (WebKit::WebPage::didChangeSelection):
885         (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
886         (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate): Deleted.
887         * WebProcess/WebPage/WebPage.h:
888         * WebProcess/WebPage/ios/WebPageIOS.mm:
889         (WebKit::WebPage::platformEditorState const):
890         (WebKit::WebPage::updateVisibleContentRects):
891
892 2019-04-21  Chris Dumez  <cdumez@apple.com>
893
894         Regression(r243767) WebFrame::m_navigationIsContinuingInAnotherProcess flag is never reset
895         https://bugs.webkit.org/show_bug.cgi?id=197144
896
897         Reviewed by Darin Adler.
898
899         WebFrame::m_navigationIsContinuingInAnotherProcess flag is never reset since it was introduced in
900         r243767. This leads to leaking Navigation objects in the UIProcess when reusing a previously
901         suspended process because such process will no longer send the DidDestroyNavigation IPC.
902
903         It turns out that resetting the flags causes API tests such as ProcessSwap.QuickBackForwardNavigationWithPSON
904         to ASSERT. This is because when the UIProcess quickly navigate back and forth without waiting for policy
905         decisions, we may end up getting the policy decision for a particular navigation *after* we've sent the
906         DidDestroyNavigation.
907
908         As a result, this patch reverts r243767 and fixes in the assertion in http/tests/adClickAttribution/store-ad-click-attribution.html
909         another way. We initially assumed that the logic in WebPageProxy::didDestroyNavigation() was failing to
910         ignore the DidDestroyNavigation from the previous process after a swap due to a race, maybe because it was
911         sometimes received too late and m_provisionalPage was already cleared. However, this would not make sense
912         since the test is crashing consistently and the page would no longer be able to receive IPC from the
913         previous process *after* we've committed the provisional process/page.
914
915         The real issue was that the DidDestroyNavigation IPC was received *before* we could construct the
916         provisional page, which is why the logic in WebPageProxy::didDestroyNavigation() was failing to ignore
917         the bad IPC. In WebPageProxy::receivedNavigationPolicyDecision(), we were calling receivedPolicyDecision()
918         (which would send the DidReceivePolicyDecision to the previous WebProcess) and then continueNavigationInNewProcess()
919         in order to construct the provisional page. I personally did not expect we could receive IPC between the
920         calls to receivedNavigationPolicyDecision() and receivedPolicyDecision(), since we are not yielding and since
921         the DidReceivePolicyDecision IPC is asynchronous. However, this is exactly what was happening in the context
922         of this test. The reason is that the DidReceivePolicyDecision IPC was getting wrapped in a synchronous message
923         and sent as synchronous message due to the Connection::m_inDispatchMessageMarkedToUseFullySynchronousModeForTesting
924         flag which seems to get set in the test due to some EventSender IPC. I believe this is because the test uses
925         EventSender to do a click on a link which triggers the navigation.
926
927         To address the issue, I now call receivedNavigationPolicyDecision() *after* continueNavigationInNewProcess()
928         to make sure that we always start the provisional load in the new process before we tell the previous process
929         to stop loading. This way, there is no way we get IPC from the previous process about the current navigation
930         before we have a provisional page.
931
932         * UIProcess/WebPageProxy.cpp:
933         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
934         (WebKit::WebPageProxy::didDestroyNavigation):
935         * WebProcess/WebPage/WebFrame.cpp:
936         (WebKit::WebFrame::didReceivePolicyDecision):
937         (WebKit::WebFrame::documentLoaderDetached):
938         * WebProcess/WebPage/WebFrame.h:
939
940 2019-04-20  Chris Dumez  <cdumez@apple.com>
941
942         Unreviewed, fix iOS build with recent SDKs.
943
944         * UIProcess/API/Cocoa/WKWebView.mm:
945         (deviceOrientation):
946         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
947         (-[WKFullScreenViewController initWithWebView:]):
948         (-[WKFullScreenViewController viewWillTransitionToSize:withTransitionCoordinator:]):
949         (-[WKFullScreenViewController _statusBarFrameDidChange:]):
950
951 2019-04-19  John Wilander  <wilander@apple.com>
952
953         Disable Ad Click Attribution in ephemeral sessions and make sure conversion requests use an ephemeral, stateless session
954         https://bugs.webkit.org/show_bug.cgi?id=197108
955         <rdar://problem/49918702>
956
957         Reviewed by Alex Christensen.
958
959         This patch introduces a new NSURLSession in WebKit::NetworkSessionCocoa called
960         m_ephemeralStatelessCookielessSession. As its name implies, it's ephemeral, 
961         stateless, and has a NSHTTPCookieAcceptPolicyNever cookie policy.
962
963         The new session can be invoked with the new enum value of
964         WebCore::StoredCredentialsPolicy called EphemeralStatelessCookieless.
965
966         WebKit::AdClickAttributionManager::fireConversionRequest() makes use of
967         the new session for its conversion requests.
968
969         This patch also makes sure that Ad Click Attributions cannot be stored in
970         ephemeral sessions and already stored attributions cannot be converted in
971         ephemeral sessions.
972
973         * NetworkProcess/AdClickAttributionManager.cpp:
974         (WebKit::AdClickAttributionManager::fireConversionRequest):
975         (WebKit::AdClickAttributionManager::toString const):
976         * NetworkProcess/NetworkLoadChecker.h:
977         * NetworkProcess/NetworkProcess.h:
978         * NetworkProcess/NetworkProcess.messages.in:
979         * NetworkProcess/NetworkResourceLoader.cpp:
980         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
981         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
982         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
983             Calls NetworkSessionCocoa::initializeEphemeralStatelessCookielessSession() lazily.
984         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
985         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
986         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
987         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
988         (WebKit::NetworkSessionCocoa::initializeEphemeralStatelessCookielessSession):
989         (WebKit::NetworkSessionCocoa::invalidateAndCancel):
990         * Shared/WebCoreArgumentCoders.h:
991
992 2019-04-19  Daniel Bates  <dabates@apple.com>
993
994         Use RetainPtr and rename +autocorrectionRectsWithRects:lastRect: to +autocorrectionRectsWithFirstCGRect:lastCGRect:
995         https://bugs.webkit.org/show_bug.cgi?id=197122
996
997         Reviewed by Wenson Hsieh.
998
999         * UIProcess/ios/WKContentViewInteraction.mm:
1000         (-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]): Renamed; formerly named +autocorrectionRectsWithRects:lastRect:.
1001         While I am here use else-branch to initialize firstRect and lastRect just to make the code closer to the optimal
1002         assembly. Also use Vector::{isEmpty, first, last}() instead of using the index operator overload and size() for
1003         emptiness checks. The code is more readable at the cost being ever so slightly slower (due to the overflow checks
1004         in first() and last()), but this code is likely not hot enough for it to matter.
1005         (-[WKContentView applyAutocorrection:toString:withCompletionHandler:]): Update for renaming.
1006         (+[WKAutocorrectionRects autocorrectionRectsWithFirstCGRect:lastCGRect:]): Ditto.
1007         (+[WKAutocorrectionRects autocorrectionRectsWithRects:lastRect:]): Deleted.
1008
1009 2019-04-19  Daniel Bates  <dabates@apple.com>
1010
1011         -[WKAutocorrectionContext emptyAutocorrectionContext:] generates invalid empty context
1012         https://bugs.webkit.org/show_bug.cgi?id=197119
1013
1014         Reviewed by Wenson Hsieh.
1015
1016         Use the existing EditingRange type to represent the location and length of the marked text
1017         range for an autocorrection instead of managing integers. This type avoid the need to handle
1018         the special case for an empty range represented as NSMakeRange(NSNotFound, 0). Currently
1019         WKAutocorrectionContext incorrectly represents the empty range as NSMakeRange(WTF::notFound, 0).
1020
1021         While I am here, simplify the existing WebAutocorrectionContext encoder/decoder code and rename
1022         +[WKAutocorrectionContext autocorrectionContextWithContext:] to +autocorrectionContextWithWebContext
1023         to better reflect the expected source of the conversion: a Web-type.
1024
1025         * Shared/ios/WebAutocorrectionContext.h:
1026         (WebKit::WebAutocorrectionContext::encode const): Reformat while I am here to make this logic easy
1027         to amend without losing SVN history.
1028         (WebKit::WebAutocorrectionContext::decode): Simplify the code while I am here.
1029         * UIProcess/ios/WKContentViewInteraction.mm:
1030         (-[WKContentView _handleAutocorrectionContext:]): Update for renaming.
1031         (+[WKAutocorrectionContext emptyAutocorrectionContext]): Update for renaming.
1032         (+[WKAutocorrectionContext autocorrectionContextWithWebContext:]): Renamed; formerly named autocorrectionContextWithContext.
1033         (+[WKAutocorrectionContext autocorrectionContextWithContext:]): Deleted.
1034         * WebProcess/WebPage/ios/WebPageIOS.mm:
1035         (WebKit::WebPage::autocorrectionContext): Update to make use of EditingRange. Also instantiate
1036         the struct and return it, initializing its fields individually instead of using the constructor to
1037         make this code less error prone. It's easy to introduce an error with the constructor notation when
1038         amending the the struct because so many of the arguments are of the same data type. Individually
1039         initializing the struct fields makes it less likely for an ordering mistake to be introduced.
1040
1041 2019-04-19  Dean Jackson  <dino@apple.com>
1042
1043         Add more _WKElementActionTypes and provide API to create with custom types
1044         https://bugs.webkit.org/show_bug.cgi?id=197117
1045         <rdar://problem/50059548>
1046
1047         Reviewed by Tim Horton.
1048
1049         We were missing a few obvious types that are well-known
1050         browser actions, and/or should be visible in share sheets.
1051         Also, clean up the API for constructing new types.
1052
1053         * UIProcess/API/Cocoa/_WKElementAction.h: Add new types for opening
1054         in new tabs, windows and downloading.
1055         * UIProcess/API/Cocoa/_WKElementAction.mm:
1056         (+[_WKElementAction elementActionWithType:title:actionHandler:]): New constructor
1057         with type, title and action.
1058         (+[_WKElementAction elementActionWithType:]): Call new method.
1059
1060 2019-04-18  Daniel Bates  <dabates@apple.com>
1061
1062         Use existing KeyEventCodesIOS constants instead of duplicating them
1063         https://bugs.webkit.org/show_bug.cgi?id=197081
1064
1065         Rubber-stamped by Wenson Hsieh.
1066
1067         * UIProcess/ios/WKContentViewInteraction.mm:
1068         (-[WKContentView _interpretKeyEvent:isCharEvent:]): While I am here, remove the case for the space key
1069         as it is identical to the default switch case.
1070
1071 2019-04-19  Keith Rollin  <krollin@apple.com>
1072
1073         Add postprocess-header-rule scripts
1074         https://bugs.webkit.org/show_bug.cgi?id=197072
1075         <rdar://problem/50027299>
1076
1077         Reviewed by Brent Fulgham.
1078
1079         Several projects have post-processing build phases where exported
1080         headers are tweaked after they've been copied. This post-processing is
1081         performed via scripts called postprocess-headers.sh. For reasons
1082         related to XCBuild, we are now transitioning to a build process where
1083         the post-processing is performed at the same time as the
1084         exporting/copying. To support this process, add similar scripts named
1085         postprocess-header-rule, which are geared towards processing a single
1086         file at a time rather than all exported files at once. Also add a
1087         build rule that makes use of these scripts. These scripts and build
1088         rules are not used at the moment; they will come into use in an
1089         imminent patch.
1090
1091         Note that I've named these postprocess-header-rule rather than
1092         postprocess-header-rule.sh. Scripts in Tools/Scripts do not have
1093         suffixes indicating how the tool is implemented. Scripts in
1094         per-project Scripts folders appear to be mixed regarding the use of
1095         suffixes. I'm opting here to follow the Tools/Scripts convention, with
1096         the expectation that over time we completely standardize on that.
1097
1098         * Scripts/postprocess-header-rule: Added.
1099         * WebKit.xcodeproj/project.pbxproj:
1100
1101 2019-04-19  Brady Eidson  <beidson@apple.com>
1102
1103         Deprecate WebKit2 plug-in support.
1104         <rdar://problem/43812306> and https://bugs.webkit.org/show_bug.cgi?id=197080
1105
1106         Reviewed by Andy Estes.
1107
1108         * UIProcess/API/Cocoa/WKPreferences.h:
1109         * UIProcess/API/Cocoa/WKPreferences.mm:
1110         (-[WKPreferences encodeWithCoder:]):
1111         (-[WKPreferences initWithCoder:]):
1112         (-[WKPreferences javaEnabled]):
1113         (-[WKPreferences setJavaEnabled:]):
1114         (-[WKPreferences plugInsEnabled]):
1115         (-[WKPreferences setPlugInsEnabled:]):
1116
1117 2019-04-19  Chris Dumez  <cdumez@apple.com>
1118
1119         Minor PSON release logging improvements
1120         https://bugs.webkit.org/show_bug.cgi?id=197104
1121
1122         Reviewed by Darin Adler.
1123
1124         * UIProcess/SuspendedPageProxy.cpp:
1125         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
1126         * UIProcess/WebPageProxy.cpp:
1127         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1128
1129 2019-04-19  Tim Horton  <timothy_horton@apple.com>
1130
1131         YouTube and Twitter embeds don't load in News
1132         https://bugs.webkit.org/show_bug.cgi?id=197111
1133         <rdar://problem/50010081>
1134
1135         Reviewed by Timothy Hatcher.
1136
1137         * WebProcess/com.apple.WebProcess.sb.in:
1138         Adjust this sandbox exception to include both platforms.
1139
1140 2019-04-19  Wenson Hsieh  <wenson_hsieh@apple.com>
1141
1142         [iOS] Add quirks to disable autocorrection and autocapitalization in hidden editable areas on some websites
1143         https://bugs.webkit.org/show_bug.cgi?id=197102
1144         <rdar://problem/49864669>
1145
1146         Reviewed by Ryosuke Niwa.
1147
1148         If the quirk for disabling autocorrection and autocapitalization in hidden editable areas is active, then check
1149         whether the focused element is hidden, and turn off autocorrection and autocapitalization if needed.
1150
1151         * WebProcess/WebPage/ios/WebPageIOS.mm:
1152         (WebKit::WebPage::getFocusedElementInformation):
1153
1154 2019-04-19  Commit Queue  <commit-queue@webkit.org>
1155
1156         Unreviewed, rolling out r244447.
1157         https://bugs.webkit.org/show_bug.cgi?id=197103
1158
1159         Caused build failures with Internal and Opensource builders
1160         (Requested by ShawnRoberts on #webkit).
1161
1162         Reverted changeset:
1163
1164         "Deprecate WebKit2 plug-in support."
1165         https://bugs.webkit.org/show_bug.cgi?id=197080
1166         https://trac.webkit.org/changeset/244447
1167
1168 2019-04-18  Brady Eidson  <beidson@apple.com>
1169
1170         Deprecate WebKit2 plug-in support.
1171         <rdar://problem/43812306> and https://bugs.webkit.org/show_bug.cgi?id=197080
1172
1173         Reviewed by Andy Estes.
1174
1175         * UIProcess/API/Cocoa/WKPreferences.h:
1176         * UIProcess/API/Cocoa/WKPreferences.mm:
1177         (-[WKPreferences encodeWithCoder:]):
1178         (-[WKPreferences initWithCoder:]):
1179         (-[WKPreferences javaEnabled]):
1180         (-[WKPreferences setJavaEnabled:]):
1181         (-[WKPreferences plugInsEnabled]):
1182         (-[WKPreferences setPlugInsEnabled:]):
1183
1184 2019-04-18  Commit Queue  <commit-queue@webkit.org>
1185
1186         Unreviewed, rolling out r244434.
1187         https://bugs.webkit.org/show_bug.cgi?id=197089
1188
1189         caused 1 API test failure (Requested by zalan on #webkit).
1190
1191         Reverted changeset:
1192
1193         "Regression (r244291): Broken API Test
1194         AutoLayoutRenderingProgressRelativeOrdering"
1195         https://bugs.webkit.org/show_bug.cgi?id=196948
1196         https://trac.webkit.org/changeset/244434
1197
1198 2019-04-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1199
1200         Add new compatibility mode API on WKNavigation
1201         https://bugs.webkit.org/show_bug.cgi?id=197069
1202         <rdar://problem/50025800>
1203
1204         Reviewed by Tim Horton.
1205
1206         Adds a new property on WKNavigation.
1207
1208         * Shared/WebCompatibilityMode.h:
1209
1210         Drive-by fix: make this enum class 8 bits wide.
1211
1212         * UIProcess/API/APINavigation.h:
1213         (API::Navigation::setEffectiveCompatibilityMode):
1214         (API::Navigation::effectiveCompatibilityMode const):
1215
1216         Add a new member variable to API::Navigation.
1217
1218         * UIProcess/API/Cocoa/WKNavigation.h:
1219         * UIProcess/API/Cocoa/WKNavigation.mm:
1220         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
1221         * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h:
1222
1223         Add various hooks into WebKitAdditions.
1224
1225         * UIProcess/WebPageProxy.cpp:
1226         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1227
1228         Set API::Navigation's effective compatibility mode.
1229
1230         (WebKit::WebPageProxy::effectiveCompatibilityModeAfterAdjustingPolicies):
1231
1232         Renamed and refactored this method to return the effective compatibility mode, chosen while adjusting website
1233         policies.
1234
1235         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode): Deleted.
1236         * UIProcess/WebPageProxy.h:
1237
1238 2019-04-18  Don Olmstead  <don.olmstead@sony.com>
1239
1240         [CMake] Make WebCore headers copies
1241         https://bugs.webkit.org/show_bug.cgi?id=182512
1242         <rdar://problem/37510435>
1243
1244         Reviewed by Alex Christensen.
1245
1246         WebCore now uses WebCore_PRIVATE_INCLUDE_DIRECTORIES for all ports. This revealed
1247         problems with WebKit's usage of WebCore headers. All include directories directly
1248         referencing the WebCore source tree we're removed from the CMake files. Any includes
1249         of WebCore headers using "*.h" were modified to <WebCore/*.h>
1250
1251         Removed generation of forwarding headers for WebCore using the perl script.
1252
1253         * CMakeLists.txt:
1254         * NetworkProcess/curl/NetworkDataTaskCurl.h:
1255         * PlatformWPE.cmake:
1256         * PlatformWin.cmake:
1257         * Scripts/generate-forwarding-headers.pl:
1258         * UIProcess/API/glib/WebKitUserContentFilterStore.cpp:
1259         * UIProcess/API/wpe/WebKitColorPrivate.h:
1260         * UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp:
1261         * UIProcess/win/PageClientImpl.cpp:
1262
1263 2019-04-18  Chris Dumez  <cdumez@apple.com>
1264
1265         [iOS] Improve detection of when web views go to background / foreground
1266         https://bugs.webkit.org/show_bug.cgi?id=197035
1267         <rdar://problem/45281182>
1268
1269         Reviewed by Tim Horton.
1270
1271         Improve detection of when web views go to background / foreground on iOS.
1272
1273         * UIProcess/ApplicationStateTracker.mm:
1274         (WebKit::ApplicationStateTracker::ApplicationStateTracker): Deleted.
1275         (WebKit::ApplicationStateTracker::~ApplicationStateTracker): Deleted.
1276         (WebKit::ApplicationStateTracker::applicationDidEnterBackground): Deleted.
1277         (WebKit::ApplicationStateTracker::applicationDidFinishSnapshottingAfterEnteringBackground): Deleted.
1278         (WebKit::ApplicationStateTracker::applicationWillEnterForeground): Deleted.
1279
1280 2019-04-18  Jer Noble  <jer.noble@apple.com>
1281
1282         Refactoring: Pull all fullscreen code out of Document and into its own helper class
1283         https://bugs.webkit.org/show_bug.cgi?id=197017
1284
1285         Reviewed by Eric Carlson.
1286
1287         * WebProcess/FullScreen/WebFullScreenManager.cpp:
1288         (WebKit::WebFullScreenManager::willEnterFullScreen):
1289         (WebKit::WebFullScreenManager::didEnterFullScreen):
1290         (WebKit::WebFullScreenManager::willExitFullScreen):
1291         (WebKit::WebFullScreenManager::didExitFullScreen):
1292         (WebKit::WebFullScreenManager::setAnimatingFullScreen):
1293         (WebKit::WebFullScreenManager::requestExitFullScreen):
1294         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
1295         (webkit_dom_document_webkit_cancel_fullscreen):
1296         (webkit_dom_document_webkit_exit_fullscreen):
1297         (webkit_dom_document_get_webkit_is_fullscreen):
1298         (webkit_dom_document_get_webkit_fullscreen_keyboard_input_allowed):
1299         (webkit_dom_document_get_webkit_current_fullscreen_element):
1300         (webkit_dom_document_get_webkit_fullscreen_element):
1301         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1302         (WebKit::WebChromeClient::createWindow):
1303
1304 2019-04-18  Megan Gardner  <megan_gardner@apple.com>
1305
1306         Update UIKit when a cut causes a selection change
1307         https://bugs.webkit.org/show_bug.cgi?id=197047
1308         <rdar://problem/36311563>
1309
1310         Reviewed by Wenson Hsieh.
1311
1312         We need to let UIKit know when a cut causes a selection change (always),
1313         so that is can appropriately update the button on the keyboard bar.
1314
1315         * UIProcess/ios/WKContentViewInteraction.mm:
1316         (-[WKContentView cutForWebView:]):
1317
1318 2019-04-18  Brent Fulgham  <bfulgham@apple.com>
1319
1320         InjectedBundle parameters often need initialization function called before unarchiving
1321         https://bugs.webkit.org/show_bug.cgi?id=189709
1322         <rdar://problem/44573653>
1323
1324         Reviewed by Ryosuke Niwa.
1325
1326         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
1327         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
1328         after the bundle initialiation function runs, which gives the embedding program the opportunity to
1329         register additional classes that are safe for serialization.
1330
1331         Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need
1332         to be serialized by the InjectedBundle.
1333         
1334         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
1335         Revise 'initialize' to call this new method.
1336
1337         * WebProcess/InjectedBundle/InjectedBundle.h:
1338         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
1339         (WebKit::InjectedBundle::initialize): Use the new method.
1340         (WebKit::InjectedBundle::decodeBundleParameters): Added.
1341         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
1342         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
1343         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
1344         NSDictionary object may itself hold other kinds of objects.
1345         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
1346         (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added.
1347
1348 2019-04-18  Zalan Bujtas  <zalan@apple.com>
1349
1350         Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
1351         https://bugs.webkit.org/show_bug.cgi?id=196948
1352         <rdar://problem/49927131>
1353
1354         Reviewed by Tim Horton.
1355
1356         Move intrinsicContentSizeDidChange out of DrawingArea. Intrinsic content size is a layout concept and
1357         after r244291 there's no reason to have it in DrawingArea.
1358
1359         * UIProcess/DrawingAreaProxy.h:
1360         (WebKit::DrawingAreaProxy::didUpdateGeometry):
1361         (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
1362         * UIProcess/DrawingAreaProxy.messages.in:
1363         * UIProcess/WebPageProxy.cpp:
1364         (WebKit::WebPageProxy::didChangeIntrinsicContentSize):
1365         (WebKit::WebPageProxy::setViewLayoutSize):
1366         * UIProcess/WebPageProxy.h:
1367         * UIProcess/WebPageProxy.messages.in:
1368         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
1369         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1370         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
1371         * UIProcess/mac/WebPageProxyMac.mm:
1372         (WebKit::WebPageProxy::intrinsicContentSizeDidChange): Deleted.
1373         * WebProcess/WebPage/WebPage.cpp:
1374         (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded):
1375         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
1376         * WebProcess/WebPage/WebPage.h:
1377         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1378         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1379         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1380         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded): Deleted.
1381
1382 2019-04-18  Ryan Haddad  <ryanhaddad@apple.com>
1383
1384         Unreviewed, rolling out r244299.
1385
1386         Breaks internal tests.
1387
1388         Reverted changeset:
1389
1390         "InjectedBundle parameters often need initialization function
1391         called before unarchiving"
1392         https://bugs.webkit.org/show_bug.cgi?id=189709
1393         https://trac.webkit.org/changeset/244299
1394
1395 2019-04-18  Shawn Roberts  <sroberts@apple.com>
1396
1397         Unreviewed manual rollout of r244248 and r244409
1398         Causing assertion failures on Mac WK2 Debug builds
1399         https://bugs.webkit.org/show_bug.cgi?id=195623
1400
1401         * NetworkProcess/NetworkProcess.cpp:
1402         (WebKit::NetworkProcess::lowMemoryHandler):
1403         * NetworkProcess/NetworkProcess.h:
1404         (WebKit::NetworkProcess::prefetchCache): Deleted.
1405         * NetworkProcess/NetworkResourceLoader.cpp:
1406         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1407         (WebKit::NetworkResourceLoader::didReceiveResponse):
1408         (WebKit::NetworkResourceLoader::didReceiveBuffer):
1409         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
1410         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const): Deleted.
1411         * NetworkProcess/NetworkResourceLoader.h:
1412         * NetworkProcess/cache/PrefetchCache.cpp: Removed.
1413         * NetworkProcess/cache/PrefetchCache.h: Removed.
1414         * Shared/WebPreferences.yaml:
1415         * Sources.txt:
1416         * WebKit.xcodeproj/project.pbxproj:
1417
1418 2019-04-18  Devin Rousso  <drousso@apple.com>
1419
1420         Web Inspector: Canvas: enable WebGL2 for inspector page
1421         https://bugs.webkit.org/show_bug.cgi?id=196932
1422         <rdar://problem/49916213>
1423
1424         Reviewed by Timothy Hatcher.
1425
1426         * WebProcess/WebPage/WebInspectorUI.cpp:
1427         (WebKit::WebInspectorUI::WebInspectorUI):
1428
1429 2019-04-17  Devin Rousso  <drousso@apple.com>
1430
1431         Web Inspector: InspectorFrontendHost::inspectionLevel returns wrong value for inspector3
1432         https://bugs.webkit.org/show_bug.cgi?id=197044
1433
1434         Reviewed by Joseph Pecoraro.
1435
1436         * UIProcess/WebInspectorUtilities.h:
1437         * UIProcess/WebInspectorUtilities.cpp:
1438         (WebKit::trackInspectorPage):
1439         (WebKit::untrackInspectorPage):
1440         Determine the level of the inspector page by looking to see if the page being inspected is
1441         in the inspector page map. If so, we must be inspecting an inspector page and should use
1442         that inspector page's inspection level as the value to increment.
1443
1444         * UIProcess/WebInspectorProxy.cpp:
1445         (WebKit::WebInspectorProxy::createFrontendPage):
1446         * UIProcess/RemoteWebInspectorProxy.cpp:
1447         (WebKit::RemoteWebInspectorProxy::createFrontendPageAndWindow):
1448
1449 2019-04-17  Tim Horton  <timothy_horton@apple.com>
1450
1451         Adopt different scroll view flashing SPI
1452         https://bugs.webkit.org/show_bug.cgi?id=197043
1453         <rdar://problem/49996476>
1454
1455         Reviewed by Wenson Hsieh.
1456
1457         * Platform/spi/ios/UIKitSPI.h:
1458         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
1459         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
1460
1461 2019-04-17  Tim Horton  <timothy_horton@apple.com>
1462
1463         REGRESSION (r241988): Switching tabs is slow
1464         https://bugs.webkit.org/show_bug.cgi?id=197037
1465         <rdar://problem/49951473>
1466
1467         Reviewed by Simon Fraser.
1468
1469         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1470         (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
1471         r241988 changed to wait for a WebPageProxy message to a given DrawingArea ID,
1472         but WebPageProxy messages are identified by their WebPageProxy ID.
1473         Revert that one change. The rest of the patch looks OK.
1474
1475 2019-04-17  Rob Buis  <rbuis@igalia.com>
1476
1477         Link prefetch not useful for top-level navigation
1478         https://bugs.webkit.org/show_bug.cgi?id=195623
1479
1480         Reviewed by Alex Christensen.
1481
1482         Fix macOS and iOS Debug WK2 bots ASSERTS after r367404, by simply
1483         not sending the DidReceiveResponse message.
1484
1485         * NetworkProcess/NetworkResourceLoader.cpp:
1486         (WebKit::NetworkResourceLoader::didReceiveResponse):
1487
1488 2019-04-17  Truitt Savell  <tsavell@apple.com>
1489
1490         Unreviewed, rolling out r244400.
1491
1492         Caused testing to exit early with assertionon Debug WK2
1493
1494         Reverted changeset:
1495
1496         "UI↔Web deadlock when printing with a JavaScript alert
1497         visible"
1498         https://bugs.webkit.org/show_bug.cgi?id=196839
1499         https://trac.webkit.org/changeset/244400
1500
1501 2019-04-17  Brady Eidson  <beidson@apple.com>
1502
1503         Link clicks in PDFs shouldn't send referrer headers.
1504         <rdar://problem/21142581> and https://bugs.webkit.org/show_bug.cgi?id=196980
1505
1506         Reviewed by Tim Horton.
1507
1508         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1509         (WebKit::PDFPlugin::clickedLink):
1510         * WebProcess/WebPage/WebPage.cpp:
1511         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
1512
1513 2019-04-17  Andy Estes  <aestes@apple.com>
1514
1515         [iOS] Support multiple file selection in UIDocumentPickerViewController
1516         https://bugs.webkit.org/show_bug.cgi?id=197014
1517         <rdar://problem/49963514>
1518
1519         Reviewed by Tim Horton.
1520
1521         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1522         (-[WKFileUploadPanel _showDocumentPickerMenu]):
1523         Allowed multiple file selection in our UIDocumentPickerViewController when
1524         _allowMultipleFiles is YES.
1525
1526         (displayStringForDocumentsAtURLs):
1527         (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
1528         Changed to support multiple file selection. When more than one file is selected, use
1529         WebCore::multipleFileUploadText() as the display string.
1530
1531 2019-04-17  Alex Christensen  <achristensen@webkit.org>
1532
1533         Make WebCompiledContentRuleListData non-default-constructible, move its nonserialized member to API::ContentRuleList
1534         https://bugs.webkit.org/show_bug.cgi?id=197033
1535
1536         Reviewed by Tim Horton.
1537
1538         This is just cleanup that makes the code nicer without changing behavior.
1539
1540         * Shared/WebCompiledContentRuleListData.cpp:
1541         (WebKit::WebCompiledContentRuleListData::encode const):
1542         (WebKit::WebCompiledContentRuleListData::decode):
1543         * Shared/WebCompiledContentRuleListData.h:
1544         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
1545         * UIProcess/API/APIContentRuleList.h:
1546         * UIProcess/API/APIContentRuleListStore.cpp:
1547         (API::createExtension):
1548
1549 2019-04-17  John Wilander  <wilander@apple.com>
1550
1551         Add prioritization of ad click conversions and cleaning of sent ad click conversions
1552         https://bugs.webkit.org/show_bug.cgi?id=196934
1553         <rdar://problem/49917773>
1554
1555         Reviewed by Chris Dumez.
1556
1557         In this description, by "pair" I mean { AdClickAttribution::Source, AdClickAttribution::Destination }.
1558
1559         This patch adds handling of prioritization of conversions according to these rules:
1560         - If we have a matching unconverted attribution, convert it. This consumes the conversion.
1561         - If we have no previously converted attribution for this pair, just store.
1562         - If we have a previously converted attribution for this pair, replace it if the new one has higher priority.
1563         - If we had no matching unconverted attribution but do have a previously converted attribution for this
1564         pair, re-convert the previously converted attribution to make sure the highest priority gets set.
1565
1566         This handling is in part done by dividing the previous m_adClickAttributionMap into 
1567         m_unconvertedAdClickAttributionMap and m_convertedAdClickAttributionMap, which now use a std::pair
1568         as key instead of a nested HashMap.
1569
1570         This patch also changes AdClickAttributionManager::firePendingConversionRequests() so that it now
1571         removes attributions which have been sent out.
1572
1573         Finally, AdClickAttributionManager::clear() no longer clears m_conversionBaseURLForTesting and
1574         m_isRunningTest since doing so caused test flakiness. It is now up to the test case that sets these
1575         members to also clear them when done.
1576
1577         * NetworkProcess/AdClickAttributionManager.cpp:
1578         (WebKit::AdClickAttributionManager::storeUnconverted):
1579         (WebKit::AdClickAttributionManager::convert):
1580         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
1581         (WebKit::AdClickAttributionManager::clear):
1582         (WebKit::AdClickAttributionManager::toString const):
1583         (WebKit::AdClickAttributionManager::setConversionURLForTesting):
1584         (WebKit::AdClickAttributionManager::ensureDestinationMapForSource): Deleted.
1585         (WebKit::AdClickAttributionManager::store): Deleted.
1586         * NetworkProcess/AdClickAttributionManager.h:
1587         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
1588         (WebKit::AdClickAttributionManager::setConversionURLForTesting): Deleted.
1589         * NetworkProcess/NetworkSession.cpp:
1590         (WebKit::NetworkSession::storeAdClickAttribution):
1591
1592 2019-04-17  Tim Horton  <timothy_horton@apple.com>
1593
1594         UI↔Web deadlock when printing with a JavaScript alert visible
1595         https://bugs.webkit.org/show_bug.cgi?id=196839
1596         <rdar://problem/49157642>
1597
1598         Reviewed by Andy Estes.
1599
1600         * Platform/IPC/Connection.cpp:
1601         (IPC::Connection::dispatchWorkQueueMessageReceiverMessage):
1602         (IPC::Connection::sendSyncReply):
1603         (IPC::Connection::dispatchSyncMessage):
1604         * Platform/IPC/Connection.h:
1605         (IPC::Connection::hasOutstandingOutgoingSynchronousReplies const):
1606         Keep track of whether we owe the other side of the connection any
1607         delayed sync replies.
1608
1609         * UIProcess/API/Cocoa/WKWebView.mm:
1610         (-[WKWebView _webViewPrintFormatter]):
1611         Most actions one can take with a _WKWebViewPrintFormatter involve
1612         synchronously messaging the Web Content process with an infinite timeout.
1613         Doing so while the Web Content process is awaiting a reply to a deferred-reply
1614         synchronous message (like, say, an alert()) results in an app-destroying deadlock.
1615         Instead of that, return a nil _WKWebViewPrintFormatter, indicating to the client
1616         that we can't print right now.
1617
1618         * UIProcess/ios/WKContentView.mm:
1619         (-[WKContentView _wk_pageCountForPrintFormatter:]):
1620         (-[WKContentView _wk_printedDocument]):
1621         The above isn't sufficient, though, because a sync message could arrive and
1622         be handled between creation and use of the _WKWebViewPrintFormatter.
1623         So, we also bail with a zero page count and null CGPDFDocument immediately
1624         before we would send a sync message to the Web Content process. Clients
1625         handle this less gracefully (e.g. showing a zero page PDF), but it is
1626         very rare compared to the above case.
1627
1628 2019-04-17  Zalan Bujtas  <zalan@apple.com>
1629
1630         [ContentChangeObserver] Use aria role as a hint whether a tap should result in a synthetic click
1631         https://bugs.webkit.org/show_bug.cgi?id=196988
1632         <rdar://problem/49955328>
1633
1634         Reviewed by Simon Fraser.
1635
1636         Tapping on elements with cretain aria role attributes should trigger synthetic click the same way it does on form control elements. 
1637
1638         * WebProcess/WebPage/ios/WebPageIOS.mm:
1639         (WebKit::isAriaRoleForImmediateClick):
1640         (WebKit::nodeAlwaysRequiresClick):
1641         (WebKit::WebPage::handleSyntheticClick):
1642
1643 2019-04-17  Alex Christensen  <achristensen@webkit.org>
1644
1645         WKRetainPtr's adoption constructor should be private
1646         https://bugs.webkit.org/show_bug.cgi?id=197019
1647
1648         Reviewed by Tim Horton.
1649
1650         RefPtr and RetainPtr have already done this.  It makes us use nicer syntax.
1651
1652         * UIProcess/API/C/WKContext.cpp:
1653         (WKContextSetDownloadClient):
1654         * UIProcess/API/cpp/WKRetainPtr.h:
1655         (WebKit::WKRetainPtr::WKRetainPtr):
1656         (WebKit::adoptWK):
1657
1658 2019-04-17  Alex Christensen  <achristensen@webkit.org>
1659
1660         Fix crash during teardown of PingLoad
1661         https://bugs.webkit.org/show_bug.cgi?id=197024
1662         <rdar://problem/49973077>
1663
1664         Reviewed by Jer Noble.
1665
1666         * NetworkProcess/PingLoad.cpp:
1667         (WebKit::PingLoad::initialize):
1668         Early return if weakThis is null.
1669
1670 2019-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1671
1672         REGRESSION (r243926): [iOS] Release assertion when computing editor state during an overflow scroll triggered by layout
1673         https://bugs.webkit.org/show_bug.cgi?id=197012
1674         <rdar://problem/49908848>
1675
1676         Reviewed by Simon Fraser.
1677
1678         We hit the release assertion due to the following sequence of events:
1679         - Dispatch a queued event (in this case, a scroll event)
1680         - Invoke the scroll event listener, which modifies layout in some way
1681         - This scrolls an overflow scrollable container under the scope of layout
1682         - Overflow scrolling then calls didChangeSelection and triggers an editor state update, which updates layout
1683
1684         In the case where the selection is in the main frame, we bail early due to the check for recursive layout (i.e.
1685         frameView->layoutContext().isInRenderTreeLayout()). However, in the case where the selection is inside a
1686         subframe, we end up skipping past this check, since the subframe's FrameView isn't currently laying out, and so
1687         we end up hitting the release assertion underneath the early return.
1688
1689         To fix this, simply defer editor state updates due to overflow scrolling until the next remote layer tree commit
1690         instead of computing and sending the information immediately. While this only defers editor state updates during
1691         overflow scrolling, <rdar://problem/47258878> tracks making editor state updates deferred in the general case.
1692
1693         Test: editing/selection/overflow-scroll-while-selecting-text.html
1694
1695         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
1696         (WebKit::WebEditorClient::overflowScrollPositionChanged):
1697         * WebProcess/WebPage/WebPage.cpp:
1698         (WebKit::WebPage::didChangeOverflowScrollPosition):
1699         (WebKit::WebPage::didChangeSelection):
1700         (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
1701         * WebProcess/WebPage/WebPage.h:
1702
1703 2019-04-17  Chris Dumez  <cdumez@apple.com>
1704
1705         Remember device orientation permission for the duration of the browsing session
1706         https://bugs.webkit.org/show_bug.cgi?id=196992
1707         <rdar://problem/49946067>
1708
1709         Reviewed by Alex Christensen.
1710
1711         Implement caching of device orientation permission decisions on the WebDeviceOrientationAndMotionAccessController,
1712         which is owned by the WebsiteDataStore. This way, if we already prompted the user of a given origin, we will
1713         remember the previous decision for the duration of the session and not prompt again.
1714
1715         * Shared/WebsitePoliciesData.cpp:
1716         (WebKit::WebsitePoliciesData::encode const):
1717         (WebKit::WebsitePoliciesData::decode):
1718         * Shared/WebsitePoliciesData.h:
1719         * UIProcess/API/APIWebsitePolicies.cpp:
1720         (API::WebsitePolicies::copy const):
1721         (API::WebsitePolicies::data):
1722         * UIProcess/API/APIWebsitePolicies.h:
1723         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
1724         (toDeviceOrientationOrMotionPermissionState):
1725         (-[WKWebpagePreferences _setDeviceOrientationAndMotionAccessPolicy:]):
1726         (toWKWebsiteDeviceOrientationAndMotionAccessPolicy):
1727         (-[WKWebpagePreferences _deviceOrientationAndMotionAccessPolicy]):
1728         * UIProcess/WebPageProxy.cpp:
1729         (WebKit::WebPageProxy::shouldAllowDeviceOrientationAndMotionAccess):
1730         * UIProcess/WebPageProxy.h:
1731         * UIProcess/WebPageProxy.messages.in:
1732         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.cpp: Added.
1733         (WebKit::WebDeviceOrientationAndMotionAccessController::shouldAllowDeviceOrientationAndMotionAccess):
1734         (WebKit::WebDeviceOrientationAndMotionAccessController::deviceOrientationPermission const):
1735         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.h: Copied from Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h.
1736         * UIProcess/WebsiteData/WebsiteDataStore.h:
1737         (WebKit::WebsiteDataStore::deviceOrientationAndMotionAccessController):
1738         * WebKit.xcodeproj/project.pbxproj:
1739         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1740         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
1741         * WebProcess/WebCoreSupport/WebChromeClient.h:
1742         * WebProcess/WebPage/WebPage.cpp:
1743         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
1744         * WebProcess/WebPage/WebPage.h:
1745
1746 2019-04-16  Andy Estes  <aestes@apple.com>
1747
1748         [iOSMac] Use UIDocumentPickerViewController for picking files
1749         https://bugs.webkit.org/show_bug.cgi?id=196999
1750         <rdar://problem/49961414>
1751
1752         Reviewed by Tim Horton.
1753
1754         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1755         (-[WKFileUploadPanel _showDocumentPickerMenu]):
1756         Changed to present a UIDocumentPickerViewController on iOSMac.
1757
1758         (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
1759         (-[WKFileUploadPanel documentPicker:didPickDocumentAtURL:]):
1760         Replaced a deprecated delegate method implementation.
1761
1762 2019-04-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1763
1764         [iOS] [WebKit2] Add support for honoring -[UIMenuItem dontDismiss]
1765         https://bugs.webkit.org/show_bug.cgi?id=196919
1766         <rdar://problem/41630459>
1767
1768         Reviewed by Tim Horton.
1769
1770         Adds modern WebKit support for -dontDismiss by implementing a couple of new platform hooks. Covered by a new
1771         layout test: editing/selection/ios/selection-after-changing-text-with-callout-menu.html.
1772
1773         * Platform/spi/ios/UIKitSPI.h:
1774
1775         Declare the private -dontDismiss property of UIMenuItem.
1776
1777         * UIProcess/API/Cocoa/WKWebView.mm:
1778         (-[WKWebView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
1779
1780         Additionally teach the web view (not just the content view) to respond to the hook. This matters in the case
1781         where the WebKit client (most notably, Mail) overrides WKWebView methods to define custom actions in the menu
1782         controller. This scenario is exercised by the new layout test.
1783
1784         * UIProcess/ios/WKContentViewInteraction.h:
1785         * UIProcess/ios/WKContentViewInteraction.mm:
1786         (-[WKContentView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
1787
1788         If an action was performed where callout bar fading was ignored, then in WebKit, don't allow selection changes
1789         to fade the callout bar until after the next remote layer tree commit.
1790
1791         (-[WKContentView _updateChangedSelection:]):
1792
1793         Stop suppressing selection updates when showing B/I/U controls, now that we can properly honor the -dontDismiss
1794         property. This was originally introduced in <rdar://problem/15199925>, presumably to ensure that B/I/U buttons
1795         (which have -dontDismiss set to YES) don't trigger selection change and end up dismissing themselves; however,
1796         if triggering B/I/U actually changes the selection rects, this also means that the selection rects on-screen
1797         would be stale after triggering these actions. This effect is most noticeable when bolding text.
1798
1799         (-[WKContentView shouldAllowHidingSelectionCommands]):
1800
1801 2019-04-16  Ross Kirsling  <ross.kirsling@sony.com>
1802
1803         Unreviewed non-unified build fix after r244307.
1804
1805         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
1806
1807 2019-04-16  Megan Gardner  <megan_gardner@apple.com>
1808
1809         Allow sharing from imageSheet on an image document
1810         https://bugs.webkit.org/show_bug.cgi?id=196891
1811         <rdar://problem/25377386>
1812
1813         Reviewed by Tim Horton.
1814
1815         Allow sharing from an image sheet generated from an image document
1816         by storing the image URL and using it as a fallback for the URL.
1817         Store it as an image on WKElementAction to not accidentally trigger
1818         any actions that should actually be associated with pure URLs.
1819
1820         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
1821         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
1822         (-[_WKActivatedElementInfo _initWithInteractionInformationAtPosition:]):
1823         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:]):
1824         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:userInfo:]):
1825         (-[_WKActivatedElementInfo imageURL]):
1826         (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:]): Deleted.
1827         (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:userInfo:]): Deleted.
1828         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
1829         * UIProcess/API/Cocoa/_WKElementAction.mm:
1830         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
1831         * UIProcess/ios/WKActionSheetAssistant.mm:
1832         (-[WKActionSheetAssistant showImageSheet]):
1833         (-[WKActionSheetAssistant defaultActionsForImageSheet:]):
1834         (-[WKActionSheetAssistant showLinkSheet]):
1835         * UIProcess/ios/WKContentViewInteraction.mm:
1836         (-[WKContentView _showAttachmentSheet]):
1837         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
1838         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
1839
1840 2019-04-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1841
1842         [Cocoa] Add a way for Apple-internal clients to opt into recommended compatibility mode
1843         https://bugs.webkit.org/show_bug.cgi?id=196977
1844         <rdar://problem/49871194>
1845
1846         Reviewed by Tim Horton.
1847
1848         Add a helper method to query whether the navigation client should bypass policy safeguards when determining the
1849         recommended compatibility mode. We bypass policy safeguards in Cocoa platforms if the navigation delegate
1850         implements the new navigation delegate API.
1851
1852         * UIProcess/API/APINavigationClient.h:
1853         (API::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
1854         * UIProcess/Cocoa/NavigationState.h:
1855         * UIProcess/Cocoa/NavigationState.mm:
1856         (WebKit::NavigationState::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
1857
1858 2019-04-16  Per Arne Vollan  <pvollan@apple.com>
1859
1860         -[WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:] never returns _WKWebsiteDataTypeCredentials
1861         https://bugs.webkit.org/show_bug.cgi?id=196991
1862         <rdar://problem/45507423>
1863
1864         Reviewed by Brent Fulgham.
1865
1866         The credentials are stored in the Network process. To enable fetching credentials from the Network process,
1867         a proper process access type needs to be set for the credential Website data type.
1868
1869         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1870         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
1871
1872 2019-04-16  Alex Christensen  <achristensen@webkit.org>
1873
1874         REGRESSION(r244162) Clearing website data from ephemeral WKWebsiteDataStore should finish instead of asserting or hanging
1875         https://bugs.webkit.org/show_bug.cgi?id=196995
1876
1877         Reviewed by Brady Eidson.
1878
1879         Always call CompletionHandlers.  Otherwise things hang or assert.
1880         I added an API test that asserts without this change so we don't regress this again.
1881
1882         * NetworkProcess/cache/CacheStorageEngine.cpp:
1883         (WebKit::CacheStorage::Engine::clearAllCaches):
1884         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
1885
1886 2019-04-16  Chris Dumez  <cdumez@apple.com>
1887
1888         URL set by document.open() is not communicated to the UIProcess
1889         https://bugs.webkit.org/show_bug.cgi?id=196941
1890         <rdar://problem/49237544>
1891
1892         Reviewed by Geoff Garen.
1893
1894         Whenever the UIProcess is notified of an explicit document.open() call, update the
1895         PageLoadState to make sure the URL is up-to-date. Also make sure the page / process
1896         knows it committed a load (i.e. It is no longer showing the initially empty document).
1897
1898         * UIProcess/PageLoadState.cpp:
1899         (WebKit::PageLoadState::didExplicitOpen):
1900         * UIProcess/PageLoadState.h:
1901         * UIProcess/WebPageProxy.cpp:
1902         (WebKit::WebPageProxy::didExplicitOpenForFrame):
1903         * UIProcess/WebPageProxy.h:
1904         * UIProcess/WebPageProxy.messages.in:
1905         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1906         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
1907         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1908
1909 2019-04-16  Chris Dumez  <cdumez@apple.com>
1910
1911         Show prompt for device orientation access if the client does not implement the corresponding API delegate
1912         https://bugs.webkit.org/show_bug.cgi?id=196971
1913         <rdar://problem/49945840>
1914
1915         Reviewed by Alex Christensen.
1916
1917         Show prompt for device orientation access if the client does not implement the corresponding
1918         API delegate, instead of rejecting access by default.
1919
1920         * UIProcess/Cocoa/UIDelegate.mm:
1921         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
1922         * UIProcess/Cocoa/WKOrientationAccessAlert.h: Added.
1923         * UIProcess/Cocoa/WKOrientationAccessAlert.mm: Added.
1924         (WebKit::presentOrientationAccessAlert):
1925         * WebKit.xcodeproj/project.pbxproj:
1926
1927 2019-04-16  Zalan Bujtas  <zalan@apple.com>
1928
1929         REGRESSION(r243557)[ContentChangeObserver] Need to double tap text formatting elements in MS Word web app
1930         https://bugs.webkit.org/show_bug.cgi?id=196975
1931         <rdar://problem/49489849>
1932
1933         Reviewed by Simon Fraser.
1934
1935         This patch ensures that we always proceed with synthetic click on form elements.
1936
1937         Covered by existing tests.
1938
1939         * WebProcess/WebPage/ios/WebPageIOS.mm:
1940         (WebKit::WebPage::handleSyntheticClick):
1941
1942 2019-04-16  Timothy Hatcher  <timothy@apple.com>
1943
1944         FrameView base background color always starts white.
1945         https://bugs.webkit.org/show_bug.cgi?id=196976
1946
1947         Reviewed by Beth Dakin.
1948
1949         * WebProcess/WebPage/WebPage.cpp:
1950         (WebKit::WebPage::WebPage): Set m_backgroundColor before calling
1951         WebFrame::createWithCoreMainFrame so the call to create the FrameView
1952         for the empty page in transitionToCommittedForNewPage() gets
1953         the correct color from WebPage.
1954
1955 2019-04-16  Ryan Haddad  <ryanhaddad@apple.com>
1956
1957         Unreviewed, fix the build with recent SDKs.
1958
1959         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1960         (WebKit::WKWebViewState::store):
1961
1962 2019-04-16  Commit Queue  <commit-queue@webkit.org>
1963
1964         Unreviewed, rolling out r244321.
1965         https://bugs.webkit.org/show_bug.cgi?id=196968
1966
1967         Causing all WK2 Debug builds to exit early after Assertion
1968         failures. (Requested by ShawnRoberts on #webkit).
1969
1970         Reverted changeset:
1971
1972         "URL set by document.open() is not communicated to the
1973         UIProcess"
1974         https://bugs.webkit.org/show_bug.cgi?id=196941
1975         https://trac.webkit.org/changeset/244321
1976
1977 2019-04-15  Joseph Pecoraro  <pecoraro@apple.com>
1978
1979         Web Inspector: CRASH when reopening tab with docked inspector on crashed page
1980         https://bugs.webkit.org/show_bug.cgi?id=196954
1981         <rdar://problem/48716433>
1982
1983         Reviewed by Ryosuke Niwa.
1984
1985         * UIProcess/mac/WebInspectorProxyMac.mm:
1986         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
1987
1988 2019-04-15  Chris Dumez  <cdumez@apple.com>
1989
1990         URL set by document.open() is not communicated to the UIProcess
1991         https://bugs.webkit.org/show_bug.cgi?id=196941
1992         <rdar://problem/49237544>
1993
1994         Reviewed by Geoffrey Garen.
1995
1996         Whenever the UIProcess is notified of an explicit document.open() call, update the
1997         PageLoadState to make sure the URL is up-to-date. Also make sure the page / process
1998         knows it committed a load (i.e. It is no longer showing the initially empty document).
1999
2000         * UIProcess/PageLoadState.cpp:
2001         (WebKit::PageLoadState::didExplicitOpen):
2002         * UIProcess/PageLoadState.h:
2003         * UIProcess/WebPageProxy.cpp:
2004         (WebKit::WebPageProxy::didExplicitOpenForFrame):
2005         * UIProcess/WebPageProxy.h:
2006         * UIProcess/WebPageProxy.messages.in:
2007         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2008         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
2009         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2010
2011 2019-04-15  Alex Christensen  <achristensen@webkit.org>
2012
2013         Stop using hyphenationFactor
2014         https://bugs.webkit.org/show_bug.cgi?id=196949
2015         <rdar://problem/49779594>
2016
2017         Reviewed by Geoffrey Garen.
2018
2019         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
2020         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
2021         I added this use of hyphenationFactor in r241124 but the other changes in that revision make the use of hyphenationFactor redundant.
2022         There is a reason to remove it in the radar.
2023
2024 2019-04-15  Alex Christensen  <achristensen@webkit.org>
2025
2026         Forward declare WKWebView in _WKDiagnosticLoggingDelegate.h
2027
2028         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
2029         This fixes builds where _WKDiagnosticLoggingDelegate.h is the only WebKit header included, such as my work on rdar://problem/35175989
2030
2031 2019-04-15  Jer Noble  <jer.noble@apple.com>
2032
2033         Add a DiagnosticLogging method taking an arbitrary dictionary of values.
2034         https://bugs.webkit.org/show_bug.cgi?id=196773
2035
2036         Reviewed by Alex Christensen.
2037
2038         In addition to adding the new logging delegate method (and piping everything into it), 
2039         add a new APIObject class to represent a signed integer.
2040
2041         * Shared/API/APINumber.h:
2042         * Shared/API/APIObject.h:
2043         * Shared/Cocoa/APIObject.mm:
2044         (API::Object::newObject):
2045         * Shared/Cocoa/WKNSNumber.mm:
2046         (-[WKNSNumber dealloc]):
2047         (-[WKNSNumber objCType]):
2048         (-[WKNSNumber getValue:]):
2049         (-[WKNSNumber longLongValue]):
2050         (-[WKNSNumber _apiObject]):
2051         * Shared/UserData.cpp:
2052         (WebKit::UserData::encode):
2053         (WebKit::UserData::decode):
2054         * UIProcess/API/APIDiagnosticLoggingClient.h:
2055         * UIProcess/API/C/WKPageDiagnosticLoggingClient.h:
2056         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
2057         * UIProcess/Cocoa/DiagnosticLoggingClient.h:
2058         * UIProcess/Cocoa/DiagnosticLoggingClient.mm:
2059         (WebKit::DiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
2060         * UIProcess/ProvisionalPageProxy.cpp:
2061         (WebKit::ProvisionalPageProxy::didReceiveMessage):
2062         * UIProcess/WebPageDiagnosticLoggingClient.cpp:
2063         (WebKit::WebPageDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
2064         * UIProcess/WebPageDiagnosticLoggingClient.h:
2065         * UIProcess/WebPageProxy.cpp:
2066         (WebKit::WebPageProxy::logDiagnosticMessageWithValueDictionary):
2067         * UIProcess/WebPageProxy.h:
2068         * UIProcess/WebPageProxy.messages.in:
2069         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
2070         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
2071         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
2072
2073 2019-04-15  Dean Jackson  <dino@apple.com>
2074
2075         Provide option to not create a longpress gesture recognizer
2076         https://bugs.webkit.org/show_bug.cgi?id=196937
2077         <rdar://problem/49918278>
2078
2079         Build fix for iOS platforms that don't have link preview.
2080
2081         * UIProcess/ios/WKContentViewInteraction.mm:
2082         (-[WKContentView setupInteraction]):
2083
2084 2019-04-15  Brent Fulgham  <bfulgham@apple.com>
2085
2086         InjectedBundle parameters often need initialization function called before unarchiving
2087         https://bugs.webkit.org/show_bug.cgi?id=189709
2088         <rdar://problem/44573653>
2089
2090         Reviewed by Ryosuke Niwa.
2091
2092         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
2093         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
2094         after the bundle initialiation function runs, which gives the embedding program the opportunity to
2095         register additional classes that are safe for serialization.
2096
2097         Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need
2098         to be serialized by the InjectedBundle.
2099         
2100         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
2101         Revise 'initialize' to call this new method.
2102
2103         * WebProcess/InjectedBundle/InjectedBundle.h:
2104         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
2105         (WebKit::InjectedBundle::initialize): Use the new method.
2106         (WebKit::InjectedBundle::decodeBundleParameters): Added.
2107         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
2108         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
2109         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
2110         NSDictionary object may itself hold other kinds of objects.
2111         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
2112         (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added.
2113
2114 2019-04-15  Dean Jackson  <dino@apple.com>
2115
2116         Provide option to not create a longpress gesture recognizer
2117         https://bugs.webkit.org/show_bug.cgi?id=196937
2118         <rdar://problem/49918278>
2119
2120         Reviewed by Antoine Quint.
2121
2122         A WebKitAdditions file has changed name to WKContentViewInteractionWKInteraction.mm.
2123
2124         Add a property to toggle if we should add a long press gesture
2125         recognizer.
2126
2127         * UIProcess/ios/WKContentViewInteraction.h:
2128         * UIProcess/ios/WKContentViewInteraction.mm:
2129         (-[WKContentView setupInteraction]):
2130         (shouldUsePreviewForLongPress):
2131         (-[WKContentView shouldUsePreviewForLongPress]):
2132
2133 2019-04-15  Don Olmstead  <don.olmstead@sony.com>
2134
2135         [CMake] WebCore derived sources should only be referenced inside WebCore
2136         https://bugs.webkit.org/show_bug.cgi?id=196904
2137
2138         Reviewed by Konstantin Tokarev.
2139
2140         Remove reference to DERIVED_SOURCES_WEBCORE_DIR in PlatformMac.cmake.
2141
2142         * PlatformMac.cmake:
2143
2144 2019-04-15  Zalan Bujtas  <zalan@apple.com>
2145
2146         DrawingArea should only capture painting related milestones
2147         https://bugs.webkit.org/show_bug.cgi?id=196926
2148         <rdar://problem/48003845>
2149
2150         Reviewed by Tim Horton.
2151
2152         While dispatching layout milestones (mixture of layout and painting items), the associated drawing areas should only capture the painting related milestones.
2153         These captured milestones get dispatched later in the commit handler to ensure that they are not forwarded prematurely.
2154         However the truly layout related milestones (e.g. DidFirstVisuallyNonEmptyLayout) should be dispatched right away with no delay.
2155
2156         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
2157         (WebKit::RemoteLayerTreeTransaction::newlyReachedPaintingMilestones const):
2158         (WebKit::RemoteLayerTreeTransaction::setNewlyReachedPaintingMilestones):
2159         (WebKit::RemoteLayerTreeTransaction::newlyReachedLayoutMilestones const): Deleted.
2160         (WebKit::RemoteLayerTreeTransaction::setNewlyReachedLayoutMilestones): Deleted.
2161         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2162         (WebKit::RemoteLayerTreeTransaction::encode const):
2163         (WebKit::RemoteLayerTreeTransaction::decode):
2164         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2165         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2166         * WebProcess/WebPage/DrawingArea.h:
2167         (WebKit::DrawingArea::addMilestonesToDispatch):
2168         (WebKit::DrawingArea::dispatchDidReachLayoutMilestone): Deleted.
2169         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
2170         (WebKit::RemoteLayerTreeDrawingArea::addMilestonesToDispatch):
2171         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2172         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2173         (WebKit::RemoteLayerTreeDrawingArea::dispatchDidReachLayoutMilestone): Deleted.
2174         * WebProcess/WebPage/WebPage.cpp:
2175         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
2176         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2177         (WebKit::TiledCoreAnimationDrawingArea::addMilestonesToDispatch):
2178         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2179         (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedPaintingMilestones):
2180         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
2181         (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones): Deleted.
2182         (WebKit::TiledCoreAnimationDrawingArea::dispatchDidReachLayoutMilestone): Deleted.
2183
2184 2019-04-15  John Wilander  <wilander@apple.com>
2185
2186         Send delayed Ad Click Attribution conversion requests to the click source
2187         https://bugs.webkit.org/show_bug.cgi?id=196838
2188         <rdar://problem/47650157>
2189
2190         Reviewed by Chris Dumez and Youenn Fablet.
2191
2192         This patch schedules a conversion request with appropriate data going to the
2193         click source as a result of an ad click conversion.
2194
2195         WebKit::AdClickAttributionManager makes use of existing WebKit::PingLoad
2196         infrastructure to make the request. This will probably be reworked into a
2197         dedicated load class further on.
2198
2199         New test infrastructure allows for an override of both the conversion URL
2200         and the 24-48 hour timer.
2201
2202         * NetworkProcess/AdClickAttributionManager.cpp: Added.
2203         (WebKit::AdClickAttributionManager::ensureDestinationMapForSource):
2204         (WebKit::AdClickAttributionManager::store):
2205         (WebKit::AdClickAttributionManager::startTimer):
2206             Convenience function to support test override.
2207         (WebKit::AdClickAttributionManager::convert):
2208             This function now sets the timer.
2209         (WebKit::AdClickAttributionManager::fireConversionRequest):
2210             Fire an individual request.
2211         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
2212             This is the timer function that iterates over all pending attributions.
2213         (WebKit::AdClickAttributionManager::clear):
2214             Now clears the two new test settings members.
2215         (WebKit::AdClickAttributionManager::toString const):
2216         * NetworkProcess/AdClickAttributionManager.h: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.h.
2217         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
2218         (WebKit::AdClickAttributionManager::setPingLoadFunction):
2219         (WebKit::AdClickAttributionManager::setOverrideTimerForTesting):
2220         (WebKit::AdClickAttributionManager::setConversionURLForTesting):
2221         * NetworkProcess/NetworkAdClickAttribution.cpp: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.cpp.
2222         * NetworkProcess/NetworkProcess.cpp:
2223         (WebKit::NetworkProcess::storeAdClickAttribution):
2224         (WebKit::NetworkProcess::dumpAdClickAttribution):
2225         (WebKit::NetworkProcess::clearAdClickAttribution):
2226         (WebKit::NetworkProcess::setAdClickAttributionOverrideTimerForTesting):
2227         (WebKit::NetworkProcess::setAdClickAttributionConversionURLForTesting):
2228         * NetworkProcess/NetworkProcess.h:
2229         * NetworkProcess/NetworkProcess.messages.in:
2230         * NetworkProcess/NetworkSession.cpp:
2231         (WebKit::NetworkSession::NetworkSession):
2232         (WebKit::NetworkSession::setAdClickAttributionOverrideTimerForTesting):
2233         (WebKit::NetworkSession::setAdClickAttributionConversionURLForTesting):
2234         * NetworkProcess/NetworkSession.h:
2235         * NetworkProcess/PingLoad.cpp:
2236         (WebKit::PingLoad::PingLoad):
2237         (WebKit::m_blobFiles):
2238         (WebKit::PingLoad::initialize):
2239             The PingLoad constructor is now split in two to allow for construction
2240             without a WebKit::NetworkConnectionToWebProcess object. The body of
2241             the constructor was moved into the new initialize() function which is
2242             shared between constructors.
2243         * NetworkProcess/PingLoad.h:
2244         * Sources.txt:
2245             Removed NetworkProcess/NetworkAdClickAttribution.cpp and added
2246             NetworkProcess/NetworkAdClickAttribution.cpp.
2247         * UIProcess/API/C/WKPage.cpp:
2248         (WKPageSetAdClickAttributionOverrideTimerForTesting):
2249         (WKPageSetAdClickAttributionConversionURLForTesting):
2250         * UIProcess/API/C/WKPagePrivate.h:
2251         * UIProcess/Network/NetworkProcessProxy.cpp:
2252         (WebKit::NetworkProcessProxy::dumpAdClickAttribution): Deleted.
2253         (WebKit::NetworkProcessProxy::clearAdClickAttribution): Deleted.
2254         * UIProcess/Network/NetworkProcessProxy.h:
2255         * UIProcess/WebPageProxy.cpp:
2256         (WebKit::WebPageProxy::dumpAdClickAttribution):
2257         (WebKit::WebPageProxy::clearAdClickAttribution):
2258         (WebKit::WebPageProxy::setAdClickAttributionOverrideTimerForTesting):
2259         (WebKit::WebPageProxy::setAdClickAttributionConversionURLForTesting):
2260         * UIProcess/WebPageProxy.h:
2261         * UIProcess/WebProcessPool.cpp:
2262         (WebKit::WebProcessPool::dumpAdClickAttribution): Deleted.
2263         (WebKit::WebProcessPool::clearAdClickAttribution): Deleted.
2264         * UIProcess/WebProcessPool.h:
2265         * WebKit.xcodeproj/project.pbxproj:
2266
2267 2019-04-15  Devin Rousso  <drousso@apple.com>
2268
2269         WebDriver: Set Cookie endpoint does not correctly set subdomain cookies
2270         https://bugs.webkit.org/show_bug.cgi?id=196872
2271         <rdar://problem/49233240>
2272
2273         Reviewed by Joseph Pecoraro.
2274
2275         * UIProcess/Automation/WebAutomationSession.cpp:
2276         (WebKit::WebAutomationSession::addSingleCookie):
2277         Rather than try to "force" the cookie to be set on the current active URL, use the cookie
2278         itself to figure out which domain it should be set on.
2279
2280 2019-04-15  Philippe Normand  <pnormand@igalia.com>
2281
2282         [GTK][WPE] Add enable-media websetting
2283         https://bugs.webkit.org/show_bug.cgi?id=196863
2284
2285         Reviewed by Michael Catanzaro.
2286
2287         It can be useful for headless browsers, for instance. The setting is enabled by default.
2288
2289         * Shared/WebPreferences.yaml:
2290         * UIProcess/API/glib/WebKitSettings.cpp:
2291         (webKitSettingsSetProperty):
2292         (webKitSettingsGetProperty):
2293         (webkit_settings_class_init):
2294         (webkit_settings_get_enable_media):
2295         (webkit_settings_set_enable_media):
2296         * UIProcess/API/gtk/WebKitSettings.h:
2297         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2298         * UIProcess/API/wpe/WebKitSettings.h:
2299         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
2300
2301 2019-04-14  Rob Buis  <rbuis@igalia.com>
2302
2303         Link prefetch not useful for top-level navigation
2304         https://bugs.webkit.org/show_bug.cgi?id=195623
2305
2306         Reviewed by Youenn Fablet.
2307
2308         Cache cross-domain top-level prefetches in a dedicated cache. When a navigation
2309         to the same url is done within a threshold (5 seconds), reuse the
2310         prefetch cache entry, move it to the disk cache and navigate to
2311         the url, meaning no extra network trip is needed. When not used within
2312         the threshold period, the prefetch entry will be erased using a timer.
2313
2314         * NetworkProcess/NetworkProcess.cpp:
2315         (WebKit::NetworkProcess::lowMemoryHandler):
2316         * NetworkProcess/NetworkProcess.h:
2317         (WebKit::NetworkProcess::prefetchCache):
2318         * NetworkProcess/NetworkResourceLoader.cpp:
2319         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2320         (WebKit::NetworkResourceLoader::didReceiveResponse):
2321         (WebKit::NetworkResourceLoader::didReceiveBuffer):
2322         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
2323         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const):
2324         * NetworkProcess/NetworkResourceLoader.h:
2325         * NetworkProcess/cache/PrefetchCache.cpp: Added.
2326         (WebKit::PrefetchCache::Entry::Entry):
2327         (WebKit::PrefetchCache::PrefetchCache):
2328         (WebKit::PrefetchCache::~PrefetchCache):
2329         (WebKit::PrefetchCache::clear):
2330         (WebKit::PrefetchCache::take):
2331         (WebKit::PrefetchCache::store):
2332         (WebKit::PrefetchCache::sessionPrefetchMap const):
2333         (WebKit::PrefetchCache::clearExpiredEntries):
2334         * NetworkProcess/cache/PrefetchCache.h: Added.
2335         (WebKit::PrefetchCache::Entry::response const):
2336         (WebKit::PrefetchCache::Entry::releaseBuffer):
2337         * Shared/WebPreferences.yaml:
2338         * Sources.txt:
2339         * WebKit.xcodeproj/project.pbxproj:
2340
2341 2019-04-14  Andy Estes  <aestes@apple.com>
2342
2343         [Cocoa] WKCustomProtocolLoader should store a WeakPtr to its LegacyCustomProtocolManagerProxy
2344         https://bugs.webkit.org/show_bug.cgi?id=196893
2345         <rdar://problem/48318983>
2346
2347         Reviewed by Anders Carlsson.
2348
2349         In addition to manually invalidating each WKCustomProtocolLoader's _customProtocolManagerProxy
2350         pointer when the LegacyCustomProtocolManagerClient is invalidated, use a WeakPtr in case the
2351         LegacyCustomProtocolManagerProxy is ever destroyed without first invalidating the client.
2352         Also add null pointer checks to NSURLConnectionDelegate methods, which might be called after
2353         the LegacyCustomProtocolManagerProxy has been destroyed.
2354
2355         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
2356         (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
2357         (-[WKCustomProtocolLoader cancel]):
2358         (-[WKCustomProtocolLoader connection:didFailWithError:]):
2359         (-[WKCustomProtocolLoader connection:didReceiveResponse:]):
2360         (-[WKCustomProtocolLoader connection:didReceiveData:]):
2361         (-[WKCustomProtocolLoader connection:willSendRequest:redirectResponse:]):
2362         (-[WKCustomProtocolLoader connectionDidFinishLoading:]):
2363         (WebKit::LegacyCustomProtocolManagerClient::startLoading):
2364         (WebKit::LegacyCustomProtocolManagerClient::invalidate):
2365         (-[WKCustomProtocolLoader customProtocolManagerProxyDestroyed]): Deleted.
2366         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h:
2367
2368 2019-04-14  Don Olmstead  <don.olmstead@sony.com>
2369
2370         [CMake] JavaScriptCore derived sources should only be referenced inside JavaScriptCore
2371         https://bugs.webkit.org/show_bug.cgi?id=196742
2372
2373         Reviewed by Konstantin Tokarev.
2374
2375         Don't set JavaScriptCore_SCRIPTS_DIR now that it is set within WebKitFS.
2376
2377         * CMakeLists.txt:
2378         * PlatformWin.cmake:
2379         
2380         Remove use of DERIVED_SOURCES_JAVASCRIPTCORE_DIR.
2381
2382 2019-04-13  Chris Dumez  <cdumez@apple.com>
2383
2384         [ Mac Debug ] TestWebKitAPI.ProcessSwap.ReuseSuspendedProcessForRegularNavigationRetainBundlePage is a flaky crash
2385         https://bugs.webkit.org/show_bug.cgi?id=196548
2386         <rdar://problem/49567254>
2387
2388         Reviewed by Darin Adler.
2389
2390         Update ProvisionalPageProxy methods to more consistently ignore unexpected IPC from the process. Previously,
2391         some of the methods were doing this, but some other like didFailProvisionalLoadForFrame() weren't and this
2392         was leading to this flaky crash. The issue is that if we do the load in an existing process that was recently
2393         doing, there may be leftover IPC for the same pageID and this IPC gets received by the ProvisionalPageProxy
2394         even though it is from a previous navigation. For this reason, the ProvisionalPageProxy should ignore all
2395         incoming IPC that is not for its associated navigation.
2396
2397         * UIProcess/ProvisionalPageProxy.cpp:
2398         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
2399         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
2400         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
2401         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
2402         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
2403         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
2404         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
2405         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
2406         (WebKit::ProvisionalPageProxy::didPerformServerRedirect):
2407         (WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
2408         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync):
2409
2410 2019-04-13  Wenson Hsieh  <wenson_hsieh@apple.com>
2411
2412         Unreviewed, try to fix the internal build after r244239
2413
2414         Force the bots to regenerate WKWebpagePreferences.h by touching the file. Adds a `Foundation/Foundation.h`
2415         import that was missing anyways.
2416
2417         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
2418
2419 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2420
2421         Enable modern compatibility mode by default in WKWebView on some devices
2422         https://bugs.webkit.org/show_bug.cgi?id=196883
2423         <rdar://problem/49864527>
2424
2425         Reviewed by Tim Horton.
2426
2427         Make some minor adjustments to new API.
2428
2429         * Shared/WebCompatibilityMode.h:
2430
2431         Rename WebCompatibilityMode::Default to WebCompatibilityMode::Recommended.
2432
2433         * Shared/WebPreferences.yaml:
2434         * Shared/WebPreferencesDefaultValues.h:
2435
2436         Now that the role of the UseModernCompatibilityModeByDefault debug preference is limited to bypassing linked-on-
2437         or-after and app bundle compatibility hacks, we no longer make this default to true in iOSMac.
2438
2439         * UIProcess/API/APIWebsitePolicies.h:
2440         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
2441
2442         Rename the withPreferences: label to just preferences:.
2443
2444         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
2445         * UIProcess/Cocoa/NavigationState.mm:
2446         (WebKit::NavigationState::setNavigationDelegate):
2447         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2448         * UIProcess/Cocoa/VersionChecks.h:
2449         * UIProcess/ios/WebPageProxyIOS.mm:
2450
2451 2019-04-12  Brian Burg  <bburg@apple.com>
2452
2453         WebDriver: fix typo in EnterFullscreen.js in error-handling code
2454         https://bugs.webkit.org/show_bug.cgi?id=196882
2455         <rdar://problem/49867122>
2456
2457         Reviewed by Devin Rousso.
2458
2459         * UIProcess/Automation/atoms/EnterFullscreen.js:
2460         (enterFullscreen):
2461
2462 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
2463
2464         Unreviewed fix for non-unified build.
2465
2466         * Shared/PrintInfo.cpp:
2467         Add missing include from r244202.
2468
2469 2019-04-12  Saam barati  <sbarati@apple.com>
2470
2471         Sometimes we need to user fewer CPUs in our threading calculations
2472         https://bugs.webkit.org/show_bug.cgi?id=196794
2473         <rdar://problem/49389497>
2474
2475         Reviewed by Yusuke Suzuki.
2476
2477         * WebProcess/com.apple.WebProcess.sb.in:
2478
2479 2019-04-12  Devin Rousso  <drousso@apple.com>
2480
2481         WebDriver: evaluating javascript shouldn't fail if a dialog is shown
2482         https://bugs.webkit.org/show_bug.cgi?id=196847
2483         <rdar://problem/49609396>
2484
2485         Reviewed by Brian Burg.
2486
2487         * UIProcess/Automation/WebAutomationSession.cpp:
2488         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
2489
2490 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
2491
2492         WebKit should build successfully even with -DENABLE_UNIFIED_BUILDS=OFF
2493         https://bugs.webkit.org/show_bug.cgi?id=196845
2494
2495         Reviewed by Ryosuke Niwa.
2496
2497         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
2498         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
2499         * NetworkProcess/NetworkDataTask.cpp:
2500         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
2501         * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Include wtf/Forward.h for String and CompletionHandler fwd decls.
2502         * NetworkProcess/NetworkProcess.cpp:
2503         * NetworkProcess/NetworkResourceLoadMap.cpp:
2504         * NetworkProcess/NetworkResourceLoadMap.h:
2505         * NetworkProcess/NetworkResourceLoader.cpp:
2506         * NetworkProcess/PingLoad.h:
2507         * Shared/WebCompiledContentRuleListData.cpp:
2508         * Shared/gtk/WebEventFactory.cpp:
2509         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2510         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
2511         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
2512         (WKWebsiteDataStoreStatisticsResetToConsistentState):
2513         * UIProcess/Downloads/DownloadProxyMap.cpp:
2514         * UIProcess/InspectorTargetProxy.cpp:
2515         * UIProcess/PageClient.h:
2516         * UIProcess/ProcessAssertion.cpp:
2517         * UIProcess/ProvisionalPageProxy.h:
2518         * UIProcess/WebPageInspectorTargetAgent.h:
2519         * UIProcess/geoclue/GeoclueGeolocationProvider.cpp:
2520         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2521         (WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage):
2522         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2523         (WKBundleSetDatabaseQuota):
2524         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
2525         Add missing includes / forward declarations to address compiler errors on GTK / WinCairo.
2526
2527 2019-04-12  Eric Carlson  <eric.carlson@apple.com>
2528
2529         Update AudioSession route sharing policy
2530         https://bugs.webkit.org/show_bug.cgi?id=196776
2531         <rdar://problem/46501611>
2532
2533         Reviewed by Jer Noble.
2534
2535         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
2536         (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:hasVideo:]):
2537
2538 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2539
2540         WebsitePolicies doesn't copy its media source policy in WebsitePolicies::copy
2541         https://bugs.webkit.org/show_bug.cgi?id=196862
2542
2543         Reviewed by Darin Adler.
2544
2545         Add a missing bit of code to copy m_mediaSourcePolicy over when making a copy of WebsitePolicies. This doesn't
2546         have any observable effect, since m_mediaSourcePolicy isn't currently exposed as SPI on WKWebpagePreferences.
2547
2548         * UIProcess/API/APIWebsitePolicies.cpp:
2549         (API::WebsitePolicies::copy const):
2550
2551 2019-04-12  Simon Fraser  <simon.fraser@apple.com>
2552
2553         [iOS WK2] Make -webkit-overflow-scrolling be a no-op
2554         https://bugs.webkit.org/show_bug.cgi?id=196803
2555         rdar://problem/49078202
2556
2557         Reviewed by Antti Koivisto.
2558
2559         Flip LegacyOverflowScrollingTouchEnabled to false.
2560
2561         * Shared/WebPreferences.yaml:
2562
2563 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2564
2565         [iOS] Software keyboard is shown too frequently on some websites
2566         https://bugs.webkit.org/show_bug.cgi?id=195856
2567         <rdar://problem/49191395>
2568
2569         Reviewed by Darin Adler.
2570
2571         On some websites, hidden editable elements are very frequently focused upon user interaction. Currently, this
2572         causes the software keyboard to pop in and out unexpectedly; luckily, these same sites also apply
2573         inputmode="none" to the hidden editable element, which ought to ensure that the software keyboard doesn't appear
2574         when the element is focused.
2575
2576         However, since we disabled support for inputmode="none" in r240497, the software keyboard is no longer
2577         suppressed, and becomes a big nuissance. r240497 removed support for this feature because, when using a hardware
2578         keyboard, pressing the globe key no longer showed UI for switching languages. However, support for inputmode
2579         none makes a much larger impact when a software keyboard is used (since the entire software keyboard animates in
2580         and out), whereas a hardware keyboard only displays an input accessory view. For this reason, we can mitigate
2581         this bug without reintroducing <rdar://problem/47406553> by re-enabling inputmode="none", but only when a
2582         hardware keyboard is not attached.
2583
2584         * UIProcess/API/Cocoa/WKWebView.mm:
2585         (hardwareKeyboardAvailabilityChangedCallback):
2586         * UIProcess/ios/WKContentViewInteraction.h:
2587         * UIProcess/ios/WKContentViewInteraction.mm:
2588         (-[WKContentView shouldShowAutomaticKeyboardUI]):
2589
2590         Don't show the keyboard if inputmode is none and a hardware keyboard is not attached.
2591
2592         (-[WKContentView _hardwareKeyboardAvailabilityChanged]):
2593
2594         Reload input views if the inputmode is none to ensure that if a hardware keyboard is attached while editing an
2595         element with inputmode="none", we'll show the input accessory view once again.
2596
2597 2019-04-12  Antoine Quint  <graouts@apple.com>
2598
2599         Opt some websites into the simulated mouse events dispatch quirk when in modern compatibility mode
2600         https://bugs.webkit.org/show_bug.cgi?id=196830
2601         <rdar://problem/49124313>
2602
2603         Reviewed by Wenson Hsieh.
2604
2605         We add a new policy to determine whether simulated mouse events dispatch are allowed.
2606
2607         * Shared/WebsitePoliciesData.cpp:
2608         (WebKit::WebsitePoliciesData::encode const):
2609         (WebKit::WebsitePoliciesData::decode):
2610         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2611         * Shared/WebsitePoliciesData.h:
2612         * Shared/WebsiteSimulatedMouseEventsDispatchPolicy.h: Added.
2613         * UIProcess/API/APIWebsitePolicies.cpp:
2614         (API::WebsitePolicies::copy const):
2615         (API::WebsitePolicies::data):
2616         * UIProcess/API/APIWebsitePolicies.h:
2617         * WebKit.xcodeproj/project.pbxproj:
2618
2619 2019-04-12  Chris Dumez  <cdumez@apple.com>
2620
2621         [iOS Sim Debug] ASSERTION FAILED: m_downloads.isEmpty() Layout Test http/tests/websocket/tests/hybi/network-process-crash-error.html is a flaky crash
2622         https://bugs.webkit.org/show_bug.cgi?id=196781
2623         <rdar://problem/49789381>
2624
2625         Reviewed by Darin Adler.
2626
2627         When the network process gets terminated by the client, the NetworkProcessProxy object (and thus its DownloadProxyMap member) get
2628         destroyed right away, before we get a call to didClose(IPC::Connection&). As a result, if there are ongoing downloads at the time
2629         of the termination, we will hit the assertion above. To address the issue, update the NetworkProcessProxy destructor to invalidate
2630         its DownloadProxyMap member, similator to what it does in didClose(IPC::Connection&).
2631
2632         * UIProcess/Downloads/DownloadProxyMap.cpp:
2633         (WebKit::DownloadProxyMap::invalidate):
2634         (WebKit::DownloadProxyMap::processDidClose): Deleted.
2635         * UIProcess/Downloads/DownloadProxyMap.h:
2636         * UIProcess/Network/NetworkProcessProxy.cpp:
2637         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
2638         (WebKit::NetworkProcessProxy::didClose):
2639
2640 2019-04-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2641
2642         [GTK] REGRESSION(r243860): Many tests failing
2643         https://bugs.webkit.org/show_bug.cgi?id=196791
2644
2645         Reviewed by Joanmarie Diggs.
2646
2647         Calling updateAccessibilityTree() on document loaded was causing a re-layout because of the backing store update
2648         that confused all those tests. We shouldn't need to update the accessibility tree on document load, it should
2649         happen automatically when root object is attached/detached. This patch emits children-changed::add when the root
2650         object wrapper is attached and children-changed::remove when the root object is detached. That way ATs are
2651         notified of the changes in the accessibility tree.
2652
2653         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2654         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad): Remove call to WebPage::updateAccessibilityTree().
2655         * WebProcess/WebPage/WebPage.h: Remove updateAccessibilityTree().
2656         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
2657         (coreRootObjectWrapperDetachedCallback): Emit children-changed::remove.
2658         (rootWebAreaWrapper): Helper to get the root WebArea wrapper.
2659         (accessibilityRootObjectWrapper): Set the parent here when root object is created and emit children-changed::add.
2660         (webkitWebPageAccessibilityObjectRefChild): Dot no set the parent here, it's now set when the root object is created.
2661         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Remove webkitWebPageAccessibilityObjectRefresh().
2662         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2663
2664 2019-04-11  Megan Gardner  <megan_gardner@apple.com>
2665
2666         Update 'Save Image' to more clear instructions
2667         https://bugs.webkit.org/show_bug.cgi?id=196833
2668         <rdar://problem/47446845>
2669
2670         Reviewed by Wenson Hsieh.
2671
2672         Just updating to a new string.
2673
2674         * UIProcess/API/Cocoa/_WKElementAction.mm:
2675         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
2676
2677 2019-04-11  Chris Dumez  <cdumez@apple.com>
2678
2679         Unable to run system Safari with trunk WebKit
2680         https://bugs.webkit.org/show_bug.cgi?id=196777
2681         <rdar://problem/49784574>
2682
2683         Reviewed by Alex Christensen.
2684
2685         * UIProcess/API/Cocoa/WKWebView.mm:
2686         (-[WKWebView _initializeWithConfiguration:]):
2687         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
2688         data store only happens for apps rebuilt using recent SDK.
2689
2690         * UIProcess/Cocoa/VersionChecks.h:
2691         * UIProcess/Cocoa/VersionChecks.mm:
2692         (WebKit::linkedOnOrAfter):
2693         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
2694           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
2695           be controlled by the caller.
2696         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
2697           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
2698           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
2699           0 value for sdkVersion.
2700
2701 2019-04-11  Zalan Bujtas  <zalan@apple.com>
2702
2703         Add @page margin support
2704         https://bugs.webkit.org/show_bug.cgi?id=196680
2705         <rdar://problem/45217707>
2706
2707         Reviewed by Tim Horton.
2708
2709         * Shared/PrintInfo.cpp:
2710         (WebKit::PrintInfo::encode const):
2711         (WebKit::PrintInfo::decode):
2712         * Shared/PrintInfo.h:
2713         * Shared/WebPreferences.yaml:
2714         * Shared/gtk/PrintInfoGtk.cpp:
2715         (WebKit::PrintInfo::PrintInfo):
2716         * Shared/mac/PrintInfoMac.mm:
2717         (WebKit::PrintInfo::PrintInfo):
2718         * UIProcess/API/C/WKPage.cpp:
2719         (WKPageComputePagesForPrinting):
2720         * UIProcess/API/C/WKPreferences.cpp:
2721         (WKPreferencesSetPageAtRuleSupportEnabled):
2722         (WKPreferencesGetPageAtRuleSupportEnabled):
2723         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2724         * UIProcess/GenericCallback.h:
2725         * UIProcess/WebPageProxy.cpp:
2726         (WebKit::WebPageProxy::computedPagesCallback):
2727         * UIProcess/WebPageProxy.h:
2728         * UIProcess/WebPageProxy.messages.in:
2729         * UIProcess/mac/WKPrintingView.mm:
2730         (pageDidComputePageRects):
2731         (-[WKPrintingView _askPageToComputePageRects]):
2732         * WebProcess/WebPage/WebPage.cpp:
2733         (WebKit::WebPage::beginPrinting):
2734         (WebKit::WebPage::computePagesForPrinting):
2735         (WebKit::WebPage::computePagesForPrintingImpl):
2736         * WebProcess/WebPage/WebPage.h:
2737         * WebProcess/WebPage/ios/WebPageIOS.mm:
2738         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
2739
2740 2019-04-11  Dean Jackson  <dino@apple.com>
2741
2742         Extract UTI mapping and allow for additions
2743         https://bugs.webkit.org/show_bug.cgi?id=196822
2744         <rdar://problem/49822339>
2745
2746         Reviewed by Tim Horton.
2747
2748         Use the new helper to map MIME type to UTI.
2749
2750         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2751         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
2752         * UIProcess/ios/WKSystemPreviewView.mm:
2753         (getUTIForSystemPreviewMIMEType):
2754
2755
2756 2019-04-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
2757
2758         REGRESSION (r244182): RemoteLayerTreeDrawingArea::flushLayers() should not be reentrant
2759         https://bugs.webkit.org/show_bug.cgi?id=196825
2760
2761         Reviewed by Simon Fraser.
2762
2763         Ensure the layer transactions IDs are sequential. So bail out of
2764         RemoteLayerTreeDrawingArea::flushLayers() if reentrancy is detected.
2765
2766         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
2767         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2768         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2769
2770 2019-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2771
2772         Allow the MediaSource API to be enabled via website policy
2773         https://bugs.webkit.org/show_bug.cgi?id=196429
2774         <rdar://problem/48774333>
2775
2776         Reviewed by Tim Horton.
2777
2778         Adds support for using WebsitePolicies to determine whether to enable the MediaSource API.
2779
2780         * Shared/WebPreferences.yaml:
2781
2782         Disengage the mediaSourceEnabled internal preference from the corresponding WebCore setting; to ensure that
2783         setting the preference to `true` still results in enabling the MediaSource API, we instead make it such that
2784         turning on mediaSourceEnabled causes WebsitePolicies to set its WebsiteMediaSourcePolicy to Enable.
2785
2786         In the future, we should deprecate and remove this preference, in favor of simply setting preferred
2787         compatibility mode on WKWebpagePreferences.
2788
2789         * Shared/WebPreferences.yaml:
2790         * Shared/WebsiteMediaSourcePolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h.
2791         * Shared/WebsitePoliciesData.cpp:
2792         (WebKit::WebsitePoliciesData::encode const):
2793         (WebKit::WebsitePoliciesData::decode):
2794
2795         Add plumbing for m_mediaSourcePolicy in the set of website policies.
2796
2797         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2798
2799         Update the document loader with the given media source policy. There are two possibilities when applying the set
2800         of policies to the document loader; either the document loader is already attached to a Frame, or the document
2801         loader is yet to be attached to a Frame.
2802
2803         In the first case, we update Frame's settings on the spot, by calling the new applyPoliciesToSettings helper
2804         method. In the second scenario, we stash the policy state on DocumentLoader; when the DocumentLoader is attached
2805         to a Frame, we'll then update the Frame's settings using DocumentLoader's policy.
2806
2807         * Shared/WebsitePoliciesData.h:
2808         * UIProcess/API/APIWebsitePolicies.cpp:
2809         (API::WebsitePolicies::data):
2810         * UIProcess/API/APIWebsitePolicies.h:
2811         * UIProcess/API/C/WKPage.cpp:
2812         (WKPageSetPageNavigationClient):
2813         * UIProcess/Cocoa/NavigationState.mm:
2814         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2815
2816         Move code that adjusts website policies after deciding policies for the navigation action from NavigationClient
2817         ::decidePolicyForNavigationAction to the completion handler of the policy listener. This allows us to respect
2818         default website policies on the web view configuration, even when using the C API to set the navigation client,
2819         and also allows us to have a single call site for adjustPoliciesForCompatibilityMode. This also enables our
2820         layout tests to opt into modern compatibility mode by default, when specifying modern compatibility mode on
2821         webpage preferences.
2822
2823         * UIProcess/WebPageProxy.cpp:
2824         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2825         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
2826         * UIProcess/WebPageProxy.h:
2827         * WebKit.xcodeproj/project.pbxproj:
2828
2829 2019-04-11  Antti Koivisto  <antti@apple.com>
2830
2831         REGRESSION: changing iPad orientation on blogger.com crashes under RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations()
2832         https://bugs.webkit.org/show_bug.cgi?id=196813
2833         <rdar://problem/49393264>
2834
2835         Reviewed by Simon Fraser.
2836
2837         No test, can't repro.
2838
2839         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2840         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
2841
2842         Null check the nodes.
2843
2844 2019-04-10  Chris Dumez  <cdumez@apple.com>
2845
2846         Regression(r244144) ProcessSwap.ReuseSuspendedProcessLoadHTMLString API test is flaky
2847         https://bugs.webkit.org/show_bug.cgi?id=196784
2848
2849         Reviewed by Antti Koivisto.
2850
2851         When we enter accelerated compositing mode in the new process, we supposed to *close* the last
2852         SuspendedPageProxy, not destroy it. This was causing flakiness in the test because it was testing
2853         that we were using the SuspendedPageProxy's process for a cross-site link navigation, which is
2854         an optimization. This optimization was partly broken by r244144 as the SuspendedPageProxy would
2855         not sometimes be gone by the time we need it.
2856
2857         * UIProcess/SuspendedPageProxy.cpp:
2858         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
2859
2860 2019-04-10  Alex Christensen  <achristensen@webkit.org>
2861
2862         WKNavigationResponse._downloadAttribute should be nil when no download attribute is present
2863         https://bugs.webkit.org/show_bug.cgi?id=196809
2864         <rdar://49800762>
2865
2866         Reviewed by Brady Eidson.
2867
2868         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
2869         (-[WKNavigationResponse _downloadAttribute]):
2870
2871 2019-04-10  Tim Horton  <timothy_horton@apple.com>
2872
2873         REGRESSION (r241734): ⌥⌘↑ and ⌥⌘↓ no longer navigate to previous/next Reading List article
2874         https://bugs.webkit.org/show_bug.cgi?id=196797
2875         <rdar://problem/48484715>
2876
2877         Reviewed by Simon Fraser.
2878
2879         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
2880         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
2881         Validate the set of modifier keys pressed when handling a key event for scrolling:
2882         Ignore key events with multiple modifier keys pressed.
2883         Ignore key events with an invalid modifier key pressed for a given primary key.
2884
2885 2019-04-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
2886
2887         requestAnimationFrame should execute before the next frame
2888         https://bugs.webkit.org/show_bug.cgi?id=177484
2889
2890         Reviewed by Simon Fraser.
2891
2892         Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
2893         a single call to Page::updateRendering(). This new function implements 
2894         "Update the rendering" step of the HTML Event Loop specification
2895         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
2896
2897         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
2898         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
2899         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
2900         (WebKit::DrawingAreaCoordinatedGraphics::display):
2901         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
2902         (WebKit::LayerTreeHost::layerFlushTimerFired):
2903
2904         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2905         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2906         -- Call Page::updateRendering() to make sure that "Update the rendering"
2907            happens immediately before updating the page.
2908
2909         -- Move the call to RemoteLayerBackingStoreCollection::willFlushLayers()
2910            to be exactly before flushing the layers. This fixes the assertion
2911            ASSERT(m_inLayerFlush) which was firing when running a layout test.
2912            RemoteLayerTreeDrawingArea::flushLayers() now can call itself through
2913            TestRunner::notifyDone(). flushLayers() was calling willFlushLayers()
2914            twice before calling didFlushLayers().
2915
2916         * WebProcess/WebPage/WebPage.cpp:
2917         (WebKit::WebPage::layoutIfNeeded):
2918         (WebKit::WebPage::updateRendering):
2919         (WebKit::WebPage::willDisplayPage): Deleted.
2920         * WebProcess/WebPage/WebPage.h:
2921         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2922         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
2923
2924 2019-04-10  Devin Rousso  <drousso@apple.com>
2925
2926         Web Inspector: save sheet should be anchored underneath the tab bar when detached
2927         https://bugs.webkit.org/show_bug.cgi?id=196722
2928         <rdar://problem/49613280>
2929
2930         Reviewed by Timothy Hatcher.
2931
2932         * WebProcess/WebPage/WebInspectorUI.h:
2933         * WebProcess/WebPage/WebInspectorUI.cpp:
2934         (WebKit::WebInspectorUI::changeSheetRect): Added.
2935         * UIProcess/WebInspectorProxy.messages.in:
2936         * UIProcess/WebInspectorProxy.h:
2937         (WebKit::WebInspectorProxy::sheetRect const): Added.
2938         * UIProcess/WebInspectorProxy.cpp:
2939         (WebKit::WebInspectorProxy::setSheetRect): Added.
2940         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
2941         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
2942         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
2943         * UIProcess/mac/WebInspectorProxyMac.mm:
2944         (-[WKWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
2945         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
2946         * UIProcess/win/WebInspectorProxyWin.cpp:
2947         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
2948         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
2949         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
2950
2951         * WebProcess/WebPage/RemoteWebInspectorUI.h:
2952         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
2953         (WebKit::RemoteWebInspectorUI::changeSheetRect): Added.
2954         * UIProcess/RemoteWebInspectorProxy.messages.in:
2955         * UIProcess/RemoteWebInspectorProxy.h:
2956         (WebKit::RemoteWebInspectorProxy::sheetRect const): Added.
2957         * UIProcess/RemoteWebInspectorProxy.cpp:
2958         (WebKit::RemoteWebInspectorProxy::setSheetRect): Added.
2959         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
2960         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
2961         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
2962         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
2963         (-[WKRemoteWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
2964         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
2965         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
2966
2967 2019-04-10  Andy Estes  <aestes@apple.com>
2968
2969         [iOS] Let PDFHostViewController specify the background color to use for WKPDFView
2970         https://bugs.webkit.org/show_bug.cgi?id=196785
2971         <rdar://problem/48240051>
2972
2973         Reviewed by Tim Horton.
2974
2975         * UIProcess/ios/WKPDFView.mm:
2976         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
2977
2978 2019-04-10  Chris Dumez  <cdumez@apple.com>
2979
2980         Unreviewed, rolling out r244146.
2981
2982         Caused a few DeviceOrientation API test failures on iOS
2983
2984         Reverted changeset:
2985
2986         "Unable to run system Safari with trunk WebKit"
2987         https://bugs.webkit.org/show_bug.cgi?id=196777
2988         https://trac.webkit.org/changeset/244146
2989
2990 2019-04-10  Devin Rousso  <drousso@apple.com>
2991
2992         Web Inspector: REGRESSION: lazy agents used outside of frontend/instrumentation can be accessed before being created
2993         https://bugs.webkit.org/show_bug.cgi?id=196725
2994         <rdar://problem/49669810>
2995
2996         Reviewed by Timothy Hatcher.
2997
2998         * WebProcess/WebPage/WebInspector.cpp:
2999         (WebKit::WebInspector::showMainResourceForFrame):
3000
3001 2019-04-10  Youenn Fablet  <youenn@apple.com>
3002
3003         Clear Cache Storage structures before removing all related files
3004         https://bugs.webkit.org/show_bug.cgi?id=196650
3005
3006         Reviewed by Alex Christensen.
3007
3008         Previously, we were clearing files in parallel to clearing the internal CacheStorage structures.
3009         To make things more deterministic, clear files/folders directly
3010         after CachesStorage structures have finished being cleared.
3011
3012         * NetworkProcess/cache/CacheStorageEngine.cpp:
3013         (WebKit::CacheStorage::Engine::clearAllCaches):
3014         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
3015
3016 2019-04-10  Alex Christensen  <achristensen@webkit.org>
3017
3018         Add SPI WKNavigationResponse._downloadAttribute
3019         https://bugs.webkit.org/show_bug.cgi?id=196755
3020         <rdar://49587365>
3021
3022         Reviewed by Brady Eidson.
3023
3024         * UIProcess/API/APINavigationResponse.h:
3025         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
3026         (-[WKNavigationResponse _downloadAttribute]):
3027         * UIProcess/API/Cocoa/WKNavigationResponsePrivate.h:
3028         * UIProcess/ProvisionalPageProxy.cpp:
3029         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
3030         * UIProcess/ProvisionalPageProxy.h:
3031         * UIProcess/WebPageProxy.cpp:
3032         (WebKit::WebPageProxy::decidePolicyForResponse):
3033         (WebKit::WebPageProxy::decidePolicyForResponseShared):
3034         * UIProcess/WebPageProxy.h:
3035         * UIProcess/WebPageProxy.messages.in:
3036         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3037         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
3038         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3039
3040 2019-04-10  Youenn Fablet  <youenn@apple.com>
3041
3042         SWClientConnection should not double hop to fire some events
3043         https://bugs.webkit.org/show_bug.cgi?id=196735
3044
3045         Reviewed by Alex Christensen.
3046
3047         Removed unnecessary method.
3048
3049         * WebProcess/Storage/WebSWClientConnection.cpp:
3050         * WebProcess/Storage/WebSWClientConnection.h:
3051
3052 2019-04-10  Per Arne Vollan  <pvollan@apple.com>
3053
3054         [iOS] Fix iokit-get-properties sandbox violations
3055         https://bugs.webkit.org/show_bug.cgi?id=196782
3056         <rdar://problem/49497720>
3057
3058         Reviewed by Brent Fulgham.
3059
3060         Add iokit properties to the WebContent sandbox on iOS.
3061
3062         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3063
3064 2019-04-10  Tim Horton  <timothy_horton@apple.com>
3065
3066         Add modern API for overriding the page's specified viewport configuration
3067         https://bugs.webkit.org/show_bug.cgi?id=167734
3068         <rdar://problem/30331795>
3069
3070         Reviewed by Simon Fraser.
3071
3072         * Shared/WebPageCreationParameters.cpp:
3073         (WebKit::WebPageCreationParameters::encode const):
3074         (WebKit::WebPageCreationParameters::decode):
3075         * Shared/WebPageCreationParameters.h:
3076         Plumb overrideViewportArguments in WebPageCreationParameters, so that
3077         if the process crashes (or swaps) they are maintained.
3078
3079         * UIProcess/API/Cocoa/WKWebView.mm:
3080         (viewportArgumentsFromDictionary):
3081         (-[WKWebView _overrideViewportWithArguments:]):
3082         Add SPI to set override viewport arguments. Parse them into a ViewportArguments
3083         object and use the existing (now improved) overrideViewportArguments mechanism
3084         to take over the page's viewport arguments.
3085
3086         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3087         * UIProcess/WebPageProxy.cpp:
3088         (WebKit::WebPageProxy::creationParameters):
3089         * UIProcess/WebPageProxy.h:
3090         * UIProcess/ios/WebPageProxyIOS.mm:
3091         (WebKit::WebPageProxy::setOverrideViewportArguments):
3092         * WebProcess/WebPage/WebPage.cpp:
3093         Plumb overrideViewportArguments around more.
3094
3095 2019-04-10  Jiewen Tan  <jiewen_tan@apple.com>
3096
3097         Add runJavaScriptInFrame for WebPageProxy/WebPage
3098         https://bugs.webkit.org/show_bug.cgi?id=196750
3099         <rdar://problem/49755738>
3100
3101         Reviewed by Youenn Fablet.
3102
3103         Tests of the new method will be covered by the internal counterpart.
3104
3105         * UIProcess/WebFrameProxy.cpp:
3106         (WebKit::WebFrameProxy::loadData):
3107         * UIProcess/WebFrameProxy.h:
3108         Add a comment.
3109         * UIProcess/WebPageProxy.cpp:
3110         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
3111         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
3112         Merge the above two runJavaScriptInMainFrame*.
3113         (WebKit::WebPageProxy::runJavaScriptInFrame):
3114         * UIProcess/WebPageProxy.h:
3115         * WebProcess/WebPage/WebPage.cpp:
3116         (WebKit::WebPage::loadDataInFrame):
3117         Add an assertion.
3118         (WebKit::WebPage::runJavaScript):
3119         (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld):
3120         (WebKit::WebPage::runJavaScriptInFrame):
3121         (WebKit::WebPage::runJavaScriptInMainFrame): Deleted.
3122         * WebProcess/WebPage/WebPage.h:
3123         * WebProcess/WebPage/WebPage.messages.in:
3124
3125 2019-04-10  Chris Dumez  <cdumez@apple.com>
3126
3127         Unable to run system Safari with trunk WebKit
3128         https://bugs.webkit.org/show_bug.cgi?id=196777
3129         <rdar://problem/49784574>
3130
3131         Reviewed by Alex Christensen.
3132
3133         * UIProcess/API/Cocoa/WKWebView.mm:
3134         (-[WKWebView _initializeWithConfiguration:]):
3135         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
3136         data store only happens for apps rebuilt using recent SDK.
3137
3138         * UIProcess/Cocoa/VersionChecks.h:
3139         * UIProcess/Cocoa/VersionChecks.mm:
3140         (WebKit::linkedOnOrAfter):
3141         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
3142           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
3143           be controlled by the caller.
3144         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
3145           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
3146           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
3147           0 value for sdkVersion.
3148
3149 2019-04-10  Chris Dumez  <cdumez@apple.com>
3150
3151         Regression(r240562) Audio sometimes keeps playing in previous process after a process-swap
3152         https://bugs.webkit.org/show_bug.cgi?id=196774
3153         <rdar://problem/49460572>
3154
3155         Reviewed by Alex Christensen.
3156
3157         r240562 added logic to prevent flashing on navigation. When we receive the DidFailToSuspendAfterProcessSwap
3158         IPC from the previous process, we would delay closing the WebPage in that process until EnterAcceleratedCompositingMode
3159         IPC is received from the new process. The issue is that this was racy as we would receive the EnterAcceleratedCompositingMode
3160         IPC from the new process *before* receiving the DidFailToSuspendAfterProcessSwap IPC from the previous process, which which
3161         case we would fail to close the WebPage and audio could keep playing.
3162
3163         To address the issue, the WebPageProxy keeps track of its last suspended page and notifies it whenever it receives the
3164         EnterAcceleratedCompositingMode IPC. If the suspended page already received the DidFailToSuspendAfterProcessSwap IPC, it
3165         will close the page. Otherwise, it will set a boolean data member indicating that we should not delay page closing when
3166         the DidFailToSuspendAfterProcessSwap is eventually received.
3167
3168         * UIProcess/SuspendedPageProxy.cpp:
3169         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
3170         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
3171         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
3172         * UIProcess/SuspendedPageProxy.h:
3173         * UIProcess/WebPageProxy.cpp:
3174         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
3175         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
3176         * UIProcess/WebPageProxy.h:
3177         * UIProcess/WebProcessPool.cpp:
3178         * UIProcess/WebProcessPool.h:
3179
3180 2019-04-10  Timothy Hatcher  <timothy@apple.com>
3181
3182         WKScrollView background color does not match WKWebView before content is loaded.
3183         https://bugs.webkit.org/show_bug.cgi?id=196745
3184         rdar://problem/49750810
3185
3186         Reviewed by Megan Gardner.
3187
3188         * UIProcess/API/Cocoa/WKWebView.mm:
3189         (scrollViewBackgroundColor): Default to _contentView.backgroundColor on invalid base color.
3190         (-[WKWebView _processDidExit]): Reset to _contentView.backgroundColor.
3191         (-[WKWebView setBackgroundColor:]): Call _updateScrollViewBackground since it can use
3192         _contentView.backgroundColor and it has changed.
3193
3194 2019-04-10  Megan Gardner  <megan_gardner@apple.com>
3195
3196         Fix text autoscrolling when typing in modern webkit
3197         https://bugs.webkit.org/show_bug.cgi?id=196718
3198         <rdar://problem/49225507>
3199
3200         Reviewed by Tim Horton.
3201
3202         For staging only. We need to turn off UIKit's scrolling behavior to land
3203         the changes we are making. To keep from the build ever breaking,
3204         I am temporarily circumventing the changes in UIKit. This will be removed
3205         once the next UIKit submission happens.
3206
3207         * UIProcess/ios/WKContentViewInteraction.mm:
3208         (-[WKUIWKTextInteractionAssistant scrollSelectionToVisible]):
3209         (-[WKContentView setUpTextSelectionAssistant]):
3210
3211 2019-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
3212
3213         [iOSMac] Opt into modern compatibility mode by default
3214         https://bugs.webkit.org/show_bug.cgi?id=196763
3215         <rdar://problem/49038732>
3216
3217         Reviewed by Tim Horton.
3218
3219         Achieve this by limiting legacy compatibility mode by default to non-iOSMac iOS only.
3220
3221         * Shared/WebPreferences.yaml:
3222         * Shared/WebPreferencesDefaultValues.h:
3223
3224 2019-04-10  Alex Christensen  <achristensen@webkit.org>
3225
3226         RemoteObjectRegistry message receiver should be removed when WebPage::close is called instead of waiting until dealloc
3227         https://bugs.webkit.org/show_bug.cgi?id=196744
3228         <rdar://49415309>
3229
3230         Reviewed by Chris Dumez.
3231
3232         This is a similar problem to the one I fixed in r241306 so I piggy-backed on the same test.
3233         When you do a cross site navigation but the previous page is in a suspended process then you navigate back,
3234         you can get two WebPage objects in the same process with the same IDs.  WebPage::close has been called
3235         on the old one which is supposed to make it so all the message receivers associated with it have been removed
3236         so we don't have any loss of communication, but we missed the RemoteObjectRegistry messages, which are owned
3237         by the ObjC bundle object wrapping the WebPage (which can keep it alive if a strong reference to it is held).
3238         To fix the assertion that happens in this case and the resulting communication breakage, teach the WebPage about
3239         these messages so it can tear down the message receiver with the others it removes at close time.
3240
3241         * Shared/API/Cocoa/RemoteObjectRegistry.h:
3242         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3243         (-[WKWebProcessPlugInBrowserContextController dealloc]):
3244         (-[WKWebProcessPlugInBrowserContextController _remoteObjectRegistry]):
3245         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
3246         (WebKit::WebPage::addRemoteObjectRegistry):
3247         * WebProcess/WebPage/WebPage.cpp:
3248         (WebKit::WebPage::close):
3249         * WebProcess/WebPage/WebPage.h:
3250
3251 2019-04-10  Chris Dumez  <cdumez@apple.com>
3252
3253         Unreviewed, drop SuspendedPageProxy data member that is unused after r244075.
3254
3255         * UIProcess/SuspendedPageProxy.h:
3256
3257 2019-04-10  Antoine Quint  <graouts@apple.com>
3258
3259         Enable Pointer Events on watchOS
3260         https://bugs.webkit.org/show_bug.cgi?id=196771
3261         <rdar://problem/49040909>
3262
3263         Reviewed by Dean Jackson.
3264
3265         * Configurations/FeatureDefines.xcconfig:
3266
3267 2019-04-10  Brady Eidson  <beidson@apple.com>
3268
3269         Background tabs are not fully reactivated after a link is opened from an external application.
3270         <rdar://problem/49533278> and https://bugs.webkit.org/show_bug.cgi?id=196705
3271
3272         Reviewed by Chris Dumez.
3273
3274         If an app unparents a WKWebView right after activation but before the "applicationWillEnterForeground" notification
3275         is dispatched, then that WKWebView is in a broken state with a frozen layer tree.
3276
3277         The WKApplicationStateTrackingView logic needs to be a little more resilient.
3278
3279         * UIProcess/ios/WKApplicationStateTrackingView.mm:
3280         (-[WKApplicationStateTrackingView willMoveToWindow:]): When clearing the window, remember the current background state.
3281         (-[WKApplicationStateTrackingView didMoveToWindow]): If our last observed background state doesn't match the current
3282           background state then fake the relevant notification.
3283         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]): Remember that we've observed a backgrounding.
3284         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]): Remember that we've observed a foregrounding.
3285
3286 2019-04-10  Diego Pino Garcia  <dpino@igalia.com>
3287
3288         Unreviewed, build fix for r244097
3289
3290         * NetworkProcess/NetworkProcess.cpp:
3291         (WebKit::NetworkProcess::actualPrepareToSuspend):
3292         (WebKit::NetworkProcess::resume):
3293         Added guards for ENABLE(SERVICE_WORKER)
3294
3295 2019-04-09  Keith Rollin  <krollin@apple.com>
3296
3297         Unreviewed build maintenance -- update .xcfilelists.
3298
3299         * DerivedSources-input.xcfilelist:
3300         * DerivedSources-output.xcfilelist:
3301
3302 2019-04-09  Zalan Bujtas  <zalan@apple.com>
3303
3304         [AutoSizing] Avoid making text paragraphs scroll horizontally when there is a wide table
3305         https://bugs.webkit.org/show_bug.cgi?id=196743
3306         <rdar://problem/43897551>
3307
3308         Reviewed by Tim Horton.
3309
3310         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3311         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
3312         * WebProcess/WebPage/WebPage.cpp:
3313         (WebKit::WebPage::setViewLayoutSize):
3314
3315 2019-04-09  Youenn Fablet  <youenn@apple.com>
3316
3317         Close service worker database on network process suspension
3318         https://bugs.webkit.org/show_bug.cgi?id=196623
3319         <rdar://problem/48930869>
3320
3321         Reviewed by Alex Christensen.
3322
3323         Close service worker database when preparing to suspend.
3324         On resume, push changes if any is needed.
3325
3326         * NetworkProcess/NetworkProcess.cpp:
3327         (WebKit::NetworkProcess::actualPrepareToSuspend):
3328         (WebKit::NetworkProcess::cancelPrepareToSuspend):
3329         (WebKit::NetworkProcess::processDidResume):
3330         * UIProcess/API/Cocoa/WKProcessPool.mm:
3331         (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):
3332         (-[WKProcessPool _sendNetworkProcessDidResume]):
3333         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3334         * UIProcess/Network/NetworkProcessProxy.h:
3335         * UIProcess/WebProcessPool.cpp:
3336         (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently):
3337         (WebKit::WebProcessPool::sendNetworkProcessDidResume):
3338         * UIProcess/WebProcessPool.h:
3339
3340 2019-04-09  Daniel Bates  <dabates@apple.com>
3341
3342         [iPad] Should open popover when the spacebar is pressed
3343         https://bugs.webkit.org/show_bug.cgi?id=196360
3344         <rdar://problem/49389129>
3345
3346         Reviewed by Brent Fulgham.
3347
3348         Pressing the spacebar should open the popover for a focused popup button (e.g. <select>) on iOS
3349         just like it does on the Mac.
3350
3351         For now, we keep the iPhone behavior of blurring the element when the Done button is pressed and
3352         hence pressing spacebar does nothing (because there is no focused element).
3353
3354         * UIProcess/ios/WKContentViewInteraction.h:
3355         * UIProcess/ios/WKContentViewInteraction.mm:
3356         (-[WKContentView accessoryOpen]): Added. Extracted the logic from -_elementDidFocus to scroll to
3357         the focused element, update the accessory and then tell the accessory to begin editing.
3358         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3359         Write in terms of -accessoryOpen.
3360         * UIProcess/ios/forms/WKFormPeripheralBase.mm:
3361         (-[WKFormPeripheralBase handleKeyEvent:]): Interpret the spacebar when the peripheral is closed (!_editing)
3362         and call -accessoryOpen to ultimately call back to this peripheral to tell it to begin editing,
3363         which will cause the popover to appear again.
3364
3365 2019-04-09  Chris Dumez  <cdumez@apple.com>
3366
3367         Unreviewed, fix webkitpy failure after r244085.
3368
3369         Use a list instead of a set for header includes so that the order is
3370         maintained.
3371
3372         * Scripts/webkit/messages.py:
3373
3374 2019-04-09  Andy Estes  <aestes@apple.com>
3375
3376         [Apple Pay] Add release logging to PaymentCoordinator
3377         https://bugs.webkit.org/show_bug.cgi?id=196738
3378
3379         Reviewed by Alex Christensen.
3380
3381         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
3382         (WebKit::WebPaymentCoordinator::isAlwaysOnLoggingAllowed const):
3383         * WebProcess/ApplePay/WebPaymentCoordinator.h:
3384
3385 2019-04-09  Jer Noble  <jer.noble@apple.com>
3386
3387         [Cocoa] Awaken UIProcess if WebContent process is awakened from suspensions unexpectedly.
3388         https://bugs.webkit.org/show_bug.cgi?id=196659
3389
3390         Reviewed by Chris Dumez.
3391
3392         * Platform/IPC/Connection.h:
3393         (IPC::Connection::sendWithAsyncReply):
3394         * Platform/spi/ios/AssertionServicesSPI.h:
3395         * Shared/Cocoa/ProcessTaskStateObserver.h: Added.
3396         (WebKit::ProcessTaskStateObserver::setClient):
3397         (WebKit::ProcessTaskStateObserver::client):
3398         (WebKit::ProcessTaskStateObserver::taskState const):
3399         * Shared/Cocoa/ProcessTaskStateObserver.mm: Added.
3400         (-[WKProcessTaskStateObserverDelegate process:taskStateDidChange:]):
3401         (WebKit::toProcessTaskStateObserverTaskState):
3402         (WebKit::ProcessTaskStateObserver::ProcessTaskStateObserver):
3403         (WebKit::ProcessTaskStateObserver::~ProcessTaskStateObserver):
3404         (WebKit::ProcessTaskStateObserver::setTaskState):
3405         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
3406         (WebKit::WebProcessProxy::processWasUnexpectedlyUnsuspended):
3407         * UIProcess/ProcessAssertion.h:
3408         * UIProcess/ProcessThrottler.cpp:
3409         (WebKit::ProcessThrottler::updateAssertion):
3410         * UIProcess/ProcessThrottler.h:
3411         (WebKit::ProcessThrottler::shouldBeRunnable const):
3412         * UIProcess/WebProcessProxy.h:
3413         * UIProcess/WebProcessProxy.messages.in:
3414         * UIProcess/ios/ProcessAssertionIOS.mm:
3415         (WebKit::reasonForState):
3416         (WebKit::toBKSProcessAssertionReason):
3417         (WebKit::ProcessAssertion::ProcessAssertion):
3418         * WebKit.xcodeproj/project.pbxproj:
3419         * WebProcess/WebProcess.cpp:
3420         (WebKit::WebProcess::actualPrepareToSuspend):
3421         (WebKit::WebProcess::cancelPrepareToSuspend):
3422         (WebKit::WebProcess::processDidResume):
3423         * WebProcess/WebProcess.h:
3424         * WebProcess/cocoa/WebProcessCocoa.mm:
3425         (WebKit::WebProcess::processTaskStateDidChange):
3426
3427 2019-04-09  Alex Christensen  <achristensen@webkit.org>
3428
3429         Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
3430         https://bugs.webkit.org/show_bug.cgi?id=196665
3431         <rdar://45115669>
3432
3433         Reviewed by Geoff Garen.
3434
3435         It is insufficient to just not navigate the subframe.  We must leave the page that contained it.
3436
3437         * UIProcess/API/Cocoa/WKWebView.mm:
3438         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
3439         * UIProcess/Cocoa/WebViewImpl.mm:
3440         (WebKit::WebViewImpl::showSafeBrowsingWarning):
3441