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