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