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