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