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