2cd493088ba67fabcd96273798dcc1320208ec36
[WebKit.git] / Source / WebKit / ChangeLog
1 2020-04-27  Diego Pino Garcia  <dpino@igalia.com>
2
3         Unreviewed, reverting r260696.
4
5         Build fix after r260672, no needed since r260672 is also being reverted.
6
7         Reverted changeset:
8
9         "REGRESSION(210942): [GTK][WPE] Unreviewed, EWS build bots
10         fail in compile-webkit step"
11         https://bugs.webkit.org/show_bug.cgi?id=211014
12         https://trac.webkit.org/changeset/260696
13
14 2020-04-26  Darin Adler  <darin@apple.com>
15
16         [Cocoa] stop using out arguments for document attributes when converting to attributed strings
17         https://bugs.webkit.org/show_bug.cgi?id=211048
18
19         Reviewed by Sam Weinig.
20
21         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
22         (WebKit::updateTaskWithFirstPartyForSameSiteCookies): Use init instead of initWithString:@"".
23
24         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
25         (IPC::ArgumentCoder<WebCore::AttributedString>::encode): Moved here from AttributedString.mm.
26         (IPC::ArgumentCoder<WebCore::AttributedString>::decode): Ditto.
27
28         * Shared/DocumentEditingContext.h: Updated to use WebCore::AttributeString.
29         * Shared/DocumentEditingContext.mm:
30         (IPC::ArgumentCoder<WebKit::DocumentEditingContext>::decode): Ditto.
31
32         * Shared/WebCoreArgumentCoders.h: Added coder for WebCore::AttributedString.
33
34         * Shared/mac/AttributedString.h: Removed.
35         * Shared/mac/AttributedString.mm: Removed.
36
37         * SourcesCocoa.txt: Removed AttributedString.mm.
38
39         * UIProcess/API/Cocoa/WKWebView.mm: Updated to use WebCore::AttributedString.
40         * UIProcess/Cocoa/TextCheckingController.mm: Ditto.
41         * UIProcess/Cocoa/WebViewImpl.mm:
42         (WebKit::WebViewImpl::attributedSubstringForProposedRange): Ditto.
43         * UIProcess/WebPageProxy.cpp:
44         (WebKit::WebPageProxy::getContentsAsAttributedString): Ditto.
45         * UIProcess/WebPageProxy.h: Ditto.
46         * UIProcess/WebPageProxy.messages.in: Ditto.
47         * UIProcess/mac/WebPageProxyMac.mm:
48         (WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync): Ditto.
49         (WebKit::WebPageProxy::attributedStringForCharacterRangeCallback): Ditto.
50
51         * WebKit.xcodeproj/project.pbxproj: Removed AttributedString.h and AttributedString.mm.
52
53         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h: Updated to use WebCore::AttributedString.
54         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.messages.in: Ditto.
55         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
56         (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection): Ditto.
57         (WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions): Ditto.
58
59         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
60         (WebKit::WebPage::dictionaryPopupInfoForRange): Updated since editingAttributedString
61         returns a struct.
62         (WebKit::WebPage::getContentsAsAttributedString): Updated to use SimpleRange and
63         since attributedString returns a struct.
64
65         * WebProcess/WebPage/WebPage.h: Updated to use WebCore::AttributedString.
66         * WebProcess/WebPage/WebPage.messages.in: Ditto.
67         * WebProcess/WebPage/ios/WebPageIOS.mm:
68         (WebKit::WebPage::requestDocumentEditingContext): Ditto.
69         * WebProcess/WebPage/mac/WebPageMac.mm:
70         (WebKit::WebPage::attributedSubstringForCharacterRangeAsync): Ditto.
71         (WebKit::WebPage::handleSelectionServiceClick): Ditto.
72
73 2020-04-26  Said Abou-Hallawa  <sabouhallawa@apple.com>
74
75         Rendering update steps should use Seconds for the timestamps
76         https://bugs.webkit.org/show_bug.cgi?id=210990
77
78         Reviewed by Daniel Bates.
79
80         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
81         (WebKit::CompositingCoordinator::timestamp const):
82
83 2020-04-26  Peng Liu  <peng.liu6@apple.com>
84
85         Remove unused class PlaybackSessionInterface
86         https://bugs.webkit.org/show_bug.cgi?id=211031
87
88         Reviewed by Daniel Bates.
89
90         * WebProcess/cocoa/PlaybackSessionManager.h:
91
92 2020-04-11  Darin Adler  <darin@apple.com>
93
94         Stop using live ranges in functions that return range of the selection
95         https://bugs.webkit.org/show_bug.cgi?id=210396
96
97         Reviewed by Sam Weinig.
98
99         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
100         (WebKit::WebEditorClient::updateGlobalSelection): Remove use of live range.
101
102         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
103         (WebKit::WebPage::dictionaryPopupInfoForRange): Updated for changes
104         to attributedString functions.
105         (WebKit::WebPage::getContentsAsAttributedString): Ditto.
106
107         * WebProcess/WebPage/FindController.cpp:
108         (WebKit::FindController::updateFindUIAfterPageScroll): Use createLiveRange.
109
110         * WebProcess/WebPage/WebPage.cpp:
111         (WebKit::WebPage::getSelectedRangeAsync): Ditto.
112         (WebKit::WebPage::currentSelectionAsRange): Ditto.
113
114         * WebProcess/WebPage/WebPage.h: Change m_rangeForDropSnapshot
115         to use a SimpleRange instead of a live range.
116
117         * WebProcess/WebPage/ios/WebPageIOS.mm:
118         (WebKit::plainTextForContext): Overloaded for SimpleRange and
119         Optional<SimpleRange> as needed by code below.
120         (WebKit::plainTextForDisplay): Ditto.
121         (WebKit::WebPage::getPlatformEditorState const): Use createLiveRange.
122         (WebKit::WebPage::getSelectionContext): Remove use of live range.
123         (WebKit::WebPage::didConcludeDrop): Ditto.
124         (WebKit::WebPage::didConcludeEditDrag): Use createLiveRange.
125         (WebKit::WebPage::computeAndSendEditDragSnapshot): Ditto.
126         (WebKit::WebPage::startAutoscrollAtPosition): Remove use of
127         live range.
128         (WebKit::WebPage::requestEvasionRectsAboveSelection): Use
129         createLiveRange.
130         (WebKit::WebPage::requestDictationContext): Remove use of live range.
131         (WebKit::WebPage::replaceSelectedText): Use createLiveRange.
132         (WebKit::WebPage::applyAutocorrectionInternal): Ditto.
133         (WebKit::WebPage::autocorrectionContext): Remove use of live range.
134         (WebKit::WebPage::requestDocumentEditingContext): Use createLiveRange.
135
136         * WebProcess/WebPage/mac/WebPageMac.mm:
137         (WebKit::WebPage::getPlatformEditorState const): Remove use of
138         live range.
139         (WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
140         Updated for change to HTMLConverter functions.
141         (WebKit::WebPage::handleSelectionServiceClick): Ditto.
142         (WebKit::WebPage::performImmediateActionHitTestAtLocation):
143         Remove use of live range.
144
145 2020-04-25  Alex Christensen  <achristensen@webkit.org>
146
147         Fix internal iOS build.
148         https://bugs.webkit.org/show_bug.cgi?id=210521
149
150         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
151         (WebKit::WebPaymentCoordinatorProxy::platformBeginApplePaySetup):
152
153 2020-04-25  Alex Christensen  <achristensen@webkit.org>
154
155         Move ApplePay code from WebKitAdditions to WebCore and WebKit
156         https://bugs.webkit.org/show_bug.cgi?id=210521
157
158 2020-04-25  Alex Christensen  <achristensen@webkit.org>
159
160         Move ApplePay code from WebKitAdditions to WebCore and WebKit
161         https://bugs.webkit.org/show_bug.cgi?id=210521
162
163         Reviewed by Andy Estes.
164
165         * DerivedSources.make:
166         * Scripts/webkit/messages.py:
167         * Shared/ApplePay/ApplePayPaymentSetupFeatures.h: Added.
168         (WebKit::PaymentSetupFeatures::platformFeatures const):
169         * Shared/ApplePay/ApplePayPaymentSetupFeatures.mm: Added.
170         (WebKit::PaymentSetupFeatures::PaymentSetupFeatures):
171         (WebKit::PaymentSetupFeatures::encode const):
172         (WebKit::PaymentSetupFeatures::decode):
173         (WebKit::PaymentSetupFeatures::operator Vector<Ref<WebCore::ApplePaySetupFeature>> const):
174         * Shared/ApplePay/PaymentSetupConfiguration.h: Added.
175         (WebKit::PaymentSetupConfiguration::platformConfiguration const):
176         * Shared/ApplePay/PaymentSetupConfiguration.mm: Added.
177         (WebKit::toPlatformConfiguration):
178         (WebKit::PaymentSetupConfiguration::PaymentSetupConfiguration):
179         (WebKit::PaymentSetupConfiguration::encode const):
180         (WebKit::PaymentSetupConfiguration::decode):
181         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
182         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
183         (WebKit::WebPaymentCoordinatorProxy::finishConstruction): Deleted.
184         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
185         * Shared/ApplePay/cocoa/PaymentSetupConfiguration.mm: Added.
186         (WebKitAdditions::toPlatformConfiguration):
187         (WebKitAdditions::PaymentSetupConfiguration::PaymentSetupConfiguration):
188         (WebKitAdditions::PaymentSetupConfiguration::encode const):
189         (WebKitAdditions::PaymentSetupConfiguration::decode):
190         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
191         (WebKit::finishCreating):
192         (WebKit::WebPaymentCoordinatorProxy::getSetupFeatures):
193         (WebKit::WebPaymentCoordinatorProxy::beginApplePaySetup):
194         (WebKit::WebPaymentCoordinatorProxy::endApplePaySetup):
195         (WebKit::WebPaymentCoordinatorProxy::platformBeginApplePaySetup):
196         (WebKit::WebPaymentCoordinatorProxy::platformEndApplePaySetup):
197         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
198         (IPC::finishDecoding):
199         (IPC::finishEncoding):
200         (IPC::ArgumentCoder<WebCore::PaymentInstallmentConfiguration>::encode):
201         (IPC::ArgumentCoder<WebCore::PaymentInstallmentConfiguration>::decode):
202         * SourcesCocoa.txt:
203         * WebKit.xcodeproj/project.pbxproj:
204         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
205         (WebKit::WebPaymentCoordinator::getSetupFeatures):
206         (WebKit::WebPaymentCoordinator::beginApplePaySetup):
207         (WebKit::WebPaymentCoordinator::endApplePaySetup):
208         * WebProcess/ApplePay/WebPaymentCoordinator.h:
209
210 2020-04-25  Darin Adler  <darin@apple.com>
211
212         [Cocoa] Deal with another round of Xcode upgrade checks
213         https://bugs.webkit.org/show_bug.cgi?id=211027
214
215         Reviewed by Alexey Proskuryakov.
216
217         * WebKit.xcodeproj/project.pbxproj: Bump the upgrade check version.
218         Add a base localization.
219
220 2020-04-25  Alex Christensen  <achristensen@webkit.org>
221
222         Prepare to remove automatic URL->String conversion operators
223         https://bugs.webkit.org/show_bug.cgi?id=211007
224
225         Reviewed by Darin Adler.
226
227         * Shared/API/APIError.h:
228         (API::Error::failingURL const):
229         * Shared/API/c/WKSharedAPICast.h:
230         (WebKit::toCopiedURLAPI):
231         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
232         (setUpPagePolicyClient):
233         * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm:
234         (WebKit::reportAnErrorURL):
235         * UIProcess/Cocoa/UIDelegate.mm:
236         (WebKit::requestUserMediaAuthorizationForFrame):
237         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
238         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
239         (WebKit::WebPasteboardProxy::readURLFromPasteboard):
240         * UIProcess/ProvisionalPageProxy.cpp:
241         (WebKit::ProvisionalPageProxy::cancel):
242         * UIProcess/WebPageProxy.cpp:
243         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
244         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
245         (WebKit::WebPageProxy::loadAlternateHTML):
246         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
247         (WebKit::WebPageProxy::didExplicitOpenForFrame):
248         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared):
249         (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared):
250         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
251         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
252         (WebKit::WebPageProxy::createNewPage):
253         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
254         (-[WKWebProcessPlugInFrame URL]):
255         * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp:
256         (WebKit::NetscapePluginStream::didReceiveResponse):
257         * WebProcess/Plugins/PDF/PDFPlugin.mm:
258         (WebKit::PDFPlugin::clickedLink):
259         (WebKit::PDFPlugin::openWithNativeApplication):
260         * WebProcess/Plugins/PluginView.cpp:
261         (WebKit::PluginView::performURLRequest):
262         (WebKit::PluginView::performJavaScriptURLRequest):
263         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
264         (WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect):
265         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
266         (WebKit::WebFrameLoaderClient::shouldForceUniversalAccessFromLocalURL):
267         * WebProcess/WebPage/WebFrame.cpp:
268         (WebKit::WebFrame::info const):
269         * WebProcess/WebStorage/StorageAreaMap.cpp:
270         (WebKit::StorageAreaMap::setItem):
271         (WebKit::StorageAreaMap::removeItem):
272         (WebKit::StorageAreaMap::clear):
273         * WebProcess/cocoa/WebProcessCocoa.mm:
274         (WebKit::origin):
275
276 2020-04-25  Darin Adler  <darin@apple.com>
277
278         Move URL to use StringView when returning substrings of the URL
279         https://bugs.webkit.org/show_bug.cgi?id=210431
280
281         Reviewed by Anders Carlsson.
282
283         * NetworkProcess/NetworkLoadChecker.cpp:
284         (WebKit::NetworkLoadChecker::checkRedirection): Use hasCredentials.
285         (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded const):
286         Remove use of ASCIILiteral for setProtocol.
287
288         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
289         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl): Updated for
290         password name change.
291         (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection): Ditto.
292
293         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
294         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Updated
295         for password name change.
296         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): Ditto.
297
298         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
299         (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): Updated for
300         password name change.
301         (WebKit::NetworkDataTaskSoup::applyAuthenticationToRequest): Ditto.
302         (WebKit::NetworkDataTaskSoup::continueHTTPRedirection): Ditto.
303         (WebKit::NetworkDataTaskSoup::shouldAllowHSTSPolicySetting const):
304         Use != to compare hosts, rather than hostsAreEqual.
305         (WebKit::NetworkDataTaskSoup::shouldAllowHSTSProtocolUpgrade const):
306         Refactored to use || to match the function above.
307
308         * Shared/API/APIURL.h:
309         (API::URL::host const): Removed validity check; WTF::URL::host
310         returns null if the URL is invalid.
311         (API::URL::protocol const): Ditto.
312         (API::URL::path const): Ditto.
313         (API::URL::lastPathComponent const): Ditto. Also added toString
314         since WTF::URL::lastPathComponent now returns a StringView.
315
316         * UIProcess/Cocoa/DownloadClient.mm:
317         (WebKit::DownloadClient::didFinish): Use hasFragmentIdentifier.
318
319         * UIProcess/DeviceIdHashSaltStorage.cpp:
320         (WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk):
321         Refactored a bit and use fileURLWithFileSystemPath and
322         updated since lastPathComponent returns a StringView.
323
324         * UIProcess/Plugins/PluginInfoStore.cpp:
325         (WebKit::pathExtension): Updated since lastPathComponent
326         returns a StringView. Refactored a little.
327
328         * UIProcess/WebPageProxy.cpp:
329         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
330         Use truncatedForUseAsBase.
331         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
332         Use != to compare hosts, rather than hostsAreEqual.
333         (WebKit::WebPageProxy::decidePolicyForNewWindowAction): Ditto.
334         (WebKit::WebPageProxy::createNewPage): Ditto.
335
336         * UIProcess/WebProcessProxy.cpp:
337         (WebKit::WebProcessProxy::assumeReadAccessToBaseURL):
338         Use truncatedForUseAsBase.
339
340         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
341         (WebKit::WebsiteDataStore::initializeAppBoundDomains):
342         Don't use ASCIILiteral for argument to setProtocol.
343
344         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
345         (WebKit::WebMediaKeyStorageManager::getMediaKeyOrigins):
346         Use fileURLWithFileSystemPath, also refactored a bit.
347
348         * WebProcess/Plugins/PDF/PDFPlugin.mm:
349         (WebKit::PDFPlugin::installPDFDocument): Updated since
350         fragmentIdentifier returns a StringView.
351
352         * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
353         (WebKit::WebContextMenuClient::searchWithGoogle): Streamlined
354         the implementation a bit.
355
356         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
357         (WebKit::WebDragClient::declareAndWriteDragImage):
358         Updated since lastPathComponent returns a StringView.
359
360 2020-04-25  David Kilzer  <ddkilzer@apple.com>
361
362         IPC::Decoder::isInvalid() should be renamed to isValid()
363         <https://webkit.org/b/211000>
364
365         Reviewed by Darin Adler.
366
367         Negative logic is more difficult to reason about than positive
368         logic.
369
370         * Platform/IPC/Connection.cpp:
371         (IPC::Connection::dispatchMessage):
372         (IPC::Connection::dispatchWorkQueueMessageReceiverMessage):
373         (IPC::Connection::dispatchThreadMessageReceiverMessage):
374         (IPC::Connection::dispatchSyncMessage):
375         * Platform/IPC/Connection.h:
376         (IPC::Connection::sendWithAsyncReply):
377         * Platform/IPC/Decoder.cpp:
378         (IPC::Decoder::create):
379         * Platform/IPC/Decoder.h:
380         (IPC::Decoder::isValid const): Rename from isInvalid()
381         and invert logic.
382         (IPC::Decoder::isInvalid const): Rename to isValid().
383         * Platform/IPC/MessageSender.h:
384         * UIProcess/AuxiliaryProcessProxy.h:
385         (WebKit::AuxiliaryProcessProxy::sendWithAsyncReply):
386         - Change Decoder::isInvalid() to Decoder::isValid() and reverse
387           the Boolean logic.
388
389 2020-04-25  Diego Pino Garcia  <dpino@igalia.com>
390
391         REGRESSION(210942): [GTK][WPE] EWS build bots fail in compile-webkit step
392         https://bugs.webkit.org/show_bug.cgi?id=211014
393
394         Make command that generates 'InspectorGResourceBundle.xml' depend on target 
395         WebInspectorUI, instead of file 'inspector-resources.stamp'.
396
397         * InspectorGResources.cmake:
398
399 2020-04-24  Diego Pino Garcia  <dpino@igalia.com>
400
401         [WPE][Debug] Unreviewed, fix build after r260063
402         https://bugs.webkit.org/show_bug.cgi?id=211009
403
404         r260063 removed include of WebProcess.h in WebSocketProvider.cpp,
405         which broke unified builds in WPE Debug.
406
407         * WebProcess/Network/WebSocketProvider.cpp:
408
409 2020-04-24  David Kilzer  <ddkilzer@apple.com>
410
411         WebPasteboardProxy::getPasteboardStringsForType() and WebPasteboardProxy::readURLFromPasteboard() should check return value of SharedMemory::createHandle()
412         <https://webkit.org/b/211002>
413
414         Reviewed by Wenson Hsieh.
415
416         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
417         (WebKit::WebPasteboardProxy::getPasteboardBufferForType):
418         (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
419         - Check result of SharedMemory::createHandle() and return early
420           on failure.
421
422 2020-04-24  Chris Dumez  <cdumez@apple.com>
423
424         [iOS] Unable to sign up on twitter.com
425         https://bugs.webkit.org/show_bug.cgi?id=211003
426         <rdar://problem/58804852>
427
428         Reviewed by Darin Adler.
429
430         * UIProcess/WebPageProxy.cpp:
431         * UIProcess/WebPageProxy.h:
432         * UIProcess/ios/WKApplicationStateTrackingView.mm:
433         (-[WKApplicationStateTrackingView _willBeginSnapshotSequence]):
434         (-[WKApplicationStateTrackingView _didCompleteSnapshotSequence]):
435         * WebProcess/WebPage/WebPage.cpp:
436         (WebKit::WebPage::setShouldFireEvents):
437         (WebKit::WebPage::setShouldFireResizeEvents): Deleted.
438         * WebProcess/WebPage/WebPage.h:
439         * WebProcess/WebPage/WebPage.messages.in:
440
441 2020-04-24  Christopher Reid  <chris.reid@sony.com>
442
443         [Win] Bundle Inspector Resources in Release builds
444         https://bugs.webkit.org/show_bug.cgi?id=210942
445
446         Reviewed by Fujii Hironori.
447
448         Move CMake logic for the inspector resource copy script to
449         Source/WebInspectorUI so it can be shared with Win and other platforms.
450
451         * InspectorGResources.cmake:
452         * PlatformWPE.cmake:
453         * PlatformWin.cmake:
454
455 2020-04-24  Kate Cheney  <katherine_cheney@apple.com>
456
457         Removing website data for a domain should delete corresponding ITP entry
458         https://bugs.webkit.org/show_bug.cgi?id=210864
459         <rdar://problem/59473193>
460
461         Reviewed by John Wilander.
462
463         Tests: http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-link-decoration-database.html
464                http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-link-decoration.html
465                http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-mixed-statistics-entries-database.html
466                http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-mixed-statistics-entries.html
467                http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads-database.html
468                http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads.html
469
470         In the database store: deletes domain from the ObservedDomains table
471         when website data is deleted for that domain. This deletes every
472         instance of the domainID in the database due to cascading deletions.
473
474         In the memory store: deletes every instance of the domain in the
475         statistics map, which will update the plist.
476
477         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
478         (WebKit::ResourceLoadStatisticsDatabaseStore::removeDataForDomain):
479         (WebKit::ResourceLoadStatisticsDatabaseStore::domainIDExistsInDatabase):
480         Needed a new function to check for the existence of domainID in any
481         table. Existing queries rely on the ObservedDomains entry, which means
482         testing using those could result in a false positive if the domainID
483         was deleted from ObservedDomains but is floating around in another
484         table.
485
486         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
487         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
488         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataForDomain):
489         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
490         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
491         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
492         (WebKit::WebResourceLoadStatisticsStore::domainIDExistsInDatabase):
493         (WebKit::WebResourceLoadStatisticsStore::removeDataForDomain):
494         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
495         * NetworkProcess/NetworkProcess.cpp:
496         (WebKit::NetworkProcess::domainIDExistsInDatabase):
497         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
498         Pass RegistrableDomains vector to deleteWebsiteDataForOrigins,
499         captured based on the WebsiteData display name.
500
501         * NetworkProcess/NetworkProcess.h:
502         * NetworkProcess/NetworkProcess.messages.in:
503         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
504         (WKWebsiteDataStoreRemoveITPDataForDomain):
505         (WKWebsiteDataStoreDoesStatisticsDomainIDExistInDatabase):
506         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
507         * UIProcess/Network/NetworkProcessProxy.cpp:
508         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
509         (WebKit::NetworkProcessProxy::domainIDExistsInDatabase):
510         * UIProcess/Network/NetworkProcessProxy.h:
511         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
512         (WebKit::WebsiteDataStore::removeData):
513         (WebKit::WebsiteDataStore::domainIDExistsInDatabase):
514         * UIProcess/WebsiteData/WebsiteDataStore.h:
515
516 2020-04-24  David Kilzer  <ddkilzer@apple.com>
517
518         Use CocoaImage platform abstraction for NSImage/UIImage
519         <https://webkit.org/b/210974>
520
521         Reviewed by Darin Adler.
522
523         * Platform/cocoa/CocoaImage.h: Add.
524         - Define CocoaImage here for cross-platform use.  Don't use
525           OBJC_CLASS() here because this is an Objective-C header.
526         * UIProcess/API/Cocoa/WKWebView.mm:
527         (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
528         - Combine separate platform-specific methods into one method.
529         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
530         - Combine separate platform-specific instance variables into
531           one instance variable.
532         (-[_WKActivatedElementInfo image]):
533         - Combine separate methods into one platform-specific method.
534         * UIProcess/QuickLookThumbnailLoader.h:
535         - Move cross-platform definition to CocoaImge.h.
536         * UIProcess/QuickLookThumbnailLoader.mm:
537         - Drive-by fix of soft-linking header include order.
538         * WebKit.xcodeproj/project.pbxproj:
539         - Add CocoaImage.h to the project.
540         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
541         (-[WKWebProcessPlugInNodeHandle renderedImageWithOptions:]):
542         (-[WKWebProcessPlugInNodeHandle renderedImageWithOptions:width:]):
543         - Combine separate platform-specific methods into one method.
544
545 2020-04-24  David Kilzer  <ddkilzer@apple.com>
546
547         IPC::Decoder should use create() pattern
548         <https://webkit.org/b/210949>
549         <rdar://problem/62144409>
550
551         Reviewed by Geoffrey Garen.
552
553         * Platform/IPC/Decoder.cpp:
554         (IPC::Decoder::create): Add implementation. Returns nullptr if
555         Decoder constructor returns an invalid object.
556         (IPC::Decoder::Decoder): Mark invalid if m_buffer is not 64-bit
557         aligned.
558         (IPC::Decoder::unwrapForTesting): Switch to Decoder::create().
559         * Platform/IPC/Decoder.h:
560         (IPC::Decoder::create): Add declaration.
561         (IPC::Decoder::Decoder): Make explicit.  (Can't be made private
562         since we use std::unique_ptr<Decoder>.)
563         * Platform/IPC/cocoa/ConnectionCocoa.mm:
564         (IPC::createMessageDecoder): Switch to Decoder::create().
565
566 2020-04-24  Tim Horton  <timothy_horton@apple.com>
567
568         iPad: "Pocket City" interaction does not work with trackpad
569         https://bugs.webkit.org/show_bug.cgi?id=210985
570         <rdar://problem/62273077>
571
572         Reviewed by Wenson Hsieh.
573
574         * UIProcess/ios/WKContentViewInteraction.mm:
575         (-[WKContentView shouldUseMouseGestureRecognizer]):
576         Add another app to the list who fall back to touch event synthesis until rebuilt.
577
578 2020-04-24  Alex Christensen  <achristensen@webkit.org>
579
580         SPI clients using fastServerTrustEvaluationEnabled need SPI to inform them of modern TLS negotiation
581         https://bugs.webkit.org/show_bug.cgi?id=210533
582
583         Reviewed by Brady Eidson.
584
585         * NetworkProcess/NetworkDataTask.h:
586         (WebKit::NetworkDataTaskClient::didNegotiateModernTLS):
587         * NetworkProcess/NetworkLoad.cpp:
588         (WebKit::NetworkLoad::didNegotiateModernTLS):
589         * NetworkProcess/NetworkLoad.h:
590         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
591         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
592         (WebKit::NetworkDataTaskCocoa::didNegotiateModernTLS):
593         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
594         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
595         * UIProcess/API/APINavigationClient.h:
596         (API::NavigationClient::didNegotiateModernTLS):
597         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
598         * UIProcess/Cocoa/NavigationState.h:
599         * UIProcess/Cocoa/NavigationState.mm:
600         (WebKit::NavigationState::setNavigationDelegate):
601         (WebKit::NavigationState::NavigationClient::didNegotiateModernTLS):
602         * UIProcess/Network/NetworkProcessProxy.cpp:
603         (WebKit::NetworkProcessProxy::didNegotiateModernTLS):
604         * UIProcess/Network/NetworkProcessProxy.h:
605         * UIProcess/Network/NetworkProcessProxy.messages.in:
606         * UIProcess/WebPageProxy.cpp:
607         * UIProcess/WebPageProxy.h:
608
609 2020-04-24  Brian Burg  <bburg@apple.com>
610
611         Web Automation: timeout underneath Automation.evaluateJavaScriptFunction in Selenium test frame_switching_tests.py::testShouldNotBeAbleToDoAnythingTheFrameIsDeletedFromUnderUs[Safari]
612         https://bugs.webkit.org/show_bug.cgi?id=210162
613         <rdar://problem/60561009>
614
615         Reviewed by Devin Rousso.
616
617         When an iframe is detached from the DOM, it is no longer exposed as a browsing context
618         and it's not possible to Evaluate JavaScript or perform other commands with it. This
619         patch adds frame lifecycle monitoring so that pending script evaluations are cancelled
620         with FrameNotFound as soon as the iframe is detached from the DOM. This change also avoids
621         running more commands with the frame if it's detached from its DOMWindow and ready to be GC'd.
622
623         * Sources.txt:
624         * WebKit.xcodeproj/project.pbxproj:
625         * WebProcess/Automation/WebAutomationDOMWindowObserver.h: Added.
626         * WebProcess/Automation/WebAutomationDOMWindowObserver.cpp: Added.
627         (WebKit::WebAutomationDOMWindowObserver::WebAutomationDOMWindowObserver):
628         (WebKit::WebAutomationDOMWindowObserver::~WebAutomationDOMWindowObserver):
629         (WebKit::WebAutomationDOMWindowObserver::frame const):
630         (WebKit::WebAutomationDOMWindowObserver::willDestroyGlobalObjectInCachedFrame):
631         (WebKit::WebAutomationDOMWindowObserver::willDestroyGlobalObjectInFrame):
632         (WebKit::WebAutomationDOMWindowObserver::willDetachGlobalObjectFromFrame):
633         This class is a stripped-down copy of DOMWindowExtension, which is the only other
634         client of DOMWindow::Observer interface. When a frame is detached, destroyed, or
635         navigates (global object detached), then call the callback and unregister.
636
637         * WebProcess/Automation/WebAutomationSessionProxy.h:
638         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
639         (WebKit::WebAutomationSessionProxy::~WebAutomationSessionProxy):
640         (WebKit::WebAutomationSessionProxy::didClearWindowObjectForFrame):
641         (WebKit::WebAutomationSessionProxy::willDestroyGlobalObjectForFrame):
642         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
643         (WebKit::WebAutomationSessionProxy::ensureObserverForFrame): For non-main frames,
644         ensure we add a frame observer if we are about to evaluate JavaScript upon the frame.
645         This acts as a watchdog in case the frame becomes detached while waiting for pending
646         JS evaluations. When a frame is detached, the JS evaluation may or may not complete.
647
648         (WebKit::WebAutomationSessionProxy::selectOptionElement): Fix hilarious typo.
649
650         * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp:
651         * WebProcess/GPU/media/WebMediaStrategy.cpp:
652         (WebKit::WebMediaStrategy::clearNowPlayingInfo):
653         (WebKit::WebMediaStrategy::setNowPlayingInfo):
654         Adding a new file seems to have exposed a few missing includes and namespace qualifiers.
655         This is due to unified sources chunking.
656
657 2020-04-24  Alex Christensen  <achristensen@webkit.org>
658
659         Use sendWithAsyncReply for ShareSheet related messages
660         https://bugs.webkit.org/show_bug.cgi?id=210828
661         <rdar://problem/61800730>
662
663         Reviewed by Brent Fulgham.
664
665         * Platform/IPC/MessageSender.cpp:
666         We need to call addAsyncReplyHandler before sendMessage in case this is the first async message from this process.
667         Otherwise the reply from the first message is dropped sometimes.
668         * Shared/ShareSheetCallbackID.h: Removed.
669         * UIProcess/WebPageProxy.cpp:
670         (WebKit::WebPageProxy::showShareSheet):
671         * UIProcess/WebPageProxy.h:
672         * UIProcess/WebPageProxy.messages.in:
673         * WebKit.xcodeproj/project.pbxproj:
674         * WebProcess/WebPage/WebPage.cpp:
675         (WebKit::WebPage::showShareSheet):
676         (WebKit::nextShareSheetCallbackID): Deleted.
677         (WebKit::WebPage::didCompleteShareSheet): Deleted.
678         * WebProcess/WebPage/WebPage.h:
679         * WebProcess/WebPage/WebPage.messages.in:
680
681 2020-04-24  Youenn Fablet  <youenn@apple.com> and Luming Yin <luming_yin@apple.com>
682
683         Call STDynamicActivityAttributionPublisher in the WebProcess
684         https://bugs.webkit.org/show_bug.cgi?id=210772
685         <rdar://problem/62075201>
686
687         Reviewed by Geoffrey Garen.
688
689         Call STDynamicActivityAttributionPublisher in WebProcess to make use of the newly added plist entry.
690         Use of a sandbox extension to protect this call.
691
692         * Configurations/WebKit.xcconfig:
693         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
694         * Scripts/process-entitlements.sh:
695         * Shared/WebProcessCreationParameters.cpp:
696         (WebKit::WebProcessCreationParameters::encode const):
697         (WebKit::WebProcessCreationParameters::decode):
698         * Shared/WebProcessCreationParameters.h:
699         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
700         (WebKit::WebProcessPool::platformInitializeWebProcess):
701         * WebKit.xcodeproj/project.pbxproj:
702         * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-iOS.plist:
703         * WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/InfoPlist.strings: Added.
704         * WebProcess/cocoa/WebProcessCocoa.mm:
705         (WebKit::WebProcess::platformInitializeWebProcess):
706
707 2020-04-24  Simon Fraser  <simon.fraser@apple.com>
708
709         Move some post-renderingUpdate code into WebCore
710         https://bugs.webkit.org/show_bug.cgi?id=210952
711
712         Reviewed by Antti Koivisto.
713
714         Factor some code called by the various DrawingArea subclasses into Page::finalizeRenderingUpdate(),
715         with some flags to control behavior that differs between drawing areas.
716
717         ScrollingCoordinator::commitTreeStateIfNeeded() is a no-op for RemoteScrollingCoordinator so
718         it's fine to always call it.
719
720         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
721         (WebKit::RemoteLayerTreeDrawingArea::updateRendering):
722         * WebProcess/WebPage/WebPage.cpp:
723         (WebKit::WebPage::finalizeRenderingUpdate):
724         * WebProcess/WebPage/WebPage.h:
725         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
726         (WebKit::TiledCoreAnimationDrawingArea::updateRendering):
727
728 2020-04-24  Chris Dumez  <cdumez@apple.com>
729
730         [iOS] Stop using legacy BKSApplicationStateMonitor
731         https://bugs.webkit.org/show_bug.cgi?id=210945
732
733         Reviewed by Tim Horton.
734
735         Stop using legacy BKSApplicationStateMonitor and use RunningBoard API instead.
736
737         * Configurations/WebKit.xcconfig:
738         Stop linking against ApplicationServices when using iOS 14 SDK now that we are
739         fully transitioned to RunningBoard.
740
741         * Platform/spi/ios/RunningBoardServicesSPI.h:
742         * UIProcess/ApplicationStateTracker.h:
743         * UIProcess/ApplicationStateTracker.mm:
744         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
745         (WebKit::isApplicationForeground):
746         (WebKit::ApplicationStateTracker::~ApplicationStateTracker):
747         (WebKit::isBackgroundState): Deleted.
748         * UIProcess/ios/PageClientImplIOS.mm:
749         (WebKit::PageClientImpl::isApplicationVisible):
750
751 2020-04-23  Simon Fraser  <simon.fraser@apple.com>
752
753         Bounce displayWasRefreshed() via EventDispatcher
754         https://bugs.webkit.org/show_bug.cgi?id=208778
755
756         Reviewed by Antti Koivisto.
757
758         Allow the WebContent process to be notified of display refresh off the main thread, so other
759         threads like the scrolling thread can respond without being blocked. Achieve this
760         by having EventDispatcher receive the IPC message, then bounce it to the main thread.
761
762         * UIProcess/mac/DisplayLink.cpp:
763         (WebKit::DisplayLink::displayLinkCallback):
764         * WebProcess/WebPage/EventDispatcher.cpp:
765         (WebKit::EventDispatcher::displayWasRefreshed):
766         * WebProcess/WebPage/EventDispatcher.h:
767         * WebProcess/WebPage/EventDispatcher.messages.in:
768         * WebProcess/WebProcess.h:
769         * WebProcess/cocoa/WebProcessCocoa.mm:
770         (WebKit::WebProcess::displayWasRefreshed):
771
772 2020-04-23  David Kilzer  <ddkilzer@apple.com>
773
774         Clean up QuickLookThumbnailLoader
775         <https://webkit.org/b/210814>
776
777         Reviewed by Darin Adler.
778
779         The following items are cleaned up:
780         - Extract `using PlatformImage` into QuickLookThumbnailLoader.h,
781           rename to `CocoaImage` and use to get rid of duplicate
782           code.
783         - Change `id` to `instancetype` for -init methods.
784         - Add `atomic` keyword to @property definitions that were using
785           it as the default.  (Use of atomic properties is rare in
786           WebKit, so being explicit avoids a scenario where it looks
787           like `nonatomic` was left off by accident.)
788         - Change @property definitions to `readonly` that are never
789           written to outside of QuickLookThumbnailLoader.mm.
790         - Delete unused @property definitions.
791         - Change method declarations into read-only @property
792           definitions.
793         - Re-declare atomic read-only @property definitions in
794           QuickLookThumbnailLoader.h as read-write definitions in
795           QuickLookThumbnailLoader.mm if they are written to.
796
797         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
798         (WebKit::convertPlatformImageToBitmap):
799         * UIProcess/QuickLookThumbnailLoader.h:
800         - Rename qlThumbnailGenerationQueue @property to just `queue`.
801         - Remove `contentType` @property.  It is not used anywhere.
802           This also fixes a theoretical leak found by the clang static
803           analyzer.
804         - Remove `shouldWrite` @property.  It is only used within
805           QuickLookThumbnailLoader.mm.
806         - Change `identifier` and `thumbnail` to @property declarations.
807         * UIProcess/QuickLookThumbnailLoader.mm:
808         - Change WKQLThumbnailLoadOperation._identifier type from
809           NSMutableString to NSString.  There was no reason for it to
810           be mutable.
811         (-[WKQLThumbnailQueueManager init]):
812         (-[WKQLThumbnailQueueManager dealloc]):
813         - Release `_queue` to fix theoretical leak found by the clang
814           static analyzer.
815         (-[WKQLThumbnailLoadOperation initWithAttachment:identifier:]):
816         (-[WKQLThumbnailLoadOperation initWithURL:identifier:]):
817         (-[WKQLThumbnailLoadOperation start]):
818         - Rename `req` to `request`.
819         - Change separate #if macros to #if/#else since only one version
820           of this code can be used at a time.
821         (-[WKQLThumbnailLoadOperation thumbnail]):
822         - Use CocoaImage to use one copy of the method.
823
824 2020-04-23  Megan Gardner  <megan_gardner@apple.com>
825
826         Long pressing attachments in Notes does not activate Context Menu.
827         https://bugs.webkit.org/show_bug.cgi?id=210936
828         <rdar://problem/61171576>
829
830         Reviewed by Tim Horton.
831
832         Not having the ID available for notes makes their code to create the context
833         menu and its items fail. We should probably be passing this information on
834         for any element if we have it.
835
836         * WebProcess/WebPage/ios/WebPageIOS.mm:
837         (WebKit::selectionPositionInformation):
838
839 2020-04-23  Brent Fulgham  <bfulgham@apple.com>
840
841         Allow "kern.osversion" sysctl read
842         https://bugs.webkit.org/show_bug.cgi?id=210929
843         <rdar://problem/62256013>
844
845         Reviewed by Per Arne Vollan.
846
847         Libdispatch checks "kern.osversion" as part of the code path we use for launching our XPC services.
848         We already allow it for some services (Network Process), and should be doing so for our other
849         helper processes.
850
851         * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
852         * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
853         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
854         * WebProcess/com.apple.WebProcess.sb.in:
855
856 2020-04-23  Peng Liu  <peng.liu6@apple.com>
857
858         Remove the WebKit.plist for Feature Flags
859         https://bugs.webkit.org/show_bug.cgi?id=210534
860
861         Reviewed by Simon Fraser.
862
863         * FeatureFlags/WebKit.plist: Removed.
864         * WebKit.xcodeproj/project.pbxproj:
865
866 2020-04-23  Chris Dumez  <cdumez@apple.com>
867
868         [iOS] Crash on RunningBoard process assertion invalidation
869         https://bugs.webkit.org/show_bug.cgi?id=210873
870         <rdar://problem/62194917>
871
872         Unreviewed, nil out the observer only after we've removed it to fix crashes on the bots.
873
874         * UIProcess/ios/ProcessAssertionIOS.mm:
875         (WebKit::ProcessAssertion::~ProcessAssertion):
876
877 2020-04-23  Kate Cheney  <katherine_cheney@apple.com>
878
879         All ITP database tables should reference the ObservedDomains table on DELETE CASCADE
880         https://bugs.webkit.org/show_bug.cgi?id=210874
881         <rdar://problem/62209438>
882
883         Reviewed by Brady Eidson.
884
885         This makes it easier to delete an ITP entry from the entire database.
886         An entry shouldn't really exist outside of ObservedDomains anyways,
887         because that table holds all data about the domain, so this is a good
888         change to make regardless of the deletion use case.
889
890         (WebKit::needsNewCreateTableSchema):
891         Function to check for old CREATE TABLE queries.
892
893         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
894         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
895         (WebKit::ResourceLoadStatisticsDatabaseStore::enableForeignKeys):
896         Must enable foreign keys to use DELETE CASCADE.
897
898         (WebKit::ResourceLoadStatisticsDatabaseStore::isMigrationNecessary):
899         (WebKit::ResourceLoadStatisticsDatabaseStore::migrateDataToNewTablesIfNecessary):
900         Since this is a schema change that is executed when a table is created, we
901         need to check if the current schema is out of date. If so, we can
902         create new tables using the proper reference and migrate the data.
903
904         (WebKit::ResourceLoadStatisticsDatabaseStore::openAndDropOldDatabaseIfNecessary):
905         We only need to migrate the data if there were no issues with the
906         schema (otherwise the entire database will already have been created
907         with the correct CREATE TABLE queries).
908
909         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
910
911 2020-04-23  Don Olmstead  <don.olmstead@sony.com>
912
913         [CMake] CMAKE_BINARY_DIR should always be a PRIVATE include directory
914         https://bugs.webkit.org/show_bug.cgi?id=196717
915
916         Reviewed by Michael Catanzaro.
917
918         Include CMAKE_BINARY_DIR either directly or through WebKit_PRIVATE_INCLUDE_DIRECTORIES.
919
920         * PlatformGTK.cmake:
921         * PlatformWPE.cmake:
922
923 2020-04-23  Adrian Perez de Castro  <aperez@igalia.com>
924
925         Regression after r260359 ([GTK][WPE] lowWatermarkPages() in MemoryPressureMonitor.cpp only searches the "low" value inside the first "Node" section)
926         https://bugs.webkit.org/show_bug.cgi?id=210916
927
928         Reviewed by Carlos Alberto Lopez Perez.
929
930         Switch over to using a FileHandle type based on std::unique_ptr with a custom deleter and an
931         utility function for opening files. This makes easier to follow the logic inside the polling
932         loop for opening files and retrying when needed. This also fixes exiting the thread when the
933         systemMemoryUsedAsPercentage() function would return -1, to loop restart instead to keep
934         trying.
935
936         Thanks to Pablo Saavedra for his help in making this patch.
937
938         No new tests needed.
939
940         * UIProcess/linux/MemoryPressureMonitor.cpp:
941         (WebKit::FileHandleDeleter::operator()): Add deleter to use with std::unique_ptr<>.
942         (WebKit::tryOpeningForUnbufferedReading): Add utility function to open a file handle if
943         needed and configuring its buffering upon opening.
944         (WebKit::MemoryPressureMonitor::start): Use FileHandle to ensure that handles are always
945         closed properly, and fix logic retry opening files on failure.
946
947 2020-04-23  Nikos Mouchtaris  <nmouchtaris@apple.com>
948
949         Soft link QuickLookThumbnailing framework
950         https://bugs.webkit.org/show_bug.cgi?id=210894
951
952         Reviewed by Megan Gardner.
953
954         Soft link QuickLookThumbnailing framework to solve build error.
955
956         No new tests. Unnecessary.
957
958         * Configurations/WebKit.xcconfig:
959         * UIProcess/QuickLookThumbnailLoader.mm:
960         (-[WKQLThumbnailLoadOperation initWithURL:identifier:]):
961         (-[WKQLThumbnailLoadOperation start]):
962         * UIProcess/QuickLookThumbnailingSPI.h: Added.
963         * UIProcess/QuickLookThumbnailingSoftLink.h: Added.
964         * UIProcess/QuickLookThumbnailingSoftLink.mm: Added.
965         * WebKit.xcodeproj/project.pbxproj:
966
967 2020-04-23  Chris Dumez  <cdumez@apple.com>
968
969         [iOS] Port MediaPlayback process assertion to RunningBoard
970         https://bugs.webkit.org/show_bug.cgi?id=210212
971         <rdar://problem/61476951>
972
973         Reviewed by Geoff Garen.
974
975         Port MediaPlayback process assertion to RunningBoard instead of the legacy BKSProcessAssertion.
976         We can now #ifdef out the legacy BKSProcessAssertion on recent iOS builds.
977
978         * UIProcess/ProcessAssertion.h:
979         * UIProcess/ios/ProcessAssertionIOS.mm:
980         (WebKit::runningBoardNameForAssertionType):
981         (WebKit::ProcessAssertion::ProcessAssertion):
982         (WebKit::ProcessAssertion::~ProcessAssertion):
983
984 2020-04-23  John Frankish  <john.frankish@outlook.com>
985
986         [GTK] Crash in cairo_surface_mark_dirty_rectangle() in accelerated compositing mode under X11
987         https://bugs.webkit.org/show_bug.cgi?id=210636
988
989         Reviewed by Carlos Garcia Campos.
990
991         When cairo is configured to use xcb instead of xlib, it might use an image surface attached to the xlib one as
992         snapshot. In that case a flush is needed to detach that snapshot after we have drawn the surface in the
993         context.
994
995         * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
996         (WebKit::AcceleratedBackingStoreX11::paint): Call cairo_surface_flush() after drawing.
997
998 2020-04-23  Chris Dumez  <cdumez@apple.com>
999
1000         Unreviewed, reverting r260133.
1001
1002         We can use RunningBoard foreground assertion again now that
1003         <rdar://problem/61830390> has been fixed
1004
1005         Reverted changeset:
1006
1007         "REGRESSION (r259610): WebGL does not work at all on iOS (was:
1008         Google Maps tiles turn black after initial load)"
1009         https://trac.webkit.org/changeset/260133
1010
1011 2020-04-22  Ryan Haddad  <ryanhaddad@apple.com>
1012
1013         Unreviewed, reverting r260553.
1014
1015         Broke iOS and Catalina builds.
1016
1017         Reverted changeset:
1018
1019         "Soft link QuickLookThumbnailing framework"
1020         https://bugs.webkit.org/show_bug.cgi?id=210894
1021         https://trac.webkit.org/changeset/260553
1022
1023 2020-04-22  Darin Adler  <darin@apple.com>
1024
1025         [Cocoa] Build with UChar as char16_t even in builds that use Apple's internal SDK
1026         https://bugs.webkit.org/show_bug.cgi?id=210845
1027
1028         Reviewed by Anders Carlsson.
1029
1030         * Configurations/BaseTarget.xcconfig: Move ICU-configuring macros to Platform.h.
1031
1032         * Platform/unix/EnvironmentUtilities.h: Removed unneeded includes.
1033         This sidesteps a problem with Apple's internal InstallAPI tool that happens
1034         if StringView.h is included and Platform.h is not included first.
1035
1036         * UIProcess/API/cpp/WKRetainPtr.h: Removed unneeded includes, and used
1037         #pragma once.
1038
1039         * UIProcess/Cocoa/PreferenceObserver.h: Moved most things out of the header,
1040         since they don't need to be there.
1041         * UIProcess/Cocoa/PreferenceObserver.mm: Moved them here including using a
1042         class extension for the data member of WKPreferenceObserver.
1043
1044         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristicParameters.h:
1045         Removed unneeded WTF prefix.
1046
1047 2020-04-22  Nikos Mouchtaris  <nmouchtaris@apple.com>
1048
1049         Soft link QuickLookThumbnailing framework
1050         https://bugs.webkit.org/show_bug.cgi?id=210894
1051
1052         Reviewed by Tim Horton.
1053
1054         Soft link QuickLookThumbnailing framework to solve build error.
1055
1056         No new tests. Unnecessary.
1057
1058         * Configurations/WebKit.xcconfig:
1059         * UIProcess/QuickLookThumbnailLoader.mm:
1060         (-[WKQLThumbnailLoadOperation initWithURL:identifier:]):
1061         (-[WKQLThumbnailLoadOperation start]):
1062         * UIProcess/QuickLookThumbnailingSPI.h: Added.
1063         * UIProcess/QuickLookThumbnailingSoftLink.h: Added.
1064         * UIProcess/QuickLookThumbnailingSoftLink.mm: Added.
1065         * WebKit.xcodeproj/project.pbxproj:
1066
1067 2020-04-22  Daniel Bates  <dabates@apple.com>
1068
1069         Support toggling debug overlay for touch action region and editable element region independent from non-fast scrollable region
1070         https://bugs.webkit.org/show_bug.cgi?id=210774
1071
1072         Reviewed by Dean Jackson.
1073
1074         Expose two new enumerators to toggle touch action region and editable element region
1075         overlay painting.
1076
1077         * UIProcess/API/C/WKPreferencesRef.h:
1078         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1079
1080 2020-04-22  Chris Dumez  <cdumez@apple.com>
1081
1082         [iOS] Expose -_webView:willGoToBackForwardListItem:inPageCache:
1083         https://bugs.webkit.org/show_bug.cgi?id=210878
1084         <rdar://problem/62202276>
1085
1086         Reviewed by Alex Christensen.
1087
1088         Expose -_webView:willGoToBackForwardListItem:inPageCache: on iOS.
1089
1090         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1091         * UIProcess/Cocoa/NavigationState.h:
1092         * UIProcess/Cocoa/NavigationState.mm:
1093         (WebKit::NavigationState::setNavigationDelegate):
1094         (WebKit::NavigationState::NavigationClient::willGoToBackForwardListItem):
1095
1096 2020-04-22  Chris Dumez  <cdumez@apple.com>
1097
1098         [iOS] Crash on RunningBoard process assertion invalidation
1099         https://bugs.webkit.org/show_bug.cgi?id=210873
1100         <rdar://problem/62194917>
1101
1102         Reviewed by Darin Adler.
1103
1104         * UIProcess/ios/ProcessAssertionIOS.mm:
1105         (-[WKRBSAssertionDelegate assertion:didInvalidateWithError:]):
1106         Capture a weak pointer to self and make sure we only access the invalidation handler on
1107         the main thread if |self| is still alive.
1108
1109         (WebKit::ProcessAssertion::~ProcessAssertion):
1110         Null out the WKRBSAssertionDelegate's observer in the ProcessAssertion destructor, to
1111         make sure processAssertionWasInvalidated() cannot get called after the ProcessAssertion
1112         has been destroyed.
1113
1114 2020-04-22  David Kilzer  <ddkilzer@apple.com>
1115
1116         IPC::decodeSharedBuffer() should check the return value of SharedMemory::map()
1117         <https://webkit.org/b/210844>
1118         <rdar://problem/60773120>
1119
1120         Reviewed by Geoffrey Garen.
1121
1122         * Shared/WebCoreArgumentCoders.cpp:
1123         (IPC::decodeSharedBuffer):
1124         - Add nullptr check and early return.
1125
1126 2020-04-22  Brent Fulgham  <bfulgham@apple.com>
1127
1128         Switch from debug ASSERT to RELEASE_ASSERT in toNPJSObject
1129         https://bugs.webkit.org/show_bug.cgi?id=210823
1130         <rdar://problem/61774056>
1131
1132         Reviewed by David Kilzer.
1133
1134         * WebProcess/Plugins/Netscape/NPJSObject.h:
1135         (WebKit::NPJSObject::toNPJSObject):
1136
1137 2020-04-22  Youenn Fablet  <youenn@apple.com>
1138
1139         Simplify SWServerWorker::whenActivated logic
1140         https://bugs.webkit.org/show_bug.cgi?id=210795
1141
1142         Reviewed by Alex Christensen.
1143
1144         Improve logging and update code according whenActivated implementation.
1145         Add an early check for timeouts so that we return earlier in that case.
1146
1147         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1148         (WebKit::WebSWServerConnection::createFetchTask):
1149         (WebKit::WebSWServerConnection::startFetch):
1150
1151 2020-04-21  Ryan Haddad  <ryanhaddad@apple.com>
1152
1153         Unreviewed, reverting r260478.
1154
1155         Caused TestWebKitAPI.WKAttachmentTests crashes on Catalina
1156
1157         Reverted changeset:
1158
1159         "Clean up QuickLookThumbnailLoader"
1160         https://bugs.webkit.org/show_bug.cgi?id=210814
1161         https://trac.webkit.org/changeset/260478
1162
1163 2020-04-21  Ryan Haddad  <ryanhaddad@apple.com>
1164
1165         Unreviewed, reverting r260410.
1166
1167         Caused crashes in Safari
1168
1169         Reverted changeset:
1170
1171         "SPI clients using fastServerTrustEvaluationEnabled need SPI
1172         to inform them of modern TLS negotiation"
1173         https://bugs.webkit.org/show_bug.cgi?id=210533
1174         https://trac.webkit.org/changeset/260410
1175
1176 2020-04-21  Ryan Haddad  <ryanhaddad@apple.com>
1177
1178         Unreviewed, reverting r260475.
1179
1180         New assert caused layout tests to exit early on iOS and macOS
1181
1182         Reverted changeset:
1183
1184         "REGRESSION(r260410) Frequent Network process crashes"
1185         https://bugs.webkit.org/show_bug.cgi?id=210825
1186         https://trac.webkit.org/changeset/260475
1187
1188 2020-04-21  David Kilzer  <ddkilzer@apple.com>
1189
1190         IPC::Encoder::reserve() can be private
1191         <https://webkit.org/b/210833>
1192         <rdar://problem/62124193>
1193
1194         Reviewed by Darin Adler.
1195
1196         * Platform/IPC/Encoder.h:
1197         (IPC::Encoder::reserve):
1198         - Move from public to private.
1199
1200 2020-04-21  Stephan Szabo  <stephan.szabo@sony.com>
1201
1202         [PlayStation] Fix GPU Process build for VIDEO_PRESENTATION_MODE changes
1203         https://bugs.webkit.org/show_bug.cgi?id=210836
1204
1205         Reviewed by Darin Adler.
1206
1207         Build fix, no new tests.
1208
1209         * GPUProcess/media/playstation/RemoteMediaPlayerProxyPlayStation.cpp:
1210
1211 2020-04-21  Peng Liu  <peng.liu6@apple.com>
1212
1213         Fix MACCATALYST build failures
1214         https://bugs.webkit.org/show_bug.cgi?id=210815
1215
1216         Reviewed by Tim Horton.
1217
1218         * Configurations/FeatureDefines.xcconfig:
1219         * UIProcess/API/ios/WKWebViewIOS.mm:
1220         (-[WKWebView _isShowingVideoPictureInPicture]):
1221         (-[WKWebView _mayAutomaticallyShowVideoPictureInPicture]):
1222         * UIProcess/ios/WebPageProxyIOS.mm:
1223         (WebKit::WebPageProxy::applicationDidBecomeActive):
1224
1225 2020-04-19  Darin Adler  <darin@apple.com>
1226
1227         [Cocoa] Use createNSArray in many more places that build NSArray objects from C++ collections
1228         https://bugs.webkit.org/show_bug.cgi?id=210702
1229
1230         Reviewed by Alex Christensen.
1231
1232         * Platform/cocoa/PaymentAuthorizationPresenter.mm:
1233         (WebKit::toNSErrors): Use createNSArray and return a RetainPtr to cut down
1234         on autorelease.
1235         (WebKit::toPKShippingMethods): Ditto.
1236         (WebKit::PaymentAuthorizationPresenter::completePaymentSession): Updated for RetainPtr.
1237         (WebKit::PaymentAuthorizationPresenter::completeShippingContactSelection): Ditto.
1238
1239         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1240         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Use createNSArray.
1241         Also removed code to support platforms without -setThumbnailURLs: since we don't
1242         have those any more.
1243
1244         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
1245         (WebKit::RemoteLayerTreePropertyApplier::updateChildren): Use createNSArray.
1246         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
1247         (coreCookiesToNSCookies); Ditto.
1248         * UIProcess/API/Cocoa/WKProcessPool.mm:
1249         (+[WKProcessPool _allProcessPoolsForTesting]): Ditto.
1250
1251         * UIProcess/API/Cocoa/WKWebView.mm:
1252         (-[WKWebView _startTextManipulationsWithConfiguration:completion:]): Cut down on
1253         repeated code by adding a lambda to create a _WKTextManipulationItem and by using
1254         createNSArray.
1255         (wkTextManipulationErrors): Use createNSArray. Also tighten up the code that maps
1256         WebCore::TextManipulationController::ManipulationFailureType to the
1257         _WKTextManipulationItemError code.
1258
1259         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
1260         (-[WKWebpagePreferences _customHeaderFields]): Use createNSArray.
1261         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
1262         (-[WKWebsiteDataRecord _originsStrings]): Ditto.
1263         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1264         (-[WKWebsiteDataStore _getResourceLoadStatisticsDataSummary:]): Ditto.
1265         * UIProcess/API/Cocoa/_WKDownload.mm:
1266         (-[_WKDownload redirectChain]): Ditto.
1267         * UIProcess/API/Cocoa/_WKFrameTreeNode.mm:
1268         (-[_WKFrameTreeNode childFrames]): Ditto.
1269         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1270         (-[_WKProcessPoolConfiguration additionalReadAccessAllowedURLs]): Ditto.
1271         * UIProcess/API/Cocoa/_WKResourceLoadStatisticsThirdParty.mm:
1272         (-[_WKResourceLoadStatisticsThirdParty underFirstParties]): Ditto.
1273         * UIProcess/API/ios/WKWebViewIOS.mm:
1274         (-[WKWebView _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:]): Ditto.
1275         * UIProcess/Cocoa/NavigationState.mm:
1276         (WebKit::NavigationState::NavigationClient::didChangeBackForwardList): Ditto.
1277         * UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.mm:
1278         (WebKit::RemoteLayerTreeScrollingPerformanceData::data): Ditto.
1279         * UIProcess/ios/DragDropInteractionState.mm:
1280         (WebKit::createTargetedDragPreview): Ditto.
1281
1282         * UIProcess/ios/WKContentViewInteraction.mm:
1283         (-[WKContentView _updateTapHighlight]): Removed uneeded RetainPtr local variable.
1284         Use createNSArray. Refactored to make the "all rectilinear" case more parallel
1285         to the general case.
1286         (-[WKContentView webSelectionRectsForSelectionRects:]): Use createNSArray.
1287         (wkTextSelectionRects): Ditto.
1288         (createTargetedPreview): Ditto.
1289         (-[WKContentView _presentationRectsForPreviewItemController:]): Ditto.
1290
1291         * UIProcess/mac/WKTextFinderClient.mm:
1292         (-[WKTextFinderClient didFindStringMatchesWithRects:didWrapAround:]): Use createNSArray.
1293
1294         * UIProcess/mac/WKTextInputWindowController.mm:
1295         (-[WKTextInputView validAttributesForMarkedText]): Use +[NSArray arrayByAddingObject:].
1296
1297         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
1298         (collectIcons): Use createNSArray.
1299
1300         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1301         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Marked class here
1302         as final. Cut down on local variables a bit. Use createNSArray.
1303
1304         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
1305         (WebKit::addAnimationToLayer): Removed unnecessary use of RetainPtr. Use createNSArray.
1306
1307         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1308         (WebKit::WebBackForwardListProxy::WebBackForwardListProxy): Addd a FIXME about
1309         a problem I noticed, unrelated to the rest of the changes.
1310
1311         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1312         (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]): Use createNSArray.
1313         * WebProcess/cocoa/WebProcessCocoa.mm:
1314         (WebKit::WebProcess::registerWithStateDumper): Ditto.
1315         (WebKit::activePagesOrigins): Ditto.
1316
1317 2020-04-21  David Kilzer  <ddkilzer@apple.com>
1318
1319         Clean up QuickLookThumbnailLoader
1320         <https://webkit.org/b/210814>
1321
1322         Reviewed by Darin Adler.
1323
1324         The following items are cleaned up:
1325         - Extract `using PlatformImage` into QuickLookThumbnailLoader.h,
1326           rename to `CocoaImage` and use to get rid of duplicate
1327           code.
1328         - Change `id` to `instancetype` for -init methods.
1329         - Add `atomic` keyword to @property definitions that were using
1330           it as the default.  (Use of atomic properties is rare in
1331           WebKit, so being explicit avoids a scenario where it looks
1332           like `nonatomic` was left off by accident.)
1333         - Change @property definitions to `readonly` that are never
1334           written to outside of QuickLookThumbnailLoader.mm.
1335         - Delete unused @property definitions.
1336         - Change method declarations into read-only @property
1337           definitions.
1338         - Re-declare atomic read-only @property definitions in
1339           QuickLookThumbnailLoader.h as read-write definitions in
1340           QuickLookThumbnailLoader.mm if they are written to.
1341
1342         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1343         (WebKit::convertPlatformImageToBitmap):
1344         * UIProcess/QuickLookThumbnailLoader.h:
1345         - Rename qlThumbnailGenerationQueue @property to just `queue`.
1346         - Remove `contentType` @property.  It is not used anywhere.
1347           This also fixes a theoretical leak found by the clang static
1348           analyzer.
1349         - Remove `shouldWrite` @property.  It is only used within
1350           QuickLookThumbnailLoader.mm.
1351         - Change `identifier` and `thumbnail` to @property declarations.
1352         * UIProcess/QuickLookThumbnailLoader.mm:
1353         - Change WKQLThumbnailLoadOperation._identifier type from
1354           NSMutableString to NSString.  There was no reason for it to
1355           be mutable.
1356         (-[WKQLThumbnailQueueManager init]):
1357         (-[WKQLThumbnailQueueManager dealloc]):
1358         - Release `_queue` to fix theoretical leak found by the clang
1359           static analyzer.
1360         (-[WKQLThumbnailLoadOperation initWithAttachment:identifier:]):
1361         (-[WKQLThumbnailLoadOperation initWithURL:identifier:]):
1362         (-[WKQLThumbnailLoadOperation start]):
1363         - Rename `req` to `request` and use RetainPtr<>.
1364         - Change separate #if macros to #if/#else since only one version
1365           of this code can be used at a time.
1366         (-[WKQLThumbnailLoadOperation thumbnail]):
1367         - Use CocoaImage to use one copy of the method.
1368
1369 2020-04-21  David Kilzer  <ddkilzer@apple.com>
1370
1371         Fix extra/missing #undef statements
1372         <https://webkit.org/b/210818>
1373         <rdar://problem/61973329>
1374
1375         Reviewed by Chris Dumez.
1376
1377         * UIProcess/Network/NetworkProcessProxy.cpp:
1378         - Remove #undef MESSAGE_CHECK_URL.  It is no longer used.
1379         * UIProcess/WebPageProxy.cpp:
1380         - Add missing #undef MESSAGE_CHECK_COMPLETION.
1381         - Sort #undef in reverse order of #define.
1382         * UIProcess/mac/WebPageProxyMac.mm:
1383         - Add missing #undef MESSAGE_CHECK_WITH_RETURN_VALUE.
1384         - Sort #undef in reverse order of #define.
1385
1386 2020-04-21  Chris Dumez  <cdumez@apple.com>
1387
1388         REGRESSION(r260410) Frequent Network process crashes
1389         https://bugs.webkit.org/show_bug.cgi?id=210825
1390
1391         Reviewed by Alex Christensen.
1392
1393         The webPageProxyID in the NetworkProcessProxy::DidNegotiateModernTLS() IPC was invalid because
1394         NetworkProcessProxy::preconnectTo() was failing to initialize NetworkLoadParameters::webPageProxyID.
1395         This patch addresses the issue.
1396
1397         No new tests, added new assertion that would be tripped by existing tests.
1398
1399         * NetworkProcess/NetworkLoad.cpp:
1400         (WebKit::NetworkLoad::NetworkLoad):
1401         * NetworkProcess/NetworkProcess.cpp:
1402         (WebKit::NetworkProcess::preconnectTo):
1403         * NetworkProcess/NetworkProcess.h:
1404         * NetworkProcess/NetworkProcess.messages.in:
1405         * UIProcess/Network/NetworkProcessProxy.cpp:
1406         (WebKit::NetworkProcessProxy::preconnectTo):
1407         * UIProcess/Network/NetworkProcessProxy.h:
1408         * UIProcess/WebPageProxy.cpp:
1409         (WebKit::WebPageProxy::preconnectTo):
1410
1411 2020-04-21  Jer Noble  <jer.noble@apple.com>
1412
1413         PiP buttons shows up in element fullscreen when PiP is disabled in WKWebViewConfiguration
1414         https://bugs.webkit.org/show_bug.cgi?id=210813
1415
1416         Reviewed by Eric Carlson.
1417
1418         Not currently testable; entering fullscreen never completes in the iOS TestWebKitAPI app
1419         because that process is not a UI Application.
1420
1421         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1422         (-[WKFullScreenViewController videoControlsManagerDidChange]):
1423
1424 2020-04-21  Brent Fulgham  <bfulgham@apple.com>
1425
1426         [Cocoa] Don't bother compiling UpdateInfo since it's not used
1427         https://bugs.webkit.org/show_bug.cgi?id=210819
1428         <rdar://problem/61774766>
1429
1430         Reviewed by Darin Adler.
1431
1432         Since we don't use the UpdateInfo class in Cocoa builds, let's not
1433         bother building it.
1434
1435         * Shared/UpdateInfo.cpp:
1436         * Shared/UpdateInfo.h:
1437         * UIProcess/DrawingAreaProxy.h:
1438
1439 2020-04-21  Timothy Horton  <timothy_horton@apple.com>
1440
1441         One more build fix after r260407
1442
1443         * Configurations/WebKit.xcconfig:
1444
1445 2020-04-21  Chris Dumez  <cdumez@apple.com>
1446
1447         [iOS] Provide better names for ProcessThrottler process assertions
1448         https://bugs.webkit.org/show_bug.cgi?id=210808
1449
1450         Reviewed by Geoffrey Garen.
1451
1452         Provide better names for ProcessThrottler process assertions, to facilitate debugging.
1453
1454         * UIProcess/GPU/GPUProcessProxy.h:
1455         * UIProcess/Network/NetworkProcessProxy.h:
1456         * UIProcess/ProcessAssertion.cpp:
1457         (WebKit::ProcessAssertion::ProcessAssertion):
1458         * UIProcess/ProcessAssertion.h:
1459         * UIProcess/ProcessThrottler.cpp:
1460         (WebKit::ProcessThrottler::assertionName const):
1461         (WebKit::ProcessThrottler::setAssertionType):
1462         * UIProcess/ProcessThrottler.h:
1463         * UIProcess/ProcessThrottlerClient.h:
1464         * UIProcess/WebProcessProxy.h:
1465         * UIProcess/ios/ProcessAssertionIOS.mm:
1466         (WebKit::ProcessAssertion::ProcessAssertion):
1467         (WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
1468
1469 2020-04-21  Daniel Bates  <dabates@apple.com>
1470
1471         [iOS] -_didFinishTextInteractionInTextInputContext should only zoom to reveal focused element if it changed
1472         https://bugs.webkit.org/show_bug.cgi?id=210697
1473         <rdar://problem/60997530>
1474
1475         Reviewed by Wenson Hsieh. 
1476
1477         Add a new state variable to use to track whether -_focusTextInputContext invoked during a
1478         text interaction actually focused an element. Then in -_didFinishTextInteractionInTextInputContext
1479         condition marking the page to reveal the focused element on this state.
1480
1481         * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
1482         * UIProcess/API/ios/WKWebViewTestingIOS.mm:
1483         (-[WKWebView _willBeginTextInteractionInTextInputContext:]): Turn around and call the same
1484         function on the content view.
1485         (-[WKWebView _didFinishTextInteractionInTextInputContext:]): Ditto.
1486         * UIProcess/ios/WKContentViewInteraction.h:
1487         * UIProcess/ios/WKContentViewInteraction.mm:
1488         (-[WKContentView cleanUpInteraction]): Reset state.
1489         (-[WKContentView _didCommitLoadForMainFrame]): Ditto.
1490         (-[WKContentView _focusTextInputContext:placeCaretAt:completionHandler:]): Update state to
1491         indicate whether the focusd element did change or not. I use bitwise ORing instead of strict
1492         assignment to update it because this function can be called multiple times by an internal
1493         Apple client during a text interaction (e.g. <rdar://problem/59430806>). I thought about
1494         making this a FIXME, but this function is otherwise capable of handling multiple invocations
1495         so I didn't.
1496         (-[WKContentView _willBeginTextInteractionInTextInputContext:]): Reset added state.
1497         (-[WKContentView _didFinishTextInteractionInTextInputContext:]): Check if state was set to
1498         indicate that a focus change happened. If so, do what we do now + reset state. Otherwise,
1499         do everything we do now except for marking the page as needing to reveal the focused element
1500         on the next editor state update.
1501         * WebProcess/WebPage/ios/WebPageIOS.mm:
1502         (WebKit::WebPage::focusTextInputContextAndPlaceCaret): Check that the target is focusable
1503         before calling FocusController::setFocusedElement() because it ultimately calls Document::setFocusedElement()
1504         that can return true for a non-focusable element. I added a comment in Document.h to explain
1505         this subtlety. I also decided not to check the return value of FocusController::setFocusedElement().
1506         Instead I am checking the more important condition that the focused element is the target
1507         element. Passing true to visiblePositionInFocusedNodeForPoint() will ultimately assert this
1508         to be true. Note that setFocusedElement() may not have done anything as m_focusedElement
1509         could have already been equal to the target element. This is OK and I still update the
1510         caret position.
1511
1512 2020-04-21  Timothy Hatcher  <timothy@apple.com>
1513
1514         Reset m_userScriptsNotified when web process crashes.
1515         https://bugs.webkit.org/show_bug.cgi?id=210807
1516
1517         Reviewed by Alex Christensen.
1518
1519         * UIProcess/WebPageProxy.cpp:
1520         (WebPageProxy::resetStateAfterProcessExited): Set m_userScriptsNotified to false.
1521
1522 2020-04-21  Timothy Horton  <timothy_horton@apple.com>
1523
1524         Fix the build
1525
1526         * Configurations/WebKit.xcconfig:
1527
1528 2020-04-21  David Kilzer  <ddkilzer@apple.com>
1529
1530         [IPC hardening] ShareableResource::create() should validate its parameters
1531         <https://webkit.org/b/210779>
1532         <rdar://problem/60887693>
1533
1534         Reviewed by Chris Dumez.
1535
1536         * NetworkProcess/cache/NetworkCache.cpp:
1537         (WebKit::NetworkCache::Cache::store):
1538         * NetworkProcess/cache/NetworkCacheEntry.cpp:
1539         (WebKit::NetworkCache::Entry::initializeShareableResourceHandleFromStorageRecord const):
1540         * WebProcess/WebPage/ios/WebPageIOS.mm:
1541         (WebKit::WebPage::didFinishLoadForQuickLookDocumentInMainFrame):
1542         - Handle nullptr returned from ShareableResource::create().
1543
1544         * Shared/ShareableResource.cpp:
1545         (WebKit::ShareableResource::create):
1546         - Change to return RefPtr<>.
1547         - Validate parameters before calling constructor.  Return
1548           nullptr on failure.
1549         (WebKit::ShareableResource::ShareableResource):
1550         - Remove assert and comment since checks are now done in
1551           ShareableResource::create().
1552         * Shared/ShareableResource.h:
1553         (WebKit::ShareableResource::create):
1554         - Change to return RefPtr<>.
1555
1556 2020-04-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1557
1558         [Cocoa] Tighten up some more IPC message checks in WebPasteboardProxy
1559         https://bugs.webkit.org/show_bug.cgi?id=210780
1560         <rdar://problem/62088479>
1561
1562         Reviewed by Alex Christensen.
1563
1564         Adjust some existing IPC message checks in WebPasteboardProxy, and also introduces some new ones. See below for
1565         more details.
1566
1567         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
1568         (WebKit::WebPasteboardProxy::didModifyContentsOfPasteboard):
1569
1570         Move the `pasteboardName` check here out of `didModifyContentsOfPasteboard`, and into each call site, such that
1571         we bail and kill the web process before invoking `didModifyContentsOfPasteboard` in the case where the name is
1572         empty.
1573
1574         (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType):
1575         (WebKit::WebPasteboardProxy::getPasteboardStringForType):
1576         (WebKit::WebPasteboardProxy::getPasteboardStringsForType):
1577         (WebKit::WebPasteboardProxy::getPasteboardBufferForType):
1578         (WebKit::WebPasteboardProxy::addPasteboardTypes):
1579         (WebKit::WebPasteboardProxy::setPasteboardTypes):
1580         (WebKit::WebPasteboardProxy::setPasteboardURL):
1581         (WebKit::WebPasteboardProxy::setPasteboardColor):
1582         (WebKit::WebPasteboardProxy::setPasteboardStringForType):
1583
1584         Add message checks for empty pasteboard types.
1585
1586         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
1587         (WebKit::WebPasteboardProxy::writeCustomData):
1588         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
1589         (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
1590         (WebKit::WebPasteboardProxy::writeURLToPasteboard):
1591         (WebKit::WebPasteboardProxy::writeWebContentToPasteboard):
1592         (WebKit::WebPasteboardProxy::writeImageToPasteboard):
1593         (WebKit::WebPasteboardProxy::writeStringToPasteboard):
1594
1595         Add a message check for empty pasteboard types, but only when the string is also empty; this is because iOS
1596         clears pasteboard data by writing an empty pasteboard string and type.
1597
1598 2020-04-21  Adrian Perez de Castro  <aperez@igalia.com>
1599
1600         [GTK][CMake] Make gtk-unix-print a component of FindGTK.cmake
1601         https://bugs.webkit.org/show_bug.cgi?id=210792
1602
1603         Reviewed by Carlos Garcia Campos.
1604
1605         No new tests needed.
1606
1607         * PlatformGTK.cmake: Use the GTK::UnixPrint imported target.
1608
1609 2020-04-21  Philippe Normand  <pnormand@igalia.com>
1610
1611         [CMake] gst-build-backed build fails
1612         https://bugs.webkit.org/show_bug.cgi?id=210742
1613
1614         Reviewed by Xabier Rodriguez-Calvar.
1615
1616         * PlatformWPE.cmake:
1617
1618 2020-04-21  Adrian Perez de Castro  <aperez@igalia.com>
1619
1620         Non-unified build fixes late February 2020 edition
1621         https://bugs.webkit.org/show_bug.cgi?id=210767
1622
1623         Unreviewed build fix.
1624
1625         * NetworkProcess/NetworkResourceLoadMap.h: Add missing wtf/Function.h header.
1626
1627 2020-04-20  Ross Kirsling  <ross.kirsling@sony.com>
1628
1629         Classes marked final should not use protected access specifier
1630         https://bugs.webkit.org/show_bug.cgi?id=210775
1631
1632         Reviewed by Daniel Bates.
1633
1634         * Shared/API/APIDictionary.h:
1635         * WebProcess/GPU/media/TextTrackPrivateRemote.h:
1636         * WebProcess/Plugins/Netscape/JSNPMethod.h:
1637         * WebProcess/Plugins/Netscape/JSNPObject.h:
1638
1639 2020-04-20  Peng Liu  <peng.liu6@apple.com>
1640
1641         Fix build failures when video fullscreen and picture-in-picture is disabled
1642         https://bugs.webkit.org/show_bug.cgi?id=210777
1643
1644         Reviewed by Eric Carlson.
1645
1646         Wrap video fullscreen and picture-in-picture related code with "#if ENABLE(VIDEO_PRESENTATION_MODE)".
1647
1648         * Configurations/FeatureDefines.xcconfig:
1649         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
1650         (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenGravity):
1651         (WebKit::RemoteMediaPlayerProxy::updateVideoFullscreenInlineImage):
1652         (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenMode):
1653         (WebKit::RemoteMediaPlayerProxy::videoFullscreenStandbyChanged):
1654         (WebKit::RemoteMediaPlayerProxy::setBufferingPolicy):
1655         * GPUProcess/media/RemoteMediaPlayerProxy.h:
1656         * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
1657         * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm:
1658         (WebKit::RemoteMediaPlayerProxy::prepareForPlayback):
1659         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
1660         (WebKit::MediaPlayerPrivateRemote::prepareForPlayback):
1661
1662 2020-04-20  Alex Christensen  <achristensen@webkit.org>
1663
1664         SPI clients using fastServerTrustEvaluationEnabled need SPI to inform them of modern TLS negotiation
1665         https://bugs.webkit.org/show_bug.cgi?id=210533
1666
1667         Reviewed by Brady Eidson.
1668
1669         * NetworkProcess/NetworkDataTask.h:
1670         (WebKit::NetworkDataTaskClient::didNegotiateModernTLS):
1671         * NetworkProcess/NetworkLoad.cpp:
1672         (WebKit::NetworkLoad::didNegotiateModernTLS):
1673         * NetworkProcess/NetworkLoad.h:
1674         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1675         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1676         (WebKit::NetworkDataTaskCocoa::didNegotiateModernTLS):
1677         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1678         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
1679         * UIProcess/API/APINavigationClient.h:
1680         (API::NavigationClient::didNegotiateModernTLS):
1681         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1682         * UIProcess/Cocoa/NavigationState.h:
1683         * UIProcess/Cocoa/NavigationState.mm:
1684         (WebKit::NavigationState::setNavigationDelegate):
1685         (WebKit::NavigationState::NavigationClient::didNegotiateModernTLS):
1686         * UIProcess/Network/NetworkProcessProxy.cpp:
1687         (WebKit::NetworkProcessProxy::didNegotiateModernTLS):
1688         * UIProcess/Network/NetworkProcessProxy.h:
1689         * UIProcess/Network/NetworkProcessProxy.messages.in:
1690         * UIProcess/WebPageProxy.cpp:
1691         * UIProcess/WebPageProxy.h:
1692
1693 2020-04-20  Kate Cheney  <katherine_cheney@apple.com>
1694
1695         App-bound domain behavior should abide by the limitsNavigationsToAppBoundDomains argument in WKWebView configuration
1696         https://bugs.webkit.org/show_bug.cgi?id=210769
1697         <rdar://problem/62065241>
1698
1699         Reviewed by Brent Fulgham.
1700
1701         Changes app-bound domain behavior to be triggered by the value of
1702         limitsNavigationsToAppBoundDomains, a WebView configuration flag.
1703         If the WebView has this parameter set and is currently navigating to
1704         an app bound domain, then app-bound privileges will be granted.
1705
1706         * UIProcess/WebPageProxy.cpp:
1707         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainAndCheckIfPermitted):
1708         Update this function to return a boolean to indicate whether the
1709         navigation should fail. A failure should occur if a WebView has set
1710         the limitsNavigationsToAppBoundDomains flag and attempts to navigate
1711         away from an app-bound domain.
1712
1713         If the limitsNavigationsToAppBoundDomains value has not been set to
1714         true, maintain non-app bound behavior regardless of whether the domain
1715         is app-bound or not.
1716
1717         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1718         Check the result of setIsNavigatingToAppBoundDomainAndCheckIfPermitted and fail the
1719         navigation if needed, with both RELEASE logging and an appropriate
1720         error message.
1721
1722         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain): Deleted.
1723         * UIProcess/WebPageProxy.h:
1724         Renamed for clarity.
1725
1726 2020-04-20  Nikos Mouchtaris  <nmouchtaris@apple.com>
1727
1728         WK2 Quicklook for attachments
1729         https://bugs.webkit.org/show_bug.cgi?id=208891
1730
1731         Reviewed by Darin Adler.
1732
1733         Allow attachment elements to render QuickLook thumbnail generated
1734         from contents of the file as its icon, rather than the default
1735         icons associated with each mime type.
1736
1737         * Configurations/WebKit.xcconfig:
1738         Link QuickLook thumbnailing framework.
1739         * UIProcess/API/APIAttachment.h:
1740         * UIProcess/API/Cocoa/WKWebView.mm:
1741         (-[WKWebView _insertAttachmentWithFileWrapper:contentType:completion:]):
1742         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1743         Create thumbnail request and add to queue.
1744         (WebKit::convertNSImageToBitmap):
1745         (WebKit::convertUIImageToBitmap):
1746         (WebKit::WebPageProxy::getQLThumbnailForGenerationRequestion):
1747         (WebKit::WebPageProxy::getQLThumbnailForFileWrapper):
1748         (WebKit::WebPageProxy::getQLThumbnailForAttachment):
1749         * UIProcess/QLThumbnailLoad.h: Added.
1750         * UIProcess/QLThumbnailLoad.mm: Added.
1751         Add code to request thumbnail for file data.
1752         (-[WKQLThumbnailQueueManager init]):
1753         (+[WKQLThumbnailQueueManager sharedInstance]):
1754         (-[WKQLThumbnailLoadOperation initWithAttachment:identifier:]):
1755         (-[WKQLThumbnailLoadOperation initWithURL:identifier:]):
1756         (-[WKQLThumbnailLoadOperation start]):
1757         (-[WKQLThumbnailLoadOperation isAsynchronous]):
1758         (-[WKQLThumbnailLoadOperation isExecuting]):
1759         (-[WKQLThumbnailLoadOperation setExecuting:]):
1760         (-[WKQLThumbnailLoadOperation isFinished]):
1761         (-[WKQLThumbnailLoadOperation setFinished:]):
1762         * UIProcess/WebPageProxy.cpp:
1763         * UIProcess/WebPageProxy.h:
1764         * WebKit.xcodeproj/project.pbxproj:
1765         * WebProcess/WebPage/WebPage.cpp:
1766         (WebKit::WebPage::updateAttachmentIcon):
1767         Set thumbnail of attachment element
1768         * WebProcess/WebPage/WebPage.h:
1769         * WebProcess/WebPage/WebPage.messages.in:
1770         Thumbnail request message.
1771
1772 2020-04-20  Kate Cheney  <katherine_cheney@apple.com>
1773
1774         Unreviewed macCatalyst build fix.
1775
1776         * UIProcess/WebPageProxy.cpp:
1777         (WebKit::WebPageProxy::disableServiceWorkerEntitlementInNetworkProcess):
1778         (WebKit::WebPageProxy::clearServiceWorkerEntitlementOverride):
1779
1780 2020-04-20  Simon Fraser  <simon.fraser@apple.com>
1781
1782         Scrolling with background-attachment: fixed needs to trigger repaints
1783         https://bugs.webkit.org/show_bug.cgi?id=193893
1784         <rdar://problem/47587017>
1785
1786         Reviewed by Dean Jackson.
1787
1788         When scrolling an overflow scroll which has "background-atttachment:fixed" in the content,
1789         the node will have non-empty synchronous scrolling reasons. In this case we need to
1790         send the scroll to the main thread, and trigger a repaint on scroll.
1791
1792         If handling the wheel event on the scrolling thread determines that the scroll must be sent
1793         to the main thread, EventDispatcher::wheelEvent() does so in the callback function.
1794
1795         To trigger the repaint, RenderLayer::scrollTo() asks the composited layers backing whether
1796         the node has synchronous scrolling reasons; this is implemented by asking the scrolling
1797         coordinator.
1798
1799         * WebProcess/WebPage/EventDispatcher.cpp:
1800         (WebKit::EventDispatcher::wheelEvent):
1801
1802 2020-04-20  Megan Gardner  <megan_gardner@apple.com>
1803
1804         Date and Time form controls not showing correct initial values on immediate second invocation.
1805         https://bugs.webkit.org/show_bug.cgi?id=210613
1806
1807         Reviewed by Wenson Hsieh.
1808
1809         Updating the webprocess with the newly picked time did not update the local store of that data in the
1810         UI process, so when the control was activated a second time, and we skipped the round trip to the
1811         webprocess to get the data we were certian we already had, we did not start the popover in the 
1812         correct state. We now update the webprocess and the local UI stored variable at the same time.
1813
1814         Test: fast/forms/ios/time-picker-value-change.html
1815
1816         * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
1817         * UIProcess/API/ios/WKWebViewTestingIOS.mm:
1818         (-[WKWebView timePickerValueHour]):
1819         (-[WKWebView timePickerValueMinute]):
1820         * UIProcess/ios/WKContentViewInteraction.h:
1821         * UIProcess/ios/WKContentViewInteraction.mm:
1822         (-[WKContentView updateValueAsNumberForViewController:]):
1823         (-[WKContentView updateValueForViewController:]):
1824         (-[WKContentView setTimePickerValueToHour:minute:]):
1825         (-[WKContentView timePickerValueHour]):
1826         (-[WKContentView timePickerValueMinute]):
1827         * UIProcess/ios/forms/WKFormInputControl.h:
1828         * UIProcess/ios/forms/WKFormInputControl.mm:
1829         (-[WKDateTimePicker hour]):
1830         (-[WKDateTimePicker minute]):
1831         (-[WKDateTimePicker _dateChangedSetAsNumber]):
1832         (-[WKDateTimePicker _dateChangedSetAsString]):
1833         (-[WKDateTimePicker setHour:minute:]):
1834         (-[WKFormInputControl setTimePickerHour:minute:]):
1835         (-[WKFormInputControl timePickerValueHour]):
1836         (-[WKFormInputControl timePickerValueMinute]):
1837         (-[WKDateTimePopover setHour:minute:]):
1838         (-[WKDateTimePopover hour]):
1839         (-[WKDateTimePopover minute]):
1840
1841 2020-04-20  Timothy Horton  <timothy_horton@apple.com>
1842
1843         Try to fix the macCatalyst build after r260366
1844
1845         * UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h:
1846
1847 2020-04-20  Stephan Szabo  <stephan.szabo@sony.com>
1848
1849         Fix build when !ENABLE(RESOURCE_LOAD_STATISTICS)
1850         https://bugs.webkit.org/show_bug.cgi?id=210757
1851
1852         Reviewed by Ross Kirsling.
1853
1854         Build fix, no new tests
1855
1856         * NetworkProcess/NetworkDataTask.cpp:
1857         Add ENABLE(RESOURCE_LOAD_STATISTICS) around block
1858         using NetworkSession functions only declared when
1859         that is enabled.
1860
1861 2020-04-20  Alex Christensen  <achristensen@webkit.org>
1862
1863         When SpeculativeLoadManager is destroyed, properly clean up its PendingFrameLoads
1864         https://bugs.webkit.org/show_bug.cgi?id=210759
1865         <rdar://problem/62056856>
1866
1867         Reviewed by Darin Adler.
1868
1869         Recent work on the resourceLoadStatistics layout tests increased the amount we swap out the WebsiteDataStore.
1870         When this happens, the NetworkSession is eventually destroyed in the NetworkProcess, sometimes when running the next test.
1871         An assertion was firing in the PendingFrameLoad destructor because it hadn't been marked as complete when it was destroyed.
1872         Rather than remove the assertion, when we destroy the SpeculativeLoadManager (which only happens when a WebsiteDataStore
1873         is destroyed) during a speculative pending frame load, just mark the pending frame load as complete because it is being cancelled.
1874         Marking the pending frame load as complete can tell the SpeculativeLoadManager to mutate m_pendingFrameLoads, which we don't want
1875         to do while iterating, so copy the RefPtrs into a Vector first then iterate that to get them all.
1876
1877         This fixes an assertion that was sometimes hit in http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects-database.html
1878         but only after running other tests that had initiated speculative pending frame loads.  This was ostensibly started by r260322 but is quite unrelated.
1879
1880         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
1881         (WebKit::NetworkCache::SpeculativeLoadManager::~SpeculativeLoadManager):
1882
1883 2020-04-20  Stephan Szabo  <stephan.szabo@sony.com>
1884
1885         [PlayStation] Fix build after r260277
1886         https://bugs.webkit.org/show_bug.cgi?id=210756
1887
1888         Reviewed by Don Olmstead.
1889
1890         Build fix, no new tests.
1891
1892         * PlatformPlayStation.cmake:
1893
1894 2020-04-20  Chris Dumez  <cdumez@apple.com>
1895
1896         Sending beacons when Fetch KeepAlive feature is disabled crashes the WebProcess
1897         https://bugs.webkit.org/show_bug.cgi?id=210753
1898         <rdar://problem/61896221>
1899
1900         Reviewed by Geoffrey Garen.
1901
1902         * WebProcess/Network/WebLoaderStrategy.cpp:
1903         (WebKit::WebLoaderStrategy::startPingLoad):
1904         Make sure NetworkResourceLoadParameters's webPageProxyID / webPageID / webFrameID are properly
1905         initialized before sending the IPC or IPC decoding will fail.
1906
1907 2020-04-20  David Kilzer  <ddkilzer@apple.com>
1908
1909         [IPC hardening] Use ObjectIdentifier<> for geolocationID
1910         <https://webkit.org/b/210680>
1911         <rdar://problem/58892340>
1912
1913         Reviewed by Chris Dumez.
1914
1915         Replace uses of uint64_t with GeolocationIdentifier.
1916
1917         * Scripts/webkit/messages.py:
1918         * UIProcess/GeolocationIdentifier.h: Add.
1919         * UIProcess/GeolocationPermissionRequestManagerProxy.cpp:
1920         (WebKit::GeolocationPermissionRequestManagerProxy::createRequest):
1921         (WebKit::GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision):
1922         * UIProcess/GeolocationPermissionRequestManagerProxy.h:
1923         * UIProcess/GeolocationPermissionRequestProxy.cpp:
1924         (WebKit::GeolocationPermissionRequestProxy::GeolocationPermissionRequestProxy):
1925         * UIProcess/GeolocationPermissionRequestProxy.h:
1926         (WebKit::GeolocationPermissionRequestProxy::create):
1927         * UIProcess/WebPageProxy.cpp:
1928         * UIProcess/WebPageProxy.h:
1929         * UIProcess/WebPageProxy.messages.in:
1930         * WebKit.xcodeproj/project.pbxproj:
1931         * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
1932         (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
1933         (WebKit::GeolocationPermissionRequestManager::cancelRequestForGeolocation):
1934         (WebKit::GeolocationPermissionRequestManager::didReceiveGeolocationPermissionDecision):
1935         (WebKit::generateGeolocationID): Delete.
1936         - Replace with GeolocationIdentifier::generate().
1937         * WebProcess/Geolocation/GeolocationPermissionRequestManager.h:
1938         * WebProcess/WebPage/WebPage.cpp:
1939         (WebKit::WebPage::didReceiveGeolocationPermissionDecision):
1940         * WebProcess/WebPage/WebPage.h:
1941         * WebProcess/WebPage/WebPage.messages.in:
1942
1943 2020-04-20  Chris Dumez  <cdumez@apple.com>
1944
1945         [iOS] Refactor WebKit media playback process assertion logic to minimize chances of leaking them
1946         https://bugs.webkit.org/show_bug.cgi?id=210670
1947
1948         Reviewed by Geoffrey Garen.
1949
1950         Refactor WebKit media playback process assertion logic to minimize chances of leaking them. In particular,
1951         the following changes were made:
1952         1. Instead of the WebProcessPool having a HashMap of media playback process assertions for
1953            the WebProcess, we now store the assertion on the WebProcessProxy object itself. This is
1954            less likely to get out of sync and leak.
1955         2. Add a RefCounter to the WebProcessPool to count WebProcesses that have audible media.
1956            Whenever a WebProcess starts or stops playing audible media, it merely grabs a RefCounter
1957            token or releases it. The WebProcessPool relies on this counter to decide whether or not
1958            to take a media playback assertion on behalf of the UIProcess. Since this is token-based
1959            and the token is stored on the WebProcessProxy object, it makes it less likely to leak
1960            the assertion.
1961         3. The WebProcessProxy object now has a AudibleMediaActivity data structure wrapping both
1962            its media playback assertion and its WebProcessWithAudibleMediaToken that it got from
1963            the WebProcessPool. When the WebProcess shuts down (normally or due to crash/termination),
1964            we make sure to clear this data structure.
1965         4. Make sure that the WebProcessProxy updates its AudibleMediaActivity whenever a page is
1966            removed from the WebProcess.
1967
1968         * UIProcess/WebPageProxy.cpp:
1969         * UIProcess/WebProcessPool.cpp:
1970         (WebKit::m_webProcessWithAudibleMediaCounter):
1971         (WebKit::WebProcessPool::disconnectProcess):
1972         (WebKit::WebProcessPool::webProcessWithAudibleMediaToken const):
1973         (WebKit::WebProcessPool::updateAudibleMediaAssertions):
1974         * UIProcess/WebProcessPool.h:
1975         * UIProcess/WebProcessProxy.cpp:
1976         (WebKit::WebProcessProxy::shutDown):
1977         (WebKit::WebProcessProxy::removeWebPage):
1978         (WebKit::WebProcessProxy::updateAudibleMediaAssertions):
1979         * UIProcess/WebProcessProxy.h:
1980
1981 2020-04-20  Kate Cheney  <katherine_cheney@apple.com>
1982
1983         <rdar://problem/62059046>
1984
1985         Unreviewed macCatalyst build fix.
1986
1987         * NetworkProcess/NetworkProcess.messages.in:
1988
1989 2020-04-20  Darin Adler  <darin@apple.com>
1990
1991         Use #import instead of #include in Objective-C and don't use #pragma once
1992         https://bugs.webkit.org/show_bug.cgi?id=210724
1993
1994         Reviewed by David Kilzer.
1995
1996         * mac/MigrateHeadersFromWebKitLegacy.make: Delete stale MemoryMeasure.h
1997         forwarding header from incremental WebKit builds and ignore when generating
1998         new forwarding headers.
1999
2000         * Platform/foundation/LoggingFoundation.mm:
2001         (WebKit::logLevelString): Use string directly instead of a named constant.
2002
2003         * UIProcess/mac/WebColorPickerMac.h: Mark class final.
2004
2005         * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
2006         * NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm:
2007         * NetworkProcess/cache/NetworkCacheDataCocoa.mm:
2008         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
2009         * NetworkProcess/cocoa/NetworkActivityTrackerCocoa.mm:
2010         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2011         * NetworkProcess/webrtc/NetworkRTCProvider.mm:
2012         * Platform/spi/Cocoa/DeviceManagementSPI.h:
2013         * Platform/spi/Cocoa/LocalAuthenticationSPI.h:
2014         * Platform/spi/Cocoa/NearFieldSPI.h:
2015         * Platform/spi/Cocoa/SafeBrowsingSPI.h:
2016         * Platform/spi/mac/AppKitSPI.h:
2017         * Shared/API/Cocoa/RemoteObjectInvocation.mm:
2018         * Shared/API/Cocoa/WKMain.mm:
2019         * Shared/APIWebArchive.mm:
2020         * Shared/APIWebArchiveResource.mm:
2021         * Shared/Authentication/cocoa/AuthenticationChallengeDispositionCocoa.mm:
2022         * Shared/Cocoa/LoadParametersCocoa.mm:
2023         * Shared/Cocoa/SandboxInitialiationParametersCocoa.mm:
2024         * Shared/Cocoa/WKNSData.mm:
2025         * Shared/DocumentEditingContext.mm:
2026         * Shared/Plugins/mac/PluginSandboxProfile.mm:
2027         * Shared/RemoteLayerTree/WKAnimationDelegate.h:
2028         * Shared/UserInterfaceIdiom.mm:
2029         * Shared/ios/WebIconUtilities.mm:
2030         * Shared/mac/CodeSigning.mm:
2031         * Shared/mac/ColorSpaceData.mm:
2032         * Shared/mac/HangDetectionDisablerMac.mm:
2033         * Shared/mac/PDFKitImports.mm:
2034         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
2035         * UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm:
2036         * UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm:
2037         * UIProcess/API/Cocoa/WKContentRuleList.mm:
2038         * UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm:
2039         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
2040         * UIProcess/API/Cocoa/WKPreviewActionItemIdentifiers.mm:
2041         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2042         * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h:
2043         * UIProcess/API/Cocoa/_WKApplicationManifest.h:
2044         * UIProcess/API/Cocoa/_WKAttachment.h:
2045         * UIProcess/API/Cocoa/_WKResourceLoadInfoInternal.h:
2046         * UIProcess/API/Cocoa/_WKResourceLoadStatisticsFirstPartyInternal.h:
2047         * UIProcess/API/Cocoa/_WKResourceLoadStatisticsThirdPartyInternal.h:
2048         * UIProcess/API/Cocoa/_WKTextManipulationExclusionRule.mm:
2049         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
2050         * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponseInternal.h:
2051         * UIProcess/API/Cocoa/_WKWebAuthenticationPanelInternal.h:
2052         * UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h:
2053         * UIProcess/Authentication/mac/WebCredentialMac.mm:
2054         * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
2055         * UIProcess/Cocoa/IconLoadingDelegate.mm:
2056         * UIProcess/Cocoa/MediaUtilities.mm:
2057         * UIProcess/Cocoa/PreferenceObserver.h:
2058         * UIProcess/Cocoa/PreferenceObserver.mm:
2059         * UIProcess/Cocoa/SOAuthorization/NavigationSOAuthorizationSession.mm:
2060         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationNSURLExtras.h:
2061         * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
2062         * UIProcess/Cocoa/SOAuthorization/WKSOAuthorizationDelegate.h:
2063         * UIProcess/Cocoa/WKEditCommand.h:
2064         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.h:
2065         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2066         * UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm:
2067         * UIProcess/Inspector/mac/WKInspectorViewController.h:
2068         * UIProcess/Inspector/mac/WKInspectorWKWebView.h:
2069         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
2070         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
2071         * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm:
2072         * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm:
2073         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
2074         * UIProcess/WebAuthentication/Cocoa/WKNFReaderSessionDelegate.h:
2075         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2076         * UIProcess/ios/WKDeferringGestureRecognizer.h:
2077         * UIProcess/ios/WKHighlightLongPressGestureRecognizer.h:
2078         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.h:
2079         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
2080         * UIProcess/ios/forms/WKDatePickerViewController.h:
2081         * UIProcess/ios/forms/WKDatePickerViewController.mm:
2082         * UIProcess/ios/forms/WKFocusedFormControlView.h:
2083         * UIProcess/ios/forms/WKFocusedFormControlView.mm:
2084         * UIProcess/ios/forms/WKFormColorPicker.mm:
2085         * UIProcess/ios/forms/WKNumberPadViewController.h:
2086         * UIProcess/ios/forms/WKNumberPadViewController.mm:
2087         * UIProcess/ios/forms/WKQuickboardListViewController.h:
2088         * UIProcess/ios/forms/WKQuickboardListViewController.mm:
2089         * UIProcess/ios/forms/WKSelectMenuListViewController.h:
2090         * UIProcess/ios/forms/WKTimePickerViewController.h:
2091         * UIProcess/ios/forms/WKTimePickerViewController.mm:
2092         * UIProcess/ios/fullscreen/WKFullScreenViewController.h:
2093         * UIProcess/ios/fullscreen/WKFullscreenStackView.h:
2094         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
2095         * UIProcess/mac/PageClientImplMac.mm:
2096         * UIProcess/mac/WKSharingServicePickerDelegate.h:
2097         * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm:
2098         * WebProcess/GPU/media/cocoa/VideoLayerRemoteCocoa.h:
2099         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageBannerMac.mm:
2100         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
2101         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
2102         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
2103         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
2104         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.cpp:
2105         * WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.h:
2106         * WebProcess/WebPage/mac/PageBannerMac.mm:
2107         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h:
2108         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.h:
2109         * WebProcess/cocoa/WebProcessCocoa.mm:
2110         More #import, less #pragma once.
2111
2112 2020-04-20  Pablo Saavedra  <psaavedra@igalia.com>
2113
2114         [GTK][WPE] lowWatermarkPages() in MemoryPressureMonitor.cpp only searches the "low" value inside the first "Node" section
2115         https://bugs.webkit.org/show_bug.cgi?id=210345
2116
2117         Reviewed by Adrian Perez de Castro.
2118
2119         * UIProcess/linux/MemoryPressureMonitor.cpp:
2120         (WebKit::lowWatermarkPages):
2121
2122 2020-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2123
2124         [GTK][WPE] Enable resource load statistics
2125         https://bugs.webkit.org/show_bug.cgi?id=210184
2126
2127         Reviewed by Žan Doberšek.
2128
2129         * NetworkProcess/NetworkDataTask.cpp:
2130         (WebKit::NetworkDataTask::create): Pass page and frame identifiers to the constructor.
2131         (WebKit::NetworkDataTask::isThirdPartyRequest const): Moved from NetworkDataTaskCocoa.mm.
2132         (WebKit::NetworkDataTask::restrictRequestReferrerToOriginIfNeeded): Ditto.
2133         * NetworkProcess/NetworkDataTask.h:
2134         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2135         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2136         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2137         (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): Initialize m_frameID and m_pageID.
2138         (WebKit::NetworkDataTaskSoup::createRequest): Add WasBlockingCookies parameter. Call
2139         restrictRequestReferrerToOriginIfNeeded() and disable cookies in the soup message if cookies should be blocked.
2140         (WebKit::NetworkDataTaskSoup::clearRequest): Reset m_isBlockingCookies.
2141         (WebKit::NetworkDataTaskSoup::continueHTTPRedirection): Pass WasBlockingCookies to createRequest().
2142         * NetworkProcess/soup/NetworkDataTaskSoup.h:
2143         * UIProcess/API/C/WKPage.cpp:
2144         (WKPageLoadedThirdPartyDomains): Added for tests.
2145         (WKPageClearLoadedThirdPartyDomains): Ditto.
2146         * UIProcess/API/C/WKPagePrivate.h:
2147         * UIProcess/glib/WebsiteDataStoreGLib.cpp:
2148         (WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): Use lowercase for consistency with other
2149         default directories.
2150
2151 2020-04-20  David Kilzer  <ddkilzer@apple.com>
2152
2153         REGRESSION (r259610): Leak of RBSAssertionInvalidationCallbackType due to missing -dealloc
2154         <https://webkit.org/b/210711>
2155         <rdar://problem/61993361>
2156
2157         Reviewed by Geoffrey Garen.
2158
2159         * UIProcess/ios/ProcessAssertionIOS.mm:
2160         (-[WKRBSAssertionDelegate dealloc]): Add.
2161         - Release _invalidationCallback to fix the leak.
2162
2163 2020-04-19  Brady Eidson  <beidson@apple.com>
2164
2165         Add WKScriptMessageHandler API that asynchronously responds with a promise.
2166         rdar://problem/57243492 and https://bugs.webkit.org/show_bug.cgi?id=206398
2167
2168         Reviewed by Andy Estes.
2169         
2170         Change webkit.messageHandlers.<name>.postMessage() to return a promise instead of undefined.
2171         
2172         Allow for that promise to be resolved by an asynchronous reply block up in the API client.
2173         This is like the spiritual opposite version of [WKWebView callAsyncFunction:...]
2174         
2175         And while we're adding a new script message handler variant, we're adding it sandboxed by WKContentWorld.
2176
2177         * Shared/API/APISerializedScriptValue.h:
2178         * UIProcess/API/Cocoa/APISerializedScriptValueCocoa.mm:
2179         (API::validateObject):
2180         (API::coreValueFromNSObject):
2181         (API::SerializedScriptValue::createFromNSObject):
2182         (API::SerializedScriptValue::wireBytesFromNSObject): Deleted.
2183
2184         * UIProcess/API/Cocoa/WKScriptMessage.h: Now that script message handlers can be per-world, messages
2185           declare which world they were posted from.
2186         * UIProcess/API/Cocoa/WKScriptMessage.mm:
2187         (-[WKScriptMessage _initWithBody:webView:frameInfo:name:world:]):
2188         (-[WKScriptMessage world]):
2189         (-[WKScriptMessage _initWithBody:webView:frameInfo:name:]): Deleted.
2190         * UIProcess/API/Cocoa/WKScriptMessageInternal.h:
2191
2192         * UIProcess/API/Cocoa/WKScriptMessageHandlerWithReply.h: Added.
2193           Declare the new protocol for a script message handler that can reply to messages asynchronously.
2194
2195         * UIProcess/API/Cocoa/WKUserContentController.h:
2196         * UIProcess/API/Cocoa/WKUserContentController.mm:
2197         (-[WKUserContentController _addScriptMessageHandler:]):
2198         (-[WKUserContentController addScriptMessageHandler:name:]):
2199         (-[WKUserContentController addScriptMessageHandler:contentWorld:name:]):
2200         (-[WKUserContentController addScriptMessageHandlerWithReply:contentWorld:name:]):
2201         (-[WKUserContentController removeScriptMessageHandlerForName:contentWorld:]):
2202         (-[WKUserContentController removeAllScriptMessageHandlersFromContentWorld:]):
2203         (-[WKUserContentController removeAllScriptMessageHandlers]):
2204         * UIProcess/API/Cocoa/WKUserContentControllerInternal.h:
2205         * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
2206         
2207         * UIProcess/API/Cocoa/WKWebView.mm:
2208         (-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]):
2209         Update for new shared API::SerializedScriptValue initialization.
2210         
2211         * UIProcess/API/glib/WebKitUserContentManager.cpp:
2212         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
2213         * UIProcess/Inspector/socket/RemoteInspectorProtocolHandler.cpp:
2214         
2215         * UIProcess/UserContent/WebScriptMessageHandler.h:
2216         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2217         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
2218         (WebKit::WebUserContentControllerProxy::didPostMessage):
2219         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2220         * UIProcess/UserContent/WebUserContentControllerProxy.messages.in:
2221         
2222         * WebKit.xcodeproj/project.pbxproj:
2223         
2224         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
2225         (webkit_dom_dom_window_webkit_message_handlers_post_message):
2226         
2227         * WebProcess/UserContent/WebUserContentController.cpp:
2228         (WebKit::WebUserContentController::removeAllUserScriptMessageHandlers):
2229         (WebKit::WebUserContentController::removeAllUserScriptMessageHandlersForWorlds):
2230         * WebProcess/UserContent/WebUserContentController.h:
2231         * WebProcess/UserContent/WebUserContentController.messages.in:
2232
2233 2020-04-19  David Kilzer  <ddkilzer@apple.com>
2234
2235         REGRESSION (r244091): Leak of TaskStateChangedCallbackType due to missing -dealloc
2236         <https://webkit.org/b/210710>
2237         <rdar://problem/61992856>
2238
2239         Reviewed by Darin Adler.
2240
2241         * Shared/Cocoa/ProcessTaskStateObserver.mm:
2242         (-[WKProcessTaskStateObserverDelegate dealloc]): Add.
2243         - Release _taskStateChangedCallback to fix the leak.
2244
2245 2020-04-19  David Kilzer  <ddkilzer@apple.com>
2246
2247         [IPC hardening] Use MESSAGE_CHECK in WebPageProxy::loadRecentSearches() and WebPageProxy::saveRecentSearches()
2248         <https://webkit.org/b/210683>
2249         <rdar://problem/59240446>
2250
2251         Reviewed by Geoffrey Garen.
2252
2253         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2254         (MESSAGE_CHECK): Add.
2255         (MESSAGE_CHECK_COMPLETION): Add.
2256         (WebKit::WebPageProxy::saveRecentSearches):
2257         (WebKit::WebPageProxy::loadRecentSearches):
2258         - Replace boolean check of const String& with MESSAGE_CHECK.
2259
2260 2020-04-18  Darin Adler  <darin@apple.com>
2261
2262         Update header postprocessing version cutoff to keep Apple internal builds working
2263         https://bugs.webkit.org/show_bug.cgi?id=210708
2264
2265         Reviewed by Brady Eidson.
2266
2267         * Configurations/WebKit.xcconfig: Update versions to make building with older
2268         Apple internal SDKs continue to work.
2269
2270         * Shared/API/Cocoa/WKFoundation.h:
2271         * Shared/API/Cocoa/_WKFrameHandle.h:
2272         * Shared/API/Cocoa/_WKRemoteObjectInterface.h:
2273         * UIProcess/API/Cocoa/WKContentWorld.h:
2274         * UIProcess/API/Cocoa/WKFindConfiguration.h:
2275         * UIProcess/API/Cocoa/WKFindResult.h:
2276         * UIProcess/API/Cocoa/WKFrameInfoPrivate.h:
2277         * UIProcess/API/Cocoa/WKHTTPCookieStorePrivate.h:
2278         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2279         * UIProcess/API/Cocoa/WKPDFConfiguration.h:
2280         * UIProcess/API/Cocoa/WKPreferences.h:
2281         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2282         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2283         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2284         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
2285         * UIProcess/API/Cocoa/WKUserScriptPrivate.h:
2286         * UIProcess/API/Cocoa/WKWebView.h:
2287         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
2288         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2289         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2290         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
2291         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
2292         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
2293         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2294         * UIProcess/API/Cocoa/_WKDownload.h:
2295         * UIProcess/API/Cocoa/_WKFrameTreeNode.h:
2296         * UIProcess/API/Cocoa/_WKInputDelegate.h:
2297         * UIProcess/API/Cocoa/_WKInspectorDebuggableInfo.h:
2298         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2299         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h:
2300         * UIProcess/API/Cocoa/_WKResourceLoadDelegate.h:
2301         * UIProcess/API/Cocoa/_WKResourceLoadInfo.h:
2302         * UIProcess/API/Cocoa/_WKResourceLoadStatisticsFirstParty.h:
2303         * UIProcess/API/Cocoa/_WKResourceLoadStatisticsThirdParty.h:
2304         * UIProcess/API/Cocoa/_WKTextManipulationConfiguration.h:
2305         * UIProcess/API/Cocoa/_WKTextManipulationExclusionRule.h:
2306         * UIProcess/API/Cocoa/_WKTextManipulationItem.h:
2307         * UIProcess/API/Cocoa/_WKTextManipulationToken.h:
2308         * UIProcess/API/Cocoa/_WKUserContentWorld.h:
2309         * UIProcess/API/Cocoa/_WKUserStyleSheet.h:
2310         * UIProcess/API/Cocoa/_WKWebAuthenticationAssertionResponse.h:
2311         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
2312         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2313         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2314         Because the way we do post-processing of headers in the legacy Xcode
2315         build system won't work once the files have been processed once, touch
2316         each file that has WK_MAC_TBA, WK_IOS_TBA, or
2317         WK_FRAMEWORK_HEADER_POSTPROCESSING_ENABLED in it. Found something to
2318         change in each file. This is likely unnecessary in the new Xcode build
2319         system, but I wasn't able to test that locally.
2320
2321         * WebKit.xcodeproj/project.pbxproj:
2322         (postprocess-header-rule): Added dependencies so that post-processing will be
2323         redone if Configurations/WebKit.xcconfig is touched, since that is where
2324         WK_FRAMEWORK_HEADER_POSTPROCESSING_DISABLED is set, or if
2325         Scripts/postprocess-header-rule is touched, since that is where the
2326         post-processing code is. If either of those files changes it could affect the
2327         output of post-processing. This should make a change like this work in the
2328         new Xcode build system without touching files as is done above.
2329
2330 2020-04-18  Brady Eidson  <beidson@apple.com>
2331
2332         Fix WebUserContentControllerProxy vs ContentWorld lifetime
2333         https://bugs.webkit.org/show_bug.cgi?id=210700
2334
2335         Reviewed by Alex Christensen.
2336
2337         Covered by API test.
2338         
2339         WebUserContentControllerProxy currently keeps all of its associated API::ContentWorlds alive via RefPtrs.
2340         
2341         This is despite the fact that all of the associated WebScriptMessageHandlers, UserScripts, and 
2342         UserStyleSheets already keep their associated API::ContentWorlds alive.
2343
2344         It then decideds to tell WebProcesses to forget a content world after all of its clients are removed.
2345         
2346         Unfortunately, content worlds are used for more than just content controller stuff. They're used for direct
2347         JavaScript evaluation as well.
2348         
2349         So a client could:
2350           - Add a script message handler in a content world.
2351           - Evaluate JavaScript in that content world, setting up some persistent state.
2352           - Remove the script message handler.
2353           - Find that their persistent state from the JavaScript evaluation is gone from that world, even though they
2354             still retain a usable handle to that world.
2355         
2356         The only party who has any business managing the lifetime of an API::ContentWorld is the API::ContentWorld itself.
2357         
2358         Making this change is:
2359           1 - Nice cleanup
2360           2 - Fixes the above mentioned bug
2361         
2362         * UIProcess/API/APIContentWorld.cpp:
2363         (API::ContentWorld::worldForIdentifier):
2364         (API::ContentWorld::ContentWorld):
2365         (API::ContentWorld::sharedWorldWithName):
2366         (API::ContentWorld::~ContentWorld):
2367         (API::ContentWorld::addAssociatedUserContentControllerProxy):
2368         (API::ContentWorld::userContentControllerProxyDestroyed):
2369         * UIProcess/API/APIContentWorld.h:
2370
2371         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2372         (WebKit::WebUserContentControllerProxy::parameters const):
2373         (WebKit::WebUserContentControllerProxy::addContentWorld):
2374         (WebKit::WebUserContentControllerProxy::contentWorldDestroyed):
2375         (WebKit::WebUserContentControllerProxy::addUserScript):
2376         (WebKit::WebUserContentControllerProxy::removeUserScript):
2377         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
2378         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
2379         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
2380         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
2381         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
2382         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
2383         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
2384         (WebKit::WebUserContentControllerProxy::addContentWorldUse): Deleted.
2385         (WebKit::WebUserContentControllerProxy::shouldSendRemoveContentWorldsMessage): Deleted.
2386         (WebKit::WebUserContentControllerProxy::removeContentWorldUses): Deleted.
2387         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2388
2389 2020-04-18  David Kilzer  <ddkilzer@apple.com>
2390
2391         Attempt #4 to fix tvOS build
2392
2393         Unreviewed.
2394
2395         * WebProcess/cocoa/WebProcessCocoa.mm:
2396         (WebKit::WebProcess::platformInitializeWebProcess):
2397         - Add #if ENABLE(VIDEO_PRESENTATION_MODE)/#endif to protect
2398           function defined in WebCore/PictureInPictureSupport.h.
2399         - See previous build fixes in r260307, r260308 and r260313.
2400
2401 2020-04-18  Alex Christensen  <achristensen@webkit.org>
2402
2403         Fix client certificate authentication when using non-default WKWebsiteDataStores
2404         https://bugs.webkit.org/show_bug.cgi?id=210681
2405
2406         Reviewed by Brady Eidson.
2407
2408         NetworkProcessProxy was trying to keep a map of WebsiteDataStores, but it wasn't as accurate as the one WebsiteDataStore was maintaining.
2409         Use the latter map instead and client certificate authentication works.  Otherwise, the credential isn't serialized correctly.
2410         I found this while working on <rdar://problem/60340449> but this was unrelated so I put it in a different change.
2411         This may fix <rdar://problem/60910392>.
2412
2413         * UIProcess/Network/NetworkProcessProxy.cpp:
2414         (WebKit::NetworkProcessProxy::websiteDataStoreFromSessionID):
2415
2416 2020-04-18  Pablo Saavedra  <psaavedra@igalia.com>
2417
2418         [GTK][WPE] Replace evil strtok() calls with fscanf() in MemoryPressureMonitor.cpp
2419         https://bugs.webkit.org/show_bug.cgi?id=210346
2420
2421         Reviewed by Adrian Perez de Castro.
2422
2423         * UIProcess/linux/MemoryPressureMonitor.cpp:
2424         (WebKit::lowWatermarkPages):
2425         (WebKit::getCgroupControllerPath):
2426         (WebKit::systemMemoryUsedAsPercentage):
2427         (WebKit::CGroupMemoryController::getCgroupFileValue):
2428
2429 2020-04-18  Rob Buis  <rbuis@igalia.com>
2430
2431         Reduce parameter list of the FrameLoadRequest constructor
2432         https://bugs.webkit.org/show_bug.cgi?id=210668
2433
2434         Reviewed by Darin Adler.
2435
2436         Adapt to API change.
2437
2438         * WebProcess/Inspector/WebInspector.cpp:
2439         (WebKit::WebInspector::openInNewTab):
2440         * WebProcess/Plugins/PluginView.cpp:
2441         (WebKit::PluginView::performFrameLoadURLRequest):
2442         (WebKit::PluginView::loadURL):
2443         * WebProcess/WebPage/WebPage.cpp:
2444         (WebKit::WebPage::loadURLInFrame):
2445         (WebKit::WebPage::loadDataInFrame):
2446         (WebKit::WebPage::loadRequest):
2447         (WebKit::WebPage::loadDataImpl):
2448
2449 2020-04-18  David Kilzer  <ddkilzer@apple.com>
2450
2451         [IPC hardening] Use MESSAGE_CHECK in WebPasteboardProxy
2452         <https://webkit.org/b/210684>
2453         <rdar://problem/59906721>
2454
2455         Reviewed by Wenson Hsieh.
2456
2457         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
2458         - Add missing #undef of MESSAGE_CHECK_COMPLETION and
2459           MESSAGE_CHECK_WITH_RETURN_VALUE.
2460         (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType):
2461         (WebKit::WebPasteboardProxy::getPasteboardStringForType):
2462         (WebKit::WebPasteboardProxy::getPasteboardStringsForType):
2463         (WebKit::WebPasteboardProxy::getPasteboardBufferForType):
2464         (WebKit::WebPasteboardProxy::setPasteboardStringForType):
2465         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
2466         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
2467         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
2468         (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
2469         - Replace existing code with MESSAGE_CHECK_COMPLETION macros.
2470
2471         * UIProcess/WebPasteboardProxy.cpp:
2472         (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
2473         * UIProcess/WebPasteboardProxy.h:
2474         * UIProcess/WebPasteboardProxy.messages.in:
2475         - Add IPC::Connection to TypesSafeForDOMToReadAndWrite.
2476
2477 2020-04-17  Kate Cheney  <katherine_cheney@apple.com>
2478
2479         Enable service workers for app-bound domains
2480         https://bugs.webkit.org/show_bug.cgi?id=210451
2481         <rdar://problem/61479474>
2482
2483         Reviewed by Brent Fulgham.
2484
2485         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2486         (WebKit::NetworkConnectionToWebProcess::createFetchTask):
2487         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
2488         (WebKit::NetworkConnectionToWebProcess::swConnection):
2489         (WebKit::NetworkConnectionToWebProcess::isServiceWorkerAllowed const): Deleted.
2490         * NetworkProcess/NetworkConnectionToWebProcess.h:
2491         Removed ASSERTS and service worker entitlement checks which are now done along with app-bound
2492         domain checks in SWServer.cpp.
2493
2494         * NetworkProcess/NetworkProcess.cpp:
2495         (WebKit::NetworkProcess::initializeNetworkProcess):
2496         (WebKit::NetworkProcess::addWebsiteDataStore):
2497         Remove the check for parentProcessHasServiceWorkerEntitlement() before
2498         adding a serviceWorkerSession. This doesn't do anything except add an
2499         entry to a map, and simplifies the case where we need a session for
2500         app-bound instances which should have service workers but have no entitlement.
2501
2502         Pass the entitlement and a new callback to request app-bound domains
2503         from the UI Process to the SWServer. This will make sure the server
2504         checks for the entitlement or list of app-bound domains before completing a load.
2505
2506         (WebKit::NetworkProcess::registerSWServerConnection):
2507         Remove unnecessary ASSERT for entitlement.
2508
2509         * NetworkProcess/NetworkProcess.h:
2510         * NetworkProcess/NetworkProcess.messages.in:
2511         * NetworkProcess/ios/NetworkProcessIOS.mm:
2512         (WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const):
2513         (WebKit::NetworkProcess::disableServiceWorkerEntitlement):
2514         (WebKit::NetworkProcess::clearServiceWorkerEntitlementOverride):
2515         In order to test this thoroughly, TestWebKitAPI needed a way to
2516         temporarily disable the service worker entitlement. This function
2517         overrides the check for the entitlement if the bool is set, disabling
2518         the entitlement.
2519
2520         * Shared/WebPageCreationParameters.cpp:
2521         (WebKit::WebPageCreationParameters::encode const):
2522         (WebKit::WebPageCreationParameters::decode):
2523         * Shared/WebPageCreationParameters.h:
2524         WebPage needs to know if it is app-bound when created so it can update
2525         the service worker preferences key accordingly.
2526
2527         * Shared/WebPreferences.yaml:
2528         * UIProcess/API/Cocoa/WKPreferences.mm:
2529         (-[WKPreferences _serviceWorkerEntitlementDisabledForTesting]):
2530         (-[WKPreferences _setServiceWorkerEntitlementDisabledForTesting:]):
2531         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2532         Disable entitlement for testing.
2533
2534         * UIProcess/API/APIPageConfiguration.cpp:
2535         (API::PageConfiguration::copy const):
2536         * UIProcess/API/APIPageConfiguration.h:
2537         (API::PageConfiguration::limitsNavigationsToAppBoundDomains const):
2538         (API::PageConfiguration::setLimitsNavigationsToAppBoundDomains):
2539         (API::PageConfiguration::limitsNavigationToAppBoundDomains const): Deleted.
2540         (API::PageConfiguration::setLimitsNavigationToAppBoundDomains): Deleted.
2541         (-[WKWebViewConfiguration limitsNavigationsToAppBoundDomains]):
2542         (-[WKWebViewConfiguration setLimitsNavigationsToAppBoundDomains:]):
2543         (-[WKWebViewConfiguration limitsNavigationToAppBoundDomains]): Deleted.
2544         (-[WKWebViewConfiguration setLimitsNavigationToAppBoundDomains:]): Deleted.
2545         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2546         Inconsistent naming (Navigation vs Navigations).
2547
2548         * UIProcess/API/Cocoa/WKWebView.mm:
2549         (-[WKWebView _setupPageConfiguration:]):
2550         Check for entitlement or app-bound webview.
2551
2552         (-[WKWebView _serviceWorkersEnabled:]):
2553         (-[WKWebView _clearServiceWorkerEntitlementOverride:]):
2554         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2555         Testing SPIs.
2556
2557         * UIProcess/Network/NetworkProcessProxy.cpp:
2558         (WebKit::NetworkProcessProxy::getAppBoundDomains):
2559         * UIProcess/Network/NetworkProcessProxy.h:
2560         * UIProcess/Network/NetworkProcessProxy.messages.in:
2561         Sends the app-bound domains to the Network Process.
2562
2563         * UIProcess/WebPageProxy.cpp:
2564         (WebKit::m_limitsNavigationsToAppBoundDomains):
2565         (WebKit::m_limitsNavigationToAppBoundDomains): Deleted.
2566         Naming inconsistency.
2567
2568         (WebKit::WebPageProxy::disableServiceWorkerEntitlementInNetworkProcess):
2569         (WebKit::WebPageProxy::clearServiceWorkerEntitlementOverride):
2570         * UIProcess/WebPageProxy.h:
2571         Disable entitlement for testing.
2572
2573         * WebProcess/WebPage/WebPage.cpp:
2574         (WebKit::m_isNavigatingToAppBoundDomain):
2575         Set this parameter in the constructor so it will be accurate when
2576         updating preferences.
2577
2578         (WebKit::WebPage::updatePreferences):
2579         * WebProcess/WebPage/WebPage.h:
2580         (WebKit::WebPage::clearServiceWorkerEntitlementOverride):
2581         * WebProcess/WebPage/WebPage.messages.in:
2582         * WebProcess/WebPage/ios/WebPageIOS.mm:
2583         (WebKit::WebPage::parentProcessHasServiceWorkerEntitlement const):
2584         (WebKit::WebPage::disableServiceWorkerEntitlement):
2585         (WebKit::WebPage::clearServiceWorkerEntitlementOverride):
2586         Disable entitlement for testing.
2587
2588 2020-04-17  Alex Christensen  <achristensen@webkit.org>
2589
2590         NetworkSessionCocoa should request client certificate only once per host/port
2591         https://bugs.webkit.org/show_bug.cgi?id=210626
2592         <rdar://problem/60340449>
2593
2594         Reviewed by Geoffrey Garen.
2595
2596         NSURLSession creates more than one TCP connection to a server when using HTTP 1.1.
2597         Each TCP connection with TLS generates a didReceiveChallenge to do the server trust evaluation of the certificate chain.
2598         If the server requests a client certificate in the TLS handshake, it also generates a didReceiveChallenge to request client
2599         certificates as well.  This is an implementation detail of our networking.  We should not actually ask the WKNavigationDelegate
2600         for client certificates more than once per host/port.  We should remember the credential and give it to NSURLSession immediately
2601         if we have used this credential in the past for a task that has received bytes (either a response or a redirect).  If the TLS
2602         handshake fails, we should not reuse that same certificate automatically.
2603
2604         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
2605         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2606         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
2607         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
2608         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
2609         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
2610         (WebKit::NetworkSessionCocoa::clientCertificateSuggestedForHost):
2611         (WebKit::NetworkSessionCocoa::taskReceivedBytes):
2612         (WebKit::NetworkSessionCocoa::taskFailed):
2613         (WebKit::NetworkSessionCocoa::successfulClientCertificateForHost const):
2614
2615 2020-04-17  David Kilzer  <ddkilzer@apple.com>
2616
2617         Bug 210646: REGRESSION (r260112): createArchiveList() leaks malloc memory on early returns due to an error
2618         <https://webkit.org/b/210646>
2619         <rdar://problem/61928031>
2620
2621         Reviewed by Darin Adler.
2622
2623         * Shared/mac/WebCoreArgumentCodersMac.mm:
2624         (IPC::createArchiveList):
2625         - Move early returns for protocolProperties, protocolProperties
2626           and mimeType above memory allocation to fix the memory leak.
2627
2628 2020-04-17  Brady Eidson  <beidson@apple.com>
2629
2630         Pass sandbox extensions for back/forward list navigations after the policy is decided at process-swap time.
2631         <rdar://problem/59535167> and https://bugs.webkit.org/show_bug.cgi?id=210623
2632
2633         Reviewed by Geoff Garen.
2634
2635         Covered by almost all existing tests, and a new API test.
2636
2637         Instead of granting a sandbox extension when updating the back/forward cursor for a pending 
2638         back/forward list traversal, do so after the client decides the policy.
2639         (Which is also along with a process swap in interesting cases)
2640
2641         * Shared/PolicyDecision.h:
2642         (WebKit::PolicyDecision::encode const):
2643         (WebKit::PolicyDecision::decode):
2644
2645         * Shared/WebPageCreationParameters.h:
2646
2647         * UIProcess/API/APINavigation.cpp:
2648         (API::Navigation::Navigation):
2649         * UIProcess/API/APINavigation.h:
2650         (API::Navigation::create):
2651         (API::Navigation::reloadItem const):
2652
2653         * UIProcess/ProvisionalPageProxy.cpp:
2654         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
2655         * UIProcess/ProvisionalPageProxy.h:
2656
2657         * UIProcess/WebNavigationState.cpp:
2658         (WebKit::WebNavigationState::createReloadNavigation):
2659         * UIProcess/WebNavigationState.h:
2660
2661         * UIProcess/WebPageProxy.cpp:
2662         (WebKit::WebPageProxy::launchProcessForReload):
2663         (WebKit::WebPageProxy::reload):
2664         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2665         (WebKit::WebPageProxy::receivedPolicyDecision):
2666         * UIProcess/WebPageProxy.h:
2667         (WebKit::WebPageProxy::receivedPolicyDecision):
2668         * UIProcess/WebPageProxy.messages.in:
2669
2670         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
2671         (WebKit::WebBackForwardListProxy::goToItem):
2672
2673         * WebProcess/WebPage/WebFrame.cpp:
2674         (WebKit::WebFrame::didReceivePolicyDecision):
2675
2676         * WebProcess/WebPage/WebPage.cpp:
2677         (WebKit::WebPage::SandboxExtensionTracker::didStartProvisionalLoad):
2678
2679 2020-04-17  David Kilzer  <ddkilzer@apple.com>
2680
2681         REGRESSION (r234105): [iOS] WKColorButton leaks a UIColor
2682         <https://webkit.org/b/210658>
2683         <rdar://problem/61938137>
2684
2685         Reviewed by Darin Adler.
2686
2687         * UIProcess/ios/forms/WKFormColorPicker.mm:
2688         (-[WKColorButton dealloc]): Add.
2689         - Release _color instance variable to fix leak.
2690
2691 2020-04-17  Per Arne Vollan  <pvollan@apple.com>
2692
2693         [iOS] Deny iokit open access of unused class in the WebContent sandbox
2694         https://bugs.webkit.org/show_bug.cgi?id=210669
2695
2696         Reviewed by Brent Fulgham.
2697
2698         Telemetry shows that iokit open access of an iokit class can be removed from the WebContent sandbox.
2699
2700         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2701
2702 2020-04-17  Chris Dumez  <cdumez@apple.com>
2703
2704         [iOS] Refactor WebKit uploads process assertion logic to minimize chances of leaking them
2705         https://bugs.webkit.org/show_bug.cgi?id=210664
2706         <rdar://problem/61751982>
2707
2708         Reviewed by Geoff Garen.
2709
2710         To minimize chances of leaking "WebKit uploads" process assertion, the following refactoring
2711         was done:
2712         1. WebKit upload assertions are now held by NetworkProcessProxy instead of the WebProcessPool.
2713            This makes more sense since uploads are tied to a particular network process. In base of
2714            a network process crash, we would not want those assertions to persist for example.
2715         2. Store all upload assertions (UIProcess + NetworkProcess + WebProcesses) into a single
2716            UploadActivity data structure that can easily be cleared. Make sure we clear it on network
2717            process crash.
2718         3. No longer on the WebProcess to send IPC whenever its has pending uploads or not. Instead,
2719            have the network process send such IPC. This makes more sense, especially now that all
2720            webkit upload process assertions are now stored on NetworkProcessProxy. It also makes it
2721            so that we deal properly with WebProcess crashes. In case of a WebProcess crash, its
2722            connection to the network process will get closed. NetworkConnectionToWebProcess::didClose()
2723            gets called and causes all NetworkResourceLoader objects for this connection to get
2724            destroyed. As a result, the network process will properly notify the UIProcess that this
2725            process no longer has any upload in progress.
2726
2727         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2728         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
2729         (WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess):
2730         (WebKit::NetworkConnectionToWebProcess::hasUploadStateChanged):
2731         * NetworkProcess/NetworkConnectionToWebProcess.h:
2732         * NetworkProcess/NetworkResourceLoadMap.cpp:
2733         (WebKit::NetworkResourceLoadMap::NetworkResourceLoadMap):
2734         (WebKit::NetworkResourceLoadMap::~NetworkResourceLoadMap):
2735         (WebKit::NetworkResourceLoadMap::add):
2736         (WebKit::NetworkResourceLoadMap::clear):
2737         (WebKit::NetworkResourceLoadMap::take):
2738         (WebKit::NetworkResourceLoadMap::setHasUpload):
2739         * NetworkProcess/NetworkResourceLoadMap.h:
2740         (WebKit::NetworkResourceLoadMap::hasUpload const):
2741         * UIProcess/Network/NetworkProcessProxy.cpp:
2742         (WebKit::NetworkProcessProxy::didClose):
2743         (WebKit::NetworkProcessProxy::setWebProcessHasUploads):
2744         * UIProcess/Network/NetworkProcessProxy.h:
2745         * UIProcess/Network/NetworkProcessProxy.messages.in:
2746         * UIProcess/ProcessAssertion.cpp:
2747         (WebKit::ProcessAssertion::ProcessAssertion):
2748         * UIProcess/ProcessAssertion.h:
2749         (WebKit::ProcessAssertion::pid const):
2750         * UIProcess/WebProcessPool.cpp:
2751         * UIProcess/WebProcessPool.h:
2752         * UIProcess/WebProcessPool.messages.in:
2753         * UIProcess/WebProcessProxy.cpp:
2754         (WebKit::WebProcessProxy::~WebProcessProxy):
2755         * UIProcess/WebProcessProxy.h:
2756         * WebProcess/Network/WebLoaderStrategy.cpp:
2757         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2758         (WebKit::WebLoaderStrategy::remove):
2759         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
2760         * WebProcess/Network/WebLoaderStrategy.h:
2761
2762 2020-04-17  Jer Noble  <jer.noble@apple.com>
2763
2764         Bring Fullscreen API + alert() behavior from iOS to macOS
2765         https://bugs.webkit.org/show_bug.cgi?id=210662
2766
2767         Reviewed by Eric Carlson.
2768
2769         When a page is showing an alert(), all non-synchronous messages will be blocked until the sync XPC for alert()
2770         ends. And when exiting fullscreen, we block completing the fullscreen exit animation until a repaint XPC completes.
2771         So a page that is showing an alert() will never fully exit element fullscreen mode.
2772
2773         On iOS, we fixed this behavior by exiting fullscreen mode whenever the page shows an alert() or prompt(). We should
2774         bring this behavior to macOS as well.
2775
2776         * UIProcess/WebPageProxy.cpp:
2777         (WebKit::WebPageProxy::runJavaScriptAlert):
2778         (WebKit::WebPageProxy::runJavaScriptConfirm):
2779         (WebKit::WebPageProxy::runJavaScriptPrompt):
2780
2781 2020-04-17  Don Olmstead  <don.olmstead@sony.com>
2782
2783         [CMake] Add WebKit::WebCore target
2784         https://bugs.webkit.org/show_bug.cgi?id=210445
2785
2786         Reviewed by Michael Catanzaro.
2787
2788         Use the WebKit::WebCore target within the WebKit target.
2789
2790         * CMakeLists.txt:
2791         * PlatformGTK.cmake:
2792         * PlatformWPE.cmake:
2793         * PlatformWin.cmake:
2794
2795 2020-04-17  Simon Fraser  <simon.fraser@apple.com>
2796
2797         Turn async frame and overflow scrolling on by default on macOS
2798         https://bugs.webkit.org/show_bug.cgi?id=210661
2799         rdar://problem/60420037
2800
2801         Reviewed by Tim Horton.
2802
2803         Flip the plist value and the default value for macOS which is outside of the feature flag #ifdef.
2804
2805         Testing keeps async overflow scrolling off by default, so this should not affect testing.
2806
2807         This only impacts WebKit2.
2808
2809         * FeatureFlags/WebKit.plist:
2810         * Shared/WebPreferencesDefaultValues.cpp:
2811         (WebKit::defaultAsyncFrameAndOverflowScrollingEnabled):
2812
2813 2020-04-17  Per Arne Vollan  <pvollan@apple.com>
2814
2815         [iOS] Add telemetry to some mach lookup sandbox extensions
2816         https://bugs.webkit.org/show_bug.cgi?id=210657
2817
2818         Reviewed by Darin Adler.
2819
2820         Add telemetry in order to learn more about how some of the mach lookup extensions are being used in the WebContent process on iOS.
2821
2822         No new tests, since this patch does not change any behavior.
2823
2824         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2825
2826 2020-04-17  Youenn Fablet  <youenn@apple.com>
2827
2828         Validate socket in NetworkRTCProvider::wrapNewTCPConnection
2829         https://bugs.webkit.org/show_bug.cgi?id=210594
2830
2831         Reviewed by Eric Carlson.
2832
2833         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
2834         (WebKit::NetworkRTCProvider::wrapNewTCPConnection):
2835         Add a null check in case the identifier does not relate to an existing pending socket.
2836
2837 2020-04-17  Peng Liu  <peng.liu6@apple.com>
2838
2839         Cleanup the macros for video fullscreen and picture-in-picture
2840         https://bugs.webkit.org/show_bug.cgi?id=210638
2841
2842         Reviewed by Eric Carlson.
2843
2844         Replace some "#if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))"
2845         and all "#if (PLATFORM(IOS_FAMILY) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))"
2846         with "#if ENABLE(VIDEO_PRESENTATION_MODE)".
2847
2848         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
2849         (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenGravity):
2850         (WebKit::RemoteMediaPlayerProxy::updateVideoFullscreenInlineImage):
2851         (WebKit::RemoteMediaPlayerProxy::setVideoFullscreenMode):
2852         (WebKit::RemoteMediaPlayerProxy::videoFullscreenStandbyChanged):
2853         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
2854         * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in:
2855         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2856         * UIProcess/WebPageProxy.cpp:
2857         (WebKit::WebPageProxy::didAttachToRunningProcess):
2858         (WebKit::WebPageProxy::viewDidLeaveWindow):
2859         (WebKit::WebPageProxy::exitFullscreenImmediately):
2860         * UIProcess/WebPageProxy.h:
2861         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
2862         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
2863         * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm:
2864         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2865         * WebProcess/WebCoreSupport/WebChromeClient.h:
2866         * WebProcess/WebPage/WebPage.cpp:
2867         (WebKit::WebPage::~WebPage):
2868         * WebProcess/WebPage/WebPage.h:
2869         * WebProcess/cocoa/VideoFullscreenManager.h:
2870         * WebProcess/cocoa/VideoFullscreenManager.messages.in:
2871         * WebProcess/cocoa/VideoFullscreenManager.mm:
2872
2873 2020-04-17  Claudio Saavedra  <csaavedra@igalia.com>
2874
2875         [GTK] Update for GdkKeymap API changes
2876         https://bugs.webkit.org/show_bug.cgi?id=210642
2877
2878         Reviewed by Adrian Perez de Castro.
2879
2880         No new tests needed.
2881
2882         gdk_keymap_get_default() is deprecated in GTK+ 3.22, so use
2883         gdk_keymap_get_for_display() instead. Since in GTK4 this method is
2884         removed to gdk_display_get_keymap(), add a helper to
2885         GtkVersioning.h to avoid cluttering with ifdefs all over the
2886         place.
2887
2888         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
2889         (WebKit::doKeyStrokeEvent):
2890
2891 2020-04-17  Antoine Quint  <graouts@apple.com>
2892
2893         Allow the UserStyleLevel to be set through _WKUserStyleSheet
2894         https://bugs.webkit.org/show_bug.cgi?id=210653
2895         <rdar://problem/60506645>
2896
2897         Reviewed by Tim Horton.
2898
2899         Add a new _WKUserStyleLevel enum such that we may provide the specificity level of the backing UserStyleSheet, represented by the UserStyleLevel enum in WebCore.
2900
2901         * UIProcess/API/Cocoa/_WKUserStyleSheet.h:
2902         * UIProcess/API/Cocoa/_WKUserStyleSheet.mm:
2903         (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:level:userContentWorld:]):
2904         (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:level:userContentWorld:]):
2905         (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:userContentWorld:]): Deleted.
2906         * UIProcess/API/Cocoa/_WKUserStyleSheetInternal.h:
2907         (API::toWebCoreUserStyleLevel):
2908
2909 2020-04-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2910
2911         [GTK][X11] REGRESSION(r259944): Wrong position of select popup menu in X11
2912         https://bugs.webkit.org/show_bug.cgi?id=210603
2913
2914         Reviewed by Michael Catanzaro.
2915
2916         gdk_window_move_to_rect expects the given rectangle in coordinates relative to the top-left corner of the window
2917         that the popup window is transient for. We were using screen coordinates.
2918
2919         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
2920         (WebKit::WebPopupMenuProxyGtk::showPopupMenu): Translate widget coordinates to window coordinates before passing
2921         the rectangle to gdk_window_move_to_rect().
2922
2923 2020-04-17  David Kilzer  <ddkilzer@apple.com>
2924
2925         REGRESSION (r256756): -[WKUserDefaults initWithSuiteName:]: Instance variable used while 'self' is not set to the result of '[(super or self) init...]'
2926         <https://webkit.org/b/210647>
2927         <rdar://problem/61928289>
2928
2929         Reviewed by Anders Carlsson.
2930
2931         * UIProcess/Cocoa/PreferenceObserver.mm:
2932         (-[WKUserDefaults initWithSuiteName:]):
2933         - Call `[self initWithSuite:]` and set `self` to fix the clang
2934           static analyzer warning.
2935         - Fix camelCase of `suitename` parameter.
2936
2937 2020-04-17  Per Arne Vollan  <pvollan@apple.com>
2938
2939         [iOS] Deny iokit open access to graphics related classes
2940         https://bugs.webkit.org/show_bug.cgi?id=210616
2941
2942         Reviewed by Darin Adler.
2943
2944         Deny iokit open access to graphics related classes in the WebContent process on iOS, but issue
2945         extensions for these for some devices which still need access to them.
2946
2947         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2948         * Shared/Cocoa/SandboxExtensionCocoa.mm:
2949         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
2950         (WebKit::SandboxExtension::createHandleForIOKitClassExtension):
2951         * Shared/SandboxExtension.h:
2952         * Shared/WebProcessCreationParameters.cpp:
2953         (WebKit::WebProcessCreationParameters::encode const):
2954         (WebKit::WebProcessCreationParameters::decode):
2955         * Shared/WebProcessCreationParameters.h:
2956         * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
2957         * UIProcess/API/ios/WKWebViewTestingIOS.mm:
2958         (-[WKWebView _setDeviceHasAGXCompilerServiceForTesting]):
2959         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2960         (WebKit::WebProcessPool::platformInitializeWebProcess):
2961         (WebKit::deviceHasAGXCompilerService): Deleted.
2962         * UIProcess/WebPageProxy.h:
2963         * UIProcess/ios/WebPageProxyIOS.mm:
2964         (WebKit::WebPageProxy::setDeviceHasAGXCompilerServiceForTesting const):
2965         * WebProcess/cocoa/WebProcessCocoa.mm:
2966         (WebKit::WebProcess::platformInitializeWebProcess):
2967
2968 2020-04-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2969
2970         [GTK] UI process crash when entering compositing mode when WPE_RENDERER is enabled
2971         https://bugs.webkit.org/show_bug.cgi?id=209118
2972
2973         Reviewed by Michael Catanzaro.
2974
2975         Check if EGL_WL_bind_wayland_display extension is available when using WPE_RENDERER, since we don't suport the
2976         SHM interface.
2977
2978         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
2979         (WebKit::AcceleratedBackingStoreWayland::checkRequirements): Return false if EGL_WL_bind_wayland_display is not present.
2980
2981 2020-04-17  Rob Buis  <rbuis@igalia.com>
2982
2983         Move allowPlugins to FrameLoader
2984         https://bugs.webkit.org/show_bug.cgi?id=205876
2985
2986         Reviewed by Darin Adler.
2987
2988         Adapt to API change.
2989
2990         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
2991         (WebKit::WebPluginInfoProvider::pluginInfo):
2992         (WebKit::WebPluginInfoProvider::populatePluginCache):
2993         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2994         (WebKit::WebFrameLoaderClient::objectContentType):
2995         * WebProcess/WebPage/WebPage.cpp:
2996         (WebKit::WebPage::createPlugin):
2997         (WebKit::WebPage::canPluginHandleResponse):
2998         (WebKit::WebPage::canShowMIMEType const):
2999
3000 2020-04-16  Peng Liu  <peng.liu6@apple.com>
3001
3002         Cleanup the usage of ENABLE_FULLSCREEN_API
3003         https://bugs.webkit.org/show_bug.cgi?id=210630
3004
3005         Reviewed by Daniel Bates.
3006
3007         Replace "#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API" with
3008         "#if ENABLE(FULLSCREEN_API)".
3009
3010         No new tests, no functional change
3011
3012         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3013         (WKBundlePageSetFullScreenClient):
3014         (WKBundlePageWillEnterFullScreen):
3015         (WKBundlePageDidEnterFullScreen):
3016         (WKBundlePageWillExitFullScreen):
3017         (WKBundlePageDidExitFullScreen):
3018
3019 2020-04-16  Kate Cheney  <katherine_cheney@apple.com>
3020
3021         Distinguish between an empty WKAppBoundDomains array and a missing entry
3022         https://bugs.webkit.org/show_bug.cgi?id=210628
3023         <rdar://problem/61909669>
3024
3025         Reviewed by Brent Fulgham.
3026
3027         Currently we treat a missing WKAppBoundDomains key the same as an empty
3028         key, which is incorrect. Having the key present, even with no entries,
3029         should opt an app into app-bound domain behavior.
3030
3031         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3032         (WebKit::WebsiteDataStore::initializeAppBoundDomains):
3033         (WebKit::WebsiteDataStore::beginAppBoundDomainCheck):
3034
3035 2020-04-16  Brent Fulgham  <bfulgham@apple.com>
3036
3037         Add a new 'limitNavigationsToAppBoundDomains' property to WKWebViewConfiguration 
3038         https://bugs.webkit.org/show_bug.cgi?id=210620
3039         <rdar://problem/61903225>
3040
3041         Reviewed by Andy Estes.
3042
3043         Follow-up fix. The property exposed by WKWebViewConfiguration should not
3044         use a local BOOL; it simply exposes the APIPageConfiguration value.
3045
3046         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3047         (-[WKWebViewConfiguration init]):
3048         (-[WKWebViewConfiguration copyWithZone:]):
3049         (-[WKWebViewConfiguration limitsNavigationToAppBoundDomains]):
3050         (-[WKWebViewConfiguration setLimitsNavigationToAppBoundDomains:]):
3051         (-[WKWebViewConfiguration _setIgnoresAppBoundDomains:]):
3052
3053 2020-04-16  Brent Fulgham  <bfulgham@apple.com>
3054
3055         Switch NetworkProcess and NetworkProcessProxy messages to use CallbackID class
3056         https://bugs.webkit.org/show_bug.cgi?id=210566
3057         <rdar://problem/61791784>
3058
3059         Reviewed by David Kilzer.
3060
3061         Instead of using the raw uint64_t type to represent callbacks, use the purpose
3062         built WebKit::CallbackID type.
3063
3064         Tested by existing cases.
3065
3066         * NetworkProcess/NetworkProcess.cpp:
3067         (WebKit::NetworkProcess::fetchWebsiteData):
3068         (WebKit::NetworkProcess::deleteWebsiteData):
3069         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
3070         * NetworkProcess/NetworkProcess.h:
3071         * NetworkProcess/NetworkProcess.messages.in:
3072         * UIProcess/Network/NetworkProcessProxy.cpp:
3073         (WebKit::NetworkProcessProxy::fetchWebsiteData):
3074         (WebKit::NetworkProcessProxy::deleteWebsiteData):
3075         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
3076         (WebKit::NetworkProcessProxy::didFetchWebsiteData):
3077         (WebKit::NetworkProcessProxy::didDeleteWebsiteData):
3078         (WebKit::NetworkProcessProxy::didDeleteWebsiteDataForOrigins):
3079         * UIProcess/Network/NetworkProcessProxy.h:
3080         * UIProcess/Network/NetworkProcessProxy.messages.in:
3081
3082 2020-04-16  Timothy Horton  <timothy_horton@apple.com>
3083
3084         Try to fix the macCatalyst build
3085
3086         * UIProcess/ios/WKActionSheetAssistant.h:
3087         * UIProcess/ios/WKContentViewInteraction.h:
3088         * UIProcess/ios/WKContentViewInteraction.mm:
3089         (uiImageForImage):
3090         (createTargetedPreview):
3091         (createFallbackTargetedPreview):
3092         (-[WKContentView _createTargetedContextMenuHintPreviewIfPossible]):
3093
3094 2020-04-16  David Kilzer  <ddkilzer@apple.com>
3095
3096         Re-land: [IPC Hardening] MachMessage::create() should use checked arithmetic
3097         <https://webkit.org/b/210572>
3098         <rdar://problem/61729947>
3099
3100         Reviewed by Chris Dumez.
3101
3102         * Platform/IPC/cocoa/ConnectionCocoa.mm:
3103         (IPC::Connection::sendOutgoingMessage):
3104         - Add nullptr check since MachMessage::create() can return an
3105           empty std::unique_ptr<> now.
3106         * Platform/IPC/cocoa/MachMessage.cpp:
3107         (IPC::MachMessage::create):
3108         - Use CheckedSize to compute the buffer size.
3109
3110 2020-04-16  Brent Fulgham  <bfulgham@apple.com>
3111
3112         Add a new 'limitNavigationsToAppBoundDomains' property to WKWebViewConfiguration 
3113         https://bugs.webkit.org/show_bug.cgi?id=210620
3114         <rdar://problem/61903225>
3115
3116         Reviewed by Andy Estes.
3117
3118         Provide a way for Developers to opt-in to AppBound domains through a new WKWebViewConfiguration
3119         property.
3120
3121         This patch only creates the property and exposes the flag to the APIPageConfiguration and
3122         WebPageProxy. A separate patch will take action based on its value.
3123
3124         * UIProcess/API/APIPageConfiguration.cpp:
3125         (API::PageConfiguration::copy const):
3126         * UIProcess/API/APIPageConfiguration.h:
3127         (API::PageConfiguration::limitsNavigationToAppBoundDomains const):
3128         (API::PageConfiguration::setLimitsNavigationToAppBoundDomains):
3129         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
3130         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3131         (-[WKWebViewConfiguration init]):
3132         (-[WKWebViewConfiguration copyWithZone:]):
3133         (-[WKWebViewConfiguration limitsNavigationToAppBoundDomains]):
3134         (-[WKWebViewConfiguration setLimitsNavigationToAppBoundDomains:]):
3135         (-[WKWebViewConfiguration _setIgnoresAppBoundDomains:]): Keep the new property in
3136         sync with this internal flag.
3137         * UIProcess/WebPageProxy.cpp:
3138         (WebKit::m_limitsNavigationToAppBoundDomains):
3139         * UIProcess/WebPageProxy.h:
3140
3141 2020-04-16  Sergio Villar Senin  <svillar@igalia.com>
3142
3143         Unreviewed build fix for non unified builds.
3144
3145         * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: Added missing include.
3146
3147 2020-04-16  Daniel Bates  <dabates@apple.com>
3148
3149         Remove unused -_focusTextInputContext
3150         https://bugs.webkit.org/show_bug.cgi?id=210619
3151
3152         Reviewed by Darin Adler.
3153
3154         While this function was in the "SPI" header, there is no software at Apple that was using
3155         this funciton and I will assume no non-Apple software was using it either.
3156
3157         * UIProcess/API/Cocoa/WKWebView.mm:
3158         (-[WKWebView _focusTextInputContext:completionHandler:]): Deleted.
3159         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3160         * UIProcess/WebPageProxy.cpp:
3161         * UIProcess/WebPageProxy.h:
3162
3163 2020-04-16  Brent Fulgham  <bfulgham@apple.com>
3164
3165         [macOS] Switch unused IOKit classes from allow-with-report to deny-with-report
3166         https://bugs.webkit.org/show_bug.cgi?id=210136
3167         <rdar://problem/61403216>
3168
3169         Reviewed by Per Arne Vollan.
3170
3171         After tracking telemetry for several weeks, we can now safely switch the default state
3172         of a number of IOKit classes from 'allow with telemetry' to 'deny with telemetry'.
3173
3174         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3175  
3176 2020-04-16  Daniel Bates  <dabates@apple.com>
3177
3178         Fix the iOS build when building without EDITABLE_REGION after r260192
3179         (https://bugs.webkit.org/show_bug.cgi?id=210398)
3180
3181         Have -_mayContainEditableElementsInRect compile-time conditionally call WebKit::mayContainEditableElementsInRect().
3182         If ENABLE(EDITABLE_REGION) is not enabled then return NO.
3183
3184         * UIProcess/API/ios/WKWebViewTestingIOS.mm:
3185         (-[WKWebView _mayContainEditableElementsInRect:]):
3186
3187 2020-04-16  David Kilzer  <ddkilzer@apple.com>
3188
3189         Rollout: [IPC Hardening] MachMessage::create() should use checked arithmetic
3190         <https://webkit.org/b/210572>
3191         <rdar://problem/61729947>
3192
3193         Unreviewed rollout of r260160.
3194
3195         Appears to have caused 8 API test failures on iOS.
3196
3197         * Platform/IPC/cocoa/ConnectionCocoa.mm:
3198         (IPC::Connection::sendOutgoingMessage):
3199         * Platform/IPC/cocoa/MachMessage.cpp:
3200         (IPC::MachMessage::create):
3201
3202 2020-04-16  Brent Fulgham  <bfulgham@apple.com>
3203
3204         REGRESSION(r260081) Broke iOS PLT due to InjectedBundle initialization (edit)
3205         https://bugs.webkit.org/show_bug.cgi?id=210582
3206         <rdar://problem/61838584>
3207
3208         Reviewed by Darin Adler.
3209
3210         The changes in r260081 began enforcing NSSecureCoding best practices, triggering
3211         a bug in InjectedBundleMac.mm, which is used by iOS as well.
3212
3213         This patch does the following:
3214
3215         1. Delays parameter decoding until we use the appropriate InjectedBundle mechanism
3216            for expressing the valid classes to use in the Unarchiver.
3217         2. Removes a temporary workaround needed to get PLT running on iOS again.
3218
3219         This patch also moves the check of the CFBundleGetFunctionPointerForName slightly earlier
3220         so we can use a single function pointer check, and only invoke the parameter decoding
3221         if we are using the C API.
3222         
3223         If not, we delay parameter decoding until we have constructed the WKWebProcessPlugIn
3224         object so we can consume it's 'additionalClassesForParameterCoder' before calling
3225         its initialization method.
3226
3227         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
3228         (WebKit::InjectedBundle::decodeBundleParameters): Remove temporary workaround
3229         needed to get PLT working again. Instead of using a debug assert, return as
3230         a decoding failure if the resulting object is not an NSDictionary.
3231         (WebKit::InjectedBundle::initialize): Delay decoding the bundle parameters on
3232         iOS until the Plugin's additionalClassesForParameterCoder method can be called.
3233
3234 2020-04-16  Daniel Bates  <dabates@apple.com>
3235
3236         [iOS] Add a way to focus a text input and place a caret
3237         https://bugs.webkit.org/show_bug.cgi?id=210611
3238         <rdar://problem/61893062>
3239
3240         Reviewed by Darin Adler.
3241
3242         Add some IPI that will be used by code in WebKitAdditions to focus a text input context
3243         and place the caret in it. This will replace the existing -focusTextInput SPI, which I
3244         will remove in a subsequent commit.
3245
3246         * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
3247         * UIProcess/API/ios/WKWebViewTestingIOS.mm:
3248         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Fix up code style
3249         of signature while I am here.
3250         (-[WKWebView _focusTextInputContext:placeCaretAt:completionHandler:]): Added.
3251         * UIProcess/WebPageProxy.h:
3252         * UIProcess/ios/WKContentViewInteraction.h:
3253         * UIProcess/ios/WKContentViewInteraction.mm:
3254         (-[WKContentView _isTextInputContextFocused:]): Added.
3255         (-[WKContentView _focusTextInputContext:placeCaretAt:completionHandler:]): Added.
3256         (-[WKContentView _requestTextInputContextsInRect:completionHandler:]): Fix up code style
3257         of signature while I am here.
3258         * UIProcess/ios/WebPageProxyIOS.mm:
3259         (WebKit::WebPageProxy::focusTextInputContextAndPlaceCaret):
3260         * WebProcess/WebPage/WebPage.cpp:
3261         (WebKit::WebPage::focusTextInputContext): Use auto now that elementForContext() returns a RefPtr.
3262         (WebKit::WebPage::elementForContext const): Have it return a RefPtr instead of a raw
3263         pointer so callers don't have to remember to take out a ref of otherwise be mindful
3264         of the element's lifetime.
3265         * WebProcess/WebPage/WebPage.h:
3266         * WebProcess/WebPage/WebPage.messages.in:
3267         * WebProcess/WebPage/ios/WebPageIOS.mm:
3268         (WebKit::WebPage::removeTextPlaceholder): Use auto now that elementForContext() returns a RefPtr.
3269         (WebKit::WebPage::requestDocumentEditingContext): Ditto.
3270         (WebKit::WebPage::focusTextInputContextAndPlaceCaret): Added.
3271
3272 2020-04-16  Chris Dumez  <cdumez@apple.com>
3273
3274         Use safeRoundPage() instead of round_page() in SharedMemory
3275         https://bugs.webkit.org/show_bug.cgi?id=210608
3276         <rdar://problem/60600443>
3277
3278         Reviewed by Geoffrey Garen.
3279
3280         Use new safeRoundPage() instead of round_page() in SharedMemory, to deal safely with overflows.
3281
3282         * Platform/cocoa/SharedMemoryCocoa.cpp:
3283         (WebKit::SharedMemory::allocate):
3284         (WebKit::makeMemoryEntry):
3285         (WebKit::SharedMemory::~SharedMemory):
3286         (WebKit::SharedMemory::createHandle):
3287
3288 2020-04-16  Adrian Perez de Castro  <aperez@igalia.com>
3289
3290         Non-unified build fixes mid April 2020 edition
3291         https://bugs.webkit.org/show_bug.cgi?id=210599
3292
3293         Unreviewed build fix.
3294
3295         * UIProcess/DeviceIdHashSaltStorage.cpp: Add missing Logging.h header.
3296         * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp:
3297         (WebKit::WebInspectorProxy::platformSetForcedAppearance): Add missing WebCore:: namespace
3298         prefix.
3299         * UIProcess/linux/MemoryPressureMonitor.h: Add missing wtf/text/CString.h header.
3300
3301 2020-04-16  Daniel Bates  <dabates@apple.com>
3302
3303         REGRESSION (r259762): Should always hit test for editable elements if the WKWebView is fully editable
3304         https://bugs.webkit.org/show_bug.cgi?id=210558
3305         <rdar://problem/61798347>
3306
3307         Reviewed by Wenson Hsieh.
3308
3309         If the entire WKWebView is marked editable (via SPI -[WKWebView _setEditable]) then
3310         always ask the web process to hit test the page because every element is considered
3311         editable.
3312
3313         * UIProcess/ios/WKContentViewInteraction.mm:
3314         (-[WKContentView _requestTextInputContextsInRect:completionHandler:]):
3315
3316 2020-04-16  Daniel Bates  <dabates@apple.com>
3317
3318         Move -_requestTextInputContextsInRect to WKContentView to simplify implementation
3319         https://bugs.webkit.org/show_bug.cgi?id=210398
3320         <rdar://problem/61656931>
3321
3322         Reviewed by Darin Adler.
3323
3324         -_requestTextInputContextsInRect is not needed on Mac, but supporting it complicates
3325         its implementation: it has to deal with coordinate space differences due to differences
3326         in what is the root view on Mac and iOS + it has to know about iOS's custom content views.
3327         While this function was in the "SPI" header, there is no software at Apple that was using
3328         these outside of WebKit, and I will assume no non-Apple software was using them either.
3329         Moving this function to WKContentView lets me simplify the implementation.
3330
3331         * Platform/spi/ios/UIKitSPI.h: Add more forward declarations.
3332         * UIProcess/API/Cocoa/WKWebView.mm:
3333         (-[WKWebView _convertRectFromRootViewCoordinates:]): Deleted.
3334         (-[WKWebView _convertRectToRootViewCoordinates:]): Deleted.
3335         (-[WKWebView _mayContainEditableElementsInRect:]): Deleted; moved to WKWebViewTestingIOS.mm.
3336         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Deleted; moved to WKContentViewInteraction.mm.
3337         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3338         * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
3339         * UIProcess/API/ios/WKWebViewTestingIOS.mm:
3340         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Added. Turns around and
3341         calls the function of the same name on the WKContentView. It takes care to convert the specified
3342         rect from WKWebView coordinates to WKContentView coordinates and fixes up the bounding rects
3343         for the returned contexts to be in WKWebView coordinates. This keeps existings tests passing
3344         as mekes using this function intuitive since callers specify and get rects in WKWebView coordinates.
3345         (-[WKWebView _requestDocumentContext:completionHandler:]): Added.
3346         (-[WKWebView _adjustSelectionWithDelta:completionHandler:]): Added.
3347         (-[WKWebView _mayContainEditableElementsInRect:]): Moved from WKWebView.mm.
3348         * UIProcess/ios/WKContentViewInteraction.h:
3349         * UIProcess/ios/WKContentViewInteraction.mm:
3350         (-[WKContentView _requestTextInputContextsInRect:completionHandler:]): Moved from WKWebView.mm and simplified.
3351
3352 2020-04-16  David Kilzer  <ddkilzer@apple.com>
3353
3354         [IPC Hardening] Use ObjectIdentifier<> for LegacyCustomProtocol
3355         <https://webkit.org/b/210580>
3356         <rdar://problem/61791686>
3357
3358         Reviewed by Chris Dumez.
3359
3360         Replace uses of uint64_t with LegacyCustomProtocolID.
3361
3362         * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
3363         (WebKit::LegacyCustomProtocolManager::didFailWithError):
3364         (WebKit::LegacyCustomProtocolManager::didLoadData):
3365         (WebKit::LegacyCustomProtocolManager::didReceiveResponse):
3366         (WebKit::LegacyCustomProtocolManager::didFinishLoading):
3367         (WebKit::LegacyCustomProtocolManager::wasRedirectedToRequest):
3368         (WebKit::LegacyCustomProtocolManager::protocolForID):
3369         * NetworkProcess/CustomProtocols/LegacyCustomProtocolID.h: Add.
3370         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
3371         (WebKit::LegacyCustomProtocolManager::addCustomProtocol):
3372         (WebKit::LegacyCustomProtocolManager::removeCustomProtocol):
3373         (WebKit::LegacyCustomProtocolManager::startLoading):
3374         (WebKit::LegacyCustomProtocolManager::stopLoading):
3375         (WebKit::generateCustomProtocolID): Delete.
3376         - Replace with LegacyCustomProtocolID::generate().
3377         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
3378         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.messages.in:
3379         * Scripts/webkit/messages.py:
3380         * UIProcess/API/APICustomProtocolManagerClient.h:
3381         (API::CustomProtocolManagerClient::startLoading):
3382         (API::CustomProtocolManagerClient::stopLoading):
3383         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.h:
3384         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
3385         (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
3386         (WebKit::LegacyCustomProtocolManagerClient::startLoading):
3387         (WebKit::LegacyCustomProtocolManagerClient::stopLoading):
3388         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp:
3389         (WebKit::LegacyCustomProtocolManagerProxy::startLoading):
3390         (WebKit::LegacyCustomProtocolManagerProxy::stopLoading):
3391         (WebKit::LegacyCustomProtocolManagerProxy::wasRedirectedToRequest):
3392         (WebKit::LegacyCustomProtocolManagerProxy::didReceiveResponse):
3393         (WebKit::LegacyCustomProtocolManagerProxy::didLoadData):
3394         (WebKit::LegacyCustomProtocolManagerProxy::didFailWithError):
3395         (WebKit::LegacyCustomProtocolManagerProxy::didFinishLoading):
3396         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h:
3397         - Remove unused typedef and instance variable.
3398         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.messages.in:
3399         * WebKit.xcodeproj/project.pbxproj:
3400         - Add LegacyCustomProtocolID.h to project.
3401
3402 2020-04-16  Tim Horton  <timothy_horton@apple.com>
3403
3404         REGRESSION (r259898): WebKit-based Books views are all blank
3405         https://bugs.webkit.org/show_bug.cgi?id=210590
3406         <rdar://problem/61791109>
3407
3408         Reviewed by Chris Dumez.
3409
3410         * UIProcess/Cocoa/WebViewImpl.h:
3411         * UIProcess/Cocoa/WebViewImpl.mm:
3412         (WebKit::WebViewImpl::enterAcceleratedCompositingWithRootLayer):
3413         (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer):
3414         (WebKit::WebViewImpl::setAcceleratedCompositingRootLayerAfterFlush): Deleted.
3415         * UIProcess/mac/PageClientImplMac.mm:
3416         (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
3417         (WebKit::PageClientImpl::didFirstLayerFlush):
3418         The changes to setAcceleratedCompositingRootLayer in r259898 proved
3419         to be wrong in a second way (the first being fixed in r260104): when
3420         setAcceleratedCompositingRootLayer is called from updateAcceleratedCompositingMode,
3421         because the layer hosting mode changed (Books appears to use app-hosted layers),
3422         it incorrectly identified the root layer change as a process swap, resulting
3423         in the correct layer never being unhidden.
3424
3425         This is enough mistakes that I'm going to try a different approach:
3426         put setAcceleratedCompositingRootLayer back to the way it was before, where
3427         it immediately updates the layer without any smarts, remove
3428         setAcceleratedCompositingRootLayerAfterFlush, because it's no longer necessary,
3429         and add enterAcceleratedCompositingWithRootLayer, which is specifically only
3430         called in the case where DrawingArea will for-sure send us a follow-up
3431         (didFirstLayerFlush) that will unhide the root layer.
3432
3433 2020-04-16  Eric Carlson  <eric.carlson@apple.com>
3434
3435         [macOS] Update ScreenTime as playback state changes
3436         https://bugs.webkit.org/show_bug.cgi?id=210518
3437         <rdar://problem/61181092>
3438
3439         Reviewed by Jer Noble.
3440
3441         Add a manager that gets media element state changes, and a Cocoa-specific
3442         implementation that passes that state to ScreenTime.
3443
3444         * Scripts/webkit/messages.py:
3445         * Sources.txt:
3446         * SourcesCocoa.txt:
3447         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3448         (WebKit::WebPageProxy::mediaUsageManager):
3449         (WebKit::WebPageProxy::addMediaUsageManagerSession):
3450         (WebKit::WebPageProxy::updateMediaUsageManagerSessionState):
3451         (WebKit::WebPageProxy::removeMediaUsageManagerSession):
3452         * UIProcess/Media/MediaUsageManager.cpp: Added.
3453         (WebKit::MediaUsageManager::create):
3454         (WebKit::reset):
3455         (WebKit::MediaUsageManager::addMediaSession):
3456         (WebKit::MediaUsageManager::removeMediaSession):
3457         (WebKit::MediaUsageManager::updateMediaUsage):
3458         * UIProcess/Media/MediaUsageManager.h: Added.
3459         * UIProcess/Media/cocoa/MediaUsageManagerCocoa.h: Added.
3460         (WebKit::MediaUsageManagerCocoa::SessionMediaUsage::SessionMediaUsage):
3461         * UIProcess/Media/cocoa/MediaUsageManagerCocoa.mm: Added.
3462         (WebKit::usageTrackingAvailable):
3463         (WebKit::MediaUsageManager::create):
3464         (WebKit::MediaUsageManagerCocoa::~MediaUsageManagerCocoa):
3465         (WebKit::MediaUsageManagerCocoa::reset):
3466         (WebKit::MediaUsageManagerCocoa::addMediaSession):
3467         (WebKit::MediaUsageManagerCocoa::removeMediaSession):
3468         (WebKit::MediaUsageManagerCocoa::updateMediaUsage):
3469         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
3470         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
3471         * UIProcess/WebPageProxy.cpp:
3472         * UIProcess/WebPageProxy.h:
3473         * UIProcess/WebPageProxy.messages.in:
3474         * WebKit.xcodeproj/project.pbxproj:
3475         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3476         (WebKit::WebChromeClient::addMediaUsageManagerSession):
3477         (WebKit::WebChromeClient::updateMediaUsageManagerSessionState):
3478         (WebKit::WebChromeClient::removeMediaUsageManagerSession):
3479         * WebProcess/WebCoreSupport/WebChromeClient.h:
3480         * WebProcess/WebPage/WebPage.cpp:
3481         (WebKit::WebPage::addMediaUsageManagerSession):
3482         (WebKit::WebPage::updateMediaUsageManagerSessionState):
3483         (WebKit::WebPage::removeMediaUsageManagerSession):
3484         * WebProcess/WebPage/WebPage.h:
3485
3486 2020-04-16  David Kilzer  <ddkilzer@apple.com>
3487
3488         [IPC hardening] DrawingArea::updateBackingStoreState() is not used on Apple platforms
3489         <https://webkit.org/b/210585>
3490         <rdar://problem/61802011>
3491
3492         Reviewed by Geoffrey Garen.
3493
3494         * UIProcess/DrawingAreaProxy.h:
3495         * UIProcess/DrawingAreaProxy.messages.in:
3496         * WebProcess/WebPage/DrawingArea.h:
3497         (WebKit::DrawingArea::updateBackingStoreState):
3498         * WebProcess/WebPage/DrawingArea.messages.in:
3499         - Use USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER) to
3500           protect code not used on Apple platforms.
3501
3502 2020-04-16  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3503
3504         [GTK] MiniBrowser opens new windows too small causing failures on some WPT tests
3505         https://bugs.webkit.org/show_bug.cgi?id=210206
3506
3507         Reviewed by Carlos Garcia Campos.
3508
3509         Provide the size of the default window (if is set) when windowRect is called
3510         before the window is shown.
3511
3512         * UIProcess/API/glib/WebKitUIClient.cpp:
3513
3514 2020-04-16  Tomoki Imai  <Tomoki.Imai@sony.com>
3515
3516         TextureMapper renders video element with "object-fit: cover" incorrectly
3517         https://bugs.webkit.org/show_bug.cgi?id=210544
3518
3519         Reviewed by Žan Doberšek.
3520
3521         Propagate GraphicsLayer::contentsClippingRect information to TextureMapperLayer
3522         to properly clip the outside of DOM element when the element has "object-fit: cover".
3523
3524         Unfortunately, the test is disabled on WebKitGTK due to bug 177536, bug 163528.
3525         Test: compositing/video/video-object-fit.html
3526
3527         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3528         (WebKit::CoordinatedGraphicsScene::updateSceneState):
3529
3530 2020-04-15  Jer Noble  <jer.noble@apple.com>
3531
3532         REGRESSION (r260102): ASSERTION FAILED: m_arbitrators.contains(proxy) in WebKit::SharedArbitrator::endRoutingArbitrationForArbitrator
3533         https://bugs.webkit.org/show_bug.cgi?id=210589
3534         <rdar://problem/61844208>
3535
3536         Reviewed by Eric Carlson.
3537
3538         Protect against an assertion in the SharedArbitrator in case where a WebProcess is terminated before it can call
3539         endRoutingArbitration().
3540
3541         * UIProcess/Media/AudioSessionRoutingArbitratorProxy.cpp:
3542         (WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate):
3543         * UIProcess/Media/AudioSessionRoutingArbitratorProxy.h:
3544         * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
3545         (WebKit::SharedArbitrator::isInRoutingArbitrationForArbitrator):
3546         (WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator):
3547         (WebKit::SharedArbitrator::endRoutingArbitrationForArbitrator):
3548         (WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate):
3549         * UIProcess/WebProcessProxy.cpp:
3550         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
3551
3552 2020-04-15  Tim Horton  <timothy_horton@apple.com>
3553
3554         REGRESSION (r258337): Crash when right clicking on link that uses the system UI font with optimizeLegibility on Mojave
3555         https://bugs.webkit.org/show_bug.cgi?id=210575
3556         <rdar://problem/61646717>
3557
3558         Reviewed by Darin Adler.
3559
3560         * Shared/Cocoa/ArgumentCodersCocoa.mm:
3561         (-[WKSecureCodingFontAttributeNormalizer archiver:willEncodeObject:]):
3562         (IPC::encodeSecureCodingInternal):
3563         The workaround introduced in r250640 and r251086 for archiving NSFonts
3564         with optical sizing attributes is still incomplete, which was recently
3565         revealed by making decoding failures more apparent (in r258337).
3566
3567         Specifically, the workaround was not applied to fonts encoded inside
3568         NSAttributedStrings, which are encoded using a keyed archiver... only
3569         to fonts encoded directly with CoreIPC.
3570
3571         Use a NSKeyedArchiver delegate to apply our fix-up to the optical sizing
3572         attribute when any NSFont is being encoded, and only on platforms
3573         that still exhibit the bug.
3574
3575         * Shared/Cocoa/CoreTextHelpers.h:
3576         * Shared/Cocoa/CoreTextHelpers.mm:
3577         (WebKit::fontWithAttributes):
3578         (WebKit::fontDescriptorWithFontAttributes): Deleted.
3579         * UIProcess/Cocoa/WebViewImpl.mm:
3580         (WebKit::WebViewImpl::updateFontManagerIfNeeded):
3581         * UIProcess/mac/WebPopupMenuProxyMac.mm:
3582         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
3583         Refactor fontDescriptorWithFontAttributes to just return a font since that's what all callers actually want.
3584
3585 2020-04-15  John Wilander  <wilander@apple.com>
3586
3587         Add SPI to configure WebsiteDataStores with a URL for standalone web applications and use it to disable first-party website data removal in ITP
3588         https://bugs.webkit.org/show_bug.cgi?id=209634
3589         <rdar://problem/60943970>
3590
3591         Reviewed by Alex Christensen.
3592
3593         This change adds a new property to _WKWebsiteDataStoreConfiguration.h called
3594         standaloneApplicationURL with which the hosting application can inform the
3595         website data store that it's running as a standalone web application.
3596
3597         This change also forwards an existing standaloneApplicationURL as a
3598         WebCore::RegistrableDomain into ITP so that explicit exemptions can be made
3599         to first parties of standalone web applications. The exemptions made here
3600         all for all of ITP's website data removal. This part of the change is
3601         covered by the new layout tests.
3602
3603         Tests: http/tests/resourceLoadStatistics/standalone-web-application-exempt-from-website-data-deletion-database.html
3604                http/tests/resourceLoadStatistics/standalone-web-application-exempt-from-website-data-deletion.html
3605
3606         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3607         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3608         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor):
3609         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
3610         (WebKit::ResourceLoadStatisticsStore::setStandaloneApplicationDomain):
3611         (WebKit::ResourceLoadStatisticsStore::standaloneApplicationDomain const):
3612         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3613         (WebKit::WebResourceLoadStatisticsStore::setStandaloneApplicationDomain):
3614         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3615         * NetworkProcess/NetworkSession.cpp:
3616         (WebKit::NetworkSession::NetworkSession):
3617         (WebKit::NetworkSession::forwardResourceLoadStatisticsSettings):
3618         * NetworkProcess/NetworkSession.h:
3619         * Shared/ResourceLoadStatisticsParameters.h:
3620         (WebKit::ResourceLoadStatisticsParameters::encode const):
3621         (WebKit::ResourceLoadStatisticsParameters::decode):
3622         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
3623         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
3624         (-[_WKWebsiteDataStoreConfiguration standaloneApplicationURL]):
3625         (-[_WKWebsiteDataStoreConfiguration setStandaloneApplication:]):
3626         * UIProcess/WebProcessPool.cpp:
3627         (WebKit::WebProcessPool::ensureNetworkProcess):
3628         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3629         (WebKit::WebsiteDataStore::platformSetNetworkParameters):
3630         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
3631         (WebKit::WebsiteDataStoreConfiguration::copy const):
3632         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
3633         (WebKit::WebsiteDataStoreConfiguration::standaloneApplicationURL const):
3634         (WebKit::WebsiteDataStoreConfiguration::setStandaloneApplicationURL):
3635
3636 2020-04-15  Chris Dumez  <cdumez@apple.com>
3637
3638         [IPC Hardening] MachMessage::messageSize() should use checked arithmetic
3639         https://bugs.webkit.org/show_bug.cgi?id=210567
3640         <rdar://problem/61734355>
3641
3642         Reviewed by Geoffrey Garen.
3643
3644         Replace call to round_msg() call with a call to our new safeRoundMsg() which does
3645         the same alignment up but using checked arithmetic to protect against overflows.
3646
3647         * Platform/IPC/cocoa/MachMessage.cpp:
3648         (IPC::safeRoundMsg):
3649         (IPC::MachMessage::messageSize):
3650
3651 2020-04-15  David Kilzer  <ddkilzer@apple.com>
3652
3653         [IPC Hardening] MachMessage::create() should use checked arithmetic
3654         <https://webkit.org/b/210572>
3655         <rdar://problem/61729947>
3656
3657         Reviewed by Chris Dumez.
3658
3659         * Platform/IPC/cocoa/ConnectionCocoa.mm:
3660         (IPC::Connection::sendOutgoingMessage):
3661         - Add nullptr check since MachMessage::create() can return an
3662           empty std::unique_ptr<> now.
3663         * Platform/IPC/cocoa/MachMessage.cpp:
3664         (IPC::MachMessage::create):
3665         - Use CheckedSize to compute the buffer size.
3666
3667 2020-04-15  Brent Fulgham  <bfulgham@apple.com>
3668
3669         Unreviewed PLT fix after r260081.
3670
3671         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
3672         (WebKit::InjectedBundle::decodeBundleParameters):
3673
3674 2020-04-15  Ben Nham  <nham@apple.com>
3675
3676         DidFirstLayerFlush IPC can be head-of-line-blocked and delay first paint by 200+ ms on process swap
3677         https://bugs.webkit.org/show_bug.cgi?id=210571
3678
3679         Reviewed by Geoffrey Garen.
3680
3681         When we process swap, the layer swap/unhiding for the new hosted layer is gated by the
3682         DidFirstLayerFlush IPC. But actually sending this IPC can be head-of-line blocked for an
3683         arbitrarily long time because we append it to the queue of messages for the main run loop to
3684         process. In some cases, e.g. for the NYT PLT content, this blocks first paint by 200 ms
3685         while the WebProcess main thread is busy doing other things (like executing deferred
3686         scripts).
3687
3688         To fix this, use a CATransaction commit handler to send the IPC right after we commit.
3689
3690         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3691         (WebKit::TiledCoreAnimationDrawingArea::sendDidFirstLayerFlushIfNeeded):
3692
3693 2020-04-15  Wenson Hsieh  <wenson_hsieh@apple.com>
3694
3695         Unreviewed, fix the watchOS and tvOS builds after r260146
3696
3697         Move some code for controlling the presentation of context menus on iOS behind USE(UICONTEXTMENU).
3698
3699         * UIProcess/ios/WKActionSheetAssistant.h:
3700         * UIProcess/ios/WKContentViewInteraction.mm:
3701
3702 2020-04-15  Peng Liu  <peng.liu6@apple.com>
3703
3704         Video elements don't return to the correct position when exiting fullscreen
3705         https://bugs.webkit.org/show_bug.cgi?id=210529
3706
3707         Reviewed by Jer Noble.
3708
3709         Some web pages use the "resize" event handler to calculate the element size after
3710         they exit fullscreen, and the calculation is based on the container element size which
3711         might be affected by the fullscreen mode.
3712
3713         We need to call WebPageProxy::setNeedsDOMWindowResizeEvent() to fire the "resize" event
3714         in the repaint callback after the exiting fullscreen process is completed and the
3715         possible layout change due to exiting fullscreen is done. Otherwise the size calculation
3716         might be wrong.
3717
3718         * UIProcess/WebPageProxy.cpp:
3719         * UIProcess/WebPageProxy.h:
3720         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3721         (-[WKFullScreenWindowController _completedExitFullScreen]):
3722         * UIProcess/mac/WKFullScreenWindowController.mm:
3723         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
3724         * WebProcess/WebPage/WebPage.cpp:
3725         (WebKit::WebPage::setNeedsDOMWindowResizeEvent):
3726         * WebProcess/WebPage/WebPage.h:
3727         * WebProcess/WebPage/WebPage.messages.in:
3728
3729 2020-04-15  Wenson Hsieh  <wenson_hsieh@apple.com>
3730
3731         [iPadOS] Some pages indefinitely zoom in and out due to idempotent text autosizing
3732         https://bugs.webkit.org/show_bug.cgi?id=210551
3733         <rdar://problem/56820674>
3734
3735         Reviewed by Tim Horton.
3736
3737         On a non-responsive web page with one or lines of non-wrapping text of a specific length (just under 1920px),
3738         it's possible for the combination of idempotent text autosizing heuristics and viewport shrink-to-fit to cause
3739         the single line of text to grow and shrink in size indefinitely, and additionally cause the initial scale to
3740         thrash between multiple values indefinitely. This manifests in the entire page repeatedly zooming in and out
3741         immediately after page load.
3742
3743         Consider the following scenario:
3744
3745         (1) A viewport configuration change (e.g. due to parsing the viewport meta tag) schedules the timer to reset
3746             idempotent text autosizing. Let's suppose the page has a really long line of non-wrapping 12px text that is
3747             below 1920px wide.
3748
3749         (2) The timer fires, invalidating styles and recomputing text autosizing given the current initial scale. The
3750             current initial scale is below 1, since ViewportConfiguration will attempt to shrink to fit the page to
3751             avoid horizontal scrolling. This causes text autosizing to boost the long line of text to a larger value
3752             (let's say 17px).
3753
3754         (3) The next time we perform style recomputation and layout, we discover that the content width of the page is
3755             now larger than 1920px, which is the maximum width which we'll attempt to shrink to fit; when computing
3756             initial scale, we give up trying to shrink down to avoid making the inital scale too small, and instead just
3757             keep it at 1.
3758
3759         (4) This change in viewport configuration then schedules another idempotent text autosizing reset. When this
3760             timer fires, it sees that the initial scale is now 1, which means that the text is no longer boosted, so we
3761             make the single line of text small again (12px).
3762
3763         (5) After the next style recomputation and layout, this causes the content width of the page to dip below the
3764             1920px threshold, causing the initial scale to dip below 1 again. As detailed above, this schedules another
3765             idempotent text autosizing update, which now boosts font size once again, and the cycle continues.
3766
3767         To fix this, instead of consulting the initial scale (`ViewportConfiguration::initialScale()`) when computing
3768         the boosted font size for idempotent text autosizing, we can instead ask for the initial scale ignoring content
3769         size (`ViewportConfiguration::initialScaleIgnoringContentSize()`). This prevents changes in content size due to
3770         idempotent autosizing from affecting the idempotent autosizing heuristic (through the different initial scale),
3771         and ensures that this method of text autosizing actually remains idempotent.
3772
3773         * WebProcess/WebPage/ios/WebPageIOS.mm:
3774         (WebKit::WebPage::resetIdempotentTextAutosizingIfNeeded):
3775         (WebKit::WebPage::viewportConfigurationChanged):
3776
3777 2020-04-14  Megan Gardner  <megan_gardner@apple.com>
3778
3779         Data Detected Actions sheets are presented from odd locations.
3780         https://bugs.webkit.org/show_bug.cgi?id=210531
3781         <rdar://problem/60941346>
3782
3783         Reviewed by Wenson Hsieh.
3784
3785         Use the existing context menu targeted preview code to ensure that the
3786         data detected menus are presented in a good location.
3787
3788         * UIProcess/ios/WKActionSheetAssistant.h:
3789         * UIProcess/ios/WKActionSheetAssistant.mm:
3790         (-[WKActionSheetAssistant contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
3791         * UIProcess/ios/WKContentViewInteraction.mm:
3792         (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]):
3793
3794 2020-04-15  Per Arne Vollan  <pvollan@apple.com>
3795
3796         [iOS] Potential crash under WebProcess::platformInitializeWebProcess
3797         https://bugs.webkit.org/show_bug.cgi?id=210547
3798
3799         Reviewed by Brent Fulgham.
3800
3801         If the UI process fails to issue an extension to the runningboard service, the WebContent process will crash
3802         while trying to consume this extension.
3803
3804         No new tests, since the test runners are unsandboxed, so issuing the extension will always succeed.
3805
3806         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3807         (WebKit::WebProcessPool::platformInitializeWebProcess):
3808         * WebProcess/cocoa/WebProcessCocoa.mm:
3809         (WebKit::WebProcess::platformInitializeWebProcess):
3810
3811 2020-04-15  Brent Fulgham  <bfulgham@apple.com>
3812
3813         [Cocoa] Remove generic parameter serialization fallback
3814         https://bugs.webkit.org/show_bug.cgi?id=210509
3815         <rdar://problem/55522650>
3816
3817         Reviewed by Geoffrey Garen.
3818
3819         Tested by BundleFormDelegate parameter serialization tests...
3820
3821         * UIProcess/API/Cocoa/WKWebView.mm:
3822         (-[WKWebView _setInputDelegate:]):
3823         * UIProcess/ios/PageClientImplIOS.mm:
3824         (WebKit::PageClientImpl::elementDidFocus):
3825
3826 2020-04-15  Chris Dumez  <cdumez@apple.com>
3827
3828         REGRESSION (r259610): WebGL does not work at all on iOS (was: Google Maps tiles turn black after initial load)
3829         <rdar://problem/61794480>
3830
3831         Unreviewed, partial revert of r259610 because it broke Google Maps.
3832         Stop using RunningBoard for the "Foreground" assertion because it fails to
3833         give the target GPU access.
3834
3835         * UIProcess/ios/ProcessAssertionIOS.mm:
3836         (WebKit::runningBoardNameForAssertionType):
3837
3838 2020-04-15  Carlos Garcia Campos  <cgarcia@igalia.com>
3839
3840         [GTK4] Fix use of gtk init functions
3841         https://bugs.webkit.org/show_bug.cgi?id=210550
3842
3843         Reviewed by Adrian Perez de Castro.
3844
3845         Include GtkVersioning.h instead of gtk.h
3846
3847         * WebProcess/gtk/WebProcessMainGtk.cpp:
3848
3849 2020-04-15  Peng Liu  <peng.liu6@apple.com>
3850
3851         Adopt interface AVAudioRoutingArbiter for Mac
3852         https://bugs.webkit.org/show_bug.cgi?id=210167
3853
3854         Reviewed by Jer Noble.
3855
3856         A follow-up patch to fix a build error.
3857
3858         * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
3859         (WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator):
3860
3861 2020-04-15  Adrian Perez de Castro  <aperez@igalia.com>
3862
3863         [GTK4] Provide an alternative to gtk_widget_{get,is}_toplevel()
3864         https://bugs.webkit.org/show_bug.cgi?id=210463
3865
3866         Reviewed by Carlos Garcia Campos.
3867
3868         * UIProcess/API/glib/WebKitUIClient.cpp: Adapt to take into account that GTK4 does not
3869         provide the GtkWidget.configure-event signal.
3870
3871 2020-04-15  Said Abou-Hallawa  <sabouhallawa@apple.com>
3872
3873         Unreviewed, reverting r259891.
3874
3875         Causes significant iOS MotionMark regression
3876
3877         Reverted changeset:
3878
3879         "Switch unused IOKit classes from allow-with-report to deny-
3880         with-report"
3881         https://bugs.webkit.org/show_bug.cgi?id=210136
3882         https://trac.webkit.org/changeset/259891
3883
3884 2020-04-14  Megan Gardner  <megan_gardner@apple.com>
3885
3886         File Upload Menus presented from odd locations.
3887         https://bugs.webkit.org/show_bug.cgi?id=210523
3888         <rdar://problem/60390846>
3889
3890         Use the existing context menu targeted preview code to ensure that the
3891         file menus are presented in a good location.
3892
3893         Reviewed by Wenson Hsieh.
3894
3895         * UIProcess/ios/WKContentViewInteraction.h:
3896         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3897         (-[WKFileUploadPanel contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
3898
3899 2020-04-14  David Kilzer  <ddkilzer@apple.com>
3900
3901         dictionaryValueOfType() in WebCoreArgumentCodersMac.mm can be replaced with dynamic_cf_cast<>()
3902         <https://webkit.org/b/210456>
3903
3904         Reviewed by Darin Adler.
3905
3906         * Shared/mac/WebCoreArgumentCodersMac.mm:
3907         (IPC::dictionaryValueOfType): Delete.
3908         (IPC::extractDictionaryValue): Add.
3909         - Use dynamic_cf_cast<>() in place of manually checking the
3910           CFTypeID of each object.
3911         (IPC::createArchiveList):
3912         - Call new extractDictionaryValue() template function to verify
3913           values are the correct types in the dictionary and to set the
3914           output variables.
3915
3916 2020-04-14  David Kilzer  <ddkilzer@apple.com>
3917
3918         Use CFArrayGetValues() in createArchiveList() in WebCoreArgumentCodersMac.mm
3919         <https://webkit.org/b/210519>
3920
3921         Reviewed by Darin Adler.
3922
3923         * Shared/mac/WebCoreArgumentCodersMac.mm:
3924         (IPC::createArchiveList):
3925         - Use CFArrayGetValues() to copy array more efficiently.
3926
3927 2020-04-14  Tim Horton  <timothy_horton@apple.com>
3928
3929         REGRESSION (r259898): Tabs occasionally go blank and get stuck that way
3930         https://bugs.webkit.org/show_bug.cgi?id=210520
3931         <rdar://problem/61776830>
3932
3933         Reviewed by Simon Fraser.
3934
3935         * UIProcess/Cocoa/WebViewImpl.mm:
3936         (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer):
3937         setThumbnailView calls setAcceleratedCompositingRootLayer in order to reconnect the
3938         existing root layer. After r259898, this would cause us to go down the
3939         process-swap path, and hide the root layer, and nothing would ever
3940         come along and fix it.
3941
3942         If setAcceleratedCompositingRootLayer is called with the existing root
3943         layer, that cannot be a process swap, so ignore it and proceed as before.
3944
3945 2020-04-14  Jer Noble  <jer.noble@apple.com>
3946
3947         Adopt interface AVAudioRoutingArbiter for Mac
3948         https://bugs.webkit.org/show_bug.cgi?id=210167
3949         <rdar://problem/59113994>
3950
3951         Reviewed by Eric Carlson.
3952
3953         Add a new cross-process object pair, AudioSessionRouterAbitrator/Proxy which passes routing
3954         arbitration commands from WebContent -> UIProcess. Because the UIProcess can represent
3955         multiple WebContent processes, it must track all outstanding arbitration requests globally.
3956
3957         * DerivedSources-input.xcfilelist:
3958         * DerivedSources-output.xcfilelist:
3959         * DerivedSources.make:
3960         * GPUProcess/GPUProcess.cpp:
3961         (WebKit::GPUProcess::initializeGPUProcess):
3962         * Sources.txt:
3963         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3964         (WebKit::mediaRelatedMachServices):
3965         * UIProcess/Media/AudioSessionRoutingArbitratorProxy.cpp: Added.
3966         (WebKit::AudioSessionRoutingArbitratorProxy::AudioSessionRoutingArbitratorProxy):
3967         (WebKit::AudioSessionRoutingArbitratorProxy::~AudioSessionRoutingArbitratorProxy):
3968         (WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory):
3969         (WebKit::AudioSessionRoutingArbitratorProxy::leaveRoutingArbitration):
3970         * UIProcess/Media/AudioSessionRoutingArbitratorProxy.h: Added.
3971         (WebKit::AudioSessionRoutingArbitratorProxy::category const):
3972         (WebKit::AudioSessionRoutingArbitratorProxy::destinationId):
3973         * UIProcess/Media/AudioSessionRoutingArbitratorProxy.messages.in: Added.
3974         * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm: Added.
3975         (WebKit::SharedArbitrator::sharedInstance):
3976         (WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator):
3977         (WebKit::SharedArbitrator::leaveRoutingArbitrationForArbitrator):
3978         (WebKit::AudioSessionRoutingArbitratorProxy::AudioSessionRoutingArbitratorProxy):
3979         (WebKit::AudioSessionRoutingArbitratorProxy::~AudioSessionRoutingArbitratorProxy):
3980         (WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory):
3981         (WebKit::AudioSessionRoutingArbitratorProxy::leaveRoutingArbitration):
3982         * UIProcess/WebPageProxy.h:
3983         * UIProcess/WebProcessProxy.cpp:
3984         (WebKit::WebProcessProxy::WebProcessProxy):
3985         * UIProcess/WebProcessProxy.h:
3986         * WebKit.xcodeproj/project.pbxproj:
3987         * WebProcess/WebPage/WebPage.cpp:
3988         (WebKit::m_processDisplayName):
3989         * WebProcess/WebProcess.cpp:
3990         * WebProcess/cocoa/AudioSessionRoutingArbitrator.cpp: Added.
3991         (WebKit::AudioSessionRoutingArbitrator::AudioSessionRoutingArbitrator):
3992         (WebKit::AudioSessionRoutingArbitrator::supplementName):
3993         (WebKit::AudioSessionRoutingArbitrator::beginRoutingArbitrationWithCategory):
3994         (WebKit::AudioSessionRoutingArbitrator::leaveRoutingAbritration):
3995         * WebProcess/cocoa/AudioSessionRoutingArbitrator.h: Added.
3996         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
3997         (WebKit::UserMediaCaptureManager::AudioFactory::createAudioCaptureSource):
3998         * WebProcess/com.apple.WebProcess.sb.in:
3999
4000 2020-04-14  David Kilzer  <ddkilzer@apple.com>
4001
4002         createArchiveList() in WebCoreArgumentCodersMac.mm should do more validity checks
4003         <https://webkit.org/b/210448>
4004         <rdar://problem/61677029>
4005
4006         Reviewed by Darin Adler.
4007
4008         * Shared/mac/WebCoreArgumentCodersMac.mm:
4009         (IPC::createArchiveList): Add more validity checks.
4010
4011 2020-04-14  Brent Fulgham  <bfulgham@apple.com>
4012
4013         Do more checking before reusing precompiled sandbox
4014         https://bugs.webkit.org/show_bug.cgi?id=210304
4015         <rdar://problem/61155623>
4016
4017         Reviewed by Darin Adler.
4018
4019         We recently discovered that the system sandbox framework version does not always change
4020         when breaking changes in the sandbox format are made. This can lead to the precompiled
4021         version of a sandbox not working properly when a sandbox version changes.
4022
4023         To guard against this, make the following changes:
4024
4025         1. Compare the SANDBOX_BUILD_ID in place when the sandbox was compiled to the value on
4026            the current system. SANDBOX_BUILD_ID, which is a GUID, is always regenerated when the
4027            sandbox framework is rebuilt.
4028
4029         2. Compare the OS version in place when the sandbox was compiled to the value on the current
4030            system. This will trigger us recompiling sandboxes even when the sandbox framework did not
4031            change, but this is a small performance cost that would only happen after a software update.
4032
4033         * Shared/mac/AuxiliaryProcessMac.mm:
4034         (WebKit::compileAndCacheSandboxProfile):
4035         (WebKit::tryApplyCachedSandbox):
4036
4037 2020-04-14  Per Arne Vollan  <pvollan@apple.com>
4038
4039         [iOS] Content filtering needs access to the frontboard service
4040         https://bugs.webkit.org/show_bug.cgi?id=210505
4041
4042         Reviewed by Geoffrey Garen.
4043
4044         Content filtering in the WebContent process needs access to the frontboard service on iOS. Issue an extension
4045         to this service when content filtering is enabled.
4046
4047         API test: WebKit.WebFilterFeatureHasFrontboardServiceAccess
4048
4049         * Shared/WebProcessCreationParameters.cpp:
4050         (WebKit::WebProcessCreationParameters::encode const):
4051         (WebKit::WebProcessCreationParameters::decode):
4052         * Shared/WebProcessCreationParameters.h:
4053         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
4054         (WebKit::WebProcessPool::platformInitializeWebProcess):
4055         * WebProcess/cocoa/WebProcessCocoa.mm:
4056         (WebKit::WebProcess::platformInitializeWebProcess):
4057
4058 2020-04-14  Wenson Hsieh  <wenson_hsieh@apple.com>
4059
4060         [iPadOS] Wikipedia articles lay out incorrectly in 1/3 multitasking window
4061         https://bugs.webkit.org/show_bug.cgi?id=210501
4062         <rdar://problem/54856323>
4063
4064         Reviewed by Tim Horton.
4065
4066         Apply the viewport quirk if needed; see WebCore/ChangeLog for more details.
4067
4068         * WebProcess/WebPage/ios/WebPageIOS.mm:
4069         (WebKit::WebPage::updateVisibleContentRects):
4070
4071 2020-04-14  Brent Fulgham  <bfulgham@apple.com>
4072
4073         InjectedBundle parameters often need initialization function called before unarchiving
4074         https://bugs.webkit.org/show_bug.cgi?id=189709
4075         <rdar://problem/44573653>
4076
4077         Reviewed by Ryosuke Niwa.
4078
4079         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
4080         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
4081         after the bundle initialiation function runs, which gives the embedding program the opportunity to
4082         register additional classes that are safe for serialization.
4083
4084         Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need
4085         to be serialized by the InjectedBundle.
4086         
4087         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
4088         Revise 'initialize' to call this new method.
4089
4090         * WebProcess/InjectedBundle/InjectedBundle.h:
4091         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
4092         (WebKit::InjectedBundle::initialize): Use the new method.
4093         (WebKit::InjectedBundle::decodeBundleParameters): Added.
4094         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
4095         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
4096         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
4097         NSDictionary object may itself hold other kinds of objects.
4098         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
4099         (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added.
4100
4101 2020-04-14  Wenson Hsieh  <wenson_hsieh@apple.com>
4102
4103         Address review comments after r260035
4104         https://bugs.webkit.org/show_bug.cgi?id=210440
4105
4106         Reviewed by David Kilzer.
4107
4108         Omit unused argument names.
4109
4110         * UIProcess/API/C/WKPreferences.cpp:
4111         (WKPreferencesSetIgnoreViewportScalingConstraints):
4112         (WKPreferencesGetIgnoreViewportScalingConstraints):
4113
4114 2020-04-14  Megan Ga