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