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