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