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