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