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