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