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