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