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