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