0a0aa08b94f98ae2a585ca91299fe2f1f1ae8504
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-11-04  Jiewen Tan  <jiewen_tan@apple.com>
2
3         [WebAuthn] Guard against unexpected -[_WKWebAuthenticationPanel cancel]
4         https://bugs.webkit.org/show_bug.cgi?id=203830
5         <rdar://problem/56797134>
6
7         Reviewed by Brent Fulgham .
8
9         -[_WKWebAuthenticationPanel cancel] was only expected to be called on behalf of an
10         explicit user cancel from the UI. However, clients may call it in different other
11         unexpected scenarios as well. We should guard against that.
12
13         To do so, two counter ways are implemented:
14         1) AuthenticatorManager::cancelRequest is changed to invoke the pending request if there
15         is no GlobalFrameID. This case can only be reached via calling -[_WKWebAuthenticationPanel cancel]
16         before AuthenticatorManager::cancelRequest.
17         2) WebAuthenticationPanelClient::updatePanel and WebAuthenticationPanelClient::dismissPanel
18         will call delegate methods in the next run loop to prevent -[_WKWebAuthenticationPanel cancel]
19         being called in the delegates.
20
21         Covered by new API tests.
22
23         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
24         (WebKit::AuthenticatorManager::cancelRequest):
25         (WebKit::AuthenticatorManager::createService const):
26         (WebKit::AuthenticatorManager::invokePendingCompletionHandler):
27         * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm:
28         (WebKit::WebAuthenticationPanelClient::updatePanel const):
29         (WebKit::WebAuthenticationPanelClient::dismissPanel const):
30
31 2019-11-04  Ross Kirsling  <ross.kirsling@sony.com>
32
33         Unreviewed fix for non-unified build.
34
35         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
36         * NetworkProcess/NetworkResourceLoader.cpp:
37         * Shared/ServiceWorkerInitializationData.cpp:
38         * UIProcess/API/APIAttachment.cpp:
39         * WebProcess/Storage/WebServiceWorkerProvider.h:
40         Add missing includes.
41
42 2019-11-04  Per Arne Vollan  <pvollan@apple.com>
43
44         Fix crash caused by syscall sandbox violation
45         https://bugs.webkit.org/show_bug.cgi?id=203826
46         <rdar://problem/56332491>
47
48         Reviewed by Brent Fulgham.
49
50         A new syscall needs to be allowed in the WebContent process' sandbox.
51
52         * WebProcess/com.apple.WebProcess.sb.in:
53
54 2019-11-04  John Wilander  <wilander@apple.com>
55
56         Resource Load Statistics: Flush the shared ResourceLoadObserver when the webpage is closed by JavaScript
57         https://bugs.webkit.org/show_bug.cgi?id=203623
58         <rdar://problem/56756427>
59
60         Reviewed by Alex Christensen.
61
62         This patch adds flushing of pending statistics when a window is closed by JavaScript,
63         when a webpage is removed from the web process, and when the web process prepares to
64         suspend.
65
66         New API test added.
67
68         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
69         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
70             Now calls logTestingEvent() so that the test infrastructure can wait for updates.
71         * UIProcess/API/Cocoa/WKProcessPool.mm:
72         (-[WKProcessPool _seedResourceLoadStatisticsForTestingWithFirstParty:thirdParty:shouldScheduleNotification:completionHandler:]):
73             Test infrastructure to seed every web process' WebCore::ResourceLoadObserver with test data.
74         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
75         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
76         (-[WKWebsiteDataStore _clearResourceLoadStatistics:]):
77         (-[WKWebsiteDataStore _isRegisteredAsSubresourceUnderFirstParty:thirdParty:completionHandler:]):
78             Test infrastructure.
79         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
80         * UIProcess/WebProcessPool.cpp:
81         (WebKit::WebProcessPool::seedResourceLoadStatisticsForTesting):
82             Test infrastructure.
83         * UIProcess/WebProcessPool.h:
84         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
85         (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder):
86             Made sure the completion handler is called even if there is no network process.
87         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
88             Now tells all web processes to turn ITP on or off.
89         * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
90         (WebKit::WebResourceLoadObserver::~WebResourceLoadObserver):
91         (WebKit::WebResourceLoadObserver::logSubresourceLoadingForTesting):
92             Test infrastructure to seed the observer with test data.
93         * WebProcess/WebCoreSupport/WebResourceLoadObserver.h:
94         * WebProcess/WebProcess.cpp:
95         (WebKit::WebProcess::setWebsiteDataStoreParameters):
96             Now checks whether a shared observer already exists before setting one.
97         (WebKit::WebProcess::removeWebPage):
98         (WebKit::WebProcess::prepareToSuspend):
99             These two functions now call WebProcess::flushResourceLoadStatistics().
100         (WebKit::WebProcess::setResourceLoadStatisticsEnabled):
101             This function now sets the process' shared WebCore::ResourceLoadObserver if none exists.
102         (WebKit::WebProcess::flushResourceLoadStatistics):
103             This function tells the shared WebCore::ResourceLoadObserver to send any pending
104             statistics to the central ITP store.
105         (WebKit::WebProcess::seedResourceLoadStatisticsForTesting):
106             Test infrastructure to seed the shared observer with test data.
107         * WebProcess/WebProcess.h:
108         * WebProcess/WebProcess.messages.in:
109
110 2019-11-04  Chris Dumez  <cdumez@apple.com>
111
112         [iOS][WK2] Simplify process assertion handling for the network process and service worker processes
113         https://bugs.webkit.org/show_bug.cgi?id=203633
114
115         Reviewed by Alex Christensen.
116
117         Simplify process assertion handling for the network process and service worker processes.
118         In particular, the following changes were made:
119         1. Put the NetworkProcessProxy in charge of keeping the network process runnable instead
120            of relying on the WebProcessPool to do it.
121         2. Put the WebProcessProxy in charge of keeping the web process runnable due to service
122            worker activity, instead of relying on the WebProcessPool to do it.
123         3. Introduce a new Variant data type which can store a foreground activity, a background
124            activity or no activity. This avoid having 2 separate and mutually-exclusive data
125            members for foreground and background activities.
126         4. The new code is a bit more correct because it makes sure the the activity we're holding
127            is valid, instead of simply checking that it has an activity. This means that if the
128            process assertion was previously invalidated, we will now properly take a new activity,
129            which will re-take a process assertion.
130
131         This patch also reduces the #ifdefing for IOS_FAMILY, since ProcessThrottler and
132         ProcessAssertion exist on all platforms.
133
134         * UIProcess/Network/NetworkProcessProxy.cpp:
135         (WebKit::NetworkProcessProxy::updateProcessAssertion):
136         * UIProcess/Network/NetworkProcessProxy.h:
137         * UIProcess/ProcessThrottler.cpp:
138         (WebKit::ProcessThrottler::isValidBackgroundActivity):
139         (WebKit::ProcessThrottler::isValidForegroundActivity):
140         * UIProcess/ProcessThrottler.h:
141         * UIProcess/WebProcessPool.cpp:
142         (WebKit::m_backgroundWebProcessCounter):
143         (WebKit::WebProcessPool::ensureNetworkProcess):
144         (WebKit::WebProcessPool::networkProcessCrashed):
145         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
146         (WebKit::WebProcessPool::disconnectProcess):
147         (WebKit::WebProcessPool::terminateNetworkProcess):
148         (WebKit::WebProcessPool::updateProcessAssertions):
149         * UIProcess/WebProcessPool.h:
150         * UIProcess/WebProcessProxy.cpp:
151         (WebKit::WebProcessProxy::didSetAssertionState):
152         (WebKit::WebProcessProxy::updateServiceWorkerProcessAssertion):
153         (WebKit::WebProcessProxy::enableServiceWorkers):
154         * UIProcess/WebProcessProxy.h:
155         (WebKit::WebProcessProxy::isStandaloneServiceWorkerProcess const):
156
157 2019-11-03  Jiewen Tan  <jiewen_tan@apple.com>
158
159         [WebAuthn] CtapAuthenticator::tryDowngrade should distinguish requestData().options
160         https://bugs.webkit.org/show_bug.cgi?id=203771
161         <rdar://problem/56832618>
162
163         Reviewed by Brent Fulgham.
164
165         CtapAuthenticator::tryDowngrade assumes the request is a getAssertion request. This is true
166         for most cases but not for Google's registration. For Google's registration, a quirk is
167         implemented to use U2F commands for registration if GoogleLegacyAppIdSupportExtension asks
168         us to do so.
169
170         No tests given there is no way to simulate google.com in our test infrastructures.
171
172         * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
173         (WebKit::CtapAuthenticator::tryDowngrade):
174
175 2019-11-03  Tim Horton  <timothy_horton@apple.com>
176
177         WKWebView can get stuck blank (Web Content process thinks the app is backgrounded)
178         https://bugs.webkit.org/show_bug.cgi?id=203774
179         <rdar://problem/53399054>
180
181         Reviewed by Chris Dumez.
182
183         With careful timing, if a WKWebView swaps out its content view in the
184         background, the incoming view can fail to inform the Web Content process
185         when the app comes to the foreground, leaving the layer tree frozen.
186
187         This occurs because the last-sent state is stored per-WKApplicationStateTrackingView,
188         and the content view is the WKApplicationStateTrackingView, so it is possible
189         for e.g. a WKPDFView to be in the hierarchy, keeping the correct state,
190         with an initialized-but-never-parented WKContentView hanging off the WKWebView.
191
192         If it is never parented, WKContentView will think that the current application
193         state is foreground (_lastObservedStateWasBackground is initialized to NO).
194
195         If you go into the background with a WKPDFView as the current content view,
196         it will inform the Web Content process that the application has backgrounded.
197
198         If, still in the background, WKWebView swaps from the WKPDFView to
199         the WKContentView, and then comes into the foreground, when we get the
200         notification that the app came to the foreground, we will not forward it
201         to the Web Content process, because WKContentView's _lastObservedStateWasBackground
202         remains NO.
203
204         To fix this, move _lastObservedStateWasBackground to WebPageProxy, so that
205         it always tracks the most recently sent state, regardless of which content view
206         is active.
207
208         * UIProcess/WebPageProxy.cpp:
209         (WebKit::WebPageProxy::resetState):
210         * UIProcess/WebPageProxy.h:
211         (WebKit::WebPageProxy::lastObservedStateWasBackground const):
212         * UIProcess/ios/WKApplicationStateTrackingView.mm:
213         (-[WKApplicationStateTrackingView willMoveToWindow:]):
214         (-[WKApplicationStateTrackingView didMoveToWindow]):
215         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]):
216         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]):
217         * UIProcess/ios/WebPageProxyIOS.mm:
218         (WebKit::WebPageProxy::applicationDidEnterBackground):
219         (WebKit::WebPageProxy::applicationWillEnterForeground):
220
221 2019-11-02  Devin Rousso  <drousso@apple.com>
222
223         Web Inspector: Add diagnostic logging for frontend feature usage
224         https://bugs.webkit.org/show_bug.cgi?id=203579
225         <rdar://problem/56717410>
226
227         Reviewed by Brian Burg.
228
229         This patch enables diagnostic logging for the Web Inspector web process
230         and adds the necessary `InspectorFrontendClient` plumbing to `WebInspectorUI`.
231
232         Original patch by Matt Baker <mattbaker@apple.com>.
233
234         * WebProcess/WebPage/WebInspectorUI.h:
235         * WebProcess/WebPage/WebInspectorUI.cpp:
236         (WebKit::WebInspectorUI::supportsDiagnosticLogging): Added.
237         (WebKit::WebInspectorUI::logDagnosticEvent): Added.
238         * WebProcess/WebPage/RemoteWebInspectorUI.h:
239         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
240         (WebKit::RemoteWebInspectorUI::supportsDiagnosticLogging): Added.
241         (WebKit::RemoteWebInspectorUI::logDiagnosticEvent): Added.
242
243         * UIProcess/mac/WKInspectorViewController.mm:
244         (-[WKInspectorViewController configuration]):
245         Default to enabling diagnostic logging for the Web Inspector frontend window.
246
247         * Configurations/FeatureDefines.xcconfig:
248         Add `ENABLE_INSPECTOR_TELEMETRY`, which is only enabled for macOS.
249
250 2019-11-01  Brady Eidson  <beidson@apple.com>
251
252         Promote "_getWebArchive" to API.
253         <rdar://problem/17317547> and https://bugs.webkit.org/show_bug.cgi?id=203767
254
255         Reviewed by Andy Estes.
256
257         * UIProcess/API/Cocoa/WKWebView.h:
258         * UIProcess/API/Cocoa/WKWebView.mm:
259         (-[WKWebView createWebArchiveDataWithCompletionHandler:]):
260         (-[WKWebView _getWebArchiveDataWithCompletionHandler:]):
261
262 2019-11-01  Brady Eidson  <beidson@apple.com>
263
264         Rejigger WKWebArchive headers.
265         https://bugs.webkit.org/show_bug.cgi?id=203648
266
267         Reviewed by Andy Estes.
268
269         * Shared/API/c/mac/WKWebArchiveRef.cpp: Renamed from Source/WebKit/Shared/API/c/mac/WKWebArchive.cpp.
270         (WKWebArchiveGetTypeID):
271         (WKWebArchiveCreate):
272         (WKWebArchiveCreateWithData):
273         (WKWebArchiveCreateFromRange):
274         (WKWebArchiveCopyMainResource):
275         (WKWebArchiveCopySubresources):
276         (WKWebArchiveCopySubframeArchives):
277         (WKWebArchiveCopyData):
278         * Shared/API/c/mac/WKWebArchiveRef.h: Copied from Source/WebKit/Shared/API/c/mac/WKWebArchive.h.
279         * SourcesCocoa.txt:
280         * UIProcess/API/Cocoa/WKWebArchive.h: Renamed from Source/WebKit/Shared/API/c/mac/WKWebArchive.h.
281         * WebKit.xcodeproj/project.pbxproj:
282
283 2019-11-01  Eric Carlson  <eric.carlson@apple.com>
284
285         Add experimental TextTrackCue API
286         https://bugs.webkit.org/show_bug.cgi?id=203649
287         <rdar://problem/55675172>
288
289         Reviewed by Jer Noble.
290
291         * Shared/WebPreferences.yaml:
292
293 2019-11-01  Brian Burg  <bburg@apple.com>
294
295         REGRESSION(r248696): Element Click on Mac is adding an extra page topContentInsets to y-coordinate
296         https://bugs.webkit.org/show_bug.cgi?id=203765
297         <rdar://problem/56014369>
298
299         Reviewed by Devin Rousso.
300
301         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
302         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
303         The topContentInsets is accounted for by rootViewToWindow(), so don't add it in manually.
304
305 2019-11-01  Per Arne Vollan  <pvollan@apple.com>
306
307         Investigate if mach lookup access to *.apple-extension-service, *.viewservice, and com.apple.uikit.viewservice.* can be denied
308         https://bugs.webkit.org/show_bug.cgi?id=203626
309
310         Reviewed by Alexey Proskuryakov.
311
312         Modify the allow rule for these services to include the telemetry option.
313
314         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
315
316 2019-11-01  Peng Liu  <peng.liu6@apple.com>
317
318         Turn on the Picture-in-Picture API feature by default
319         https://bugs.webkit.org/show_bug.cgi?id=203725
320
321         Reviewed by Jer Noble.
322
323         * Shared/WebPreferences.yaml:
324
325 2019-10-31  Chris Dumez  <cdumez@apple.com>
326
327         Take down the gesture snapshot early when the back/forward cache is not leveraged
328         https://bugs.webkit.org/show_bug.cgi?id=203713
329         <rdar://problem/56803910>
330
331         Reviewed by Tim Horton.
332
333         Take down the gesture snapshot as soon as the gesture is done when the back/forward cache
334         is not leveraged. Otherwise, the snapshot may stay up for a long time (while we load, parse
335         and restore scroll position) and it would look to the user as if the view was unresponsive.
336         Showing the page slowly loading in such cases is less confusing as the user knows what's
337         going on and is even able to interact with the partially loaded page.
338
339         * Shared/WebBackForwardListItem.cpp:
340         (WebKit::WebBackForwardListItem::hasCachedWebPage const):
341         * Shared/WebBackForwardListItem.h:
342         * UIProcess/ViewGestureController.cpp:
343         (WebKit::ViewGestureController::endSwipeGesture):
344         * UIProcess/ViewGestureController.h:
345         * UIProcess/ios/ViewGestureControllerIOS.mm:
346         (WebKit::ViewGestureController::makeSnapshotBlank):
347         (WebKit::ViewGestureController::endSwipeGesture):
348         * UIProcess/mac/ViewGestureControllerMac.mm:
349         (WebKit::ViewGestureController::makeSnapshotBlank):
350
351 2019-10-31  Per Arne Vollan  <pvollan@apple.com>
352
353         [iOS] Fix mach lookup sandbox violations in the Mail app
354         https://bugs.webkit.org/show_bug.cgi?id=203697
355
356         Reviewed by Alexey Proskuryakov.
357
358         Allow mach lookup to the services "com.apple.logd.events" and "com.apple.distributed_notifications@1v3",
359         which are seen when running the Mail application. Also allow "com.apple.aggregated", which was previously
360         allowed, and is showing up in reports.
361
362         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
363
364 2019-10-31  Tim Horton  <timothy_horton@apple.com>
365
366         Turn on IOSurface support in the iOS Simulator
367         https://bugs.webkit.org/show_bug.cgi?id=203026
368         <rdar://problem/56320993>
369
370         Reviewed by Simon Fraser.
371
372         * Configurations/WebKit.xcconfig:
373         Always link IOSurface now that we always have it.
374
375         * Shared/WebPreferences.yaml:
376         * Shared/WebPreferencesDefaultValues.h:
377         Turn on Accelerated Drawing and Accelerated Drawing for Canvas by default.
378
379         * UIProcess/API/Cocoa/WKWebView.mm:
380         (-[WKWebView _takeViewSnapshot]):
381         Don't use RGB10 if we don't have it.
382
383         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
384         Don't use render server snapshotting in hidden windows, because it
385         (correctly, but unhelpfully) cannot capture contents in that case.
386
387 2019-10-31  Dean Jackson  <dino@apple.com>
388
389         REGRESSION (r251215): Mail failed to build
390         https://bugs.webkit.org/show_bug.cgi?id=203700
391         <rdar://problem/56787012>
392
393         Reviewed by Antoine Quint.
394
395         Revert the private modulemap. It didn't include enough things
396         and caused some internal builds to fail.
397
398         We'll put it back with everything included sometime soon.
399
400         * Configurations/WebKit.xcconfig:
401         * Modules/OSX.modulemap: Renamed from Source/WebKit/Modules/macOS.modulemap.
402         * Modules/iOS.private.modulemap: Removed.
403         * Modules/macOS.private.modulemap: Removed.
404         * Shared/API/Cocoa/WebKitPrivate.h:
405
406 2019-10-31  Alex Christensen  <achristensen@apple.com>
407
408         Enable more features in Mac CMake build
409         https://bugs.webkit.org/show_bug.cgi?id=203699
410
411         Rubber-stamped by Tim Horton.
412
413         * PlatformMac.cmake:
414         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
415         (WebKit::UserMediaCaptureManager::createCaptureSource):
416
417 2019-10-31  Russell Epstein  <repstein@apple.com>
418
419         Unreviewed, rolling out r251861.
420
421         Caused 50+ Layout Test Crashes
422
423         Reverted changeset:
424
425         "Use SecurityOriginData in NetworkProcess where possible
426         without other changes"
427         https://bugs.webkit.org/show_bug.cgi?id=203615
428         https://trac.webkit.org/changeset/251861
429
430 2019-10-31  Truitt Savell  <tsavell@apple.com>
431
432         Unreviewed, rolling out r251854.
433
434         Broke iOS build
435
436         Reverted changeset:
437
438         "Rejigger WKWebArchive headers."
439         https://bugs.webkit.org/show_bug.cgi?id=203648
440         https://trac.webkit.org/changeset/251854
441
442 2019-10-31  Alex Christensen  <achristensen@webkit.org>
443
444         Remove unneeded HAVE_TIMINGDATAOPTIONS
445         https://bugs.webkit.org/show_bug.cgi?id=202990
446
447         Reviewed by Brady Eidson.
448
449         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
450         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
451
452 2019-10-31  Alex Christensen  <achristensen@webkit.org>
453
454         Use SecurityOriginData in NetworkProcess where possible without other changes
455         https://bugs.webkit.org/show_bug.cgi?id=203615
456
457         Reviewed by Brady Eidson.
458
459         * NetworkProcess/NetworkResourceLoadParameters.cpp:
460         (WebKit::NetworkResourceLoadParameters::encode const):
461         * NetworkProcess/NetworkResourceLoadParameters.h:
462         * NetworkProcess/NetworkResourceLoader.cpp:
463         (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions):
464         * WebProcess/Network/WebLoaderStrategy.cpp:
465         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
466
467 2019-10-31  Alex Christensen  <achristensen@webkit.org>
468
469         Expose more WKPreferences SPI
470         https://bugs.webkit.org/show_bug.cgi?id=203631
471         <rdar://problem/56717160>
472
473         Reviewed by Brady Eidson.
474
475         I added a unit test for the one that can be easily tested.
476
477         * UIProcess/API/Cocoa/WKPreferences.mm:
478         (-[WKPreferences _setWebAudioEnabled:]):
479         (-[WKPreferences _webAudioEnabled]):
480         (-[WKPreferences _setAcceleratedCompositingEnabled:]):
481         (-[WKPreferences _acceleratedCompositingEnabled]):
482         (-[WKPreferences _setRequestAnimationFrameEnabled:]):
483         (-[WKPreferences _requestAnimationFrameEnabled]):
484         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
485
486 2019-10-31  Alex Christensen  <achristensen@webkit.org>
487
488         CMake build should make WebKit framework able to be used by Safari
489         https://bugs.webkit.org/show_bug.cgi?id=203685
490
491         Rubber-stamped by Tim Horton.
492
493         * PlatformMac.cmake:
494
495 2019-10-31  Brady Eidson  <beidson@apple.com>
496
497         Rejigger WKWebArchive headers.
498         https://bugs.webkit.org/show_bug.cgi?id=203648
499
500         Reviewed by Andy Estes.
501
502         * Shared/API/c/mac/WKWebArchiveRef.cpp: Renamed from Source/WebKit/Shared/API/c/mac/WKWebArchive.cpp.
503         (WKWebArchiveGetTypeID):
504         (WKWebArchiveCreate):
505         (WKWebArchiveCreateWithData):
506         (WKWebArchiveCreateFromRange):
507         (WKWebArchiveCopyMainResource):
508         (WKWebArchiveCopySubresources):
509         (WKWebArchiveCopySubframeArchives):
510         (WKWebArchiveCopyData):
511         * Shared/API/c/mac/WKWebArchiveRef.h: Copied from Source/WebKit/Shared/API/c/mac/WKWebArchive.h.
512         * SourcesCocoa.txt:
513         * UIProcess/API/Cocoa/WKWebArchive.h: Renamed from Source/WebKit/Shared/API/c/mac/WKWebArchive.h.
514         * WebKit.xcodeproj/project.pbxproj:
515
516 2019-10-31  Wenson Hsieh  <wenson_hsieh@apple.com>
517
518         Add telemetry to test a potential cause of crashes under -[WKContentView _interpretKeyEvent:isCharEvent:]
519         https://bugs.webkit.org/show_bug.cgi?id=203630
520         <rdar://problem/56769229>
521
522         Reviewed by Simon Fraser.
523
524         This iOS-specific crash occurs under `-_interpretKeyEvent:isCharEvent:`, when we first try to access WebEvent's
525         properties with `event.keyboardFlags`. This suggests that between storing the WebEvent in WebPageProxy's
526         m_keyEventQueue, and later receiving an InterpretKeyEvent sync IPC message in the UI process, something ends up
527         overreleasing (or otherwise writing over or corrupting) the WebEvent.
528
529         However, from code inspection, nothing appears to overrelease the WebEvent; an alternate possibility is that the
530         API is somehow being invoked from a background thread, which would explain why the WebEvent may sometimes get
531         destroyed too early.
532
533         To try and detect this scenario (and avoid keeping any strong references to WebEvent at all), add an
534         `os_log_fault` in case the API is being called on a background thread, and bail immediately.
535
536         * UIProcess/ios/WKContentViewInteraction.mm:
537         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
538
539 2019-10-31  Miguel Gomez  <magomez@igalia.com>
540
541         [CoordGraphics] Avoid painting backing stores for zero-opacity layers
542         https://bugs.webkit.org/show_bug.cgi?id=184143
543
544         Reviewed by Žan Doberšek.
545
546         Do not check whether a backingStore is required by a layer inside CoordinatedGraphicsScene. This
547         decision is made by the appropriate CoordinatedGraphicsLayer and propagated to the scene by
548         sending a valid or null Nicosia::BackingStore instance through the state.
549
550         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
551         (WebKit::updateBackingStore):
552         (WebKit::layerShouldHaveBackingStore): Deleted.
553
554 2019-10-30  Peng Liu  <peng.liu6@apple.com>
555
556         [Picture-in-Picture Web API] Enable the support for iOS
557         https://bugs.webkit.org/show_bug.cgi?id=202618
558
559         Reviewed by Jer Noble.
560
561         Enable the Picture-in-Picture API support for iOS (iPad only).
562
563         * Configurations/FeatureDefines.xcconfig:
564         * WebProcess/cocoa/VideoFullscreenManager.mm:
565
566 2019-10-30  Alex Christensen  <achristensen@webkit.org>
567
568         Prevent Mac CMake build from bit rotting
569         https://bugs.webkit.org/show_bug.cgi?id=203647
570
571         Rubber-stamped by Tim Horton.
572
573         * NetworkProcess/NetworkProcess.cpp:
574         (WebKit::m_messagePortChannelRegistry):
575         * PlatformMac.cmake:
576         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
577         (-[_WKWebAuthenticationPanel delegate]):
578         (-[_WKWebAuthenticationPanel setDelegate:]):
579         * UIProcess/WebProcessProxy.cpp:
580
581 2019-10-30  Per Arne Vollan  <pvollan@apple.com>
582
583         It should be possible to create a mach sandbox extension for the WebContent process before the audit token is known
584         https://bugs.webkit.org/show_bug.cgi?id=203618
585
586         Reviewed by Brent Fulgham.
587
588         Currently, we are only able to create a mach sandbox extension for the WebContent process if we know its
589         audit token. It should be possible to create a mach extension without the audit token, since this is
590         needed when we want to create extensions before the PID or audit token is known. These extensions are
591         typically sent in the WebProcess creation parameters.
592         
593         No new tests, this is not a behavior change, but a patch in preparation for future patches.
594
595         * Shared/Cocoa/SandboxExtensionCocoa.mm:
596         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
597         (WebKit::SandboxExtension::createHandleForMachLookup):
598         (WebKit::SandboxExtension::createHandleForMachLookupByAuditToken): Deleted.
599         * Shared/SandboxExtension.h:
600         * UIProcess/ios/WebProcessProxyIOS.mm:
601         (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
602
603 2019-10-30  Per Arne Vollan  <pvollan@apple.com>
604
605         Fix some sysctl read violations in the WebContent process
606         https://bugs.webkit.org/show_bug.cgi?id=203632
607
608         Reviewed by Brent Fulgham.
609
610         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
611
612 2019-10-30  Dean Jackson  <dino@apple.com>
613
614         REGRESSION(r251568) If we didn't start a Service Worker, don't try talking to it
615         https://bugs.webkit.org/show_bug.cgi?id=203639
616         <rdar://problem/56762071>
617
618         Reviewed by Chris Dumez.
619
620         Similar to the fix that introduced this regression, if the UI process does
621         not have the entitlement to start a service worker, we should not try
622         to load with one.
623
624         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
625         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad): If the
626         parent process doesn't have a service worker, use the regular load path.
627
628 2019-10-30  Simon Fraser  <simon.fraser@apple.com>
629
630         Turn Resize Observer on by default
631         https://bugs.webkit.org/show_bug.cgi?id=203644
632         rdar://problem/56026799
633
634         Reviewed by Tim Horton.
635
636         Change the defaultValue of Resize Observer to true.
637
638         * Shared/WebPreferences.yaml:
639
640 2019-10-30  Per Arne Vollan  <pvollan@apple.com>
641
642         Lookup to mach services with the WebKit extension should list the allowed services
643         https://bugs.webkit.org/show_bug.cgi?id=203619
644
645         Reviewed by Alexey Proskuryakov.
646
647         To tighten the mach lookup rule which allows lookup to services with the "com.apple.webkit.extension.mach"
648         extension, all allowed services should be listed. Currently, we are only creating mach lookup extensions to
649         "com.apple.iphone.axserver-systemwide", but more will come in the future.
650
651         No new tests. Testing this requires UI interaction on the device to enable Accessibility.
652
653         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
654
655 2019-10-30  Alex Christensen  <achristensen@webkit.org>
656
657         WKContentRuleLists should block requests from service workers
658         https://bugs.webkit.org/show_bug.cgi?id=201980
659         <rdar://problem/55516735>
660
661         Reviewed by Chris Dumez.
662
663         Test: http/tests/contentextensions/service-worker.https.html
664
665         Also covered by an API test.
666
667         * Shared/ServiceWorkerInitializationData.cpp: Added.
668         (WebKit::ServiceWorkerInitializationData::encode const):
669         (WebKit::ServiceWorkerInitializationData::decode):
670         * Shared/ServiceWorkerInitializationData.h: Added.
671         * Sources.txt:
672         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
673         (WebKit::WebUserContentControllerProxy::addProcess):
674         (WebKit::WebUserContentControllerProxy::contentRuleListData):
675         * UIProcess/UserContent/WebUserContentControllerProxy.h:
676         * UIProcess/WebProcessPool.cpp:
677         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
678         (WebKit::WebProcessPool::createWebPage):
679         * UIProcess/WebProcessPool.h:
680         * UIProcess/WebProcessProxy.cpp:
681         (WebKit::WebProcessProxy::createForServiceWorkers):
682         (WebKit::WebProcessProxy::establishServiceWorkerContext):
683         (WebKit::contentRuleListsFromIdentifier):
684         (WebKit::WebProcessProxy::enableServiceWorkers):
685         * UIProcess/WebProcessProxy.h:
686         * WebKit.xcodeproj/project.pbxproj:
687         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
688         (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
689         (WebKit::m_userAgent):
690         (WebKit::WebSWContextManagerConnection::installServiceWorker):
691         * WebProcess/Storage/WebSWContextManagerConnection.h:
692         * WebProcess/WebProcess.cpp:
693         (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess):
694         * WebProcess/WebProcess.h:
695         * WebProcess/WebProcess.messages.in:
696
697 2019-10-30  Andres Gonzalez  <andresg_22@apple.com>
698
699         Create base class common to AccessibilityObject and AXIsolatedTreeNode.
700         https://bugs.webkit.org/show_bug.cgi?id=203408
701
702         Reviewed by Chris Fleizach.
703
704         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
705         (WKAccessibilityRootObject):
706         (WKAccessibilityFocusedObject):
707
708 2019-10-30  Chris Dumez  <cdumez@apple.com>
709
710         Unreviewed, fix reversed assertion landed in r251778.
711
712         * UIProcess/ProcessThrottler.h:
713         (WebKit::ProcessThrottler::Activity::invalidate):
714
715 2019-10-30  Chris Dumez  <cdumez@apple.com>
716
717         Unreviewed, fix WatchOS build after r251778.
718
719         * UIProcess/WebProcessProxy.h:
720
721 2019-10-30  Chris Dumez  <cdumez@apple.com>
722
723         WKFrameIsDisplayingMarkupDocument() should return true after a window.open/document.write
724         https://bugs.webkit.org/show_bug.cgi?id=203587
725         <rdar://problem/56717726>
726
727         Reviewed by Alex Christensen.
728
729         When doing a document.open(), we were propagating the document's URL to the UIProcess but not its
730         MIME type. WKFrameIsDisplayingMarkupDocument() was relying on this MIME type.
731
732         * UIProcess/WebFrameProxy.cpp:
733         (WebKit::WebFrameProxy::didExplicitOpen):
734         * UIProcess/WebFrameProxy.h:
735         * UIProcess/WebPageProxy.cpp:
736         (WebKit::WebPageProxy::didExplicitOpenForFrame):
737         * UIProcess/WebPageProxy.h:
738         * UIProcess/WebPageProxy.messages.in:
739         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
740         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
741         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
742
743 2019-10-30  Chris Dumez  <cdumez@apple.com>
744
745         REGRESSION (r238252): HTTP POST is losing application/x-www-form-urlencoded body if there's a redirect to different host
746         https://bugs.webkit.org/show_bug.cgi?id=201950
747         <rdar://problem/55577782>
748
749         Reviewed by Alex Christensen.
750
751         The resource request body was getting lost on cross-site redirects. This was caused by the fact that a cross-site
752         redirect would cause a process-swap and the request to start again from a new process. This would work fine if
753         the request does not have a body. However, we have an optimization in place which avoids encoding the request body
754         whenever it is sent over IPC. Because the WebResourceLoader::WillSendRequest IPC would not encode the request body,
755         any decision to process swap as a result of this IPC (i.e. redirect) would cause the new request in the new process
756         to be missing its body. To address the issue, we now make sure to pass the request body in the WillSendRequest IPC
757         and reconsile the request with its body on the recipient side.
758
759         Test: http/tests/misc/form-submit-file-cross-site-redirect.html
760
761         * NetworkProcess/NetworkResourceLoader.cpp:
762         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
763         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
764         (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse):
765         * WebProcess/Network/WebResourceLoader.cpp:
766         (WebKit::WebResourceLoader::willSendRequest):
767         * WebProcess/Network/WebResourceLoader.h:
768         * WebProcess/Network/WebResourceLoader.messages.in:
769
770 2019-10-30  Jer Noble  <jer.noble@apple.com>
771
772         Enable Remote Playback API by default
773         https://bugs.webkit.org/show_bug.cgi?id=203595
774
775         Reviewed by Eric Carlson.
776
777         * Shared/WebPreferences.yaml:
778
779 2019-10-30  Chris Dumez  <cdumez@apple.com>
780
781         [iOS] [WK2] Improve process assertion-related logging to help identify causes of leaked assertions
782         https://bugs.webkit.org/show_bug.cgi?id=203438
783
784         Reviewed by Antti Koivisto.
785
786         Improve process assertion-related logging to help identify causes of leaked assertions. Previously,
787         whenever our code needed to prevent suspension of a child process due to some kind of activity, it
788         would simply grab a "token" from the child process' ProcessThrottler. This, in-turn, would cause
789         the ProcessThrottler to take the right kind of ProcessAssertion or release it when nobody holds
790         any tokens any more.
791
792         We frequently have issues where the UIProcess keeps its assertions around for too long after getting
793         backgrounding. This causes the assertions to get invalidated and the UIProcess will usually suspend
794         (albeit with a delay, which is bad for power). Sometimes though, we get killed because our invalidation
795         handler does not get a chance to release the assertion in time.
796
797         Finding out why we're keeping around assertions is currently very difficult because we cannot easily
798         see in the logs who is still holding ProcessThrottler tokens. To make such debugging easier, clients
799         now notify the ProcessThrottler when they start some activity and provide a user-readable description
800         of the activity. The client then gets a ForegroundActivity or BackgroundActivity object instead of
801         simply a token. As a result, we are now able to log when a given activity that prevents suspension
802         begins and ends, with a user-friendly string. Also, when the assertion gets invalidated, it will
803         invalidate all these pending activities and we'll see in the logs the name of the activities that
804         were still going on upon invalidation.
805
806         * Shared/API/Cocoa/RemoteObjectRegistry.h:
807         (WebKit::RemoteObjectRegistry::backgroundActivity):
808         * Shared/API/Cocoa/RemoteObjectRegistry.mm:
809         (WebKit::RemoteObjectRegistry::sendInvocation):
810         * UIProcess/Cocoa/DownloadClient.h:
811         * UIProcess/Cocoa/DownloadClient.mm:
812         (WebKit::DownloadClient::takeActivityToken):
813         (WebKit::DownloadClient::releaseActivityTokenIfNecessary):
814         * UIProcess/Cocoa/NavigationState.h:
815         * UIProcess/Cocoa/NavigationState.mm:
816         (WebKit::NavigationState::NavigationState):
817         (WebKit::NavigationState::releaseNetworkActivity):
818         (WebKit::NavigationState::didChangeIsLoading):
819         (WebKit::NavigationState::didSwapWebProcesses):
820         * UIProcess/Cocoa/UIRemoteObjectRegistry.cpp:
821         (WebKit::UIRemoteObjectRegistry::backgroundActivity):
822         * UIProcess/Cocoa/UIRemoteObjectRegistry.h:
823         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
824         (WebKit::WebProcessProxy::processWasResumed):
825         * UIProcess/GenericCallback.h:
826         (WebKit::CallbackBase::CallbackBase):
827         (WebKit::GenericCallback::create):
828         (WebKit::GenericCallback::GenericCallback):
829         (WebKit::CallbackMap::put):
830         * UIProcess/Network/NetworkProcessProxy.cpp:
831         (WebKit::NetworkProcessProxy::fetchWebsiteData):
832         (WebKit::NetworkProcessProxy::deleteWebsiteData):
833         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
834         (WebKit::NetworkProcessProxy::didClose):
835         (WebKit::NetworkProcessProxy::setIsHoldingLockedFiles):
836         (WebKit::NetworkProcessProxy::syncAllCookies):
837         (WebKit::NetworkProcessProxy::didSyncAllCookies):
838         * UIProcess/Network/NetworkProcessProxy.h:
839         * UIProcess/ProcessThrottler.cpp:
840         (WebKit::ProcessThrottler::ProcessThrottler):
841         (WebKit::ProcessThrottler::~ProcessThrottler):
842         (WebKit::ProcessThrottler::addActivity):
843         (WebKit::ProcessThrottler::removeActivity):
844         (WebKit::ProcessThrottler::invalidateAllActivities):
845         (WebKit::ProcessThrottler::expectedAssertionState):
846         (WebKit::ProcessThrottler::setAssertionState):
847         (WebKit::ProcessThrottler::uiAssertionWillExpireImminently):
848         * UIProcess/ProcessThrottler.h:
849         (WebKit::ProcessThrottler::Activity::Activity):
850         (WebKit::ProcessThrottler::Activity::~Activity):
851         (WebKit::ProcessThrottler::Activity::isValid const):
852         (WebKit::ProcessThrottler::Activity::invalidate):
853         (WebKit::ProcessThrottler::shouldBeRunnable const):
854         (WebKit::ProcessThrottler::foregroundActivity):
855         (WebKit::ProcessThrottler::backgroundActivity):
856         * UIProcess/ProvisionalPageProxy.cpp:
857         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
858         * UIProcess/ProvisionalPageProxy.h:
859         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
860         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
861         * UIProcess/SuspendedPageProxy.cpp:
862         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
863         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
864         * UIProcess/SuspendedPageProxy.h:
865         * UIProcess/WebBackForwardCacheEntry.cpp:
866         (WebKit::WebBackForwardCacheEntry::~WebBackForwardCacheEntry):
867         * UIProcess/WebCookieManagerProxy.cpp:
868         (WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
869         (WebKit::WebCookieManagerProxy::deleteCookie):
870         (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
871         (WebKit::WebCookieManagerProxy::setCookies):
872         (WebKit::WebCookieManagerProxy::getAllCookies):
873         (WebKit::WebCookieManagerProxy::getCookies):
874         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
875         (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
876         * UIProcess/WebPageProxy.cpp:
877         (WebKit::WebPageProxy::close):
878         (WebKit::WebPageProxy::updateThrottleState):
879         (WebKit::WebPageProxy::waitForDidUpdateActivityState):
880         (WebKit::WebPageProxy::setInitialFocus):
881         (WebKit::WebPageProxy::validateCommand):
882         (WebKit::WebPageProxy::executeEditCommand):
883         (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart):
884         (WebKit::WebPageProxy::replaceMatches):
885         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
886         (WebKit::WebPageProxy::runJavaScriptInFrame):
887         (WebKit::WebPageProxy::getRenderTreeExternalRepresentation):
888         (WebKit::WebPageProxy::getSourceForFrame):
889         (WebKit::WebPageProxy::getContentsAsString):
890         (WebKit::WebPageProxy::getBytecodeProfile):
891         (WebKit::WebPageProxy::getSamplingProfilerOutput):
892         (WebKit::WebPageProxy::getContentsAsMHTMLData):
893         (WebKit::WebPageProxy::getSelectionOrContentsAsString):
894         (WebKit::WebPageProxy::getSelectionAsWebArchiveData):
895         (WebKit::WebPageProxy::getMainResourceDataOfFrame):
896         (WebKit::WebPageProxy::getResourceDataFromFrame):
897         (WebKit::WebPageProxy::getWebArchiveOfFrame):
898         (WebKit::WebPageProxy::forceRepaint):
899         (WebKit::WebPageProxy::resetStateAfterProcessExited):
900         (WebKit::WebPageProxy::drawToPDF):
901         (WebKit::WebPageProxy::getMarkedRangeAsync):
902         (WebKit::WebPageProxy::getSelectedRangeAsync):
903         (WebKit::WebPageProxy::characterIndexForPointAsync):
904         (WebKit::WebPageProxy::firstRectForCharacterRangeAsync):
905         (WebKit::WebPageProxy::takeSnapshot):
906         (WebKit::WebPageProxy::installActivityStateChangeCompletionHandler):
907         (WebKit::WebPageProxy::getLoadDecisionForIcon):
908         (WebKit::WebPageProxy::insertAttachment):
909         (WebKit::WebPageProxy::updateAttachmentAttributes):
910         (WebKit::WebPageProxy::getApplicationManifest):
911         * UIProcess/WebPageProxy.h:
912         * UIProcess/WebProcessPool.cpp:
913         (WebKit::WebProcessPool::initializeNewWebProcess):
914         (WebKit::WebProcessPool::updateProcessAssertions):
915         (WebKit::WebProcessPool::reinstateNetworkProcessAssertionState):
916         * UIProcess/WebProcessPool.h:
917         * UIProcess/WebProcessProxy.cpp:
918         (WebKit::WebProcessProxy::shutDown):
919         (WebKit::WebProcessProxy::fetchWebsiteData):
920         (WebKit::WebProcessProxy::deleteWebsiteData):
921         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
922         (WebKit::WebProcessProxy::setIsHoldingLockedFiles):
923         (WebKit::WebProcessProxy::startBackgroundActivityForFullscreenInput):
924         (WebKit::WebProcessProxy::endBackgroundActivityForFullscreenInput):
925         * UIProcess/WebProcessProxy.h:
926         * UIProcess/ios/WKContentViewInteraction.mm:
927         (-[WKContentView presentViewControllerForCurrentFocusedElement]):
928         (-[WKContentView dismissAllInputViewControllers:]):
929         * UIProcess/ios/WebPageProxyIOS.mm:
930         (WebKit::WebPageProxy::requestFocusedElementInformation):
931         (WebKit::WebPageProxy::selectWithGesture):
932         (WebKit::WebPageProxy::updateSelectionWithTouches):
933         (WebKit::WebPageProxy::applyAutocorrection):
934         (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
935         (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
936         (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection):
937         (WebKit::WebPageProxy::selectPositionAtPoint):
938         (WebKit::WebPageProxy::beginSelectionInDirection):
939         (WebKit::WebPageProxy::updateSelectionWithExtentPoint):
940         (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
941         (WebKit::WebPageProxy::requestDictationContext):
942         (WebKit::WebPageProxy::getSelectionContext):
943         (WebKit::WebPageProxy::selectWithTwoTouches):
944         (WebKit::WebPageProxy::applicationDidEnterBackground):
945         (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
946         (WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText):
947         (WebKit::WebPageProxy::moveSelectionByOffset):
948         (WebKit::WebPageProxy::focusNextFocusedElement):
949         (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
950
951 2019-10-30  Carlos Garcia Campos  <cgarcia@igalia.com>
952
953         REGRESSION(2.27.2): [GTK] Overview item remove button broken
954         https://bugs.webkit.org/show_bug.cgi?id=203461
955
956         Reviewed by Adrian Perez de Castro.
957
958         This is a regression of the switch to new custom protocols implementation. Epiphany is passing NULL as content
959         type of ephy-resource requests, in which case we should try to guess the mime type, but we are not doing it.
960
961         * UIProcess/API/glib/WebKitURISchemeRequest.cpp:
962         (webkitURISchemeRequestReadCallback): Use MIMETypeRegistry to guess the mime type when content type is nullptr,
963         like NetworkDataTask does.
964
965 2019-10-29  Andy Estes  <aestes@apple.com>
966
967         [Quick Look] Clean up LegacyPreviewLoaderClients
968         https://bugs.webkit.org/show_bug.cgi?id=203472
969
970         Reviewed by Brady Eidson.
971
972         Replaced QuickLookDocumentData with ShareableResource.
973
974         Removed messages WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame and
975         WebPage::DidReceivePasswordForQuickLookDocument, replacing them with async message
976         WebPageProxy::RequestPasswordForQuickLookDocumentInMainFrame.
977
978         * Shared/ios/QuickLookDocumentData.cpp: Removed.
979         * Shared/ios/QuickLookDocumentData.h: Removed.
980         * SourcesCocoa.txt:
981         * UIProcess/API/APILoaderClient.h:
982         * UIProcess/API/APINavigationClient.h:
983         (API::NavigationClient::didFinishLoadForQuickLookDocumentInMainFrame):
984         * UIProcess/Cocoa/NavigationState.h:
985         * UIProcess/Cocoa/NavigationState.mm:
986         (WebKit::NavigationState::NavigationClient::didFinishLoadForQuickLookDocumentInMainFrame):
987         * UIProcess/ProvisionalPageProxy.cpp:
988         (WebKit::ProvisionalPageProxy::requestPasswordForQuickLookDocumentInMainFrame):
989         (WebKit::ProvisionalPageProxy::didReceiveMessage):
990         (WebKit::ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame): Deleted.
991         * UIProcess/ProvisionalPageProxy.h:
992         * UIProcess/WebPageProxy.h:
993         * UIProcess/WebPageProxy.messages.in:
994         * UIProcess/ios/WebPageProxyIOS.mm:
995         (WebKit::WebPageProxy::didFinishLoadForQuickLookDocumentInMainFrame):
996         (WebKit::WebPageProxy::requestPasswordForQuickLookDocumentInMainFrame):
997         (WebKit::WebPageProxy::requestPasswordForQuickLookDocumentInMainFrameShared):
998         (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame): Deleted.
999         (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrameShared): Deleted.
1000         * WebKit.xcodeproj/project.pbxproj:
1001         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp:
1002         (WebKit::WebPreviewLoaderClient::WebPreviewLoaderClient):
1003         (WebKit::WebPreviewLoaderClient::didReceiveBuffer):
1004         (WebKit::WebPreviewLoaderClient::didFinishLoading):
1005         (WebKit::WebPreviewLoaderClient::didFail):
1006         (WebKit::WebPreviewLoaderClient::didRequestPassword):
1007         (WebKit::passwordCallbacks): Deleted.
1008         (WebKit::WebPreviewLoaderClient::~WebPreviewLoaderClient): Deleted.
1009         (WebKit::WebPreviewLoaderClient::didReceiveDataArray): Deleted.
1010         (WebKit::WebPreviewLoaderClient::didReceivePassword): Deleted.
1011         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.h:
1012         * WebProcess/WebPage/WebPage.h:
1013         * WebProcess/WebPage/WebPage.messages.in:
1014         * WebProcess/WebPage/ios/WebPageIOS.mm:
1015         (WebKit::WebPage::didStartLoadForQuickLookDocumentInMainFrame):
1016         (WebKit::WebPage::didFinishLoadForQuickLookDocumentInMainFrame):
1017         (WebKit::WebPage::requestPasswordForQuickLookDocumentInMainFrame):
1018         (WebKit::WebPage::didReceivePasswordForQuickLookDocument): Deleted.
1019
1020 2019-10-29  Jiewen Tan  <jiewen_tan@apple.com>
1021
1022         [WebAuthn] Add more information to _WKWebAuthenticationPanel
1023         https://bugs.webkit.org/show_bug.cgi?id=202561
1024         <rdar://problem/55973910>
1025
1026         Reviewed by Youenn Fablet and Brent Fulgham.
1027
1028         This change adds transports and type to _WKWebAuthenticationPanel such that
1029         clients can know what transport the current ceremony demands and the type of
1030         the current ceremony. These extra information allow clients to give users
1031         more specific instructions to interact with authenticators.
1032
1033         To pass transports to client, the way how them is collected is changed significantly:
1034         1) The timing is moved to runPanel before the client delegate call.
1035         2) NfcService::isAvailable is added for AuthenticatorManager to determine if NFC
1036         is available in the current device.
1037         3) AuthenticatorManager::filterTransports is added to filter transports requested
1038         by RP to ones that are available. This process is handled by each service naturally
1039         before.
1040         4) AuthenticatorManager::startRequest is now being splitted into AuthenticatorManager::handleRequest,
1041         AuthenticatorManager::runPanel and AuthenticatorManager::getTransports.
1042
1043         To pass type to _WKWebAuthenticationPanel, ClientDataType is moved from
1044         WebCore::AuthenticatorCoordinator to WebCore::WebAuthenticationConstants in
1045         order to be reused to indicate the ceremony type.
1046
1047         * UIProcess/API/APIWebAuthenticationPanel.cpp:
1048         (API::WebAuthenticationPanel::create):
1049         (API::WebAuthenticationPanel::WebAuthenticationPanel):
1050         * UIProcess/API/APIWebAuthenticationPanel.h:
1051         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
1052         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
1053         (-[_WKWebAuthenticationPanel relyingPartyID]):
1054         (wkWebAuthenticationTransport):
1055         (-[_WKWebAuthenticationPanel transports]):
1056         (wkWebAuthenticationType):
1057         (-[_WKWebAuthenticationPanel type]):
1058         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1059         (WebKit::WebCore::collectTransports):
1060         (WebKit::WebCore::getClientDataType):
1061         (WebKit::AuthenticatorManager::handleRequest):
1062         (WebKit::AuthenticatorManager::filterTransports const):
1063         (WebKit::AuthenticatorManager::startDiscovery):
1064         (WebKit::AuthenticatorManager::initTimeOutTimer):
1065         (WebKit::AuthenticatorManager::runPanel):
1066         (WebKit::AuthenticatorManager::getTransports const):
1067         (WebKit::AuthenticatorManager::respondReceivedInternal): Deleted.
1068         (WebKit::AuthenticatorManager::startRequest): Deleted.
1069         * UIProcess/WebAuthentication/AuthenticatorManager.h:
1070         (WebKit::AuthenticatorManager::respondReceivedInternal):
1071         * UIProcess/WebAuthentication/Cocoa/NfcService.h:
1072         * UIProcess/WebAuthentication/Cocoa/NfcService.mm:
1073         (WebKit::NfcService::isAvailable):
1074         (WebKit::NfcService::platformStartDiscovery):
1075         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
1076         (WebKit::MockAuthenticatorManager::filterTransports const):
1077         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h:
1078
1079 2019-10-29  Wenson Hsieh  <wenson_hsieh@apple.com>
1080
1081         REGRESSION (r251693): [iOS] Unable to change selection in a focused element if the element's bounds change
1082         https://bugs.webkit.org/show_bug.cgi?id=203582
1083
1084         Reviewed by Tim Horton.
1085
1086         The refactoring in r251693 broke the ability to change selection in an editable area by tapping in iOS Safari,
1087         in the case where the editable element's bounds change after focus. This is because the aforementioned change
1088         now compares position informations' element context against the focused element information's element context to
1089         check whether or not the position information request was inside the focused element. However, if the bounds of
1090         the focused element change in between the position information request and when the element is initially
1091         focused, the `operator==` comparison will fail, causing us to prevent text selection.
1092
1093         To fix this, only check whether or not the two element contexts refer to the same element in the DOM by
1094         comparing page, document and element identifiers, but not the element's bounding rect.
1095
1096         * UIProcess/ios/WKContentViewInteraction.mm:
1097         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:nodeHasBuiltInClickHandling:]):
1098         (-[WKContentView gestureRecognizerShouldBegin:]):
1099         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1100
1101 2019-10-07  Jer Noble  <jer.noble@apple.com>
1102
1103         Implement the Remote Playback API.
1104         https://bugs.webkit.org/show_bug.cgi?id=162971
1105
1106         Reviewed by Youenn Fablet.
1107
1108         Add a preference to enable the Remote Playback API. Pass the playbackTargetPickerWasDismissed()
1109         notification on to Page.
1110
1111         * Shared/WebPreferencesDefinitions.h:
1112         * UIProcess/API/C/WKPreferences.cpp:
1113         (WKPreferencesGetRemotePlaybackEnabled):
1114         (WKPreferencesSetRemotePlaybackEnabled):
1115         * UIProcess/API/C/WKPreferencesRef.h:
1116         * UIProcess/WebPageProxy.cpp:
1117         (WebKit::WebPageProxy::playbackTargetPickerWasDismissed):
1118         * UIProcess/WebPageProxy.h:
1119         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1120         (WebKit::WebChromeClient::mockMediaPlaybackTargetPickerDismissPopup):
1121         * WebProcess/WebCoreSupport/WebChromeClient.h:
1122         * WebProcess/WebPage/WebPage.cpp:
1123         (WebKit::WebPage::updatePreferences):
1124         * WebProcess/WebPage/WebPage.h:
1125         * WebProcess/WebPage/WebPage.messages.in:
1126         * WebProcess/WebPage/mac/WebPageMac.mm:
1127         (WebKit::WebPage::playbackTargetPickerWasDismissed):
1128
1129 2019-10-29  Per Arne Vollan  <pvollan@apple.com>
1130
1131         REGRESSION: WebContent getting killed due to syscall filter violation
1132         https://bugs.webkit.org/show_bug.cgi?id=203575
1133
1134         Reviewed by Alexey Proskuryakov.
1135
1136         The sandbox profile on macOS needs to open up for a syscall.
1137
1138         No new tests, covered by existing tests.
1139
1140         * WebProcess/com.apple.WebProcess.sb.in:
1141
1142 2019-10-29  Brent Fulgham  <bfulgham@apple.com>
1143
1144         [iOS] Clean up sandbox to group similar rules together 
1145         https://bugs.webkit.org/show_bug.cgi?id=203525
1146         <rdar://problem/56686416>
1147
1148         Reviewed by Per Arne Vollan.
1149
1150         Clean up the sandbox rules by grouping rules by feature areas to make future editing easier.
1151         This change should have no impact on behavior.
1152
1153         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1154
1155 2019-10-29  Myles C. Maxfield  <mmaxfield@apple.com>
1156
1157         REGRESSION (r251413): Nightly build crashes on launch due to -[WKPreferences _setShouldAllowDesignSystemUIFonts:]: unrecognized selector
1158         https://bugs.webkit.org/show_bug.cgi?id=203549
1159
1160         Reviewed by Simon Fraser.
1161
1162         r251413 deleted an SPI that new Safari stopped calling. However,
1163         old Safari continues to call it. The solution is just to add stub
1164         implementations so old Safari doesn't fail to link at runtime.
1165
1166         * UIProcess/API/Cocoa/WKPreferences.mm:
1167         (-[WKPreferences _shouldAllowDesignSystemUIFonts]):
1168         (-[WKPreferences _setShouldAllowDesignSystemUIFonts:]):
1169         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1170
1171 2019-10-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1172
1173         Add enterkeyhint support
1174         https://bugs.webkit.org/show_bug.cgi?id=189546
1175         <rdar://problem/51021148>
1176
1177         Reviewed by Tim Horton.
1178
1179         This patch adds support for the enterkeyhint HTML attribute on iOS.
1180
1181         Tests:  EnterKeyHintTests.EnterKeyHintInContentEditableElement
1182                 EnterKeyHintTests.EnterKeyHintInTextInput
1183                 EnterKeyHintTests.EnterKeyHintInTextArea
1184
1185         * Shared/FocusedElementInformation.cpp:
1186         (WebKit::FocusedElementInformation::encode const):
1187         (WebKit::FocusedElementInformation::decode):
1188         * Shared/FocusedElementInformation.h:
1189
1190         Add a new flag to FocusedElementInformation to indicate the EnterKeyHint type that should be used when bringing
1191         up an input view for the focused element.
1192
1193         * UIProcess/ios/WKContentViewInteraction.mm:
1194         (-[WKContentView textInputTraits]):
1195
1196         Map the given EnterKeyHint type to a UIReturnKeyType. If an unsupported (i.e. "previous") or default
1197         EnterKeyHint value is used, then we fall back to existing behavior which deduces the default enterkeyhint value
1198         from the input type if the focused element is inside an actionable form; otherwise, we avoid setting any value
1199         for the `returnKeyType`, defaulting to `UIReturnKeyDefault`.
1200
1201         * WebProcess/WebPage/ios/WebPageIOS.mm:
1202         (WebKit::WebPage::getFocusedElementInformation):
1203
1204 2019-10-29  Kate Cheney  <katherine_cheney@apple.com>
1205
1206         Layout Test http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-database.html is a flaky failure
1207         https://bugs.webkit.org/show_bug.cgi?id=203542#add_comment
1208         <rdar://problem/56689764>
1209
1210         Reviewed by John Wilander.
1211
1212         This test was a flaky failure due to its calling
1213         scheduleStatisticsProcessingRequestIfNecessary() after logging a cross
1214         site load with link decoration. This call is currently unecessary
1215         because this function is not yet used to classify resources, and is
1216         causing the test to execute a callback before it is ready.
1217
1218         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1219
1220 2019-10-29  Truitt Savell  <tsavell@apple.com>
1221
1222         Unreviewed, rolling out r251639.
1223
1224         Caused flakey API failures for GetDisplayMediaTest.Constraints
1225
1226         Reverted changeset:
1227
1228         "Enforce user gesture for getUserMedia in case a previous
1229         getUserMedia call was denied"
1230         https://bugs.webkit.org/show_bug.cgi?id=203362
1231         https://trac.webkit.org/changeset/251639
1232
1233 2019-10-29  Truitt Savell  <tsavell@apple.com>
1234
1235         Unreviewed, rolling out r251646.
1236
1237         Caused flakey API failures for GetDisplayMediaTest.Constraints
1238
1239         Reverted changeset:
1240
1241         "Unreviewed build fix for !ENABLE(MEDIA_STREAM) builds"
1242         https://bugs.webkit.org/show_bug.cgi?id=203362
1243         https://trac.webkit.org/changeset/251646
1244
1245 2019-10-29  Chris Dumez  <cdumez@apple.com>
1246
1247         Unreviewed, rolling out r251594.
1248
1249         Caused an API test failure
1250
1251         Reverted changeset:
1252
1253         "mp4 video element broken with service worker"
1254         https://bugs.webkit.org/show_bug.cgi?id=184447
1255         https://trac.webkit.org/changeset/251594        
1256
1257 2019-10-29  Chris Dumez  <cdumez@apple.com>
1258
1259         Notification permissions are not remembered for origins without port
1260         https://bugs.webkit.org/show_bug.cgi?id=203537
1261         <rdar://problem/55281080>
1262
1263         Reviewed by Brady Eidson.
1264
1265         When WKSecurityOriginCreate() gets called with a port that is invalid, then pass
1266         WTF::nullopt to construct the security origin instead of the invalid port.
1267
1268         The issue is that the port for security origins is optional internally. However,
1269         our API (WKSecurityOriginGetPort() & WKSecurityOrigin.port) will return 0 when
1270         there is no port. As a result, clients such as Safari sometimes pass 0 as port to construct
1271         a new WKSecurityOriginRef().
1272
1273         This was causing issues with regards to notifications because Safari would construct
1274         origins whose string representation looks like "https://www.apple.com:0" and it would
1275         not match the "https://www.apple.com" we expect internally.
1276
1277         * Shared/API/c/WKSecurityOriginRef.cpp:
1278         (WKSecurityOriginCreate):
1279
1280 2019-10-29  Adrian Perez de Castro  <aperez@igalia.com>
1281
1282         Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.27.2 release
1283
1284         * wpe/NEWS: Add release notes for 2.27.2.
1285
1286 2019-10-28  Wenson Hsieh  <wenson_hsieh@apple.com>
1287
1288         Replace InteractionInformationAtPosition.nodeAtPositionIsFocusedElement with an element context
1289         https://bugs.webkit.org/show_bug.cgi?id=203498
1290
1291         Reviewed by Tim Horton.
1292
1293         Refactors InteractionInformationAtPosition, such that it doesn't need a special flag to indicate whether there
1294         is a focused element at the position. This is a followup to webkit.org/b/203264; no new tests, as there should
1295         be no change in behavior.
1296
1297         * Shared/FocusedElementInformation.cpp:
1298         (WebKit::FocusedElementInformation::encode const):
1299         (WebKit::FocusedElementInformation::decode):
1300         * Shared/FocusedElementInformation.h:
1301
1302         Add an elementContext to FocusedElementInformation to represent the focused element; then, instead of checking
1303         whether there is a focused element underneath the request position, simply check that the position information's
1304         element context matches the FocusedElementInformation's element context.
1305
1306         Additionally, rename elementRect in FocusedElementInformation to interactionRect, to draw a distinction between
1307         this rect and the new ElementContext's boundingRect.
1308
1309         * Shared/ios/InteractionInformationAtPosition.h:
1310         * Shared/ios/InteractionInformationAtPosition.mm:
1311         (WebKit::InteractionInformationAtPosition::encode const):
1312         (WebKit::InteractionInformationAtPosition::decode):
1313
1314         Remove the nodeAtPositionIsFocusedElement flag.
1315
1316         * UIProcess/ios/WKContentViewInteraction.mm:
1317         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:nodeHasBuiltInClickHandling:]):
1318         (-[WKContentView _zoomToRevealFocusedElement]):
1319         (-[WKContentView _selectionClipRect]):
1320         (-[WKContentView gestureRecognizerShouldBegin:]):
1321         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1322
1323         In various places that consult nodeAtPositionIsFocusedElement, instead check that the position information's
1324         hit-tested element context is the same as the focused element, via FocusedElementInformation.
1325
1326         (-[WKContentView _didCommitLoadForMainFrame]):
1327
1328         Nuke the cached position information data upon navigation; without this tweak, we will fail when running several
1329         iOS layout tests back-to-back, that tap in exactly the same location.
1330
1331         (rectToRevealWhenZoomingToFocusedElement):
1332         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
1333         (-[WKContentView _elementDidBlur]):
1334         (-[WKContentView rectForFocusedFormControlView:]):
1335         (-[WKContentView _didChangeFocusedElementRect:toRect:]): Deleted.
1336
1337         Remove code to invalidate cached position information when changing the focused element rect.
1338
1339         * UIProcess/ios/forms/WKFormPopover.mm:
1340         (-[WKRotatingPopover presentPopoverAnimated:]):
1341         * WebProcess/WebPage/ios/WebPageIOS.mm:
1342         (WebKit::WebPage::positionInformation):
1343         (WebKit::WebPage::getFocusedElementInformation):
1344
1345 2019-10-28  Adrian Perez de Castro  <aperez@igalia.com>
1346
1347         [GTK][WPE] Fix various non-unified build issues introduced since r251436
1348         https://bugs.webkit.org/show_bug.cgi?id=203492
1349
1350         Reviewed by Alex Christensen and Mark Lam.
1351
1352         * UIProcess/InspectorTargetProxy.h: Add forward declaration of ProvisionalPageProxy.
1353         * UIProcess/Plugins/PluginProcessProxy.cpp: Add missin inclusion of
1354         WebProcessProxyMessages.h
1355         * UIProcess/ProcessThrottler.cpp: Add missing inclusion of wtf/CompletionHandler.h
1356         * UIProcess/ProvisionalPageProxy.h: Add missing inclusion of WebCore/FrameIdentifier.h
1357         * UIProcess/WebPageInspectorController.h: Add missing inclusion of WebCore/PageIdentifier.h
1358         * WebProcess/WebPage/WebPageInspectorTargetController.cpp: Add missing inclusion of
1359         WebPageInspectorTargetFrontendChannel.h
1360
1361 2019-10-28  Per Arne Vollan  <pvollan@apple.com>
1362
1363         [iOS] Fix sandbox violations
1364         https://bugs.webkit.org/show_bug.cgi?id=203505
1365
1366         Reviewed by Brent Fulgham.
1367
1368         Running layout tests shows that allowing mach lookup is needed for a set of services which was previously denied.
1369         This patch add rules for allowing these services again. The service 'com.apple.logd.events' is still denied, since
1370         it has not been observed to be in use.
1371
1372         No new tests, covered by existing tests.
1373
1374         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1375
1376 2019-10-28  Alex Christensen  <achristensen@webkit.org>
1377
1378         Unreviewed, rolling out r251675.
1379
1380         Broke some builds
1381
1382         Reverted changeset:
1383
1384         "Remove unused WKWebsiteDataStore setter SPI"
1385         https://bugs.webkit.org/show_bug.cgi?id=203114
1386         https://trac.webkit.org/changeset/251675
1387
1388 2019-10-28  Wenson Hsieh  <wenson_hsieh@apple.com>
1389
1390         Add bindings support for the enterkeyhint HTML attribute
1391         https://bugs.webkit.org/show_bug.cgi?id=203440
1392
1393         Reviewed by Ryosuke Niwa.
1394
1395         Add a new runtime switch for the enterkeyhint attribute, and enable it by default on macOS and iOS.
1396
1397         * Shared/WebPreferences.yaml:
1398         * Shared/WebPreferencesDefaultValues.h:
1399
1400 2019-10-28  Alex Christensen  <achristensen@webkit.org>
1401
1402         Remove unused _WKProcessPoolConfiguration SPI
1403         https://bugs.webkit.org/show_bug.cgi?id=203066
1404
1405         Reviewed by Youenn Fablet.
1406
1407         After rdar://problem/56260478 this is not used, so away it goes!
1408
1409         * NetworkProcess/NetworkProcess.h:
1410         (WebKit::NetworkProcess::suppressesConnectionTerminationOnSystemChange const): Deleted.
1411         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1412         (WebKit::NetworkProcessCreationParameters::encode const):
1413         (WebKit::NetworkProcessCreationParameters::decode):
1414         * NetworkProcess/NetworkProcessCreationParameters.h:
1415         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1416         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1417         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1418         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1419         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1420         (WebKit::globalCTDataConnectionServiceType): Deleted.
1421         (WebKit::NetworkSessionCocoa::ctDataConnectionServiceType const): Deleted.
1422         (WebKit::NetworkSessionCocoa::setCTDataConnectionServiceType): Deleted.
1423         * NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm:
1424         (WebKit::NetworkConnectionToWebProcess::paymentCoordinatorCTDataConnectionServiceType):
1425         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1426         (API::ProcessPoolConfiguration::copy):
1427         * UIProcess/API/APIProcessPoolConfiguration.h:
1428         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1429         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1430         (-[_WKProcessPoolConfiguration suppressesConnectionTerminationOnSystemChange]): Deleted.
1431         (-[_WKProcessPoolConfiguration setSuppressesConnectionTerminationOnSystemChange:]): Deleted.
1432         (-[_WKProcessPoolConfiguration CTDataConnectionServiceType]): Deleted.
1433         (-[_WKProcessPoolConfiguration setCTDataConnectionServiceType:]): Deleted.
1434         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1435         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1436         * UIProcess/ios/WebPageProxyIOS.mm:
1437         (WebKit::WebPageProxy::paymentCoordinatorCTDataConnectionServiceType):
1438
1439 2019-10-28  Alex Christensen  <achristensen@webkit.org>
1440
1441         Remove unused WKWebsiteDataStore setter SPI
1442         https://bugs.webkit.org/show_bug.cgi?id=203114
1443
1444         Reviewed by Anders Carlsson.
1445
1446         They have been replaced by _WKWebsiteDataStoreConfiguration SPI which was adopted in rdar://problem/56349165
1447
1448         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1449         (-[WKWebsiteDataStore _setBoundInterfaceIdentifier:]): Deleted.
1450         (-[WKWebsiteDataStore _boundInterfaceIdentifier]): Deleted.
1451         (-[WKWebsiteDataStore _setAllowsCellularAccess:]): Deleted.
1452         (-[WKWebsiteDataStore _allowsCellularAccess]): Deleted.
1453         (-[WKWebsiteDataStore _setProxyConfiguration:]): Deleted.
1454         (-[WKWebsiteDataStore _proxyConfiguration]): Deleted.
1455         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1456         * UIProcess/WebsiteData/WebsiteDataStore.h:
1457         (WebKit::WebsiteDataStore::setBoundInterfaceIdentifier): Deleted.
1458         (WebKit::WebsiteDataStore::setAllowsCellularAccess): Deleted.
1459         (WebKit::WebsiteDataStore::setProxyConfiguration): Deleted.
1460
1461 2019-10-28  Brady Eidson  <beidson@apple.com>
1462
1463         Expose _printOperationWithPrintInfo: SPI as API
1464         <rdar://problem/36557179> and https://bugs.webkit.org/show_bug.cgi?id=203496
1465
1466         Reviewed by Andy Estes.
1467
1468         * UIProcess/API/Cocoa/WKWebView.h:
1469         * UIProcess/API/Cocoa/WKWebView.mm:
1470         (-[WKWebView printOperationWithPrintInfo:]):
1471         (-[WKWebView _printOperationWithPrintInfo:]):
1472
1473 2019-10-28  Kate Cheney  <katherine_cheney@apple.com>
1474
1475         Layout Test http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html is a flaky failure
1476         https://bugs.webkit.org/show_bug.cgi?id=203491
1477         <rdar://problem/56674176>
1478
1479         Reviewed by Chris Dumez.
1480
1481         No new tests, this change is tested by the existing resourceLoadStatistics
1482         tests.
1483
1484         This test started flaking when a new memory store was being created
1485         between tests to maintain consistency. The call to grandfatherExistingWebsiteData
1486         from populateMemoryStoreFromDisk in the persistent storage was
1487         async, causing a race condition that led to occasional failures.
1488         Adding a completion handler and changing the callsite of
1489         populateMemoryStoreFromDisk should fix this problem.
1490
1491         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp:
1492         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
1493         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.h:
1494         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1495         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1496         The persistent store in the databaseEnabled case was never being used
1497         and is unnecessary.
1498
1499         (WebKit::WebResourceLoadStatisticsStore::populateMemoryStoreFromDisk):
1500         Since persistent storage only exists when using the memory store,
1501         populateMemoryStoreFromDisk should check if
1502         m_persistentStorage has been initialized.
1503
1504         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1505         * NetworkProcess/NetworkProcess.cpp:
1506         (WebKit::NetworkProcess::setUseITPDatabase):
1507         * NetworkProcess/NetworkSession.cpp:
1508         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
1509         (WebKit::NetworkSession::recreateResourceLoadStatisticStore):
1510         * NetworkProcess/NetworkSession.h:
1511
1512 2019-10-28  Wenson Hsieh  <wenson_hsieh@apple.com>
1513
1514         [iOS] 3 editing/pasteboard/smart-paste-paragraph-* tests are flaky
1515         https://bugs.webkit.org/show_bug.cgi?id=203264
1516         <rdar://problem/56512107>
1517
1518         Reviewed by Tim Horton.
1519
1520         Fixes several flaky layout tests that exercise a corner case in our logic for caching position information
1521         responses in the UI process. When focusing an element via a tap, we send a position information request for the
1522         tap location in -_webTouchEventsRecognized:. After the web process computes the information and hands it back to
1523         the UI process, we cache this in WKContentView's _positionInformation.
1524
1525         However, at the time of computing the request, the tapped element has not been focused yet, so the value of the
1526         position information's nodeAtPositionIsFocusedElement flag is false. After the tap is recognized, we'll then
1527         focus the element, such that if a subsequent position information request were to arrive at the same location,
1528         it would have a nodeAtPositionIsFocusedElement flag set to true.
1529
1530         In this state, if the user taps _exactly_ at the same location again, UIKit (through text interaction gestures)
1531         will ask us for information at the same point; we will end up using the cached information, for which
1532         nodeAtPositionIsFocusedElement is false, causing us to incorrectly prevent the text interaction. In this
1533         particular case, we fail to select text via a double tap gesture.
1534
1535         To address this, we invalidate the cached position information in the UI process whenever the focused element
1536         rect changes (e.g. when the focused element changes); the only exception to this is when the previously cached
1537         position information was not over the focused element, and the new focused element rect is empty, in which case
1538         the value of nodeAtPositionIsFocusedElement is guaranteed to have not changed.
1539
1540         While this may potentially leads to an additional synchronous position information request when tapping at the
1541         same location after focusing an element, this is very difficult to achieve in practice, since the tap location
1542         would need to be _exactly_ at the same location.
1543
1544         No new test, since this is exercised by existing flaky layout tests.
1545
1546         * UIProcess/ios/WKContentViewInteraction.mm:
1547         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
1548         (-[WKContentView _elementDidBlur]):
1549
1550         Also, add a FIXME about how we clear out surprisingly little of _focusedElementInformation when blurring the
1551         focused element.
1552
1553         (-[WKContentView _didChangeFocusedElementRect:toRect:]):
1554
1555 2019-10-28  John Wilander  <wilander@apple.com>
1556
1557         Storage Access API: Make the API work with the experimental 3rd-party cookie blocking
1558         https://bugs.webkit.org/show_bug.cgi?id=203428
1559         <rdar://problem/56626949>
1560
1561         Reviewed by Alex Christensen.
1562
1563         Tests: http/tests/storageAccess/deny-due-to-no-interaction-under-general-third-party-cookie-blocking.html
1564                http/tests/storageAccess/grant-with-prompt-under-general-third-party-cookie-blocking.html
1565                http/tests/storageAccess/has-storage-access-under-general-third-party-cookie-blocking-with-cookie.html
1566                http/tests/storageAccess/has-storage-access-under-general-third-party-cookie-blocking-without-cookie.html
1567
1568         This patch adds Storage Access API support for the experimental 3rd-party cookie blocking that
1569         landed in <https://trac.webkit.org/changeset/251467>.
1570
1571         There are three policies at play because it can be changed with the experimental setting:
1572         1. The underlying cookie policy.
1573         2. Shipping ITP.
1574         3. The off by default, experimental 3rd-party cookie blocking.
1575
1576         To support them all, a CookieAccess enum was added to encode how the API should respond.
1577         The enum has these values:
1578         CannotRequest - This third-party cannot request storage access based on the current policy.
1579         BasedOnCookiePolicy – This third-party should be treated according to the underlying cookie policy.
1580         OnlyIfGranted – This third-party can and must get access through the Storage Access API.
1581
1582         Here's the truth table I used to work through the logic for both
1583         document.hasStorageAccess() and document.requestStorageAccess():
1584
1585         Access  | Is        | User        | Has    | 3rd-party    |        |
1586         granted | prevalent | interaction | cookie | cookie block | RESULT |
1587         -------------------------------------------------------------------
1588         |       |           |             |        |              | false  |
1589         -------------------------------------------------------------------
1590         |       |           |             |        | true         | false  |
1591         -------------------------------------------------------------------
1592         |       |           |             | true   |              | true   |
1593         -------------------------------------------------------------------
1594         |       |           |             | true   | true         | false  |
1595         -------------------------------------------------------------------
1596         |       |           | true        |        |              | false  |
1597         -------------------------------------------------------------------
1598         |       |           | true        |        | true         | false  |
1599         -------------------------------------------------------------------
1600         |       |           | true        | true   |              | true   |
1601         -------------------------------------------------------------------
1602         |       |           | true        | true   | true         | false  |
1603         -------------------------------------------------------------------
1604         |       | true      | !care       | !care  | !care        | false  |
1605         -------------------------------------------------------------------
1606         | true  | !care     | !care       | !care  | !care        | true   |
1607         -------------------------------------------------------------------
1608
1609         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1610         (WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess const):
1611         (WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess):
1612         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
1613         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
1614             Extra checks removed since there's no harm in granting access
1615             to a third-party that already has access by way of the underlying
1616             cookie policy. Also, this is a temporary compatibility fix.
1617         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1618         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1619         (WebKit::ResourceLoadStatisticsMemoryStore::cookieAccess const):
1620         (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
1621         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
1622         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
1623             Extra checks removed since there's no harm in granting access
1624             to a third-party that already has access by way of the underlying
1625             cookie policy. Also, this is a temporary compatibility fix.
1626         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
1627         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
1628         (WebKit::ResourceLoadStatisticsStore::setIsThirdPartyCookieBlockingEnabled):
1629         (WebKit::ResourceLoadStatisticsStore::isThirdPartyCookieBlockingEnabled const):
1630         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1631         (WebKit::WebResourceLoadStatisticsStore::setIsThirdPartyCookieBlockingEnabled):
1632             This is now the single path to control this setting in both ITP
1633             and the network storage session. See comment below.
1634         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1635         * NetworkProcess/NetworkProcess.cpp:
1636         (WebKit::NetworkProcess::setShouldBlockThirdPartyCookiesForTesting):
1637         * NetworkProcess/NetworkSession.cpp:
1638         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
1639         (WebKit::NetworkSession::setIsThirdPartyCookieBlockingEnabled):
1640             Restructured these so that they are initiated like the rest of the
1641             parameters and only have a single path for changes so that a
1642             reset to consistent state resets all the state.
1643         * NetworkProcess/NetworkSession.h:
1644         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1645         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1646
1647 2019-10-28  Alex Christensen  <achristensen@webkit.org>
1648
1649         Remove unused NetworkProcessCreationParameters.urlSchemesRegisteredAsCanDisplayOnlyIfCanRequest
1650         https://bugs.webkit.org/show_bug.cgi?id=203393
1651
1652         Reviewed by Chris Dumez.
1653
1654         * NetworkProcess/NetworkProcess.cpp:
1655         (WebKit::NetworkProcess::initializeNetworkProcess):
1656         (WebKit::NetworkProcess::registerURLSchemeAsCanDisplayOnlyIfCanRequest const): Deleted.
1657         * NetworkProcess/NetworkProcess.h:
1658         * NetworkProcess/NetworkProcess.messages.in:
1659         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1660         (WebKit::NetworkProcessCreationParameters::encode const):
1661         (WebKit::NetworkProcessCreationParameters::decode):
1662         * NetworkProcess/NetworkProcessCreationParameters.h:
1663         * UIProcess/WebProcessPool.cpp:
1664         (WebKit::WebProcessPool::ensureNetworkProcess):
1665         (WebKit::WebProcessPool::registerURLSchemeAsCanDisplayOnlyIfCanRequest):
1666
1667 2019-10-28  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1668
1669         [GTK][WPE] Enable CSS typed OM
1670         https://bugs.webkit.org/show_bug.cgi?id=192875
1671
1672         Reviewed by Carlos Garcia Campos.
1673
1674         Enable the runtime feature by default on GTK/WPE when building with
1675         experimental features enabled.
1676
1677         Covered by existing tests.
1678
1679         * Shared/WebPreferences.yaml:
1680         * Shared/WebPreferencesDefaultValues.h:
1681
1682 2019-10-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1683
1684         [GTK] Simplify the Input Method implementation
1685         https://bugs.webkit.org/show_bug.cgi?id=203149
1686
1687         Reviewed by Adrian Perez de Castro.
1688
1689         * Shared/NativeWebKeyboardEvent.h: Stop using WebCore::CompositionResults.
1690         (WebKit::NativeWebKeyboardEvent::text const):
1691         (WebKit::NativeWebKeyboardEvent::handledByInputMethod const):
1692         (WebKit::NativeWebKeyboardEvent::fakedForComposition const):
1693         * Shared/gtk/NativeWebKeyboardEventGtk.cpp: Ditto.
1694         (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
1695         * Shared/gtk/WebEventFactory.cpp:
1696         (WebKit::WebEventFactory::createWebKeyboardEvent): Ditto.
1697         * Shared/gtk/WebEventFactory.h:
1698         * UIProcess/API/gtk/PageClientImpl.cpp:
1699         (WebKit::PageClientImpl::doneWithKeyEvent): Updated to use the new name.
1700         * UIProcess/API/gtk/WebKitWebViewBase.cpp: Stop using WebCore::CompositionResults.
1701         (webkitWebViewBaseKeyPressEvent):
1702         (webkitWebViewBaseKeyReleaseEvent):
1703         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h: Remove unused function.
1704         * UIProcess/WebPageProxy.cpp:
1705         (WebKit::WebPageProxy::setComposition): Use EditingRange instead of two integers and remove replacement range
1706         that is unused.
1707         (WebKit::WebPageProxy::confirmComposition): Remove unused selection range parameters.
1708         * UIProcess/WebPageProxy.h:
1709         * UIProcess/gtk/InputMethodFilter.cpp:
1710         (WebKit::InputMethodFilter::handleKeyboardEvent):
1711         (WebKit::InputMethodFilter::handleKeyboardEventWithCompositionResults):
1712         (WebKit::InputMethodFilter::confirmComposition):
1713         (WebKit::InputMethodFilter::updatePreedit):
1714         (WebKit::InputMethodFilter::confirmCurrentComposition):
1715         (WebKit::InputMethodFilter::sendCompositionAndPreeditWithFakeKeyEvents):
1716         (WebKit::InputMethodFilter::logHandleKeyboardEventForTesting):
1717         (WebKit::InputMethodFilter::logHandleKeyboardEventWithCompositionResultsForTesting):
1718         * UIProcess/gtk/InputMethodFilter.h:
1719         * WebProcess/WebPage/WebPage.cpp:
1720         (WebKit::targetFrameForEditing): Receive a reference instead of a pointer.
1721         (WebKit::WebPage::confirmComposition): Remove the unused code to handle the selection range.
1722         (WebKit::WebPage::setComposition): Remove the unused code to handle the replacement range.
1723         * WebProcess/WebPage/WebPage.h:
1724         * WebProcess/WebPage/WebPage.messages.in:
1725
1726 2019-10-27  Fujii Hironori  <Hironori.Fujii@sony.com>
1727
1728         Unreviewed build fix for !ENABLE(MEDIA_STREAM) builds
1729         https://bugs.webkit.org/show_bug.cgi?id=203362
1730         <rdar://problem/56648232>
1731
1732         * UIProcess/UserMediaPermissionRequestProxy.h: Enclosed isUserGesturePriviledged with #if ENABLE(MEDIA_STREAM).
1733
1734 2019-10-21  Jiewen Tan  <jiewen_tan@apple.com>
1735
1736         [WebAuthn] Warn users when multiple NFC tags present
1737         https://bugs.webkit.org/show_bug.cgi?id=200932
1738         <rdar://problem/54890736>
1739
1740         Reviewed by Brent Fulgham.
1741
1742         This patch utilizes -[_WKWebAuthenticationPanelDelegate panel:updateWebAuthenticationPanel:] to
1743         inform clients about multiple physical tags are presenting such that clients can instruct users
1744         to select only one of them physically. Given a physical tag could have multiple different
1745         interfaces, which NearField will treat them into different NFTags, the tagID is then used to
1746         identify if there are actually multiple physical tags.
1747
1748         This patch also adds the ability to restart polling of a partiuclar NFReaderSession to NfcConnection
1749         and the ability to restart the whole session to NfcService. The former is used to recover from errors
1750         in the discovery stages, and the latter is used to recover from errors returned from authenticators
1751         in the request stages. For the latter, given NfcConnection is not awared of the syntax of FIDO2/U2F
1752         protocol, and CtapAuthenticator/U2fAuthenticator are not awared the transport of the underneath driver.
1753         A generic restartDiscovery process is added to each service and it is up to the actual service to
1754         implement the actual process such that AuthenticatorManager can arbitrarily call it after exceptions
1755         are returned to restart the whole NFC session. To achieve restartDiscovery, NfcConnection is made
1756         RefCounted as well such that both the NfcService and the CtapNfcDriver could hold it at the same time.
1757         CtapNfcDriver uses the connection to complete requests as before while NfcService has the new capability
1758         to use it to stop the current session when restartDiscovery kicks off.
1759
1760         * Platform/spi/Cocoa/NearFieldSPI.h:
1761         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1762         (WebKit::AuthenticatorManager::serviceStatusUpdated):
1763         (WebKit::AuthenticatorManager::respondReceived):
1764         (WebKit::AuthenticatorManager::restartDiscovery):
1765         * UIProcess/WebAuthentication/AuthenticatorManager.h:
1766         * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
1767         (WebKit::AuthenticatorTransportService::startDiscovery):
1768         (WebKit::AuthenticatorTransportService::restartDiscovery):
1769         * UIProcess/WebAuthentication/AuthenticatorTransportService.h:
1770         (WebKit::AuthenticatorTransportService::restartDiscoveryInternal):
1771         * UIProcess/WebAuthentication/Cocoa/NfcConnection.h:
1772         * UIProcess/WebAuthentication/Cocoa/NfcConnection.mm:
1773         (WebKit::NfcConnection::create):
1774         (WebKit::NfcConnection::NfcConnection):
1775         (WebKit::NfcConnection::~NfcConnection):
1776         (WebKit::NfcConnection::stop const):
1777         (WebKit::NfcConnection::didDetectTags):
1778         (WebKit::NfcConnection::restartPolling):
1779         (WebKit::NfcConnection::startPolling):
1780         (WebKit::NfcConnection::didDetectTags const): Deleted.
1781         * UIProcess/WebAuthentication/Cocoa/NfcService.h:
1782         * UIProcess/WebAuthentication/Cocoa/NfcService.mm:
1783         (WebKit::NfcService::NfcService):
1784         (WebKit::NfcService::didConnectTag):
1785         (WebKit::NfcService::didDetectMultipleTags const):
1786         (WebKit::NfcService::setConnection):
1787         (WebKit::NfcService::restartDiscoveryInternal):
1788         (WebKit::NfcService::platformStartDiscovery):
1789         (WebKit::NfcService::setDriver): Deleted.
1790         * UIProcess/WebAuthentication/Mock/MockNfcService.h:
1791         * UIProcess/WebAuthentication/Mock/MockNfcService.mm:
1792         (-[WKMockNFTag tagID]):
1793         (-[WKMockNFTag initWithNFTag:]):
1794         (-[WKMockNFTag dealloc]):
1795         (-[WKMockNFTag initWithType:]):
1796         (-[WKMockNFTag initWithType:tagID:]):
1797         (WebKit::MockNfcService::receiveStopPolling):
1798         (WebKit::MockNfcService::receiveStartPolling):
1799         (WebKit::MockNfcService::platformStartDiscovery):
1800         (WebKit::MockNfcService::detectTags):
1801         (WebKit::MockNfcService::detectTags const): Deleted.
1802         * UIProcess/WebAuthentication/fido/CtapNfcDriver.cpp:
1803         (WebKit::CtapNfcDriver::CtapNfcDriver):
1804         * UIProcess/WebAuthentication/fido/CtapNfcDriver.h:
1805         * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
1806
1807 2019-10-26  youenn fablet  <youenn@apple.com>
1808
1809         Enforce user gesture for getUserMedia in case a previous getUserMedia call was denied
1810         https://bugs.webkit.org/show_bug.cgi?id=203362
1811
1812         Reviewed by Eric Carlson.
1813
1814         In case the request has user gesture priviledge, do not look at denied request history.
1815
1816         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1817         (WebKit::UserMediaPermissionRequestManagerProxy::getRequestAction):
1818         * UIProcess/UserMediaPermissionRequestProxy.h:
1819         (WebKit::UserMediaPermissionRequestProxy::isUserGesturePriviledged const):
1820
1821 2019-10-26  Chris Lord  <clord@igalia.com>
1822
1823         Put OffscreenCanvas behind a build flag
1824         https://bugs.webkit.org/show_bug.cgi?id=203146
1825
1826         Reviewed by Ryosuke Niwa.
1827
1828         Split the ImageBitmapOffscreenCanvas setting into two separate
1829         settings so OffscreenCanvas can be disabled at build time.
1830
1831         * Configurations/FeatureDefines.xcconfig:
1832         * Shared/WebPreferences.yaml:
1833         * Shared/WebPreferencesDefaultValues.h:
1834         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1835         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1836         * WebProcess/WebPage/WebInspectorUI.cpp:
1837         (WebKit::WebInspectorUI::WebInspectorUI):
1838
1839 2019-10-25  Chris Dumez  <cdumez@apple.com>
1840
1841         REGRESSION(r251599): Crash in MobileSafari tests (ASSERTION FAILED: m_pendingRequestToSuspendID)
1842         https://bugs.webkit.org/show_bug.cgi?id=203437
1843         <rdar://problem/56633399>
1844
1845         Reviewed by Geoffrey Garen.
1846
1847         * UIProcess/ProcessThrottler.cpp:
1848         (WebKit::ProcessThrottler::updateAssertionIfNeeded):
1849         Start the timer before sending the PrepareToSuspend IPC. The reason is that if the process has been
1850         terminated, the completion handler may run synchronously and cancel the request to suspend / stop
1851         the timer. Therefore, re-starting the timer after would be a mistake.
1852
1853 2019-10-25  David Kilzer  <ddkilzer@apple.com>
1854
1855         Unused arguments in MESSAGE_CHECK_CONTEXTID() macros
1856         <https://webkit.org/b/203389>
1857         <rdar://problem/55935374>
1858
1859         Reviewed by Alex Christensen.
1860
1861         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
1862         (#define MESSAGE_CHECK_CONTEXTID):
1863         - Rename macro argument from `contextID` to `identifier`
1864           and change `contextId`to `identifier` in the body of
1865           the macro so that the argument is always used.
1866         (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID):
1867         (WebKit::PlaybackSessionManagerProxy::currentTimeChanged):
1868         (WebKit::PlaybackSessionManagerProxy::bufferedTimeChanged):
1869         (WebKit::PlaybackSessionManagerProxy::seekableRangesVectorChanged):
1870         (WebKit::PlaybackSessionManagerProxy::canPlayFastReverseChanged):
1871         (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionOptionsChanged):
1872         (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionOptionsChanged):
1873         (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionIndexChanged):
1874         (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionIndexChanged):
1875         (WebKit::PlaybackSessionManagerProxy::externalPlaybackPropertiesChanged):
1876         (WebKit::PlaybackSessionManagerProxy::wirelessVideoPlaybackDisabledChanged):
1877         (WebKit::PlaybackSessionManagerProxy::mutedChanged):
1878         (WebKit::PlaybackSessionManagerProxy::volumeChanged):
1879         (WebKit::PlaybackSessionManagerProxy::durationChanged):
1880         (WebKit::PlaybackSessionManagerProxy::playbackStartedTimeChanged):
1881         (WebKit::PlaybackSessionManagerProxy::rateChanged):
1882         (WebKit::PlaybackSessionManagerProxy::pictureInPictureSupportedChanged):
1883         (WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged):
1884         (WebKit::PlaybackSessionManagerProxy::handleControlledElementIDResponse const):
1885         - Change `contextID` to `contextId` to match local variable name
1886           now that MESSAGE_CHECK_CONTEXTID() doesn't paper over this
1887           typo for us.
1888
1889         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1890         (#define MESSAGE_CHECK_CONTEXTID):
1891         - Rename macro argument from `contextID` to `identifier`
1892           and change `contextId`to `identifier` in the body of
1893           the macro so that the argument is always used.
1894
1895         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
1896         (#define MESSAGE_CHECK_CONTEXTID):
1897         - Rename macro argument and variable in the body of the
1898           macro from `id` to `identifier` for consistency.
1899
1900 2019-10-25  Per Arne Vollan  <pvollan@apple.com>
1901
1902         [iOS] Fix sandbox violations seen while running layout tests
1903         https://bugs.webkit.org/show_bug.cgi?id=203419
1904
1905         Reviewed by Brent Fulgham.
1906
1907         Deny mach lookup to 'com.apple.logd' and 'com.apple.logd.events' and suppress logs, since these are
1908         believed to be unneeded in the WebContent process. Allow sysctl write to 'vm.footprint_suspend'.
1909         Deny mach lookup to 'com.apple.system.notification_center' and suppress logs, since allowing this
1910         is not believed to be needed in the WebContent process.
1911
1912         No new tests, covered by existing tests.
1913
1914         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1915
1916 2019-10-25  Matt Lewis  <jlewis3@apple.com>
1917
1918         Rolling out r251579,r251162,r251512,r251500, and r251498 for build failures
1919         and test failures
1920
1921         Unreviewed rollout.
1922
1923         * Platform/spi/Cocoa/NearFieldSPI.h:
1924         * UIProcess/API/APIWebAuthenticationPanel.cpp:
1925         (API::WebAuthenticationPanel::create):
1926         (API::WebAuthenticationPanel::WebAuthenticationPanel):
1927         * UIProcess/API/APIWebAuthenticationPanel.h:
1928         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
1929         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
1930         (-[_WKWebAuthenticationPanel relyingPartyID]):
1931         (wkWebAuthenticationTransport): Deleted.
1932         (-[_WKWebAuthenticationPanel transports]): Deleted.
1933         (wkWebAuthenticationType): Deleted.
1934         (-[_WKWebAuthenticationPanel type]): Deleted.
1935         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1936         (WebKit::WebCore::collectTransports):
1937         (WebKit::AuthenticatorManager::handleRequest):
1938         (WebKit::AuthenticatorManager::respondReceived):
1939         (WebKit::AuthenticatorManager::respondReceivedInternal):
1940         (WebKit::AuthenticatorManager::startDiscovery):
1941         (WebKit::AuthenticatorManager::initTimeOutTimer):
1942         (WebKit::AuthenticatorManager::runPanel):
1943         (WebKit::AuthenticatorManager::startRequest):
1944         (WebKit::AuthenticatorManager::invokePendingCompletionHandler):
1945         (WebKit::WebCore::getClientDataType): Deleted.
1946         (WebKit::AuthenticatorManager::serviceStatusUpdated): Deleted.
1947         (WebKit::AuthenticatorManager::filterTransports const): Deleted.
1948         (WebKit::AuthenticatorManager::getTransports const): Deleted.
1949         (WebKit::AuthenticatorManager::restartDiscovery): Deleted.
1950         * UIProcess/WebAuthentication/AuthenticatorManager.h:
1951         (WebKit::AuthenticatorManager::respondReceivedInternal): Deleted.
1952         * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
1953         (WebKit::AuthenticatorTransportService::startDiscovery):
1954         (WebKit::AuthenticatorTransportService::restartDiscovery): Deleted.
1955         * UIProcess/WebAuthentication/AuthenticatorTransportService.h:
1956         (WebKit::AuthenticatorTransportService::restartDiscoveryInternal): Deleted.
1957         * UIProcess/WebAuthentication/Cocoa/NfcConnection.h:
1958         * UIProcess/WebAuthentication/Cocoa/NfcConnection.mm:
1959         (WebKit::NfcConnection::NfcConnection):
1960         (WebKit::NfcConnection::~NfcConnection):
1961         (WebKit::NfcConnection::didDetectTags const):
1962         (WebKit::NfcConnection::create): Deleted.
1963         (WebKit::NfcConnection::stop const): Deleted.
1964         (WebKit::NfcConnection::didDetectTags): Deleted.
1965         (WebKit::NfcConnection::restartPolling): Deleted.
1966         (WebKit::NfcConnection::startPolling): Deleted.
1967         * UIProcess/WebAuthentication/Cocoa/NfcService.h:
1968         * UIProcess/WebAuthentication/Cocoa/NfcService.mm:
1969         (WebKit::NfcService::NfcService):
1970         (WebKit::NfcService::didConnectTag):
1971         (WebKit::NfcService::setDriver):
1972         (WebKit::NfcService::platformStartDiscovery):
1973         (WebKit::NfcService::isAvailable): Deleted.
1974         (WebKit::NfcService::didDetectMultipleTags const): Deleted.
1975         (WebKit::NfcService::setConnection): Deleted.
1976         (WebKit::NfcService::restartDiscoveryInternal): Deleted.
1977         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
1978         (WebKit::MockAuthenticatorManager::filterTransports const): Deleted.
1979         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h:
1980         * UIProcess/WebAuthentication/Mock/MockNfcService.h:
1981         * UIProcess/WebAuthentication/Mock/MockNfcService.mm:
1982         (-[WKMockNFTag initWithNFTag:]):
1983         (-[WKMockNFTag dealloc]):
1984         (-[WKMockNFTag initWithType:]):
1985         (WebKit::MockNfcService::platformStartDiscovery):
1986         (WebKit::MockNfcService::detectTags const):
1987         (-[WKMockNFTag tagID]): Deleted.
1988         (-[WKMockNFTag initWithType:tagID:]): Deleted.
1989         (WebKit::MockNfcService::receiveStopPolling): Deleted.
1990         (WebKit::MockNfcService::receiveStartPolling): Deleted.
1991         * UIProcess/WebAuthentication/fido/CtapNfcDriver.cpp:
1992         (WebKit::CtapNfcDriver::CtapNfcDriver):
1993         * UIProcess/WebAuthentication/fido/CtapNfcDriver.h:
1994         * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
1995
1996 2019-10-24  Wenson Hsieh  <wenson_hsieh@apple.com>
1997
1998         [iOS 13] fast/forms/ios/accessory-bar-navigation.html is a flaky failure
1999         https://bugs.webkit.org/show_bug.cgi?id=203294
2000         <rdar://problem/54520848>
2001
2002         Reviewed by Tim Horton.
2003
2004         Add an SPI declaration (as well as an internal-SKD-only header import) for UIKeyboardPreferencesController.
2005         See Tools/ChangeLog for more details.
2006
2007         * Platform/spi/ios/UIKitSPI.h:
2008
2009 2019-10-24  Ryosuke Niwa  <rniwa@webkit.org>
2010
2011         Add exclusion rules to text manipulation SPI
2012         https://bugs.webkit.org/show_bug.cgi?id=203398
2013         <rdar://problem/56567256>
2014
2015         Reviewed by Wenson Hsieh.
2016
2017         Added SPI to specify the configuration for the text manipulation (see r251574), in particular, the set of rules
2018         governing which content should be excluded or included in text manipulations.
2019
2020         Test: TextManipulation.StartTextManipulationExitEarlyWithoutDelegate
2021
2022         * SourcesCocoa.txt:
2023         * UIProcess/API/Cocoa/WKWebView.mm:
2024         (-[WKWebView _startTextManipulationsWithConfiguration:completion:]): Takes _WKTextManipulationConfiguration
2025         as an argument. Also fixed a bug that we weren't calling the completion handler when the delegate was not set.
2026         (-[WKWebView _completeTextManipulation:completion:]):
2027         (-[WKWebView _startTextManipulationsWithCompletionHandler:]): Deleted.
2028         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2029         * UIProcess/API/Cocoa/_WKTextManipulationConfiguration.h: Added.
2030         * UIProcess/API/Cocoa/_WKTextManipulationConfiguration.mm: Added.
2031         * UIProcess/API/Cocoa/_WKTextManipulationExclusionRule.h: Added.
2032         * UIProcess/API/Cocoa/_WKTextManipulationExclusionRule.mm: Added.
2033         (-[_WKTextManipulationExclusionRule initExclusion:forElement:]): Added.
2034         (-[_WKTextManipulationExclusionRule initExclusion:forAttribute:value:]): Added.
2035         (-[_WKTextManipulationExclusionRule elementName]): Added.
2036         (-[_WKTextManipulationExclusionRule attributeName]): Added.
2037         (-[_WKTextManipulationExclusionRule attributeValue]): Added.
2038         * UIProcess/API/Cocoa/_WKTextManipulationToken.h: Added excluded boolean property.
2039         * UIProcess/API/Cocoa/_WKTextManipulationToken.mm: Removed the superflous import of RetainPtr.h
2040         * UIProcess/WebPageProxy.cpp:
2041         (WebKit::WebPageProxy::startTextManipulations):
2042         (WebKit::WebPageProxy::completeTextManipulation):
2043         * UIProcess/WebPageProxy.h:
2044         * WebKit.xcodeproj/project.pbxproj:
2045         * WebProcess/WebPage/WebPage.cpp:
2046         (WebKit::WebPage::startTextManipulations):
2047         (WebKit::WebPage::completeTextManipulation):
2048         * WebProcess/WebPage/WebPage.h:
2049         * WebProcess/WebPage/WebPage.messages.in:
2050
2051 2019-10-25  Chris Dumez  <cdumez@apple.com>
2052
2053         [iOS][WK2] Use sendWithAsyncReply() to simplify the prepareToSuspend logic
2054         https://bugs.webkit.org/show_bug.cgi?id=203422
2055
2056         Reviewed by Alex Christensen.
2057
2058         Use sendWithAsyncReply() to simplify the prepareToSuspend logic and make it easier to
2059         understand.
2060
2061         * NetworkProcess/NetworkProcess.cpp:
2062         (WebKit::NetworkProcess::processWillSuspendImminentlyForTestingSync):
2063         (WebKit::NetworkProcess::prepareToSuspend):
2064         * NetworkProcess/NetworkProcess.h:
2065         * NetworkProcess/NetworkProcess.messages.in:
2066         * UIProcess/API/Cocoa/WKWebView.mm:
2067         (-[WKWebView _processWillSuspendImminentlyForTesting]):
2068         * UIProcess/Network/NetworkProcessProxy.cpp:
2069         (WebKit::NetworkProcessProxy::sendPrepareToSuspend):
2070         (WebKit::NetworkProcessProxy::processReadyToSuspend): Deleted.
2071         * UIProcess/Network/NetworkProcessProxy.h:
2072         * UIProcess/Network/NetworkProcessProxy.messages.in:
2073         * UIProcess/ProcessThrottler.cpp:
2074         (WebKit::ProcessThrottler::processReadyToSuspend):
2075         (WebKit::ProcessThrottler::sendPrepareToSuspendIPC):
2076         * UIProcess/ProcessThrottler.h:
2077         * UIProcess/ProcessThrottlerClient.h:
2078         * UIProcess/WebProcessProxy.cpp:
2079         (WebKit::WebProcessProxy::sendPrepareToSuspend):
2080         (WebKit::WebProcessProxy::processReadyToSuspend): Deleted.
2081         * UIProcess/WebProcessProxy.h:
2082         * UIProcess/WebProcessProxy.messages.in:
2083         * WebProcess/WebProcess.cpp:
2084         (WebKit::WebProcess::prepareToSuspend):
2085         * WebProcess/WebProcess.h:
2086         * WebProcess/WebProcess.messages.in:
2087
2088 2019-10-25  youenn fablet  <youenn@apple.com>
2089
2090         WebProcess should unregister its interest for a SWServerRegistration when all its corresponding ServiceWorkerRegistrations are destroyed
2091         https://bugs.webkit.org/show_bug.cgi?id=203410
2092
2093         Reviewed by Chris Dumez.
2094
2095         A SWServerRegistration is keeping a list of web processes that should be notified of change to its state.
2096         Previously, WebProcesses were registering their interest to a SWServerRegistration on construction of a ServiceWorkerRegistration,
2097         and unregistering their interest on destruction of a ServiceWorkerRegistration.
2098
2099         This does not work in case two ServiceWorkerRegistrations are created for the same SWServerRegistration in the same WebProcess.
2100         In that case, when one of the two ServiceWorkerRegistration is destroyed, the WebProcess will no longer be notified of changes to the SWServerRegistration,
2101         thus breaking the second ServiceWorkerRegistration behavior.
2102
2103         We introduce a map at WebProcess level to keep track of the number of ServiceWorkerRegistration created for a given SWServerRegistration.
2104
2105         Covered by re-enabled tests.
2106
2107         * WebProcess/Storage/WebSWClientConnection.cpp:
2108         (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
2109         (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
2110         * WebProcess/WebProcess.cpp:
2111         (WebKit::WebProcess::addServiceWorkerRegistration):
2112         (WebKit::WebProcess::removeServiceWorkerRegistration):
2113         * WebProcess/WebProcess.h:
2114
2115 2019-10-25  youenn fablet  <youenn@apple.com>
2116
2117         mp4 video element broken with service worker
2118         https://bugs.webkit.org/show_bug.cgi?id=184447
2119         <rdar://problem/39313155>
2120
2121         Reviewed by Chris Dumez.
2122
2123         Make a response as range-requested as per https://fetch.spec.whatwg.org/#http-network-or-cache-fetch step 15.
2124
2125         * NetworkProcess/NetworkLoadChecker.cpp:
2126         (WebKit::NetworkLoadChecker::checkRedirection):
2127         (WebKit::NetworkLoadChecker::validateResponse):
2128         * NetworkProcess/NetworkLoadChecker.h:
2129         * NetworkProcess/NetworkResourceLoader.cpp:
2130         (WebKit::NetworkResourceLoader::didReceiveResponse):
2131         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
2132
2133 2019-10-25  Chris Dumez  <cdumez@apple.com>
2134
2135         [iOS] Regression(r251067) WebProcesses with service workers no longer keep their network process alive
2136         https://bugs.webkit.org/show_bug.cgi?id=203388
2137         <rdar://problem/56600074>
2138
2139         Reviewed by Geoffrey Garen.
2140
2141         Historically, WebProcessProxy::didSetAssertionState() used to return early for service worker processes
2142         because we did not want service worker processes to prevent the network process from suspending. The
2143         WebProcesses using the service worker process would prevent the network process from suspending when
2144         they are visible, so it would work fine.
2145
2146         However, after r251067, there is no longer a concept of service worker process per se. Service workers
2147         will now sometimes run in regular WebProcesses where we have pages. In such cases, didSetAssertionState()
2148         would still return early and fail to keep its network process alive, even when the page(s) in this process
2149         are visible on screen.
2150
2151         To address the issue, we now only return early if the process has a service worker but no page.
2152         This should restore pre-existing behavior.
2153
2154         Note that this was causing hangs such as <rdar://problem/56245136> because the WebProcess would be
2155         stuck on sync IPC to a suspended network process.
2156
2157         * UIProcess/WebProcessProxy.cpp:
2158         (WebKit::WebProcessProxy::didSetAssertionState):
2159
2160 2019-10-25  Chris Dumez  <cdumez@apple.com>
2161
2162         Standardize "PageID=" vs "pageID =" in release logging
2163         https://bugs.webkit.org/show_bug.cgi?id=203002
2164
2165         Reviewed by Geoffrey Garen.
2166
2167         * UIProcess/API/Cocoa/WKWebView.mm:
2168         (-[WKWebView _didCommitLayerTree:]):
2169         (-[WKWebView _updateVisibleContentRects]):
2170         (-[WKWebView _cancelAnimatedResize]):
2171         (-[WKWebView _didCompleteAnimatedResize]):
2172         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
2173         (-[WKWebView _endAnimatedResize]):
2174         (-[WKWebView _resizeWhileHidingContentWithUpdates:]):
2175         * UIProcess/ProvisionalPageProxy.cpp:
2176         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
2177         (WebKit::ProvisionalPageProxy::processDidTerminate):
2178         (WebKit::ProvisionalPageProxy::cancel):
2179         (WebKit::ProvisionalPageProxy::loadData):
2180         (WebKit::ProvisionalPageProxy::loadRequest):
2181         (WebKit::ProvisionalPageProxy::goToBackForwardItem):
2182         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
2183         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
2184         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
2185         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
2186         * WebProcess/Network/WebLoaderStrategy.cpp:
2187         (WebKit::WebLoaderStrategy::loadResource):
2188         (WebKit::WebLoaderStrategy::scheduleLoad):
2189         (WebKit::WebLoaderStrategy::tryLoadingUsingURLSchemeHandler):
2190         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2191         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
2192         * WebProcess/Network/WebResourceLoader.cpp:
2193         (WebKit::WebResourceLoader::willSendRequest):
2194         (WebKit::WebResourceLoader::didReceiveResponse):
2195         (WebKit::WebResourceLoader::didReceiveData):
2196         (WebKit::WebResourceLoader::didFinishResourceLoad):
2197         (WebKit::WebResourceLoader::serviceWorkerDidNotHandle):
2198         (WebKit::WebResourceLoader::didFailResourceLoad):
2199         (WebKit::WebResourceLoader::didBlockAuthenticationChallenge):
2200         (WebKit::WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied):
2201         (WebKit::WebResourceLoader::didReceiveResource):
2202         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2203         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
2204         (WebKit::WebFrameLoaderClient::dispatchDidFailLoad):
2205         * WebProcess/WebPage/WebPage.cpp:
2206         (WebKit::WebPage::freezeLayerTree):
2207         (WebKit::WebPage::unfreezeLayerTree):
2208
2209 2019-10-24  Chris Dumez  <cdumez@apple.com>
2210
2211         Simplify ProcessThrottler implementation
2212         https://bugs.webkit.org/show_bug.cgi?id=203370
2213
2214         Reviewed by Alex Christensen.
2215
2216         Simplify ProcessThrottler implementation by:
2217         - Getting rid of CancelPrepareToSuspend IPC. Instead a regular ProcessDidResume IPC is sent to
2218           the child process.
2219         - Getting rid of the ProcessWillSuspendImminently IPC and send a regular ProcessDidResume IPC
2220           with a 'isSuspensionImminent' flag instead.
2221         - Whether the suspension is imminent or not, the child process now always responds with
2222           a ProcessReadyToSuspend IPC. This simplifies our logic as the idea is that treating imminent
2223           and non-imminent suspension should share as much of the same logic as possible.
2224         - All PrepareToSuspend IPCs now have an associated identifier and the child process sends back
2225           this identifier when responding with a ProcessReadyToSuspend IPC. This allows the
2226           ProcessThrottler to easily ignore outdated requests to suspend, without requiring the
2227           m_suspendMessageCount data member we had.
2228
2229         This patch also adds more logging to ProcessThrottler and the suspension logic in the child
2230         processes. All ProcessThrottler logging now also shows the child process's PID for clarity.
2231
2232         * NetworkProcess/NetworkProcess.cpp:
2233         (WebKit::NetworkProcess::processWillSuspendImminentlyForTestingSync):
2234         (WebKit::NetworkProcess::prepareToSuspend):
2235         * NetworkProcess/NetworkProcess.h:
2236         * NetworkProcess/NetworkProcess.messages.in:
2237         * UIProcess/API/Cocoa/WKWebView.mm:
2238         (-[WKWebView _processWillSuspendImminentlyForTesting]):
2239         * UIProcess/Network/NetworkProcessProxy.cpp:
2240         (WebKit::NetworkProcessProxy::sendPrepareToSuspend):
2241         (WebKit::NetworkProcessProxy::processReadyToSuspend):
2242         * UIProcess/Network/NetworkProcessProxy.h:
2243         * UIProcess/Network/NetworkProcessProxy.messages.in:
2244         * UIProcess/ProcessThrottler.cpp:
2245         (WebKit::generatePrepareToSuspendRequestID):
2246         (WebKit::ProcessThrottler::ProcessThrottler):
2247         (WebKit::m_backgroundCounter):
2248         (WebKit::ProcessThrottler::expectedAssertionState):
2249         (WebKit::ProcessThrottler::updateAssertionStateNow):
2250         (WebKit::ProcessThrottler::setAssertionState):
2251         (WebKit::ProcessThrottler::updateAssertionIfNeeded):
2252         (WebKit::ProcessThrottler::didConnectToProcess):
2253         (WebKit::ProcessThrottler::prepareToSuspendTimeoutTimerFired):
2254         (WebKit::ProcessThrottler::processReadyToSuspend):
2255         (WebKit::ProcessThrottler::clearPendingRequestToSuspend):
2256         (WebKit::ProcessThrottler::sendPrepareToSuspendIPC):
2257         (WebKit::ProcessThrottler::uiAssertionWillExpireImminently):
2258         * UIProcess/ProcessThrottler.h:
2259         * UIProcess/ProcessThrottlerClient.h:
2260         * UIProcess/WebProcessProxy.cpp:
2261         (WebKit::WebProcessProxy::sendPrepareToSuspend):
2262         (WebKit::WebProcessProxy::processReadyToSuspend):
2263         * UIProcess/WebProcessProxy.h:
2264         * UIProcess/WebProcessProxy.messages.in:
2265         * WebProcess/WebProcess.cpp:
2266         (WebKit::WebProcess::prepareToSuspend):
2267         * WebProcess/WebProcess.h:
2268         * WebProcess/WebProcess.messages.in:
2269
2270 2019-10-23  Ryosuke Niwa  <rniwa@webkit.org>
2271
2272         Add a mechanism to find and manipulate text by paragraphs
2273         https://bugs.webkit.org/show_bug.cgi?id=203286
2274
2275         Reviewed by Wenson Hsieh.
2276
2277         This patch introduces a new SPI to find paragraphs of text and let client replace the content of each paragraph.
2278         For now, this SPI is limited to find & replace contents of main frame's document.
2279
2280         WKWebView's _startTextManipulationsWithCompletionHandler sends StartTextManipulations message to WebContent process
2281         to find all paragraphs in the main frame. WebContent process will send back DidFindTextManipulationItem message
2282         for each paragraph, which in turn calls back _WKTextManipulationDelegate's _webView: didFindTextManipulationItem:.
2283
2284         Upon receiving this delegate callback, the client can invoke WKWebView's _completeTextManipulation to replace
2285         the content. It will send CompleteTextManipulation to WebContent process, which will invoke completeManipulation
2286         on main frame's document's TextManipulationController.
2287
2288         * UIProcess/API/Cocoa/WKWebView.mm:
2289         (-[WKWebView _textManipulationDelegate]): Aded.
2290         (-[WKWebView _setTextManipulationDelegate:]): Aded.
2291         (-[WKWebView _startTextManipulationsWithCompletionHandler:]):
2292         (-[WKWebView _completeTextManipulation:completion:]):
2293         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2294         * UIProcess/API/Cocoa/_WKTextManipulationDelegate.h: Added.
2295         * UIProcess/API/Cocoa/_WKTextManipulationItem.h: Added.
2296         * UIProcess/API/Cocoa/_WKTextManipulationItem.mm: Added.
2297         (-[_WKTextManipulationItem initWithIdentifier:tokens:]):
2298         (-[_WKTextManipulationItem identifier]):
2299         (-[_WKTextManipulationItem tokens]):
2300         * UIProcess/API/Cocoa/_WKTextManipulationToken.h: Added.
2301         * UIProcess/API/Cocoa/_WKTextManipulationToken.mm: Added.
2302         (-[_WKTextManipulationToken init]):
2303         * UIProcess/WebPageProxy.cpp:
2304         (WebKit::WebPageProxy::startTextManipulations):
2305         (WebKit::WebPageProxy::didFindTextManipulationItem):
2306         (WebKit::WebPageProxy::completeTextManipulation):
2307         * UIProcess/WebPageProxy.h:
2308         * UIProcess/WebPageProxy.messages.in:
2309         * WebKit.xcodeproj/project.pbxproj:
2310         * WebProcess/WebPage/WebPage.cpp:
2311         (WebKit::WebPage::startTextManipulations):
2312         (WebKit::WebPage::completeTextManipulation):
2313         * WebProcess/WebPage/WebPage.h:
2314         * WebProcess/WebPage/WebPage.messages.in:
2315
2316 2019-10-24  Matt Lewis  <jlewis3@apple.com>
2317
2318         Unreviewed, rolling out r251558.
2319
2320         This broke internal builds
2321
2322         Reverted changeset:
2323
2324         "Add a mechanism to find and manipulate text by paragraphs"
2325         https://bugs.webkit.org/show_bug.cgi?id=203286
2326         https://trac.webkit.org/changeset/251558
2327
2328 2019-10-24  Alex Christensen  <achristensen@webkit.org>
2329
2330         REGRESSION(r251409) Service worker connection should not be established without service worker entitlement
2331         https://bugs.webkit.org/show_bug.cgi?id=203385
2332         <rdar://problem/37790257>
2333
2334         Reviewed by Chris Dumez.
2335
2336         r251409 introduced a new call to establishSWServerConnection that should have an entitlement check.
2337         This was caught by a unit test in CI that is not easy to reproduce in WebKit's test.  See the radar.
2338
2339         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2340         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
2341
2342 2019-10-24  Brent Fulgham  <bfulgham@apple.com>
2343
2344         [iOS] Mismatch in com.apple.coremedia.audiodeviceclock declarations
2345         https://bugs.webkit.org/show_bug.cgi?id=203367
2346         <rdar://problem/56581166>
2347
2348         Reviewed by Per Arne Vollan.
2349
2350         The 'common.sb' sandbox allows access to "com.apple.coremedia.audiodeviceclock.xpc", but
2351         the WebContent sandbox blocked access to "com.apple.coremedia.audiodeviceclock". This means
2352         we aren't blocking that endpoint.
2353
2354         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2355
2356 2019-10-24  Brent Fulgham  <bfulgham@apple.com>
2357
2358         [iOS] Mismatch in com.apple.MediaPlayer.RemotePlayerService declarations
2359         https://bugs.webkit.org/show_bug.cgi?id=203368
2360         <rdar://problem/56581152>
2361
2362         Reviewed by Per Arne Vollan.
2363
2364         The 'common.sb' sandbox allows access to the xpc-service-name "com.apple.MediaPlayer.RemotePlayerService",
2365         but we block access to the global-name "com.apple.MediaPlayer.RemoteService". We aren't blocking
2366         the right thing.
2367
2368         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2369
2370 2019-10-24  Brady Eidson  <beidson@apple.com>
2371
2372         Expose pageZoom as API.
2373         https://bugs.webkit.org/show_bug.cgi?id=203381
2374
2375         Reviewed by Andy Estes.
2376
2377         No new tests (No behavior change, identical to SPI)
2378
2379         * UIProcess/API/Cocoa/WKWebView.h:
2380         * UIProcess/API/Cocoa/WKWebView.mm:
2381         (-[WKWebView setPageZoom:]):
2382         (-[WKWebView pageZoom]):
2383         (-[WKWebView _pageZoomFactor]):
2384         (-[WKWebView _setPageZoomFactor:]):
2385
2386 2019-10-23  Ryosuke Niwa  <rniwa@webkit.org>
2387
2388         Add a mechanism to find and manipulate text by paragraphs
2389         https://bugs.webkit.org/show_bug.cgi?id=203286
2390
2391         Reviewed by Wenson Hsieh.
2392
2393         This patch introduces a new SPI to find paragraphs of text and let client replace the content of each paragraph.
2394         For now, this SPI is limited to find & replace contents of main frame's document.
2395
2396         WKWebView's _startTextManipulationsWithCompletionHandler sends StartTextManipulations message to WebContent process
2397         to find all paragraphs in the main frame. WebContent process will send back DidFindTextManipulationItem message
2398         for each paragraph, which in turn calls back _WKTextManipulationDelegate's _webView: didFindTextManipulationItem:.
2399
2400         Upon receiving this delegate callback, the client can invoke WKWebView's _completeTextManipulation to replace
2401         the content. It will send CompleteTextManipulation to WebContent process, which will invoke completeManipulation
2402         on main frame's document's TextManipulationController.
2403
2404         * UIProcess/API/Cocoa/WKWebView.mm:
2405         (-[WKWebView _textManipulationDelegate]): Aded.
2406         (-[WKWebView _setTextManipulationDelegate:]): Aded.
2407         (-[WKWebView _startTextManipulationsWithCompletionHandler:]):
2408         (-[WKWebView _completeTextManipulation:completion:]):
2409         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2410         * UIProcess/API/Cocoa/_WKTextManipulationDelegate.h: Added.
2411         * UIProcess/API/Cocoa/_WKTextManipulationItem.h: Added.
2412         * UIProcess/API/Cocoa/_WKTextManipulationItem.mm: Added.
2413         (-[_WKTextManipulationItem initWithIdentifier:tokens:]):
2414         (-[_WKTextManipulationItem identifier]):
2415         (-[_WKTextManipulationItem tokens]):
2416         * UIProcess/API/Cocoa/_WKTextManipulationToken.h: Added.
2417         * UIProcess/API/Cocoa/_WKTextManipulationToken.mm: Added.
2418         (-[_WKTextManipulationToken init]):
2419         * UIProcess/WebPageProxy.cpp:
2420         (WebKit::WebPageProxy::startTextManipulations):
2421         (WebKit::WebPageProxy::didFindTextManipulationItem):
2422         (WebKit::WebPageProxy::completeTextManipulation):
2423         * UIProcess/WebPageProxy.h:
2424         * UIProcess/WebPageProxy.messages.in:
2425         * WebKit.xcodeproj/project.pbxproj:
2426         * WebProcess/WebPage/WebPage.cpp:
2427         (WebKit::WebPage::startTextManipulations):
2428         (WebKit::WebPage::completeTextManipulation):
2429         * WebProcess/WebPage/WebPage.h:
2430         * WebProcess/WebPage/WebPage.messages.in:
2431
2432 2019-10-24  Brent Fulgham  <bfulgham@apple.com>
2433
2434         Unreviewed fix after r251511.
2435
2436         Some syctl names were omitted from the initial checkin.
2437
2438         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2439
2440 2019-10-24  Brady Eidson  <beidson@apple.com>
2441
2442         Formalize PDF snapshot API.
2443         https://bugs.webkit.org/show_bug.cgi?id=203374
2444
2445         Reviewed by Tim Horton.
2446
2447         Covered by API tests and MiniBrowser usage.
2448
2449         * SourcesCocoa.txt:
2450         * UIProcess/API/Cocoa/WKPDFConfiguration.h: Added.
2451         * UIProcess/API/Cocoa/WKPDFConfiguration.mm: Added.
2452         (-[WKPDFConfiguration init]):
2453         (-[WKPDFConfiguration copyWithZone:]):
2454
2455         * UIProcess/API/Cocoa/WKWebView.h:
2456         * UIProcess/API/Cocoa/WKWebView.mm:
2457         (-[WKWebView createPDFWithConfiguration:completionHandler:]):
2458         (-[WKWebView _takePDFSnapshotWithConfiguration:completionHandler:]):
2459
2460         * UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h: Unified build strikes again.
2461
2462         * WebKit.xcodeproj/project.pbxproj:
2463
2464 2019-10-24  Brent Fulgham  <bfulgham@apple.com>
2465
2466         [iOS] Remove 'deny' rules that do not have a corresponding 'allow' rule
2467         https://bugs.webkit.org/show_bug.cgi?id=203352
2468
2469         Reviewed by Per Arne Vollan.
2470
2471         Now that we no longer import 'common.sb', and have removed entries that allowed
2472         services that we block, we can remove the 'deny' command. This is safe because
2473         everything is denied by default.
2474
2475         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2476
2477 2019-10-24  Alex Christensen  <achristensen@webkit.org>
2478
2479         Pass CORS-enabled schemes through WebProcess instead of having them NetworkProcess-global
2480         https://bugs.webkit.org/show_bug.cgi?id=202891
2481
2482         Reviewed by Youenn Fablet.
2483
2484         No change in behavior.  Now the LegacySchemeRegistry is not used as much in the NetworkProcess, a step towards no use at all.
2485         This functionality is currently only available through the glib API webkit_security_manager_register_uri_scheme_as_cors_enabled
2486         but it has been requested in bug 201180 and bug 199064.
2487
2488         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2489         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
2490         (WebKit::NetworkConnectionToWebProcess::loadPing):
2491         (WebKit::NetworkConnectionToWebProcess::registerURLSchemesAsCORSEnabled):
2492         * NetworkProcess/NetworkConnectionToWebProcess.h:
2493         (WebKit::NetworkConnectionToWebProcess::schemeRegistry):
2494         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2495         * NetworkProcess/NetworkLoadChecker.cpp:
2496         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
2497         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
2498         * NetworkProcess/NetworkLoadChecker.h:
2499         * NetworkProcess/NetworkProcess.cpp:
2500         (WebKit::NetworkProcess::initializeNetworkProcess):
2501         (WebKit::NetworkProcess::registerURLSchemeAsCORSEnabled const): Deleted.
2502         * NetworkProcess/NetworkProcess.messages.in:
2503         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2504         (WebKit::NetworkProcessCreationParameters::encode const):
2505         (WebKit::NetworkProcessCreationParameters::decode):
2506         * NetworkProcess/NetworkProcessCreationParameters.h:
2507         * NetworkProcess/NetworkResourceLoader.cpp:
2508         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
2509         * NetworkProcess/NetworkSchemeRegistry.cpp: Added.
2510         (WebKit::NetworkSchemeRegistry::registerURLSchemeAsCORSEnabled):
2511         (WebKit::NetworkSchemeRegistry::shouldTreatURLSchemeAsCORSEnabled):
2512         * NetworkProcess/NetworkSchemeRegistry.h: Added.
2513         (WebKit::NetworkSchemeRegistry::create):
2514         * NetworkProcess/PingLoad.cpp:
2515         (WebKit::PingLoad::PingLoad):
2516         Use nullptr, indicating that the PingLoad constructor that is used in ad click attribution should not check the custom scheme registry.
2517         This is Ok because ad click attribution is only used for HTTP family schemes.
2518         (WebKit::m_blobFiles):
2519         * NetworkProcess/PingLoad.h:
2520         * Sources.txt:
2521         * UIProcess/WebProcessPool.cpp:
2522         (WebKit::WebProcessPool::ensureNetworkProcess):
2523         (WebKit::WebProcessPool::registerURLSchemeAsCORSEnabled):
2524         * WebKit.xcodeproj/project.pbxproj:
2525         * WebProcess/WebProcess.cpp:
2526         (WebKit::WebProcess::initializeWebProcess):
2527         (WebKit::WebProcess::registerURLSchemeAsCORSEnabled):
2528         (WebKit::WebProcess::ensureNetworkProcessConnection):
2529         (WebKit::WebProcess::registerURLSchemeAsCORSEnabled const): Deleted.
2530         * WebProcess/WebProcess.h:
2531
2532 2019-10-24  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2533
2534         [GTK][WPE] Enable runtime setting with experimental features for Server Timing API
2535         https://bugs.webkit.org/show_bug.cgi?id=203295
2536
2537         Reviewed by Carlos Garcia Campos.
2538
2539         Enable the runtime ServerTiming by default when GTK or WPE is built
2540         with experimental features enabled.
2541
2542         No new tests, no change in behaviour for WTR.
2543
2544         * Shared/WebPreferences.yaml:
2545         * Shared/WebPreferencesDefaultValues.h:
2546
2547 2019-10-23  Chris Dumez  <cdumez@apple.com>
2548
2549         WebBackForwardCache::removeEntriesMatching() may re-enter and crash
2550         https://bugs.webkit.org/show_bug.cgi?id=203341
2551         <rdar://problem/56553939>
2552
2553         Reviewed by Geoffrey Garen.
2554
2555         When WebBackForwardCache::removeEntriesMatching() was clearing the WebBackForwardListItem's
2556         WebBackForwardCacheEntry, it could destroyed a SuspendedPageProxy which could shutdown a
2557         WebProcess. Upon shutting down, we would try to remove WebBackForwardCache entries associated
2558         with a given process, re-enter removeEntriesMatching() and crash.
2559
2560         To address the issue, I made WebBackForwardCache::removeEntriesMatching() safe to re-enter.
2561         We now clear the WebBackForwardListItems' WebBackForwardCacheEntries only after we're done
2562         updating m_itemsWithCachedPage.
2563
2564         * UIProcess/WebBackForwardCache.cpp:
2565         (WebKit::WebBackForwardCache::removeEntriesMatching):
2566
2567 2019-10-23  Megan Gardner  <megan_gardner@apple.com>
2568
2569         Rename force-press-related functions to refer to context menus, and fix a former force-press test
2570         https://bugs.webkit.org/show_bug.cgi?id=202663
2571         <rdar://problem/52699530>
2572
2573         Reviewed by Dean Jackson.
2574
2575         Add plumbing for contextMenu tests to function again, and rename all 
2576         relevant fuctions to more correctly reflect that this does not specifically
2577         require a force press to activate any longer.
2578
2579         * UIProcess/API/Cocoa/WKWebView.mm:
2580         (-[WKWebView _didShowContextMenu]):
2581         (-[WKWebView _didDismissContextMenu]):
2582         (-[WKWebView _didShowForcePressPreview]): Deleted.
2583         (-[WKWebView _didDismissForcePressPreview]): Deleted.
2584         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2585         * UIProcess/ios/WKContentViewInteraction.mm:
2586         (-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]):
2587         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
2588         (-[WKContentView _previewItemController:didDismissPreview:committing:]):
2589         (-[WKContentView _previewItemControllerDidCancelPreview:]):
2590
2591 2019-10-23  Tim Horton  <timothy_horton@apple.com>
2592
2593         macCatalyst: Should dispatch contextmenu event on right click
2594         https://bugs.webkit.org/show_bug.cgi?id=203316
2595         <rdar://problem/54617376>
2596
2597         Reviewed by Wenson Hsieh.
2598
2599         * WebProcess/WebPage/WebPage.cpp:
2600         (WebKit::isContextClick):
2601         (WebKit::handleContextMenuEvent):
2602         (WebKit::WebPage::contextMenuForKeyEvent):
2603         (WebKit::handleMouseEvent):
2604         * WebProcess/WebPage/WebPage.h:
2605
2606 2019-10-23  Brent Fulgham  <bfulgham@apple.com>
2607
2608         [iOS] Stop including 'common.sb' 
2609         https://bugs.webkit.org/show_bug.cgi?id=203318
2610
2611         Reviewed by Per Arne Vollan.
2612
2613         Replace the 'import' of common.sb with the equivalent statements. This is the
2614         first step in a task to remove uneeded sandbox rules.
2615
2616         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2617
2618 2019-10-23  Kate Cheney  <katherine_cheney@apple.com>
2619
2620         Implement dumpResourceLoadStatistics in SQLite ITP Database
2621         https://bugs.webkit.org/show_bug.cgi?id=203224
2622         <rdar://problem/56482165>
2623
2624         Reviewed by John Wilander. 
2625
2626         This patch implements dumpResourceLoadStatistics() in the ITP database
2627         store. This function required a boolean flag isScheduledForWebsiteDataRemoval that
2628         now must be stored in the database, resulting in a small schema change.
2629
2630         Because of the schema change, this patch also compares any existing 
2631         database file against the new schema, and deletes the existing file if the schema is 
2632         not current. 
2633
2634         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2635         The logic for topFrameLinkDecorationsFromQuery was the opposite
2636         of all other "xyzFrom" queries. When merging data from the memory 
2637         store, the load statistic being inserted holds a list of topFrames 
2638         which it has been redirected to from. I think it makes more sense
2639         to also organize the table this way.
2640
2641         (WebKit::ObservedDomainsTableSchemaV1):
2642         (WebKit::ObservedDomainsTableSchemaV1Alternate):
2643         For support on both iOS and MacOS, there are two CREATE TABLE queries
2644         to compare to, depending on whether the query result contains quotes
2645         around the table name.
2646
2647         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
2648         (WebKit::ResourceLoadStatisticsDatabaseStore::openITPDatabase):
2649         (WebKit::ResourceLoadStatisticsDatabaseStore::openAndDropOldDatabaseIfNecessary):
2650         The code to check for the current schema was adapted from SQLiteIDBBackingStore.cpp
2651
2652         (WebKit::ResourceLoadStatisticsDatabaseStore::prepareStatements):
2653         (WebKit::ResourceLoadStatisticsDatabaseStore::insertObservedDomain):
2654         (WebKit::ResourceLoadStatisticsDatabaseStore::ensureAndMakeDomainList):
2655         The previous naming of the list parameter in this function was
2656         confusing because it is used by many different relationships not just
2657         subframes under top frames.
2658
2659         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationshipList):
2660         topFrameLinkDecorationsFrom were never inserted into the database.
2661
2662         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
2663         (WebKit::ResourceLoadStatisticsDatabaseStore::merge):
2664         (WebKit::ResourceLoadStatisticsDatabaseStore::mergeStatistic):
2665         Since the statement to get all data for a given domain is now used in
2666         multiple places, I stored the query as a constexpr auto.
2667
2668         (WebKit::ResourceLoadStatisticsDatabaseStore::logCrossSiteLoadWithLinkDecoration):
2669         Matched the memory store functionality, which calls the boolean
2670         "gotLinkDecorationFromPrevalentResource." I thought isScheduledForWebsiteDataRemoval 
2671         would be more clear of a name, because this flag gets cleared even when
2672         prevalent top frame link decorations for this domain still exist in the table.
2673
2674         (WebKit::ResourceLoadStatisticsDatabaseStore::dumpResourceLoadStatistics):
2675         (WebKit::ResourceLoadStatisticsDatabaseStore::setIsScheduledForWebsiteDataRemoval):
2676         (WebKit::ResourceLoadStatisticsDatabaseStore::prevalentDomains): Deleted.
2677         (WebKit::ResourceLoadStatisticsDatabaseStore::domains):
2678         To match memory store functionality, the check for website data to
2679         delete should check all domains, not just prevalent ones.
2680
2681         (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUnexpiredRecentUserInteraction):
2682         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllWebsiteDataFor):
2683         This now needs to check if the resource is prevalent, because it is
2684         no longer guaranteed.
2685
2686         (WebKit::ResourceLoadStatisticsDatabaseStore::shouldRemoveAllButCookiesFor):
2687         (WebKit::ResourceLoadStatisticsDatabaseStore::registrableDomainsToRemoveWebsiteDataFor):
2688         (WebKit::ResourceLoadStatisticsDatabaseStore::getDomainStringFromDomainID):
2689         (WebKit::ResourceLoadStatisticsDatabaseStore::getSubStatisticStatement):
2690         (WebKit::ResourceLoadStatisticsDatabaseStore::appendSubStatisticList):
2691         (WebKit::ResourceLoadStatisticsDatabaseStore::resourceToString):
2692         This functionality matches the toString function in
2693         ResourceLoadStatistics.cpp.
2694
2695         (WebKit::CompletionHandler<void):
2696         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
2697
2698 2019-10-23  Yury Semikhatsky  <yurys@chromium.org>
2699
2700         Web Inspector: notify inspector when provisional page is created, committed and destroyed
2701         https://bugs.webkit.org/show_bug.cgi?id=202704
2702
2703         Reviewed by Devin Rousso.
2704
2705         Target.targetCreated event is now generated for provisional pages as well as for regular
2706         ones. This is the first step toward reattaching inspector earlier during PSON. In the future
2707         if debugging is in progress the provisional target (page) will be paused until a signal from
2708         inspector frontend. This will enable the frontend configure all agents before navigation starts.
2709
2710         * Sources.txt:
2711         * UIProcess/API/APIWebAuthenticationPanel.cpp:
2712         (API::WebAuthenticationPanel::WebAuthenticationPanel): Added explicit namespace specifier
2713         to the constructor's argument as otherwise compilation fails due to conflict between API::String
2714         and WTF::String.
2715
2716         * UIProcess/InspectorTargetProxy.cpp:
2717         (WebKit::InspectorTargetProxy::create):
2718         (WebKit::InspectorTargetProxy::connect):
2719         (WebKit::InspectorTargetProxy::disconnect):
2720         (WebKit::InspectorTargetProxy::sendMessageToTargetBackend):
2721         (WebKit::InspectorTargetProxy::didCommitProvisionalTarget):
2722         (WebKit::InspectorTargetProxy::isProvisional const):
2723         (WebKit::InspectorTargetProxy::previousTargetID const):
2724         * UIProcess/InspectorTargetProxy.h: Target proxy can start as a provisional target (with a pointer to
2725         ProvisionalPageProxy) and later either be committed or destroyed.
2726
2727         * UIProcess/ProvisionalPageProxy.cpp:
2728         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
2729         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
2730         (WebKit::ProvisionalPageProxy::didReceiveMessage): Forward inspector messages to parent page's WebPageInspectorController.
2731         Since each WebPage has a unique identifier the target ids will be globally unique and there is no risk of collisions.
2732
2733         * UIProcess/ProvisionalPageProxy.h:
2734         (WebKit::ProvisionalPageProxy::page const):
2735         * UIProcess/WebPageInspectorController.cpp:
2736         (WebKit::getTargetID):
2737         (WebKit::WebPageInspectorController::WebPageInspectorController):
2738         (WebKit::WebPageInspectorController::clearTargets):
2739         (WebKit::WebPageInspectorController::createInspectorTarget):
2740         (WebKit::WebPageInspectorController::destroyInspectorTarget):
2741         (WebKit::WebPageInspectorController::didCreateProvisionalPage):
2742         (WebKit::WebPageInspectorController::didDestroyProvisionalPage):
2743         (WebKit::WebPageInspectorController::didCommitProvisionalPage):
2744         (WebKit::WebPageInspectorController::addTarget):
2745         * UIProcess/WebPageInspectorController.h:
2746         * UIProcess/WebPageInspectorTargetAgent.cpp: Removed. Merged this agent into InspectorTargetAgent.
2747         * UIProcess/WebPageInspectorTargetAgent.h: Removed.
2748         * UIProcess/WebPageProxy.cpp:
2749         (WebKit::m_resetRecentCrashCountTimer):
2750         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2751         (WebKit::WebPageProxy::commitProvisionalPage):
2752         * UIProcess/WebPageProxy.h: Moved the target management logic into WebPageInspectorController.
2753         WebPageProxy/ProvisionalPageProxy are expected to notifiy it about key lifecycle events and also
2754         forward to it messages from inspector in the inspected WebProcess. How it translates to Target
2755         events is inspector's business.
2756
2757         * WebKit.xcodeproj/project.pbxproj:
2758         * WebProcess/WebPage/WebPageInspectorTarget.cpp:
2759         (WebKit::WebPageInspectorTarget::identifier const):
2760         (WebKit::WebPageInspectorTarget::connect):
2761         (WebKit::WebPageInspectorTarget::disconnect):
2762         (WebKit::WebPageInspectorTarget::toTargetID):
2763         * WebProcess/WebPage/WebPageInspectorTarget.h: Made the target own frontend channel instance as it's the
2764         only place where the page specific channel is used.
2765
2766         * WebProcess/WebPage/WebPageInspectorTargetController.cpp:
2767         (WebKit::WebPageInspectorTargetController::removeTarget):
2768         (WebKit::WebPageInspectorTargetController::connectInspector):
2769         (WebKit::WebPageInspectorTargetController::disconnectInspector):
2770         * WebProcess/WebPage/WebPageInspectorTargetController.h:
2771         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
2772         (WebKit::WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel):
2773         (WebKit::WebPageInspectorTargetFrontendChannel::sendMessageToFrontend):
2774         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h: The channel's lifetime is managed by owning
2775         target. No need to reference count it.
2776
2777 2019-10-22  Jiewen Tan  <jiewen_tan@apple.com>
2778
2779         [WebAuthn] Supply FrameInfo in -[WKUIDelegatePrivate _webView:runWebAuthenticationPanel:initiatedByFrame:completionHandler:]
2780         https://bugs.webkit.org/show_bug.cgi?id=202563
2781         <rdar://problem/55973968>
2782
2783         Reviewed by Brent Fulgham.
2784
2785         This patch makes WKFrameInfo available to clients via the above SPI. To do so,
2786         SecuirtyOrigin of the caller document is passed from WebContent Process.
2787
2788         * UIProcess/API/APIUIClient.h:
2789         (API::UIClient::runWebAuthenticationPanel):
2790         * UIProcess/API/C/WKPage.cpp:
2791         (WKPageSetPageUIClient):
2792         * UIProcess/Cocoa/UIDelegate.h:
2793         * UIProcess/Cocoa/UIDelegate.mm:
2794         (WebKit::UIDelegate::UIClient::runWebAuthenticationPanel):
2795         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2796         (WebKit::AuthenticatorManager::runPanel):
2797         * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
2798         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
2799         (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
2800         (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
2801         (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):
2802         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
2803         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in:
2804         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
2805         (WebKit::WebAuthenticatorCoordinator::makeCredential):
2806         (WebKit::WebAuthenticatorCoordinator::getAssertion):
2807         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h:
2808
2809 2019-10-23  Andy Estes  <aestes@apple.com>
2810
2811         [Quick Look] Rename PreviewLoader{,Client} to LegacyPreviewLoader{,Client}
2812         https://bugs.webkit.org/show_bug.cgi?id=203306
2813
2814         Reviewed by Tim Horton.
2815
2816         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2817         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2818         * WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm:
2819         (WebKit::WebFrameLoaderClient::createPreviewLoaderClient):
2820         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.h:
2821
2822 2019-10-22  Fujii Hironori  <Hironori.Fujii@sony.com>
2823
2824         Unreviewed build fix for non-unified source builds
2825         https://bugs.webkit.org/show_bug.cgi?id=203055
2826         <rdar://problem/56504295>
2827
2828         * WebProcess/Storage/WebServiceWorkerProvider.cpp: Added #include <WebCore/RuntimeEnabledFeatures.h>.
2829
2830 2019-10-22  John Wilander  <wilander@apple.com>
2831
2832         Resource Load Statistics (experimental): Block all third-party cookies
2833         https://bugs.webkit.org/show_bug.cgi?id=203266
2834         <rdar://problem/56512858>
2835
2836         Reviewed by Alex Christensen.
2837
2838         This change updates the experimental change in
2839         <https://trac.webkit.org/changeset/251213> to block all
2840         third-party cookies, regardless of user interaction with
2841         the first-party website.
2842
2843         * NetworkProcess/NetworkProcess.cpp:
2844         (WebKit::NetworkProcess::setShouldBlockThirdPartyCookiesForTesting):
2845         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2846         (WebKit::NetworkSessionCreationParameters::encode const):
2847         (WebKit::NetworkSessionCreationParameters::decode):
2848         * NetworkProcess/NetworkSessionCreationParameters.h:
2849         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2850         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2851         * Shared/WebPreferences.yaml:
2852         * UIProcess/WebProcessPool.cpp:
2853         (WebKit::WebProcessPool::ensureNetworkProcess):
2854         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2855         (WebKit::WebsiteDataStore::parameters):
2856
2857 2019-10-22  Tim Horton  <timothy_horton@apple.com>
2858
2859         Make it possible to not include IPC Messages headers in other headers
2860         https://bugs.webkit.org/show_bug.cgi?id=203074
2861
2862         * Scripts/webkit/messages_unittest.py:
2863         (GeneratedFileContentsTest.assertHeaderEqual):
2864         (GeneratedFileContentsTest.assertImplementationEqual):
2865         (UnsupportedPrecompilerDirectiveTest.test_error_at_else):
2866         (UnsupportedPrecompilerDirectiveTest.test_error_at_elif):
2867         Fix the message generator unit tests.
2868
2869 2019-10-22  Alex Christensen  <achristensen@webkit.org>
2870
2871         Re-enable legacy TLS by default, keep runtime switch
2872         https://bugs.webkit.org/show_bug.cgi?id=203253
2873
2874         Reviewed by Geoffrey Garen.
2875
2876         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2877         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2878         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2879         (WebKit::WebsiteDataStore::parameters):
2880
2881 2019-10-22  Alex Christensen  <achristensen@webkit.org>
2882
2883         Revert r243010 on pre-Catalina macOS
2884         https://bugs.webkit.org/show_bug.cgi?id=203265
2885         <rdar://problem/55570995>
2886
2887         Reviewed by Per Arne Vollan.
2888
2889         * WebProcess/com.apple.WebProcess.sb.in:
2890
2891 2019-10-22  Tim Horton  <timothy_horton@apple.com>
2892
2893         Update xcfilelists
2894
2895         * DerivedSources-output.xcfilelist:
2896
2897 2019-10-22  Tim Horton  <timothy_horton@apple.com>
2898
2899         Make it possible to not include IPC Messages headers in other headers
2900         https://bugs.webkit.org/show_bug.cgi?id=203074
2901
2902         Reviewed by Geoffrey Garen.
2903
2904         Make the Messages generator generate a new -MessagesReplies.h file, which
2905         only includes headers for and definitions of DelayedReply/AsyncReply types,
2906         which need to be mentioned as arguments to message hander methods, and
2907         thus must be available in various headers throughout the project.
2908
2909         In order to do this, we have to de-nest them from the primary message
2910         class, but we then 'using' them back into place inside the message class
2911         so that most of the code doesn't need to change.
2912
2913         This helps to wildly decrease the header load of WebPage.h and WebPageProxy.h,
2914         especially, because the number of headers needed for types in their replies
2915         is much smaller than the number needed for all message receivers.
2916
2917         Also, only invoke the Messages generator once per source file, and
2918         only parse the source file once, generating all three output files
2919         in one invocation.
2920
2921         And then clean up all the missing indirect includes that we lost by doing this.
2922
2923         All-in-all this is worth roughly 8% on the WebKit2 Build Time Benchmark.
2924
2925         * CMakeLists.txt:
2926         * DerivedSources-input.xcfilelist:
2927         * DerivedSources.make:
2928         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2929         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2930         * NetworkProcess/NetworkConnectionToWebProcess.h:
2931         * NetworkProcess/NetworkResourceLoader.cpp:
2932         * NetworkProcess/NetworkResourceLoader.h:
2933         * PluginProcess/PluginControllerProxy.cpp:
2934         * PluginProcess/PluginControllerProxy.h:
2935         * PluginProcess/WebProcessConnection.h:
2936         * Scripts/Makefile:
2937         * Scripts/generate-message-receiver.py:
2938         (main):
2939         * Scripts/generate-messages-header.py: Removed.
2940         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
2941         * Scripts/webkit/LegacyMessages-expected.h:
2942         * Scripts/webkit/LegacyMessagesReplies-expected.h: Added.
2943         * Scripts/webkit/MessageReceiver-expected.cpp:
2944         * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
2945         * Scripts/webkit/Messages-expected.h:
2946         * Scripts/webkit/MessagesReplies-expected.h: Added.
2947         * Scripts/webkit/MessagesRepliesSuperclassReplies-expected.h: Added.
2948         * Scripts/webkit/MessagesSuperclass-expected.h:
2949         * Scripts/webkit/messages.py:
2950         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2951         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
2952         * UIProcess/Downloads/DownloadProxy.h:
2953         * UIProcess/Network/NetworkProcessProxy.cpp:
2954         * UIProcess/Network/NetworkProcessProxy.h:
2955         * UIProcess/Plugins/PluginProcessManager.cpp:
2956         * UIProcess/Plugins/PluginProcessManager.h:
2957         * UIProcess/Plugins/PluginProcessProxy.h:
2958         * UIProcess/ProvisionalPageProxy.h:
2959         * UIProcess/SuspendedPageProxy.h:
2960         * UIProcess/WebPageProxy.cpp:
2961         * UIProcess/WebPageProxy.h:
2962         * UIProcess/WebProcessPool.cpp:
2963         * UIProcess/WebProcessPool.h:
2964         * UIProcess/WebProcessProxy.h:
2965         * UIProcess/ios/WKContentView.mm:
2966         * UIProcess/ios/WKContentViewInteraction.mm:
2967         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2968         * WebKit.xcodeproj/project.pbxproj:
2969         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2970         * WebProcess/Storage/WebSWContextManagerConnection.h:
2971         * WebProcess/WebPage/WebPage.h:
2972         * WebProcess/WebPage/ios/WebPageIOS.mm:
2973         * WebProcess/cocoa/VideoFullscreenManager.h:
2974         * WebProcess/cocoa/VideoFullscreenManager.mm:
2975
2976 2019-10-22  Chris Dumez  <cdumez@apple.com>
2977
2978         Simplify "Unexpectedly Resumed" assertion handling
2979         https://bugs.webkit.org/show_bug.cgi?id=203254
2980
2981         Reviewed by Geoffrey Garen.
2982
2983         When the WebContent process gets resumed from suspension, it now unconditionally takes a
2984         process assertion on behalf on the UIProcess and sends a ProcessDidResume IPC to the
2985         UIProcess. The UIProcess then sends a DidHandleProcessWasResumed IPC back after handing
2986         the ProcessDidResume IPC allowing the WebContent process to release its assertion on
2987         behalf on the UIProcess.
2988
2989         The previous code was racy because it relied on the m_processIsSuspended flag, which was
2990         queried and set from different threads. Also, the 'unexpectedly resumed' naming was
2991         confusing since we'd often take this assertion whenever the WebProcess got resumed,
2992         wether unexpected or not, simply because the processTaskStateDidChange IPC won the race
2993         with the ProcessDidResume IPC from the UIProcess.
2994
2995         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2996         (WebKit::WebProcessProxy::processWasResumed):
2997         (WebKit::WebProcessProxy::processWasUnexpectedlyUnsuspended): Deleted.
2998         * UIProcess/WebProcessProxy.h:
2999         * UIProcess/WebProcessProxy.messages.in:
3000         * WebProcess/WebProcess.cpp:
3001         (WebKit::WebProcess::processDidResume):
3002         * WebProcess/WebProcess.h:
3003         * WebProcess/WebProcess.messages.in:
3004         * WebProcess/cocoa/WebProcessCocoa.mm:
3005         (WebKit::WebProcess::processTaskStateDidChange):
3006         (WebKit::WebProcess::didHandleProcessWasResumed):
3007
3008 2019-10-22  youenn fablet  <youenn@apple.com>
3009
3010         Remove mayHaveServiceWorkerRegisteredForOrigin
3011         https://bugs.webkit.org/show_bug.cgi?id=203055
3012
3013         Reviewed by Alex Christensen.
3014
3015         This optimization was used for ensuring we would not create a storage process when no service worker registration is stored on disk.
3016         Now that we do not have a storage process and we are doing registration matching direclty in network process, we can safely remove that optimization.
3017         We also move the throttle state handling in WK2 layer. This allows us to not create a network process connection to update throttle state until
3018         there is a network process connection. This allows continuing passing an API test checking network process connections after crashes.
3019
3020         * Shared/WebPageCreationParameters.cpp:
3021         (WebKit::WebPageCreationParameters::encode const):
3022         (WebKit::WebPageCreationParameters::decode):
3023         * Shared/WebPageCreationParameters.h:
3024         * UIProcess/WebPageProxy.cpp:
3025         (WebKit::WebPageProxy::creationParameters):
3026         * UIProcess/WebProcessPool.cpp:
3027         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
3028         (WebKit::WebProcessPool::updateServiceWorkerUserAgent):
3029         * UIProcess/WebProcessPool.h:
3030         * WebProcess/Network/NetworkProcessConnection.h:
3031         * WebProcess/Storage/WebSWClientConnection.h:
3032         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
3033         (WebKit::WebServiceWorkerProvider::serviceWorkerConnection):
3034         (WebKit::WebServiceWorkerProvider::updateThrottleState):
3035         * WebProcess/Storage/WebServiceWorkerProvider.h:
3036         * WebProcess/WebPage/WebPage.cpp:
3037         (WebKit::m_textAutoSizingAdjustmentTimer):
3038         (WebKit::WebPage::updateThrottleState):
3039
3040 2019-10-22  Yury Semikhatsky  <yurys@chromium.org>
3041
3042         [GTK] Web Inspector: add an option for disabling minification and concatenation of inspector UI in release build
3043         https://bugs.webkit.org/show_bug.cgi?id=203201
3044
3045         Reviewed by Carlos Garcia Campos.
3046
3047         Allow passing COMBINE_INSPECTOR_RESOURCES and COMBINE_TEST_RESOURCES as cmake arguments. This
3048         enables to avoid minification of Web Inspector scripts in release binaries which is very
3049         convenient during inspector UI development.
3050
3051         * InspectorGResources.cmake:
3052
3053 2019-10-22  Adrian Perez de Castro  <aperez@igalia.com>
3054
3055         [GTK][WPE] Fix non-unified builds after r251326
3056         https://bugs.webkit.org/show_bug.cgi?id=203244
3057
3058         Reviewed by Youenn Fablet.
3059
3060         * Shared/UserData.cpp: Add missing inclusion of WebCoreArgumentCoders.h
3061         * UIProcess/Automation/SimulatedInputDispatcher.cpp: Add missing inclusion of wtf/Variant.h
3062         * UIProcess/ProvisionalPageProxy.h: Add missing inclusion of WebCore/ResourceRequest.h
3063         * UIProcess/WebTextChecker.cpp: Add missing inclusion of WebPageProxy.h
3064         * WebProcess/Databases/WebDatabaseProvider.cpp: Add missing inclusion of WebIDBConnectionToServer.h
3065
3066 2019-10-22  youenn fablet  <youenn@apple.com>
3067
3068         WebSWServerToContextConnection should not assert when failing loads at destruction time
3069         https://bugs.webkit.org/show_bug.cgi?id=203243
3070
3071         Reviewed by Alex Christensen.
3072
3073         On WebSWServerToContextConnection destruction, we move the fetch task map and fail the tasks.
3074         At destruction of the tasks, which happens synchronously, they will try to unregister themselves
3075         and the assertion that the task is in the map will fail.
3076         To fix that, add a specific contextClosed method that will clear the task connection weak pointer.
3077
3078         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
3079         (WebKit::ServiceWorkerFetchTask::contextClosed):
3080         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
3081         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
3082         (WebKit::WebSWServerToContextConnection::~WebSWServerToContextConnection):
3083
3084 2019-10-22  youenn fablet  <youenn@apple.com>
3085
3086         ServiceWorkerFetchTask can use the NetworkConnectionToWebProcess sessionID
3087         https://bugs.webkit.org/show_bug.cgi?id=202208
3088
3089         Reviewed by Alex Christensen.
3090
3091         No need to store the sessionID in ServiceWorkerFetchTask since we can get it from its loader.
3092
3093         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
3094         (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):
3095         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
3096         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
3097         (WebKit::WebSWServerConnection::createFetchTask):
3098
3099 2019-10-22  youenn fablet  <youenn@apple.com>
3100
3101         Remove the ability to fallback to custom scheme handlers after a service worker did not handle the load
3102         https://bugs.webkit.org/show_bug.cgi?id=203239
3103
3104         Reviewed by Alex Christensen.
3105
3106         We remove the ability for service workers to intercept custom scheme handlers.
3107         We can then remove the ability for loads that are not handled by service workers to go through custom scheme handlers.
3108
3109         * WebProcess/Network/WebLoaderStrategy.cpp:
3110         (WebKit::WebLoaderStrategy::scheduleLoad):
3111         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3112         * WebProcess/Network/WebResourceLoader.cpp:
3113         (WebKit::WebResourceLoader::serviceWorkerDidNotHandle):
3114
3115 2019-10-22  Carlos Garcia Campos  <cgarcia@igalia.com>
3116
3117         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.27.2 release
3118
3119         * gtk/NEWS: Add release notes for 2.27.2.
3120
3121 2019-10-21  Yusuke Suzuki  <ysuzuki@apple.com>
3122
3123         [JSC] Thread JSGlobalObject* instead of ExecState*
3124         https://bugs.webkit.org/show_bug.cgi?id=202392
3125
3126         Reviewed by Geoffrey Garen.
3127
3128         * WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp:
3129         (webkit_frame_get_js_value_for_dom_object_in_script_world):
3130         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3131         (WebKit::InjectedBundle::reportException):
3132         (WebKit::InjectedBundle::createWebDataFromUint8Array):
3133         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
3134         (WebKit::callMethod):
3135         * WebProcess/Plugins/Netscape/JSNPMethod.h:
3136         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
3137         (WebKit::JSNPObject::callMethod):
3138         (WebKit::JSNPObject::callObject):
3139         (WebKit::JSNPObject::callConstructor):
3140         (WebKit::callNPJSObject):
3141         (WebKit::constructWithConstructor):
3142         (WebKit::JSNPObject::getOwnPropertySlot):
3143         (WebKit::JSNPObject::put):
3144         (WebKit::JSNPObject::deleteProperty):
3145         (WebKit::JSNPObject::deletePropertyByIndex):
3146         (WebKit::JSNPObject::getOwnPropertyNames):
3147         (WebKit::JSNPObject::propertyGetter):
3148         (WebKit::JSNPObject::methodGetter):
3149         (WebKit::JSNPObject::throwInvalidAccessError):
3150         * WebProcess/Plugins/Netscape/JSNPObject.h:
3151         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
3152         (WebKit::identifierFromIdentifierRep):
3153         (WebKit::NPJSObject::hasMethod):
3154         (WebKit::NPJSObject::invoke):
3155         (WebKit::NPJSObject::invokeDefault):
3156         (WebKit::NPJSObject::hasProperty):
3157         (WebKit::NPJSObject::getProperty):
3158         (WebKit::NPJSObject::setProperty):
3159         (WebKit::NPJSObject::removeProperty):
3160         (WebKit::NPJSObject::enumerate):
3161         (WebKit::NPJSObject::construct):
3162         * WebProcess/Plugins/Netscape/NPJSObject.h:
3163         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
3164         (WebKit::NPRuntimeObjectMap::convertNPVariantToJSValue):
3165         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
3166         (WebKit::NPRuntimeObjectMap::evaluate):
3167         (WebKit::NPRuntimeObjectMap::moveGlobalExceptionToExecState):
3168         (WebKit::NPRuntimeObjectMap::globalExec const): Deleted.
3169         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h:
3170         * WebProcess/Plugins/PluginView.cpp:
3171         (WebKit::PluginView::performJavaScriptURLRequest):
3172         * WebProcess/WebPage/WebFrame.cpp:
3173         (WebKit::WebFrame::jsContext):
3174         (WebKit::WebFrame::jsContextForWorld):
3175         (WebKit::WebFrame::frameForContext):
3176         (WebKit::WebFrame::jsWrapperForWorld):
3177         * WebProcess/WebPage/WebPage.cpp:
3178         (WebKit::WebPage::freezeLayerTree):
3179         (WebKit::WebPage::unfreezeLayerTree):
3180         (WebKit::WebPage::runJavaScript):
3181         * WebProcess/WebProcess.cpp:
3182         (WebKit::WebProcess::networkProcessConnectionClosed):
3183
3184 2019-10-22  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3185
3186         [GTK][WPE] Enable service workers by default
3187         https://bugs.webkit.org/show_bug.cgi?id=200815
3188
3189         Reviewed by Carlos Garcia Campos.
3190
3191         Flip the run-time switch to be enabled by default and not only
3192         when building with experimental features enabled.
3193
3194         * Shared/WebPreferencesDefaultValues.h:
3195
3196 2019-10-22  Carlos Garcia Campos  <cgarcia@igalia.com>
3197
3198         [GTK] C++ comments used in C header files
3199         https://bugs.webkit.org/show_bug.cgi?id=203191
3200
3201         Reviewed by Žan Doberšek.
3202
3203         * UIProcess/API/gtk/WebKitAutocleanups.h:
3204         * UIProcess/API/gtk/WebKitDefines.h:
3205         * UIProcess/API/gtk/WebKitForwardDeclarations.h:
3206         * UIProcess/API/gtk/WebKitWebViewBase.h:
3207         * UIProcess/API/wpe/WebKitAutocleanups.h:
3208         * UIProcess/API/wpe/WebKitDefines.h:
3209         * WebProcess/InjectedBundle/API/gtk/WebKitWebEditor.h:
3210         * WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionAutocleanups.h:
3211         * WebProcess/InjectedBundle/API/wpe/WebKitWebEditor.h:
3212         * WebProcess/InjectedBundle/API/wpe/WebKitWebExtensionAutocleanups.h:
3213
3214 2019-10-22  Wenson Hsieh  <wenson_hsieh@apple.com>
3215
3216         imported/w3c/web-platform-tests/clipboard-apis/async-navigator-clipboard-basics.https.html is flaky
3217         https://bugs.webkit.org/show_bug.cgi?id=203181
3218
3219         Reviewed by Ryosuke Niwa.
3220
3221         Add a changeCount argument to informationForItemAtIndex and allPasteboardItemInfo, and also make then return
3222         optional values; also, adjust changeCount to be an `int64_t` in a few places. See WebCore ChangeLog for more
3223         details.
3224
3225         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
3226         (WebKit::WebPasteboardProxy::pasteboardCopy):
3227         (WebKit::WebPasteboardProxy::getPasteboardChangeCount):
3228         (WebKit::WebPasteboardProxy::addPasteboardTypes):
3229         (WebKit::WebPasteboardProxy::setPasteboardTypes):
3230         (WebKit::WebPasteboardProxy::setPasteboardURL):
3231         (WebKit::WebPasteboardProxy::setPasteboardColor):
3232         (WebKit::WebPasteboardProxy::setPasteboardStringForType):
3233         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
3234         (WebKit::WebPasteboardProxy::writeCustomData):
3235         (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
3236         (WebKit::WebPasteboardProxy::informationForItemAtIndex):
3237         * UIProcess/WebPasteboardProxy.cpp:
3238         (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
3239         (WebKit::WebPasteboardProxy::informationForItemAtIndex):
3240         * UIProcess/WebPasteboardProxy.h:
3241         * UIProcess/WebPasteboardProxy.messages.in:
3242         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3243         (WebKit::PDFPlugin::writeItemsToPasteboard):
3244         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3245         (WebKit::WebPlatformStrategies::changeCount):
3246         (WebKit::WebPlatformStrategies::addTypes):
3247         (WebKit::WebPlatformStrategies::setTypes):
3248         (WebKit::WebPlatformStrategies::setBufferForType):
3249         (WebKit::WebPlatformStrategies::setURL):
3250         (WebKit::WebPlatformStrategies::setColor):
3251         (WebKit::WebPlatformStrategies::setStringForType):
3252         (WebKit::WebPlatformStrategies::writeCustomData):
3253         (WebKit::WebPlatformStrategies::allPasteboardItemInfo):
3254         (WebKit::WebPlatformStrategies::informationForItemAtIndex):
3255         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
3256
3257 2019-10-21  Daniel Bates  <dabates@apple.com>
3258
3259         Add some PencilKit extension points
3260         https://bugs.webkit.org/show_bug.cgi?id=202962
3261         <rdar://problem/56269759>
3262
3263         Reviewed by Andy Estes.
3264
3265         This is the WebKit part corresponding to <rdar://problem/56261392>.
3266
3267         * UIProcess/ios/WKContentViewInteraction.mm:
3268         (-[WKContentView setupInteraction]): Call extension point.
3269         (-[WKContentView cleanupInteraction]): Ditto.
3270
3271 2019-10-21  Matt Lewis  <jlewis3@apple.com>
3272
3273         Unreviewed, rolling out r251381.
3274
3275         This broke an internal build.
3276
3277         Reverted changeset:
3278
3279         "Add some PencilKit extension points"
3280         https://bugs.webkit.org/show_bug.cgi?id=202962
3281         https://trac.webkit.org/changeset/251381
3282
3283 2019-10-21  Myles C. Maxfield  <mmaxfield@apple.com>
3284
3285         [Cocoa] Move ui-serif, ui-monospaced, and ui-rounded out from behind SPI
3286         https://bugs.webkit.org/show_bug.cgi?id=203129
3287
3288         Reviewed by Tim Horton.
3289
3290         * Shared/WebPreferences.yaml:
3291         * UIProcess/API/Cocoa/WKPreferences.mm:
3292         (-[WKPreferences _shouldAllowDesignSystemUIFonts]): Deleted.
3293         (-[WKPreferences _setShouldAllowDesignSystemUIFonts:]): Deleted.
3294         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3295
3296 2019-10-21  youenn fablet  <youenn@apple.com>
3297
3298         Move service worker registration matching for navigation loads to network process
3299         https://bugs.webkit.org/show_bug.cgi?id=203144
3300
3301         Reviewed by Chris Dumez.
3302
3303         Create a WebSWServerConnection whenever receiving a load request in NetworkProcess.
3304         This connection is used to check for service worker registration in case of navigation loads.
3305         Similarly, we create a WebSWClientConnection whenever WebProcess needs it, including when receiving WebSWClientConnection messages from NetworkProcess.
3306         This for instance happens when service worker registration import is complete to fill the shared registration origin store.
3307
3308         Delay loads until SWServer has finished importing its registrations.
3309         This is needed since we might otherwise not intercept loads that could be intercepted.
3310         Waiting for importing registrations was previously ensured by WebProcess getting a matching registration in DocumentLoader.
3311
3312         NetworkResourceLoader is now checking for service worker interception in case of redirections for navigations.
3313         This is needed as redirections could end up using a new registration.
3314
3315         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3316         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
3317         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
3318         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
3319         (WebKit::NetworkConnectionToWebProcess::swConnection):
3320         * NetworkProcess/NetworkConnectionToWebProcess.h:
3321         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3322         * NetworkProcess/NetworkResourceLoader.cpp:
3323         (WebKit::NetworkResourceLoader::continueWillSendRequest):
3324         (WebKit::NetworkResourceLoader::startWithServiceWorker):
3325         (WebKit::NetworkResourceLoader::serviceWorkerDidNotHandle):
3326         * NetworkProcess/NetworkResourceLoader.h:
3327         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
3328         (WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):
3329         (WebKit::ServiceWorkerFetchTask::start):
3330         (WebKit::ServiceWorkerFetchTask::startFetch):
3331         (WebKit::ServiceWorkerFetchTask::continueFetchTaskWith):
3332         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
3333         (WebKit::ServiceWorkerFetchTask::takeRequest):
3334         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
3335         (WebKit::WebSWServerConnection::controlClient):
3336         (WebKit::WebSWServerConnection::createFetchTask):
3337         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
3338         * WebProcess/Network/NetworkProcessConnection.cpp:
3339         (WebKit::NetworkProcessConnection::didReceiveMessage):
3340         * WebProcess/Network/WebLoaderStrategy.cpp:
3341         (WebKit::WebLoaderStrategy::scheduleLoad):
3342         * WebProcess/Storage/WebSWClientConnection.cpp:
3343         (WebKit::WebSWClientConnection::WebSWClientConnection):
3344         (WebKit::WebSWClientConnection::registrationReady):
3345         (WebKit::WebSWClientConnection::documentIsControlled):
3346         * WebProcess/Storage/WebSWClientConnection.h:
3347         * WebProcess/Storage/WebSWClientConnection.messages.in:
3348
3349 2019-10-21  Sihui Liu  <sihui_liu@apple.com>
3350
3351         Remove IDBBackingStoreTemporaryFileHandler
3352         https://bugs.webkit.org/show_bug.cgi?id=203128
3353
3354         Reviewed by Alex Christensen.
3355
3356         * NetworkProcess/NetworkProcess.cpp:
3357         (WebKit::NetworkProcess::createIDBServer):
3358         (WebKit::NetworkProcess::accessToTemporaryFileComplete): Deleted.
3359         * NetworkProcess/NetworkProcess.h:
3360
3361 2019-10-21  John Wilander  <wilander@apple.com>
3362
3363         Resource Load Statistics: Update cookie blocking in NetworkStorageSession after first user interaction
3364         https://bugs.webkit.org/show_bug.cgi?id=203195
3365         <rdar://problem/56464567>
3366
3367         Reviewed by Alex Christensen and Chris Dumez.
3368
3369         This change makes sure that the state of cookie blocking in
3370         WebCore:: NetworkStorageSession is immediately updated if the logged
3371         user interaction was new for this domain. It adds a completion
3372         handler to WebResourceLoadStatisticsStore::logUserInteraction() so
3373         that the call properly waits for everything to be updated.
3374
3375         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3376         (WebKit::CompletionHandler<void):
3377         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
3378         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3379         (WebKit::ResourceLoadStatisticsMemoryStore::logUserInteraction):
3380         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
3381         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
3382         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3383         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
3384
3385 2019-10-21  Dean Jackson  <dino@apple.com>
3386
3387         Dispatch AR event on the originating anchor element
3388         https://bugs.webkit.org/show_bug.cgi?id=203198
3389         <rdar://55743929>
3390
3391         Reviewed by Simon Fraser.
3392
3393         Use the ElementContext on SystemPreviewInfo.
3394
3395         * UIProcess/API/Cocoa/WKWebView.mm:
3396         (-[WKWebView _triggerSystemPreviewActionOnElement:frame:page:]):
3397         (-[WKWebView _triggerSystemPreviewActionOnFrame:page:]): Deleted.
3398         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3399         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
3400         * UIProcess/SystemPreviewController.h:
3401         * WebProcess/WebPage/WebPage.cpp:
3402         (WebKit::WebPage::systemPreviewActionTriggered):
3403
3404 2019-10-21  Dean Jackson  <dino@apple.com>
3405
3406         Move ElementContext from WebKit to WebCore
3407         https://bugs.webkit.org/show_bug.cgi?id=203210
3408         <rdar://problem/56475682>
3409
3410         Reviewed by Simon Fraser.
3411
3412         * Scripts/webkit/messages.py:
3413         * Shared/DocumentEditingContext.h:
3414         * Shared/DocumentEditingContext.mm:
3415         (IPC::ArgumentCoder<WebKit::DocumentEditingContextRequest>::decode):
3416         * Shared/ElementContext.cpp: Removed.
3417         * Shared/ElementContext.h: Removed.
3418         * Shared/WebPreferencesDefaultValues.cpp:
3419         (WebKit::defaultCSSOMViewScrollingAPIEnabled):
3420         * Shared/WebsitePoliciesData.cpp:
3421         (WebKit::WebsitePoliciesData::decode):
3422         * Shared/ios/InteractionInformationAtPosition.h:
3423         * Sources.txt:
3424         * UIProcess/API/Cocoa/WKWebView.mm:
3425         (-[WKWebView _requestTextInputContextsInRect:completionHandler:]):
3426         * UIProcess/API/Cocoa/_WKTextInputContext.mm:
3427         (-[_WKTextInputContext _initWithTextInputContext:]):
3428         (-[_WKTextInputContext _textInputContext]):
3429         * UIProcess/API/Cocoa/_WKTextInputContextInternal.h:
3430         * UIProcess/WebPageProxy.cpp:
3431         (WebKit::WebPageProxy::textInputContextsInRect):
3432         (WebKit::WebPageProxy::focusTextInputContext):
3433         * UIProcess/WebPageProxy.h:
3434         * WebKit.xcodeproj/project.pbxproj:
3435         * WebProcess/WebPage/WebPage.cpp:
3436         (WebKit::WebPage::textInputContextsInRect):
3437         (WebKit::WebPage::focusTextInputContext):
3438         (WebKit::WebPage::elementForContext const):
3439         (WebKit::WebPage::contextForElement const):
3440         * WebProcess/WebPage/WebPage.h:
3441         * WebProcess/WebPage/WebPage.messages.in:
3442         * WebProcess/WebPage/ios/WebPageIOS.mm:
3443         (WebKit::WebPage::startInteractionWithElementContextOrPosition):
3444
3445 2019-10-21  Alex Christensen  <achristensen@webkit.org>
3446
3447         ServiceWorker tests should use TCPServer instead of WKURLSchemeHandler
3448         https://bugs.webkit.org/show_bug.cgi?id=203141
3449
3450         Reviewed by Youenn Fablet.
3451
3452         * NetworkProcess/NetworkProcess.cpp:
3453         (WebKit::NetworkProcess::initializeNetworkProcess):
3454         (WebKit::NetworkProcess::addWebsiteDataStore):
3455         (WebKit::NetworkProcess::swServerForSession):
3456         (WebKit::NetworkProcess::addServiceWorkerSession):
3457         * NetworkProcess/NetworkProcess.h:
3458         * Shared/WebsiteDataStoreParameters.cpp:
3459         (WebKit::WebsiteDataStoreParameters::encode const):
3460         (WebKit::WebsiteDataStoreParameters::decode):
3461         * Shared/WebsiteDataStoreParameters.h:
3462         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
3463         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
3464         (-[_WKWebsiteDataStoreConfiguration registerURLSchemeServiceWorkersCanHandleForTesting:]): Deleted.
3465         * UIProcess/WebProcessPool.cpp:
3466         (WebKit::WebProcessPool::initializeNewWebProcess):
3467         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3468         (WebKit::WebsiteDataStore::parameters):
3469         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
3470         (WebKit::WebsiteDataStoreConfiguration::copy):
3471         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
3472         (WebKit::WebsiteDataStoreConfiguration::serviceWorkerRegisteredSchemes const): Deleted.
3473         (WebKit::WebsiteDataStoreConfiguration::registerServiceWorkerScheme): Deleted.
3474
3475 2019-10-21  Tim Horton  <timothy_horton@apple.com>
3476
3477         macCatalyst: Swipe navigation gestures do not work
3478         https://bugs.webkit.org/show_bug.cgi?id=203205
3479         <rdar://problem/54617473>
3480
3481         Reviewed by Wenson Hsieh.
3482
3483         * UIProcess/ios/ViewGestureControllerIOS.mm:
3484         (-[WKSwipeTransitionController gestureRecognizerForInteractiveTransition:WithTarget:action:]):
3485         Use a different gesture recognizer for swipe in macCatalyst that behaves
3486         more like the macOS implementation, based on scrolling instead of the
3487         gesture coming from a screen edge.
3488
3489 2019-10-21  Daniel Bates  <dabates@apple.com>
3490
3491         Add some PencilKit extension points
3492         https://bugs.webkit.org/show_bug.cgi?id=202962
3493         <rdar://problem/56269759>
3494
3495         Reviewed by Andy Estes.
3496
3497         This is the WebKit part corresponding to <rdar://problem/56261392>.
3498
3499         * UIProcess/ios/WKContentViewInteraction.mm:
3500         (-[WKContentView setupInteraction]): Call extension point.
3501         (-[WKContentView cleanupInteraction]): Ditto.
3502
3503 2019-10-21  Chris Dumez  <cdumez@apple.com>
3504
3505         Add more release logging for "Unexpectedly resumed" assertion
3506         https://bugs.webkit.org/show_bug.cgi?id=203196
3507
3508         Reviewed by Geoffrey Garen.
3509
3510         * WebProcess/WebProcess.cpp:
3511         (WebKit::WebProcess::processDidResume):
3512         * WebProcess/cocoa/WebProcessCocoa.mm:
3513         (WebKit::WebProcess::processTaskStateDidChange):
3514
3515 2019-10-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3516
3517         [GTK] Objects category in emoji picker is empty
3518         https://bugs.webkit.org/show_bug.cgi?id=203189
3519
3520         Reviewed by Adrian Perez de Castro.
3521
3522         There's a typo in the first emopi name of objects section.
3523
3524         * UIProcess/API/gtk/WebKitEmojiChooser.cpp:
3525         (webkitEmojiChooserSetupEmojiSections): uted speaker -> muted speaker
3526
3527 2019-10-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3528
3529         [GTK][WPE] IconDatabase is not thread safe yet
3530         https://bugs.webkit.org/show_bug.cgi?id=202980
3531
3532         Reviewed by Adrian Perez de Castro.
3533
3534         Current implementation is safer, but we still need to protect members used by both threads.
3535
3536         * UIProcess/API/glib/IconDatabase.cpp:
3537         (WebKit::IconDatabase::populatePageURLToIconURLMap):
3538         (WebKit::IconDatabase::clearLoadedIconsTimerFired):
3539         (WebKit::IconDatabase::checkIconURLAndSetPageURLIfNeeded):
3540         (WebKit::IconDatabase::loadIconForPageURL):
3541         (WebKit::IconDatabase::iconURLForPageURL):
3542         (WebKit::IconDatabase::setIconForPageURL):
3543         (WebKit::IconDatabase::clear):
3544         * UIProcess/API/glib/IconDatabase.h:
3545
3546 2019-10-21  Tim Horton  <timothy_horton@apple.com>
3547
3548         Clean up some includes to improve WebKit2 build speed
3549         https://bugs.webkit.org/show_bug.cgi?id=203071
3550
3551         Reviewed by Wenson Hsieh.
3552
3553         This is worth about 6% on WebKit2, and unlocks another 8% improvement
3554         down the line (but which is less mechanical).
3555
3556         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
3557         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3558         * NetworkProcess/NetworkSocketChannel.h:
3559         * NetworkProcess/WebStorage/StorageArea.h:
3560         * NetworkProcess/WebStorage/StorageManager.cpp:
3561         * NetworkProcess/WebStorage/StorageManagerSet.cpp:
3562         * Platform/IPC/Connection.h:
3563         * Shared/API/APIURL.h:
3564         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
3565         * Shared/WebCoreArgumentCoders.cpp:
3566         * Shared/WebCoreArgumentCoders.h:
3567         * UIProcess/API/APIAttachment.h:
3568         * UIProcess/API/Cocoa/_WKInspector.mm:
3569         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
3570         * UIProcess/TextCheckerCompletion.cpp:
3571         * UIProcess/TextCheckerCompletion.h:
3572         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
3573         (WebKit::WebUserContentControllerProxy::addNetworkProcess):
3574         (WebKit::WebUserContentControllerProxy::removeNetworkProcess):
3575         * UIProcess/UserContent/WebUserContentControllerProxy.h:
3576         (WebKit::WebUserContentControllerProxy::addNetworkProcess): Deleted.
3577         (WebKit::WebUserContentControllerProxy::removeNetworkProcess): Deleted.
3578         * WebProcess/Automation/WebAutomationSessionProxy.h:
3579         * WebProcess/Network/NetworkProcessConnection.cpp:
3580         * WebProcess/Network/NetworkProcessConnection.h:
3581         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
3582         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3583         * WebProcess/Plugins/Plugin.cpp:
3584         * WebProcess/Plugins/Plugin.h:
3585         * WebProcess/WebProcess.cpp:
3586
3587 2019-10-20  Brent Fulgham  <bfulgham@apple.com>
3588
3589         Improve serialization logic
3590         https://bugs.webkit.org/show_bug.cgi?id=203039
3591         <rdar://problem/55631691>
3592
3593         Reviewed by Alex Christensen.
3594
3595         Check that the SecItemRequestData only contains relevant types for
3596         CFNetwork uses. 
3597
3598         * Platform/spi/Cocoa/SecItemSPI.h: Added.
3599         * Shared/mac/SecItemRequestData.cpp:
3600         (WebKit::arrayContainsInvalidType): Added.
3601         (WebKit::dictionaryContainsInvalidType): Added.
3602         (WebKit::validTypeIDs): Added.
3603         (WebKit::isValidType): Added.
3604         (WebKit::SecItemRequestData::decode): Check types during decode.
3605         * Shared/mac/SecItemRequestData.h:
3606         * WebKit.xcodeproj/project.pbxproj:
3607
3608 2019-10-19  Adrian Perez de Castro  <aperez@igalia.com>
3609
3610         [GTK][WPE] Fix non-unified builds after r250857
3611         https://bugs.webkit.org/show_bug.cgi?id=203145
3612
3613         Reviewed by Carlos Garcia Campos.
3614
3615         * UIProcess/WebProcessProxy.cpp: Add missing inclusion of the WebBackForwardCache.h header.
3616
3617 2019-10-18  Tim Horton  <timothy_horton@apple.com>
3618
3619         macCatalyst: Cursor should send mouse events, not touch events
3620         https://bugs.webkit.org/show_bug.cgi?id=203175
3621         <rdar://problem/56321134>
3622
3623         Reviewed by Simon Fraser.
3624
3625         * Platform/spi/ios/UIKitSPI.h:
3626         * Shared/NativeWebMouseEvent.h:
3627         * Shared/ios/NativeWebMouseEventIOS.mm:
3628         (WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
3629         Add a NativeWebMouseEvent constructor that doesn't actually wrap a native event,
3630         for creating totally-synthetic events.
3631
3632         * UIProcess/ios/WKMouseGestureRecognizer.h: Added.
3633         * UIProcess/ios/WKMouseGestureRecognizer.mm: Added.
3634         (webEventModifiersForUIKeyModifierFlags):
3635         (-[WKMouseGestureRecognizer initWithTarget:action:]):
3636         (-[WKMouseGestureRecognizer setView:]):
3637         (-[WKMouseGestureRecognizer lastMouseEvent]):
3638         (-[WKMouseGestureRecognizer lastMouseLocation]):
3639         (-[WKMouseGestureRecognizer mouseTouch]):
3640         (-[WKMouseGestureRecognizer _wantsHoverEvents]):
3641         (-[WKMouseGestureRecognizer reset]):
3642         (-[WKMouseGestureRecognizer _shouldReceiveTouch:forEvent:recognizerView:]):
3643         (-[WKMouseGestureRecognizer _shouldReceivePress:]):
3644         (-[WKMouseGestureRecognizer createMouseEventWithType:]):
3645         (-[WKMouseGestureRecognizer touchesBegan:withEvent:]):
3646         (-[WKMouseGestureRecognizer touchesMoved:withEvent:]):
3647         (-[WKMouseGestureRecognizer touchesEnded:withEvent:]):
3648         (-[WKMouseGestureRecognizer touchesCancelled:withEvent:]):
3649         (-[WKMouseGestureRecognizer _hoverEntered:withEvent:]):
3650         (-[WKMouseGestureRecognizer _hoverMoved:withEvent:]):
3651         (-[WKMouseGestureRecognizer _hoverExited:withEvent:]):
3652         (-[WKMouseGestureRecognizer _hoverCancelled:withEvent:]):
3653         (-[WKMouseGestureRecognizer locationInView:]):
3654         (-[WKMouseGestureRecognizer canPreventGestureRecognizer:]):
3655         (-[WKMouseGestureRecognizer canBePreventedByGestureRecognizer:]):
3656         Instead of just using UIHoverGestureRecognizer, introduce a new gesture
3657         recognizer that does what it did, but also supports cases where the button
3658         is pressed (so, mousedown and mouseup instead of just mousemove),
3659         and synthesizes mouse events for all state transitions. These events
3660         should look roughly identical to what a non-macCatalyst app would get
3661         in AppKit's mouseUp/mouseDown/mouseMoved NSResponder methods.
3662
3663         * SourcesCocoa.txt:
3664         * UIProcess/ios/WKContentViewInteraction.h:
3665         * UIProcess/ios/WKContentViewInteraction.mm:
3666         (-[WKContentView setupInteraction]):
3667         (-[WKContentView cleanupInteraction]):
3668         (-[WKContentView _removeDefaultGestureRecognizers]):
3669         (-[WKContentView _addDefaultGestureRecognizers]):
3670         (-[WKContentView gestureRecognizer:shouldReceiveTouch:]):
3671         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
3672         (-[WKContentView _showShareSheet:inRect:completionHandler:]):
3673         (-[WKContentView _mouseGestureRecognizerChanged:]):
3674         (webEventFlagsForUIKeyModifierFlags): Deleted.
3675         (-[WKContentView _hoverGestureRecognizerChanged:]): Deleted.
3676         * WebKit.xcodeproj/project.pbxproj:
3677         Make use of WKMouseGestureRecognizer to plumb the synthesized events directly
3678         to the macOS-style "handleMouseEvent" codepath, instead of going through
3679         the touch events path (and then subsequently generating synthetic clicks).
3680         Also, ensure that other gesture recognizers ignore the mouse "touch" entirely
3681         by returning NO in shouldReceiveTouch.
3682
3683 2019-10-18  Jiewen Tan  <jiewen_tan@apple.com>
3684
3685         [WebAuthn] Warn users when no credentials are found
3686         https://bugs.webkit.org/show_bug.cgi?id=203147
3687         <rdar://problem/55931123>
3688
3689         Reviewed by Brent Fulgham.
3690
3691         This patch returns _WKWebAuthenticationPanelUpdateNoCredentialsFound to client via
3692         -[_WKWebAuthenticationPanelDelegate panel:updateWebAuthenticationPanel:] when either
3693         CtapAuthenticator receives kCtap2ErrNoCredentials or U2fAuthenticator exhausts the
3694         allow list.
3695
3696         This patch also enhances CtapAuthenticator::tryDowngrade to check if the CTAP command
3697         can be converted to U2F commands to ensure kCtap2ErrNoCredentials is returned if it
3698         is the case. Otherwise, after downgrading, U2fAuthenticator will return NotSupportedError
3699         given it can't convert the commands.
3700
3701         * UIProcess/API/APIUIClient.h:
3702         * UIProcess/API/APIWebAuthenticationPanelClient.h:
3703         (API::WebAuthenticationPanelClient::updatePanel const):
3704         * UIProcess/WebAuthentication/Authenticator.h:
3705         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
3706         (WebKit::AuthenticatorManager::authenticatorStatusUpdated):
3707         * UIProcess/WebAuthentication/AuthenticatorManager.h:
3708         * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.h:
3709         * UIProcess/WebAuthentication/Cocoa/WebAuthenticationPanelClient.mm:
3710         (WebKit::WebAuthenticationPanelClient::WebAuthenticationPanelClient):
3711         (WebKit::wkWebAuthenticationPanelUpdate):
3712         (WebKit::WebAuthenticationPanelClient::updatePanel const):
3713         * UIProcess/WebAuthentication/WebAuthenticationFlags.h: Renamed from Source/WebKit/UIProcess/WebAuthentication/WebAuthenticationPanelFlags.h.
3714         * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
3715         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
3716         * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
3717         (WebKit::CtapAuthenticator::continueGetAssertionAfterResponseReceived):
3718         (WebKit::CtapAuthenticator::tryDowngrade):
3719         * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
3720         (WebKit::U2fAuthenticator::issueSignCommand):
3721         * WebKit.xcodeproj/project.pbxproj:
3722
3723 2019-10-18  Wenson Hsieh  <wenson_hsieh@apple.com>
3724
3725         [Clipboard API] Refactor Pasteboard::read() to take an optional item index
3726         https://bugs.webkit.org/show_bug.cgi?id=203161
3727
3728         Reviewed by Tim Horton.
3729
3730         * Shared/mac/PasteboardTypes.mm:
3731         (WebKit::PasteboardTypes::forEditing):
3732         (WebKit::PasteboardTypes::forSelection):
3733
3734         Support "com.apple.webarchive" alongside the private "Apple Web Archive pasteboard type".
3735
3736         * UIProcess/Cocoa/WebViewImpl.mm:
3737         (WebKit::WebViewImpl::setPromisedDataForImage):
3738
3739 2019-10-18  Ryosuke Niwa  <rniwa@webkit.org>
3740
3741         [iOS] REGRESSION(r251269): fast/events/ios/rotation/do-not-shrink-to-fit-content-after-rotation.html and fast/events/ios/rotation/layout-viewport-during-safari-type-rotation.html fail
3742         https://bugs.webkit.org/show_bug.cgi?id=203162
3743         <rdar://problem/56418459>
3744
3745         Reviewed by Simon Fraser.
3746
3747         Synchronously update the rendering before the orientation change and other viewport size updates.
3748
3749         Otherwise, resize event will be dispatched in the middle of orientation animation,
3750         and would result in non-determistic results.
3751
3752         * WebProcess/WebPage/ios/WebPageIOS.mm:
3753         (WebKit::WebPage::dynamicViewportSizeUpdate):
3754
3755 2019-10-18  Chris Dumez  <cdumez@apple.com>
3756
3757         [iOS] "Unexpectedly Resumed" process assertion may cause us to get terminated
3758         https://bugs.webkit.org/show_bug.cgi?id=203046
3759         <rdar://problem/56179592>
3760
3761         Reviewed by Geoffrey Garen.
3762
3763         This patch implements the following to avoid getting terminated:
3764         1. Schedule the task to release the assertion on a background thread instead of
3765            the main thread so that we end up releasing the task even if the main thread
3766            is somehow hung.
3767         2. Add an invalidation handler to the process assertion which releases the assertion
3768            upon expiration.
3769
3770         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
3771         (WebKit::WebProcessProxy::processWasUnexpectedlyUnsuspended):
3772         * WebProcess/WebProcess.cpp:
3773         (WebKit::WebProcess::processDidResume):
3774         * WebProcess/WebProcess.h:
3775         * WebProcess/cocoa/WebProcessCocoa.mm:
3776         (WebKit::WebProcess::processTaskStateDidChange):
3777
3778 2019-10-18  Jer Noble  <jer.noble@apple.com>
3779
3780         Add experimental HDR MediaCapabilities support.
3781         https://bugs.webkit.org/show_bug.cgi?id=203113
3782
3783         Reviewed by Eric Carlson.
3784
3785         Add experimental hdrMediaCapabilitiesEnabled preference.
3786
3787         * Shared/WebPreferences.yaml:
3788
3789 2019-10-18  Jiewen Tan  <jiewen_tan@apple.com>
3790
3791         [WebAuthn] Implement AuthenticatorCancel
3792         https://bugs.webkit.org/show_bug.cgi?id=191523
3793         <rdar://problem/55920204>
3794
3795         Reviewed by Brent Fulgham.
3796
3797         This patch implement two ways to cancel a pending WebAuthn ceremony:
3798         1) Via navigation activities. Activities include i) main frame navigation, ii) main frame reload,
3799         iii) main frame destruction, iv) sub frame navigation, and v) sub frame destruction. All the above
3800         activities will cancel any pending WebAuthn ceremony that is associated with the frame. To prove
3801         the association, a GlobalFrameIdentifier is bridged into WebAuthenticationRequestData. Navigation
3802         cancel is done in WebPageProxy::didStartProvisionalLoadForFrameShared, and destruction cancel is done
3803         in WebProcessProxy::didDestroyFrame and WebPageProxy::resetState.
3804         2) Via UI. This path is simply bridged -[_WKWebAuthenticationPanel cancel] into AuthenticatorManager.
3805         Noted, this patch follows the spec to wait until time out to notify RPs.
3806         References: i) Step 20 of https://www.w3.org/TR/webauthn/#createCredential, ii) Step 18 of
3807         https://www.w3.org/TR/webauthn/#getAssertion
3808
3809         As for what the cancel actually does, it:
3810         1) stops any HID/NFC scanning;
3811         2) sends CTAPHID_CANCEL to any HID authenticators that have been added. Reference:
3812         https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#usb-hid-cancel
3813         Sending CTAPHID_CANCEL, however, is not trivial. An abstract class FidoAuthenticator is crafted to
3814         do this labor for both CtapAuthenticator and U2fAuthenticator during the time of destructions.
3815         Noted: The CtapHidDriver is the only CtapDriver implements the cancel method. Since the message
3816         is sent during state reset, lifecycle of the HidConenction and HidService which manage the underlying
3817         IOHIDDeviceRef is very hard to hold. This is required for the regular async sender. Therefore,
3818         HidConnection::sendSync is crafted to send the message synchronously to get rid of the tediousness
3819         of managing those lifecycles.
3820
3821         P.S. Vector::grow doesn't initialize POD types. Therefore, this patch also appends it with memset
3822         for FidoHidPacket.
3823
3824         P.S.S. This patch also simplifies AuthenticatorCoordinatorClient by: i) moving code from AuthenticatorCoordinatorClient
3825         to WebAuthenticatorCoordinatorClient, and ii) using sendWithAsyncReply. The latter allows us to
3826         get rid of the complex mechanism of ensuring the right reply is returned.
3827
3828         * DerivedSources.make:
3829         * Sources.txt:
3830         * UIProcess/API/APIWebAuthenticationPanel.cpp:
3831         (API::WebAuthenticationPanel::create):
3832         (API::WebAuthenticationPanel::WebAuthenticationPanel):
3833         (API::WebAuthenticationPanel::cancel const):
3834         * UIProcess/API/APIWebAuthenticationPanel.h:
3835         * UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
3836         (-[_WKWebAuthenticationPanel cancel]):
3837         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
3838         (WebKit::AuthenticatorManager::cancelRequest):
3839         (WebKit::AuthenticatorManager::clearState):
3840         (WebKit::AuthenticatorManager::runPanel):
3841         (WebKit::AuthenticatorManager::resetState):
3842         * UIProcess/WebAuthentication/AuthenticatorManager.h:
3843         * UIProcess/WebAuthentication/Cocoa/HidConnection.h:
3844         (WebKit::HidConnection::isInitialized const):
3845         (WebKit::HidConnection::setIsInitialized):
3846         * UIProcess/WebAuthentication/Cocoa/HidConnection.mm:
3847         (WebKit::HidConnection::~HidConnection):
3848         (WebKit::HidConnection::initialize):
3849         (WebKit::HidConnection::terminate):
3850         (WebKit::HidConnection::sendSync):
3851         (WebKit::HidConnection::send):
3852         (WebKit::HidConnection::registerDataReceivedCallback):
3853         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
3854         (WebKit::MockHidConnection::initialize):
3855         (WebKit::MockHidConnection::terminate):
3856         (WebKit::MockHidConnection::sendSync):
3857         (WebKit::MockHidConnection::send):
3858         (WebKit::MockHidConnection::feedReports):
3859         * UIProcess/WebAuthentication/Mock/MockHidConnection.h:
3860         * UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
3861         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
3862         (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
3863         (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
3864         (WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):
3865         (WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable):
3866         (WebKit::WebAuthenticatorCoordinatorProxy::requestReply): Deleted.
3867         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
3868         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.messages.in:
3869         * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
3870         (WebKit::CtapAuthenticator::CtapAuthenticator):
3871         (WebKit::CtapAuthenticator::makeCredential):
3872         (WebKit::CtapAuthenticator::getAssertion):
3873         (WebKit::CtapAuthenticator::tryDowngrade):
3874         * UIProcess/WebAuthentication/fido/CtapAuthenticator.h:
3875         * UIProcess/WebAuthentication/fido/CtapDriver.h:
3876         (WebKit::CtapDriver::cancel):
3877         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
3878         (WebKit::CtapHidDriver::Worker::write):
3879         (WebKit::CtapHidDriver::Worker::read):
3880         (WebKit::CtapHidDriver::Worker::returnMessage):
3881         (WebKit::CtapHidDriver::Worker::reset):
3882         (WebKit::CtapHidDriver::Worker::cancel):
3883         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
3884         (WebKit::CtapHidDriver::continueAfterResponseReceived):
3885         (WebKit::CtapHidDriver::returnResponse):
3886         (WebKit::CtapHidDriver::reset):
3887         (WebKit::CtapHidDriver::cancel):
3888         * UIProcess/WebAuthentication/fido/CtapHidDriver.h:
3889         * UIProcess/WebAuthentication/fido/FidoAuthenticator.cpp: Copied from Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.cpp.
3890         (WebKit::FidoAuthenticator::FidoAuthenticator):
3891         (WebKit::FidoAuthenticator::~FidoAuthenticator):
3892         (WebKit::FidoAuthenticator::driver const):
3893         (WebKit::FidoAuthenticator::releaseDriver):
3894         * UIProcess/WebAuthentication/fido/FidoAuthenticator.h: Copied from Source/WebKit/UIProcess/API/APIWebAuthenticationPanel.cpp.
3895         * UIProcess/WebAuthentication/fido/FidoService.cpp:
3896         (WebKit::FidoService::continueAfterGetInfo):
3897         * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
3898         (WebKit::U2fAuthenticator::U2fAuthenticator):
3899         (WebKit::U2fAuthenticator::issueCommand):
3900         * UIProcess/WebAuthentication/fido/U2fAuthenticator.h:
3901         * UIProcess/WebPageProxy.cpp:
3902         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
3903         (WebKit::WebPageProxy::resetState):
3904         * UIProcess/WebProcessProxy.cpp:
3905         (WebKit::WebProcessProxy::didDestroyFrame):
3906         * WebKit.xcodeproj/project.pbxproj:
3907         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
3908         (WebKit::WebAuthenticatorCoordinator::WebAuthenticatorCoordinator):
3909         (WebKit::WebAuthenticatorCoordinator::makeCredential):
3910         (WebKit::WebAuthenticatorCoordinator::getAssertion):
3911         (WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable):
3912         (WebKit::WebAuthenticatorCoordinator::~WebAuthenticatorCoordinator): Deleted.
3913         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.h:
3914         * WebProcess/WebAuthentication/WebAuthenticatorCoordinator.messages.in: Removed.
3915         * WebProcess/WebPage/WebFrame.cpp:
3916         (WebKit::WebFrame::fromCoreFrame):
3917         * WebProcess/WebPage/WebFrame.h:
3918
3919 2019-10-18  Zan Dobersek  <zdobersek@igalia.com>
3920
3921         Avoid crashes on GCC-compiled binaries by avoiding a use-after-move
3922         that's the result of differring call conventions.
3923
3924         Rubber-stamped by Carlos Garcia Campos.
3925
3926         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
3927         (WebKit::WebSWServerConnection::startFetch): Copy the SW identifier from
3928         the ServiceWorkerFetchTask before it's moved into the lambda.
3929
3930 2019-10-17  Mark Lam  <mark.lam@apple.com>
3931
3932         Use constexpr in more places and remove some unnecessary external linkage.
3933         https://bugs.webkit.org/show_bug.cgi?id=203115
3934
3935         Reviewed by Yusuke Suzuki.
3936
3937         * UIProcess/API/APIContentRuleListStore.h:
3938         * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm:
3939
3940 2019-10-17  Antoine Quint  <graouts@apple.com>
3941
3942         [Web Animations] Enable the Web Animations JavaScript API by default
3943         https://bugs.webkit.org/show_bug.cgi?id=203075
3944
3945         Reviewed by Antti Koivisto.
3946
3947         * Shared/WebPreferences.yaml:
3948
3949 2019-10-17  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3950
3951         [GTK][WPE] File and Directory Entries API is not enabled
3952         https://bugs.webkit.org/show_bug.cgi?id=202796
3953
3954         Reviewed by Adrian Perez de Castro.
3955
3956         Enable by default the DirectoryUpload runtime setting that is
3957         used to enable the APIs of the File and Directory Entries API.
3958
3959         Enable also the DataTransferItemsEnabled runtime setting that
3960         exposes the DataTransferItem API. This makes the manual tests
3961         available at https://w3c-test.org/entries-api mostly pass on
3962         platform GTK (those tests need also the DataTransferItem API
3963         to enable the drag-and-drop).
3964
3965         The bug <https://webkit.org/b/98940> for DataTransferItem API
3966         remains open because the layout test editing/pasteboard/data-transfer-items.html
3967         is still not passing completely. However other manual tests for