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