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