40d0b095e0f3b8e839e8d2dde7f771132cbd51d1
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2020-04-07  Per Arne Vollan  <pvollan@apple.com>
2
3         [iOS] Deny mach lookup access to the runningboard service in the WebContent process
4         https://bugs.webkit.org/show_bug.cgi?id=209933
5
6         Reviewed by Chris Dumez.
7
8         Creating the dependency process assertion in the WebContent process requires access to runningboard, but since
9         this is only done on process startup, we can issue a temporary extension to the runningboard service, which
10         will be immediately revoked after the process assertion has been created.
11
12         Test: fast/sandbox/ios/sandbox-mach-lookup.html
13
14         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
15         * Shared/WebProcessCreationParameters.cpp:
16         (WebKit::WebProcessCreationParameters::encode const):
17         (WebKit::WebProcessCreationParameters::decode):
18         * Shared/WebProcessCreationParameters.h:
19         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
20         (WebKit::WebProcessPool::platformInitializeWebProcess):
21         * WebProcess/WebProcess.cpp:
22         (WebKit::WebProcess::initializeConnection):
23         * WebProcess/cocoa/WebProcessCocoa.mm:
24         (WebKit::WebProcess::platformInitializeWebProcess):
25
26 2020-04-07  John Wilander  <wilander@apple.com>
27
28         ITP Debug Mode logs should be more generic now that it blocks all third-party cookies by default
29         https://bugs.webkit.org/show_bug.cgi?id=210133
30         <rdar://problem/61399686>
31
32         Reviewed by Brent Fulgham.
33
34         No new tests. Just a change of logging.
35
36         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
37         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
38             Now logs if either vector has entries and uses more generic language.
39         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
40         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
41             Now logs if either vector has entries and uses more generic language.
42         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
43         (WebKit::ResourceLoadStatisticsStore::debugLogDomainsInBatches):
44             Removed hard-coded references to third-party cookie blocking and parameterized it instead.
45
46 2020-04-07  Joonghun Park  <jh718.park@samsung.com>
47
48         Move the misplaced statement to the proper place where in
49         RESOURCE_LOAD_STATISTICS macro.
50
51         This patch removes the build warning below since r259275.
52         warning: unused variable ‘sameSiteStrictEnforcementEnabled’ [-Wunused-variable]
53
54         No new tests, no new behavior changes.
55
56         * UIProcess/WebProcessPool.cpp:
57         (WebKit::WebProcessPool::ensureNetworkProcess):
58
59 2020-04-07  Jiewen Tan  <jiewen_tan@apple.com>
60
61         [WebAuthn] Cancel WebAuthn requests when users cancel LocalAuthentication prompts
62         https://bugs.webkit.org/show_bug.cgi?id=209923
63         <rdar://problem/61223713>
64
65         Reviewed by Brent Fulgham.
66
67         This patch intents to streamline WebAuthn local authenticator UX a bit more. Here, we should treat user
68         cancellation of the LocalAuthentication UI as if it were being done on the UI Client's WebAuthn UI.
69
70         * UIProcess/WebAuthentication/Authenticator.h:
71         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
72         (WebKit::AuthenticatorManager::cancelRequest):
73         * UIProcess/WebAuthentication/AuthenticatorManager.h:
74         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h:
75         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
76         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification):
77         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserVerification):
78         (WebKit::LocalAuthenticator::validateUserVerification const):
79         * UIProcess/WebAuthentication/Cocoa/LocalConnection.h:
80         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
81         (WebKit::LocalConnection::verifyUser const):
82         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
83         (WebKit::MockLocalConnection::MockLocalConnection):
84         (WebKit::MockLocalConnection::verifyUser const):
85         (WebKit::MockLocalConnection::filterResponses const):
86         * WebKit.xcodeproj/project.pbxproj:
87
88 2020-04-07  Sihui Liu  <sihui_liu@hotmail.com>
89
90         [ macOS ] Update sandbox rules for storage
91         https://bugs.webkit.org/show_bug.cgi?id=210120
92         <rdar://problem/60972224>
93
94         Reviewed by Geoffrey Garen.
95
96         This direcotry is used for cookie storage.
97
98         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
99
100 2020-04-07  Ryan Haddad  <ryanhaddad@apple.com>
101
102         Unreviewed, reverting r259655.
103
104         Caused assertion failures and timeouts on iOS bots
105
106         Reverted changeset:
107
108         "Return app-bound sessions for instances where
109         WKAppBoundDomains is"
110         https://bugs.webkit.org/show_bug.cgi?id=210124
111         https://trac.webkit.org/changeset/259655
112
113 2020-04-07  Chris Dumez  <cdumez@apple.com>
114
115         Merge DependencyAssertion into ProcessAssertion
116         https://bugs.webkit.org/show_bug.cgi?id=210076
117
118         Reviewed by Alex Christensen.
119
120         Merge DependencyAssertion into ProcessAssertion. After r259610, ProcessAssertion can use
121         RunningBoard assertions so there is no longer any need to a separate DependencyAssertion
122         class. We can simply introduce a new assertion type to ProcessAssertion.
123
124         * Shared/DependencyProcessAssertion.cpp: Removed.
125         * Shared/DependencyProcessAssertion.h: Removed.
126         * Shared/ios/DependencyProcessAssertionIOS.mm: Removed.
127         * Sources.txt:
128         * SourcesCocoa.txt:
129         * UIProcess/ProcessAssertion.h:
130         * UIProcess/ios/ProcessAssertionIOS.mm:
131         (-[WKProcessAssertionBackgroundTaskManager init]):
132         (-[WKProcessAssertionBackgroundTaskManager _hasBackgroundTask]):
133         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
134         (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]):
135         (WebKit::runningBoardNameForAssertionType):
136         * WebKit.xcodeproj/project.pbxproj:
137         * WebProcess/WebProcess.cpp:
138         (WebKit::WebProcess::initializeConnection):
139         * WebProcess/WebProcess.h:
140
141 2020-04-07  Alex Christensen  <achristensen@webkit.org>
142
143         Simplify and fortify network getNetworkProcessConnection and getGPUProcessConnection
144         https://bugs.webkit.org/show_bug.cgi?id=210142
145         <rdar://problem/59488963>
146
147         Reviewed by Youenn Fablet.
148
149         We have reports of hangs inside WebKit::getNetworkProcessConnection that seem to last forever.
150         Some of the reports indicate the network process is being suspended while a connection is being established with it.
151
152         To fix this issue we do three things:
153         1. We take a foregroundActivity when sending an async message to establish a connection.
154         2. We use sendWithAsyncReply which already has logic to handle the case where we are currently launching the process.
155            Instead of the complicated retry logic, we add a retry attempt in WebProcessPool if the connection identifier is invalid.
156         3. Add some release logging so we can better diagnose problems with this flow in the future.
157
158         The functional change is adding the foreground activity, which should prevent some hangs.
159         The rest is just to make this code more sane to understand and debug.
160         I do the same changes to NetworkProcess and GPUProcess because they are intended to be the same.  The latter is based on the former.
161
162         The API test WebKit.NetworkProcessCrashWithPendingConnection covers what happens when the network process crashes during connection establishment.
163         It fails if we don't retry somewhere, which I did in WebProcessPool.  We also need to try again in getNetworkProcessConnection and getGPUProcessConnection.
164         If it fails twice, there's nothing we can do, and we crash the web process to avoid a crash loop.
165
166         * UIProcess/GPU/GPUProcessProxy.cpp:
167         (WebKit::GPUProcessProxy::getGPUProcessConnection):
168         (WebKit::GPUProcessProxy::didFinishLaunching):
169         (WebKit::GPUProcessProxy::~GPUProcessProxy): Deleted.
170         (WebKit::GPUProcessProxy::openGPUProcessConnection): Deleted.
171         * UIProcess/GPU/GPUProcessProxy.h:
172         * UIProcess/Network/NetworkProcessProxy.cpp:
173         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
174         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
175         (WebKit::NetworkProcessProxy::networkProcessCrashed):
176         (WebKit::NetworkProcessProxy::didFinishLaunching):
177         (WebKit::NetworkProcessProxy::openNetworkProcessConnection): Deleted.
178         * UIProcess/Network/NetworkProcessProxy.h:
179         * UIProcess/WebProcessPool.cpp:
180         (WebKit::WebProcessPool::networkProcessCrashed):
181         (WebKit::WebProcessPool::getNetworkProcessConnection):
182         (WebKit::WebProcessPool::getGPUProcessConnection):
183         * UIProcess/WebProcessPool.h:
184         * WebProcess/GPU/GPUProcessConnectionInfo.h:
185         (WebKit::GPUProcessConnectionInfo::identifier const):
186         (WebKit::GPUProcessConnectionInfo::identifier): Deleted.
187         * WebProcess/Network/NetworkProcessConnectionInfo.h:
188         (WebKit::NetworkProcessConnectionInfo::identifier const):
189         (WebKit::NetworkProcessConnectionInfo::identifier): Deleted.
190
191 2020-04-07  Simon Fraser  <simon.fraser@apple.com>
192
193         Use RectEdges<> in some scrolling tree code
194         https://bugs.webkit.org/show_bug.cgi?id=210141
195
196         Reviewed by Tim Horton.
197         
198         Construct a RectEdges<>. Order is top, right, bottom, left.
199
200         * WebProcess/WebPage/EventDispatcher.cpp:
201         (WebKit::EventDispatcher::wheelEvent):
202
203 2020-04-07  Lauro Moura  <lmoura@igalia.com>
204
205         [GLIB] Avoid potential segfault in getPlatformEditorState
206         https://bugs.webkit.org/show_bug.cgi?id=210149
207
208         Reviewed by Carlos Alberto Lopez Perez.
209
210         Avoid potential surroundingRange dereference segfault.
211
212         * WebProcess/WebPage/glib/WebPageGLib.cpp:
213         (WebKit::WebPage::getPlatformEditorState const):
214
215 2020-04-07  Wenson Hsieh  <wenson_hsieh@apple.com>
216
217         Preventing touch events should not prevent gestures installed above WKWebView from recognizing
218         https://bugs.webkit.org/show_bug.cgi?id=210080
219         <rdar://problem/61365814>
220
221         Reviewed by Tim Horton.
222
223         Makes a small adjustment to native gesture deferral logic, so that gestures installed above WKWebView (in the
224         view hierarchy) are not prevented from recognizing by WKDeferringGestureRecognizer. This makes it possible for
225         WebKit clients to install custom gestures outside of WKWebView that cannot be prevented by web content, without
226         having to create a separate window and pass touches through to the WKWebView.
227
228         Test: fast/events/touch/ios/prevent-default-with-window-tap-gesture.html
229
230         * UIProcess/ios/WKContentViewInteraction.mm:
231         (-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]):
232
233 2020-04-07  Brian Burg  <bburg@apple.com>
234
235         Web Automation: Automation.inspectBrowsingContext should bring Web Inspector to front automatically
236         https://bugs.webkit.org/show_bug.cgi?id=210137
237
238         Reviewed by Joseph Pecoraro.
239
240         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
241         (WebKit::WebAutomationSession::inspectBrowsingContext):
242         Previously, calling connect() would preload Web Inspector but not show its window. This
243         made it awkward to use the 'safari:automaticInspection' capability without subsequently
244         evaluating a `debugger;` statement to bring Web Inspector to front.
245
246 2020-04-07  Kate Cheney  <katherine_cheney@apple.com>
247
248         Return app-bound sessions for instances where WKAppBoundDomains is
249         empty
250         https://bugs.webkit.org/show_bug.cgi?id=210124
251         <rdar://problem/61276630>
252
253         Reviewed by Brent Fulgham.
254
255         No new tests. Behavior confirmed by existing In-App Browser Privacy
256         tests.
257
258         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
259         (WebKit::NetworkSessionCocoa::sessionWrapperForTask):
260         Remove the flag checking if In-App Browser Privacy is enabled. We
261         should return an app-bound session if WKAppBoundDomains is empty so
262         we no longer need to check the flag here.
263
264         * UIProcess/WebPageProxy.cpp:
265         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
266         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
267         * UIProcess/WebPageProxy.h:
268         As described above, we no longer need to check the flag in this
269         instance as we are determining behavior based on the WKAppBoundDomains
270         list. Also moved the logic for checking an empty list to setIsNavigatingToAppBoundDomain,
271         so it should take an Optional (WTF::nullopt indicates an empty list).
272
273         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
274         (WebKit::WebsiteDataStore::initializeAppBoundDomains):
275         Use the flag to enable internal debugging for testing purposes.
276
277         * UIProcess/API/APIHTTPCookieStore.cpp:
278         (API::HTTPCookieStore::filterAppBoundCookies):
279         Flag no longer needed. This should be gated by whether the domains
280         list is empty or not.
281
282 2020-04-07  Per Arne Vollan  <pvollan@apple.com>
283
284         [iOS] Add message to message filter in the WebContent sandbox
285         https://bugs.webkit.org/show_bug.cgi?id=210130
286
287         Reviewed by Brent Fulgham.
288
289         Add a required syscall-mach message to the message filter in the WebContent sandbox on iOS.
290
291         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
292
293 2020-04-07  Youenn Fablet  <youenn@apple.com>
294
295         REGRESSION (r259383-259384): ASSERTION FAILED: 'Completion handler should always be called' seen with http/wpt/service-workers/service-worker-different-process.https.html
296         https://bugs.webkit.org/show_bug.cgi?id=209977
297
298         Reviewed by Chris Dumez.
299
300         * UIProcess/AuxiliaryProcessProxy.cpp:
301         (WebKit::AuxiliaryProcessProxy::~AuxiliaryProcessProxy):
302         In case AuxiliaryProcessProxy has some enqueued messages but process crashes on launch for instance,
303         we should call the completion handlers and fail.
304
305 2020-04-07  David Kilzer  <ddkilzer@apple.com>
306
307         VisitedLinkStore.messages.in and VisitedLinkStore::addVisitedLinkHashFromPage() don't agree on type of `linkHash`
308         <https://webkit.org/b/210094>
309         <rdar://problem/60334644>
310
311         Reviewed by Chris Dumez.
312
313         * Scripts/webkit/messages.py:
314         (types_that_cannot_be_forward_declared):
315         - Don't forward-declare WebCore::SharedStringHash as a class
316           since it is a uint32_t.
317         * UIProcess/VisitedLinkStore.messages.in:
318         - Use WebCore::SharedStringHash type for `linkHash` to fix the
319           type mismatch.
320
321 2020-04-07  Chris Dumez  <cdumez@apple.com>
322
323         Unreviewed, drop bad assertion introduced in r259610.
324
325         On some bots (in particular OpenSource iOS ones), we are unable to take the assertion
326         so this assertion does not hold true.
327
328         * UIProcess/ios/ProcessAssertionIOS.mm:
329         (WebKit::ProcessAssertion::ProcessAssertion):
330
331 2020-04-07  Rob Buis  <rbuis@igalia.com>
332
333         Use GlobalFrameIdentifier in NavigationAction
334         https://bugs.webkit.org/show_bug.cgi?id=210036
335
336         Reviewed by Darin Adler.
337
338         Adapt to API change.
339
340         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
341         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
342
343 2020-04-06  Kate Cheney  <katherine_cheney@apple.com>
344
345         Create a way to signal if the WKAppBoundDomains list is empty
346         https://bugs.webkit.org/show_bug.cgi?id=210074
347         <rdar://problem/61359228>
348
349         Reviewed by Brent Fulgham.
350
351         Updates the WebFramePolicyListener to return an Optional<NavigatingToAppBoundDomain>
352         to signal if the WKAppBoundDomains list is empty. If so, we don't want to update
353         any app-bound domain parameters in WebPageProxy.
354
355         * UIProcess/WebFramePolicyListenerProxy.cpp:
356         (WebKit::WebFramePolicyListenerProxy::didReceiveAppBoundDomainResult):
357         * UIProcess/WebFramePolicyListenerProxy.h:
358         * UIProcess/WebFrameProxy.cpp:
359         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
360         * UIProcess/WebFrameProxy.h:
361         * UIProcess/WebPageProxy.cpp:
362         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
363         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
364         (WebKit::WebPageProxy::decidePolicyForResponseShared):
365         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
366         (WebKit::WebsiteDataStore::beginAppBoundDomainCheck):
367         Changed the WebFramePolicyListener to take a NavigatingToAppBoundDomain
368         type as opposed to a boolean to allow it to handle the empty value.
369
370 2020-04-06  Chris Dumez  <cdumez@apple.com>
371
372         [iOS] Transition most process assertions to RunningBoard
373         https://bugs.webkit.org/show_bug.cgi?id=210065
374         <rdar://problem/61354901>
375
376         Reviewed by Geoffrey Garen.
377
378         Transition most process assertions to RunningBoard, instead of legacy BKSProcessAssertion.
379         The only assertion that still uses BKSProcessAssertion is the MediaPlayback once because
380         we do not have a RunningBoard equivalent for this one yet (see <rdar://problem/61263147>).
381
382         * UIProcess/ProcessAssertion.h:
383         * UIProcess/ios/ProcessAssertionIOS.mm:
384         (-[WKRBSAssertionDelegate assertionWillInvalidate:]):
385         (-[WKRBSAssertionDelegate assertion:didInvalidateWithError:]):
386         (WebKit::runningBoardNameForAssertionType):
387         (WebKit::ProcessAssertion::ProcessAssertion):
388         (WebKit::ProcessAssertion::~ProcessAssertion):
389         (WebKit::ProcessAssertion::processAssertionWasInvalidated):
390
391 2020-04-06  Ross Kirsling  <ross.kirsling@sony.com>
392
393         Update minimum ICU version to 60.2
394         https://bugs.webkit.org/show_bug.cgi?id=209694
395
396         Reviewed by Darin Adler.
397
398         * WebProcess/InjectedBundle/API/mac/WKDOMTextIterator.mm:
399         (-[WKDOMTextIterator currentTextPointer]):
400         Manually convert between UChar and UniChar/unichar where needed.
401
402 2020-04-06  Simon Fraser  <simon.fraser@apple.com>
403
404         Make ScrollableArea TextStream-loggable
405         https://bugs.webkit.org/show_bug.cgi?id=210042
406
407         Reviewed by Darin Adler.
408
409         ScrollableArea is a pure virtual base class, so has to dump via a virtual function,
410         so add debugDescription() and implement it in derived classes.
411
412         Make the common pattern be that operator<<(TextStream&, ...) calls debugDescription.
413
414         * UIProcess/win/WebPopupMenuProxyWin.cpp:
415         (WebKit::WebPopupMenuProxyWin::debugDescription const):
416         * UIProcess/win/WebPopupMenuProxyWin.h:
417         * WebProcess/Plugins/PDF/PDFPlugin.h:
418         * WebProcess/Plugins/PDF/PDFPlugin.mm:
419         (WebKit::PDFPlugin::debugDescription const):
420
421 2020-04-06  Commit Queue  <commit-queue@webkit.org>
422
423         Unreviewed, reverting r259469.
424         https://bugs.webkit.org/show_bug.cgi?id=210066
425
426         Introduced media playback regression (Requested by perarne on
427         #webkit).
428
429         Reverted changeset:
430
431         "[iOS] Deny mach lookup access to the runningboard service in
432         the WebContent process"
433         https://bugs.webkit.org/show_bug.cgi?id=209933
434         https://trac.webkit.org/changeset/259469
435
436 2020-04-06  Per Arne Vollan  <pvollan@apple.com>
437
438         Unreviewed sandbox compile fix.
439
440         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
441
442 2020-04-06  Víctor Manuel Jáquez Leal  <vjaquez@igalia.com>
443
444         [GTK] Remove unused header in web process
445         https://bugs.webkit.org/show_bug.cgi?id=210053
446
447         Reviewed by Michael Catanzaro.
448
449         Remove unused headers from code removed in r203774.
450
451         No new tests required.
452
453         * WebProcess/gtk/WebProcessMainGtk.cpp:
454
455 2020-04-06  Dean Jackson  <dino@apple.com>
456
457         CrashTracer: MobileSafari at WebKit: WebKit::SystemPreviewController::updateProgress
458         https://bugs.webkit.org/show_bug.cgi?id=210040
459         rdar://51410841
460
461         Reviewed by Darin Adler.
462
463         It appears that the SystemPreviewController on WebPageProxy can
464         become null causing a call to an in-progress download to crash
465         as it tries to talk to the QuickLook delegate. Guard against this
466         by checking the SystemPreviewController each time.
467
468         * UIProcess/Cocoa/DownloadClient.mm:
469         (WebKit::systemPreviewController):
470         (WebKit::DownloadClient::didReceiveResponse):
471         (WebKit::DownloadClient::didReceiveData):
472         (WebKit::DownloadClient::processDidCrash):
473         (WebKit::DownloadClient::didFinish):
474         (WebKit::DownloadClient::didFail):
475         (WebKit::DownloadClient::didCancel):
476
477 2020-04-06  Chris Dumez  <cdumez@apple.com>
478
479         ProcessAssertion should use ASCIILiteral for its reason
480         https://bugs.webkit.org/show_bug.cgi?id=210049
481
482         Reviewed by Alex Christensen.
483
484         ProcessAssertion should use ASCIILiteral for its reason, instead of a String.
485
486         * Shared/ios/DependencyProcessAssertionIOS.mm:
487         (WebKit::DependencyProcessAssertion::DependencyProcessAssertion):
488         * UIProcess/ProcessAssertion.cpp:
489         (WebKit::ProcessAssertion::ProcessAssertion):
490         * UIProcess/ProcessAssertion.h:
491         * UIProcess/ios/ProcessAssertionIOS.mm:
492         (WebKit::ProcessAssertion::ProcessAssertion):
493         (WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
494
495 2020-04-04  Darin Adler  <darin@apple.com>
496
497         Stop using live ranges in DocumentMarkerController
498         https://bugs.webkit.org/show_bug.cgi?id=209985
499
500         Reviewed by Antti Koivisto.
501
502         * UIProcess/ViewSnapshotStore.h: Removed unused "Cocoa without IOSurface" code paths.
503         * UIProcess/mac/ViewSnapshotStoreMac.mm:
504         (WebKit::ViewSnapshot::create): Ditto.
505         (WebKit::ViewSnapshot::ViewSnapshot): Ditto.
506         (WebKit::ViewSnapshot::setSurface): Ditto.
507         (WebKit::ViewSnapshot::hasImage const): Ditto.
508         (WebKit::ViewSnapshot::clearImage): Ditto.
509         (WebKit::ViewSnapshot::setVolatile): Ditto.
510         (WebKit::ViewSnapshot::asLayerContents): Ditto.
511         (WebKit::ViewSnapshot::asImageForTesting): Ditto.
512         (WebKit::ViewSnapshotStore::snapshottingContext): Deleted.
513
514         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
515         (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection): Updated since
516         addPlatformTextCheckingMarker no longer exists.
517         (WebKit::TextCheckingControllerProxy::removeAnnotationRelativeToSelection):
518         Updated since filterMarkers passes a reference instead of a pointer now.
519         (WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions):
520         Simplified code a bit by removing local variables.
521
522         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
523         (WebKit::WebPage::dictionaryPopupInfoForRange): Use
524         RenderObject::absoluteTextQuads.
525         * WebProcess/WebPage/mac/WebPageMac.mm:
526         (WebKit::WebPage::performImmediateActionHitTestAtLocation): Use
527         RenderObject::absoluteTextQuads and unitedBoundingBoxes.
528
529 2020-04-06  Per Arne Vollan  <pvollan@apple.com>
530
531         Add syscall to the WebContent sandbox
532         https://bugs.webkit.org/show_bug.cgi?id=210048
533
534         Reviewed by Brent Fulgham.
535
536         Add a required syscall to the WebContent sandbox on iOS and macOS.
537
538         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
539         * WebProcess/com.apple.WebProcess.sb.in:
540
541 2020-04-06  youenn fablet  <youenn@apple.com>
542
543         Add HEVC support in GPU Process for WebRTC
544         https://bugs.webkit.org/show_bug.cgi?id=209857
545
546         Reviewed by Eric Carlson.
547
548         * GPUProcess/webrtc/LibWebRTCCodecsProxy.h:
549         * GPUProcess/webrtc/LibWebRTCCodecsProxy.messages.in:
550         * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
551         (WebKit::LibWebRTCCodecsProxy::createH264Decoder):
552         (WebKit::LibWebRTCCodecsProxy::createH265Decoder):
553         (WebKit::LibWebRTCCodecsProxy::createEncoder):
554         (WebKit::LibWebRTCCodecsProxy::createDecoder): Deleted.
555         * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
556         (WebKit::createVideoDecoder):
557         (WebKit::createVideoEncoder):
558         (WebKit::LibWebRTCCodecs::createDecoder):
559         (WebKit::formatNameFromCodecType):
560         (WebKit::LibWebRTCCodecs::createEncoder):
561         * WebProcess/GPU/webrtc/LibWebRTCCodecs.h:
562
563 2020-04-05  Don Olmstead  <don.olmstead@sony.com>
564
565         [CMake] Add WebKit::WebKit target
566         https://bugs.webkit.org/show_bug.cgi?id=210033
567
568         Reviewed by Fujii Hironori.
569
570         Use WEBKIT_EXECUTABLE macros for the Process executables. Rename the output
571         file names to fit with the macro's expectations.
572
573         Add Headers.cmake which lists out all the public headers that are currently
574         shared by the PlayStation and Windows ports. This is then included on each
575         platform that is using it. Additionally use WEBKIT_COPY_FILES to create a
576         target which copies headers.
577
578         Finally use WEBKIT_FRAMEWORK_TARGET to create a WebKit target. Its dependent
579         on the WebKit library itself, the processes being built, and any headers that
580         are copied. This ensures that everything is built for dependent targets.
581
582         * CMakeLists.txt:
583         * Headers.cmake: Copied from Source/WebKit/PlatformPlayStation.cmake.
584         * PlatformFTW.cmake:
585         * PlatformGTK.cmake:
586         * PlatformMac.cmake:
587         * PlatformPlayStation.cmake:
588         * PlatformWPE.cmake:
589         * PlatformWin.cmake:
590
591 2020-04-05  Zan Dobersek  <zdobersek@igalia.com>
592
593         Unreviewed, adding missing header inclusions to get
594         non-unified build building.
595
596         * Shared/UserContentControllerParameters.cpp:
597
598 2020-04-04  Wenson Hsieh  <wenson_hsieh@apple.com>
599
600         Add a fourth round of logging to help diagnose <webkit.org/b/209685>
601         https://bugs.webkit.org/show_bug.cgi?id=210011
602
603         Reviewed by Darin Adler.
604
605         Remove all logging previously added to WKContentView and DragDropInteractionState.
606
607         * UIProcess/ios/DragDropInteractionState.mm:
608         (WebKit::DragDropInteractionState::stageDragItem):
609         (WebKit::DragDropInteractionState::clearStagedDragSource):
610         * UIProcess/ios/WKContentViewInteraction.mm:
611         (-[WKContentView _didHandleDragStartRequest:]):
612
613 2020-04-04  Chris Dumez  <cdumez@apple.com>
614
615         [iOS] Simplify ProcessAssertion class in preparation for switch to RunningBoard
616         https://bugs.webkit.org/show_bug.cgi?id=209984
617         <rdar://problem/61273941>
618
619         Reviewed by Darin Adler.
620
621         Simplify ProcessAssertion class in preparation for switch to RunningBoard. There
622         is a slight mismatch between the way BKS and RunningBoard process assertion API.
623         This refactoring makes it so that we can use the same ProcessAssertion class in
624         WebKit to work with either BKS or RunningBoard. Support for RunningBoard will
625         come later.
626
627         In particular, the following changes were made:
628         - Replace AssertionState & AssertionReason enums with a single ProcessAssertionType
629           one since RunningBoard does not have 2 separate concepts.
630         - Drop ProcessAssertion::setState() since it is not possible to change the flags
631           on an existing RunningBoard assertion. Instead, we are expected to create a
632           brand new process assertion of the expected type.
633
634         * NetworkProcess/Downloads/DownloadMap.cpp:
635         (WebKit::DownloadMap::add):
636         * Platform/IPC/cocoa/ConnectionCocoa.mm:
637         (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
638         * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
639         * UIProcess/API/Cocoa/WKWebViewTesting.mm:
640         (-[WKWebView _setAssertionTypeForTesting:]):
641         (-[WKWebView _setAssertionStateForTesting:]): Deleted.
642         * UIProcess/Downloads/DownloadProxyMap.cpp:
643         (WebKit::DownloadProxyMap::createDownloadProxy):
644         * UIProcess/GPU/GPUProcessProxy.h:
645         * UIProcess/Network/NetworkProcessProxy.cpp:
646         (WebKit::NetworkProcessProxy::sendProcessDidResume):
647         (WebKit::NetworkProcessProxy::takeUploadAssertion):
648         (WebKit::NetworkProcessProxy::didSetAssertionState): Deleted.
649         * UIProcess/Network/NetworkProcessProxy.h:
650         * UIProcess/ProcessAssertion.cpp:
651         (WebKit::ProcessAssertion::ProcessAssertion):
652         (WebKit::ProcessAssertion::setState): Deleted.
653         * UIProcess/ProcessAssertion.h:
654         (WebKit::ProcessAssertion::type const):
655         (WebKit::ProcessAssertion::state const): Deleted.
656         * UIProcess/ProcessThrottler.cpp:
657         (WebKit::ProcessThrottler::expectedAssertionType):
658         (WebKit::ProcessThrottler::updateAssertionTypeNow):
659         (WebKit::ProcessThrottler::setAssertionType):
660         (WebKit::ProcessThrottler::updateAssertionIfNeeded):
661         (WebKit::ProcessThrottler::didConnectToProcess):
662         (WebKit::ProcessThrottler::prepareToSuspendTimeoutTimerFired):
663         (WebKit::ProcessThrottler::processReadyToSuspend):
664         (WebKit::ProcessThrottler::sendPrepareToSuspendIPC):
665         (WebKit::ProcessThrottler::expectedAssertionState): Deleted.
666         (WebKit::ProcessThrottler::updateAssertionStateNow): Deleted.
667         (WebKit::ProcessThrottler::setAssertionState): Deleted.
668         * UIProcess/ProcessThrottler.h:
669         * UIProcess/ProcessThrottlerClient.h:
670         (WebKit::ProcessThrottlerClient::didSetAssertionType):
671         * UIProcess/WebProcessPool.cpp:
672         (WebKit::WebProcessPool::setWebProcessHasUploads):
673         (WebKit::WebProcessPool::setWebProcessIsPlayingAudibleMedia):
674         * UIProcess/WebProcessProxy.cpp:
675         (WebKit::WebProcessProxy::didSetAssertionType):
676         (WebKit::WebProcessProxy::didSetAssertionState): Deleted.
677         * UIProcess/WebProcessProxy.h:
678         (WebKit::WebProcessProxy::setAssertionTypeForTesting):
679         (WebKit::WebProcessProxy::setAssertionStateForTesting): Deleted.
680         * UIProcess/ios/ProcessAssertionIOS.mm:
681         (WebKit::flagsForAssertionType):
682         (WebKit::toBKSProcessAssertionReason):
683         (WebKit::ProcessAssertion::ProcessAssertion):
684         (WebKit::ProcessAndUIAssertion::updateRunInBackgroundCount):
685         (WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
686         (WebKit::flagsForState): Deleted.
687         (WebKit::reasonForState): Deleted.
688         (WebKit::ProcessAssertion::setState): Deleted.
689         (WebKit::ProcessAndUIAssertion::setState): Deleted.
690
691 2020-04-04  David Kilzer  <ddkilzer@apple.com>
692
693         [GPUP] Remove unnecessary RemoteCDMInstanceSessionIdentifier argument from RemoteCDMFactory::addSession()
694         <https://webkit.org/b/210006>
695
696         Reviewed by Darin Adler.
697
698         * WebProcess/GPU/media/RemoteCDMFactory.cpp:
699         (WebKit::RemoteCDMFactory::addSession):
700         - Remove argument. Use `session` parameter to retrieve the ID.
701         * WebProcess/GPU/media/RemoteCDMFactory.h:
702         (WebKit::RemoteCDMFactory::addSession):
703         - Remove argument.
704         * WebProcess/GPU/media/RemoteCDMInstance.cpp:
705         (WebKit::RemoteCDMInstance::createSession):
706         - Remove argument.
707
708 2020-04-04  Wenson Hsieh  <wenson_hsieh@apple.com>
709
710         Add even more logging to try and diagnose <webkit.org/b/209685>
711         https://bugs.webkit.org/show_bug.cgi?id=210008
712
713         Reviewed by Tim Horton.
714
715         Revert all (except one) of the logging statements added in r259518, and add several new ones. This last logging
716         pass demonstrated that DragController had failed to start a drag, since -[WKContentView _didHandleDragStartRequest:]
717         receives word that the drag has started, yet there are no staged drag items.
718
719         * UIProcess/ios/DragDropInteractionState.mm:
720         (WebKit::DragDropInteractionState::stageDragItem):
721         (WebKit::DragDropInteractionState::clearStagedDragSource):
722         * UIProcess/ios/WKContentViewInteraction.mm:
723         (-[WKContentView _didHandleAdditionalDragItemsRequest:]):
724         (-[WKContentView cleanUpDragSourceSessionState]):
725         (-[WKContentView _didPerformDragOperation:]):
726         (-[WKContentView _prepareToDragPromisedAttachment:]):
727         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
728         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
729         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
730         (-[WKContentView dragInteraction:sessionWillBegin:]):
731         (-[WKContentView dragInteraction:session:didEndWithOperation:]):
732         (-[WKContentView dragInteraction:item:willAnimateCancelWithAnimator:]):
733         (-[WKContentView dropInteraction:canHandleSession:]):
734         (-[WKContentView dropInteraction:sessionDidEnter:]):
735         (-[WKContentView dropInteraction:sessionDidExit:]):
736         (-[WKContentView dropInteraction:performDrop:]):
737         (-[WKContentView dropInteraction:sessionDidEnd:]):
738
739 2020-04-03  David Kilzer  <ddkilzer@apple.com>
740
741         WebPlatformStrategies::{readBufferFromPasteboard,bufferForType} should validate their `size` parameter
742         <https://webkit.org/b/209997>
743         <rdar://problem/60890565>
744
745         Reviewed by Wenson Hsieh.
746
747         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
748         (WebKit::WebPlatformStrategies::bufferForType):
749         (WebKit::WebPlatformStrategies::readBufferFromPasteboard):
750         - Validate the `size` parameter.
751
752 2020-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
753
754         The IPC message “registerAttachmentsFromSerializedData" should be capitalized
755         https://bugs.webkit.org/show_bug.cgi?id=209995
756         <rdar://problem/61283172>
757
758         Reviewed by Tim Horton.
759
760         Tweak the name of this IPC message so that it begins with a capital letter. No change in behavior.
761
762         * UIProcess/WebPageProxy.messages.in:
763         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
764         (WebKit::WebEditorClient::registerAttachments):
765
766 2020-04-03  Alex Christensen  <achristensen@webkit.org>
767
768         Add SPI to make WKUserScripts wait for a notification
769         https://bugs.webkit.org/show_bug.cgi?id=209845
770         <rdar://problem/60342299>
771
772         Reviewed by Chris Dumez.
773
774         * Shared/API/c/WKSharedAPICast.h:
775         (WebKit::toUserScriptInjectionTime):
776         (WebKit::toWKUserScriptInjectionTime):
777         (WebKit::toUserContentInjectedFrames):
778         * Shared/WebPageCreationParameters.cpp:
779         (WebKit::WebPageCreationParameters::encode const):
780         (WebKit::WebPageCreationParameters::decode):
781         * Shared/WebPageCreationParameters.h:
782         * Shared/WebUserContentControllerDataTypes.cpp:
783         (WebKit::WebUserScriptData::decode):
784         * UIProcess/API/APIPageConfiguration.h:
785         (API::PageConfiguration::userScriptsShouldWaitUntilNotification const):
786         (API::PageConfiguration::setUserScriptsShouldWaitUntilNotification):
787         * UIProcess/API/APIUserScript.h:
788         * UIProcess/API/C/WKPageGroup.cpp:
789         (WKPageGroupAddUserScript):
790         * UIProcess/API/C/WKUserScriptRef.cpp:
791         (WKUserScriptCreateWithSource):
792         (WKUserScriptGetMainFrameOnly):
793         * UIProcess/API/Cocoa/WKUserScript.mm:
794         (-[WKUserScript initWithSource:injectionTime:forMainFrameOnly:]):
795         (-[WKUserScript isForMainFrameOnly]):
796         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]):
797         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:userContentWorld:]):
798         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:contentWorld:]):
799         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:contentWorld:]):
800         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:contentWorld:waitForNotification:]):
801         * UIProcess/API/Cocoa/WKUserScriptInternal.h:
802         (API::toWebCoreUserScriptInjectionTime):
803         (API::toWKUserScriptInjectionTime):
804         * UIProcess/API/Cocoa/WKUserScriptPrivate.h:
805         * UIProcess/API/Cocoa/WKWebView.mm:
806         (-[WKWebView _notifyUserScripts]):
807         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
808         (-[WKWebViewConfiguration _userScriptsShouldWaitUntilNotification]):
809         (-[WKWebViewConfiguration _setUserScriptsShouldWaitUntilNotification:]):
810         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
811         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
812         * UIProcess/API/Cocoa/_WKUserStyleSheet.mm:
813         (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:]):
814         (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:userContentWorld:]):
815         (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]):
816         (-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]):
817         (-[_WKUserStyleSheet isForMainFrameOnly]):
818         * UIProcess/WebPageProxy.cpp:
819         * UIProcess/WebPageProxy.h:
820         * WebProcess/UserContent/WebUserContentController.cpp:
821         (WebKit::WebUserContentController::addUserScriptInternal):
822         * WebProcess/WebPage/WebPage.cpp:
823         (WebKit::m_processDisplayName):
824         (WebKit::WebPage::notifyUserScripts):
825         (WebKit::WebPage::addUserScript):
826         * WebProcess/WebPage/WebPage.h:
827         * WebProcess/WebPage/WebPage.messages.in:
828
829 2020-04-03  Alex Christensen  <achristensen@webkit.org>
830
831         Use AuthenticationChallenge instead of AuthenticationChallengeProxy for ResourceLoadDelegate
832         https://bugs.webkit.org/show_bug.cgi?id=207639
833
834         Reviewed by David Kilzer.
835
836         In r254345 my younger and more naive self used AuthenticationChallengeProxy instead of AuthenticationChallenge
837         because he didn't know about the WebCore::mac function, which is called by AuthenticationChallengeProxy, and it's
838         all I needed to get an NSURLAuthenticationChallenge.  Skipping the AuthenticationChallengeProxy step cleans up
839         AuthenticationChallengeProxy by removing the unnecessary ability to have a null CompletionHandler.
840
841         Covered by existing tests.
842
843         * UIProcess/API/APIResourceLoadClient.h:
844         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
845         (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
846         (): Deleted.
847         * UIProcess/Cocoa/ResourceLoadDelegate.h:
848         * UIProcess/Cocoa/ResourceLoadDelegate.mm:
849         (WebKit::ResourceLoadDelegate::ResourceLoadClient::didReceiveChallenge const):
850         * UIProcess/Network/NetworkProcessProxy.cpp:
851         (WebKit::NetworkProcessProxy::resourceLoadDidReceiveChallenge):
852         * UIProcess/WebPageProxy.cpp:
853         * UIProcess/WebPageProxy.h:
854
855 2020-04-03  Kate Cheney  <katherine_cheney@apple.com>
856
857         Prevent non app-bound domain cookies from being read or set using API calls
858         https://bugs.webkit.org/show_bug.cgi?id=209926
859         <rdar://problem/61071428>
860
861         Reviewed by Brady Eidson.
862
863         This patch filters out setting and fetching of cookies via API call 
864         to only set or return app-bound cookies.
865
866         * UIProcess/API/APIHTTPCookieStore.cpp:
867         (API::HTTPCookieStore::filterAppBoundCookies):
868         This function queries the websiteDataStore for the WKAppBoundDomains
869         entries and filters out non app-bound domains.
870
871         (API::HTTPCookieStore::cookies):
872         (API::HTTPCookieStore::cookiesForURL):
873         (API::HTTPCookieStore::setCookies):
874         These functions were updated to set/return the cookies after they've
875         been filtered through the WKAppBoundDomains.
876
877         * UIProcess/API/APIHTTPCookieStore.h:
878         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
879         (-[WKWebsiteDataStore _appBoundDomains:]):
880         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
881         (WebKit::WebsiteDataStore::getAppBoundDomains const):
882         (WebKit::WebsiteDataStore::appBoundDomainsForTesting const): Deleted.
883         Utilize a function formerly used for testing only to be used in the
884         HTTPCookieStore.
885
886         * UIProcess/WebsiteData/WebsiteDataStore.h:
887
888 2020-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
889
890         Add more logging to help diagnose <webkit.org/b/209685>
891         https://bugs.webkit.org/show_bug.cgi?id=209988
892
893         Reviewed by Timothy Hatcher.
894
895         Replace logging that was previously added in r259465 with different logging. The fact that the prior logging
896         never showed up in the failing tests suggests that the problem happens earlier than I had expected, so we need
897         to ensure that codepaths for preparing and beginning a drag session are logged instead.
898
899         This turns several existing `RELEASE_LOG`s in WKContentView into `NSLog`s, so that they will show up in test
900         failure output when run on the bots.
901
902         * UIProcess/ios/WKContentViewInteraction.mm:
903         (-[WKContentView _didHandleAdditionalDragItemsRequest:]):
904         (-[WKContentView _didHandleDragStartRequest:]):
905         (-[WKContentView cleanUpDragSourceSessionState]):
906         (-[WKContentView _didPerformDragOperation:]):
907         (-[WKContentView _prepareToDragPromisedAttachment:]):
908         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
909         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
910         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
911         (-[WKContentView dragInteraction:sessionWillBegin:]):
912         (-[WKContentView dragInteraction:session:didEndWithOperation:]):
913         (-[WKContentView dragInteraction:item:willAnimateCancelWithAnimator:]):
914         (-[WKContentView dropInteraction:canHandleSession:]):
915         (-[WKContentView dropInteraction:sessionDidEnter:]):
916         (-[WKContentView dropInteraction:sessionDidUpdate:]):
917         (-[WKContentView dropInteraction:sessionDidExit:]):
918         (-[WKContentView dropInteraction:performDrop:]):
919         (-[WKContentView dropInteraction:sessionDidEnd:]):
920
921 2020-04-03  Chris Dumez  <cdumez@apple.com>
922
923         [iOS] Give RunningBoard entitlement to all our child processes
924         https://bugs.webkit.org/show_bug.cgi?id=209986
925         <rdar://problem/61275270>
926
927         Reviewed by Geoffrey Garen.
928
929         Give RunningBoard entitlement to all our child processes on iOS. As we are
930         transitioning to RunningBoard process assertions, it is important for the
931         target process of those assertion to have the 
932         com.apple.runningboard.assertions.webkit entitlement.
933
934         * Scripts/process-entitlements.sh:
935
936 2020-04-03  Truitt Savell  <tsavell@apple.com>
937
938         Unreviewed, reverting r259440.
939
940         Introduced 2 failing tests on Mac and iOS
941
942         Reverted changeset:
943
944         "Add SPI to configure WebsiteDataStores with a URL for
945         standalone web applications and use it to disable first-party
946         website data removal in ITP"
947         https://bugs.webkit.org/show_bug.cgi?id=209634
948         https://trac.webkit.org/changeset/259440
949
950 2020-04-03  Tim Horton  <timothy_horton@apple.com>
951
952         Add a visual debug indicator for locating and identifying all kinds of WebViews
953         https://bugs.webkit.org/show_bug.cgi?id=209982
954         <rdar://problem/60339870>
955
956         Reviewed by Simon Fraser.
957
958         * UIProcess/API/Cocoa/WKWebView.mm:
959         (-[WKWebView _initializeWithConfiguration:]):
960         * UIProcess/API/mac/WKView.mm:
961         (-[WKView initWithFrame:processPool:configuration:]):
962         Adopt in WKWebView and WKView.
963
964 2020-04-03  Kate Cheney  <katherine_cheney@apple.com>
965
966         Remove _setIsNavigatingToAppBoundDomain testing SPI
967         https://bugs.webkit.org/show_bug.cgi?id=209973
968         <rdar://problem/61264350>
969
970         Reviewed by David Kilzer.
971
972         This SPI is no longer needed to set a webView as navigating to an
973         app-bound domain. We can now load a local file instead.
974
975         No new tests, confirmed behavior by existing tests.
976
977         * UIProcess/API/Cocoa/WKWebView.mm:
978         (-[WKWebView _setIsNavigatingToAppBoundDomain:completionHandler:]): Deleted.
979         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
980         * UIProcess/WebPageProxy.cpp:
981         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomainTesting): Deleted.
982         * UIProcess/WebPageProxy.h:
983         * WebProcess/WebPage/WebPage.cpp:
984         (WebKit::WebPage::setIsNavigatingToAppBoundDomainTesting): Deleted.
985         * WebProcess/WebPage/WebPage.h:
986         * WebProcess/WebPage/WebPage.messages.in:
987
988 2020-04-03  Per Arne Vollan  <pvollan@apple.com>
989
990         Unreviewed sandbox compile fix.
991
992         * WebProcess/com.apple.WebProcess.sb.in:
993
994 2020-04-03  David Kilzer  <ddkilzer@apple.com>
995
996         [Cocoa] Update MESSAGE_CHECK macros used in WebProcessProxy::didCreateSleepDisabler/WebProcessProxy::didDestroySleepDisabler
997         <https://webkit.org/b/209981>
998         <rdar://problem/61237674>
999
1000         Reviewed by Darin Adler.
1001
1002         * UIProcess/WebProcessProxy.cpp:
1003         (WebKit::WebProcessProxy::didCreateSleepDisabler):
1004         - Remove MESSAGE_CHECK for `identifier` since decoding detects
1005           invalid values.
1006         - Add MESSAGE_CHECK for `reason` since a NULL string would cause
1007           CFStringCreateWithCString() to crash later.
1008         (WebKit::WebProcessProxy::didDestroySleepDisabler):
1009         - Remove MESSAGE_CHECK for `identifier` since decoding detects
1010           invalid values.
1011
1012 2020-04-03  Megan Gardner  <megan_gardner@apple.com>
1013
1014         Color Form Control does not come up on second selection in macCatalyst
1015         https://bugs.webkit.org/show_bug.cgi?id=209939
1016         <rdar://problem/61131345>
1017
1018         Reviewed by Wenson Hsieh.
1019
1020         On selection and manual dismissal of the form, we need to also call accessoryDone,
1021         as the UIKit callbacks are not called on manual dismissal.
1022
1023         * UIProcess/ios/forms/WKFormColorPicker.mm:
1024         (-[WKColorPicker colorMatrixView:didTapColorButton:]):
1025
1026 2020-04-03  Brent Fulgham  <bfulgham@apple.com>
1027
1028         [macOS] Update sandbox rules for correct sanitizer paths in current OS releases
1029         https://bugs.webkit.org/show_bug.cgi?id=209818
1030         <rdar://problem/58422996>
1031
1032         Unreviewed follow-up based on feedback from the sanitizer team.
1033
1034         The change in r259317 left the original, incorrect, 'literal' form of the path, rather
1035         than the correct 'subpath' form. This corrects that issue.
1036
1037         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
1038         * WebProcess/com.apple.WebProcess.sb.in:
1039
1040 2020-04-03  Brent Fulgham  <bfulgham@apple.com>
1041
1042         Remove unneeded sandbox access to some file paths
1043         https://bugs.webkit.org/show_bug.cgi?id=209938
1044         <rdar://problem/59529620>
1045
1046         Reviewed by Per Arne Vollan.
1047
1048         Remove unnecessary access to some locations in /etc. These may have been needed in
1049         the past, but the WebContent process no longer requires this access. We should
1050         remove it.
1051
1052         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1053         * WebProcess/com.apple.WebProcess.sb.in:
1054
1055 2020-04-03  Per Arne Vollan  <pvollan@apple.com>
1056
1057         [iOS] Deny mach lookup access to the runningboard service in the WebContent process
1058         https://bugs.webkit.org/show_bug.cgi?id=209933
1059         <rdar://problem/56995639>
1060
1061         Reviewed by Brent Fulgham.
1062
1063         On iOS, after <https://trac.webkit.org/changeset/258180/webkit>, mach lookup access to "com.apple.runningboard"
1064         can be denied in the WebContent process.
1065
1066         Test: fast/sandbox/ios/sandbox-mach-lookup.html
1067
1068         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1069
1070 2020-04-03  Diego Pino Garcia  <dpino@igalia.com>
1071
1072         REGRESSION(r259401): [GTK] Check surroundingRange is not null
1073         https://bugs.webkit.org/show_bug.cgi?id=209966
1074
1075         Reviewed by Darin Adler & Philippe Normand.
1076
1077         * WebProcess/WebPage/glib/WebPageGLib.cpp:
1078         (WebKit::WebPage::getPlatformEditorState const):
1079
1080 2020-04-03  David Kilzer  <ddkilzer@apple.com>
1081
1082         [Xcode] Replace ASAN_OTHER_CFLAGS and ASAN_OTHER_CPLUSPLUSFLAGS with $(inherited)
1083         <https://webkit.org/b/209963>
1084         <rdar://problem/61257504>
1085
1086         Reviewed by Alexey Proskuryakov.
1087
1088         * Configurations/Base.xcconfig:
1089         - Remove ASAN_OTHER_CFLAGS, ASAN_OTHER_CPLUSPLUSFLAGS and
1090           ASAN_OTHER_LDFLAGS.
1091
1092 2020-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1093
1094         Add logging to help diagnose <webkit.org/b/209685>
1095         https://bugs.webkit.org/show_bug.cgi?id=209967
1096
1097         Reviewed by Darin Adler.
1098
1099         See WebCore/ChangeLog.
1100
1101         * UIProcess/ios/WKContentViewInteraction.mm:
1102         (-[WKContentView dropInteraction:sessionDidUpdate:]):
1103
1104 2020-04-03  youenn fablet  <youenn@apple.com>
1105
1106         ServiceWorkerFetchTask::timeoutTimerFired should not call contextClosed
1107         https://bugs.webkit.org/show_bug.cgi?id=209906
1108         <rdar://problem/61207801>
1109
1110         Reviewed by Chris Dumez.
1111
1112         Covered by http/tests/workers/service/basic-timeout.https.html no longer crashing.
1113
1114         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
1115         (WebKit::ServiceWorkerFetchTask::timeoutTimerFired):
1116         We should not call contextClosed now that we are nullying m_swServerConnection in contextClosed.
1117         Instead, we should just call cannotHandle since the timer can only fire if we have not yet received any response.
1118
1119 2020-04-03  Adrian Perez de Castro  <aperez@igalia.com>
1120
1121         Unreviewed fix after r259382
1122
1123         Rubber-stamped by Carlos Garcia Campos.
1124
1125         No new tests needed.
1126
1127         * UIProcess/API/glib/WebKitWebContext.cpp:
1128         (webkit_web_context_register_uri_scheme): Change g_return_if_fail()
1129         calls to actually check that the passed scheme is not one of the
1130         special ones.
1131
1132 2020-04-03  youenn fablet  <youenn@apple.com>
1133
1134         Add initial support for WebRTC HEVC
1135         https://bugs.webkit.org/show_bug.cgi?id=204283
1136
1137         Reviewed by Eric Carlson.
1138
1139         Remove VP8 runtime flag and add a H365 runtime flag instead.
1140
1141         * Shared/WebPreferences.yaml:
1142         * WebProcess/WebPage/WebPage.cpp:
1143         (WebKit::WebPage::updatePreferences):
1144
1145 2020-04-03  Yousuke Kimoto  <yousuke.kimoto@sony.com>
1146
1147         FileSystem handle leaks in CurlCacheManager and NetworkCacheData when failed to open a file
1148         https://bugs.webkit.org/show_bug.cgi?id=209949
1149
1150         Reviewed by Fujii Hironori.
1151
1152         A file handle of FileSystem is not closed when the file handle doesn't
1153         return its status. The handle should be released before returning.
1154
1155         No new tests, no behavior change.
1156
1157         * NetworkProcess/cache/NetworkCacheData.cpp:
1158         (WebKit::NetworkCache::mapFile):
1159
1160 2020-04-03  Peng Liu  <peng.liu6@apple.com>
1161
1162         WebCore::HTMLMediaElement::mediaCanStart crashes
1163         https://bugs.webkit.org/show_bug.cgi?id=209950
1164
1165         Reviewed by Jer Noble.
1166
1167         UserMediaPermissionRequestManager does not need to inherit from
1168         CanMakeWeakPtr<UserMediaPermissionRequestManager> because its
1169         parent class MediaCanStartListener supports WeakPtr now.
1170
1171         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
1172
1173 2020-04-02  John Wilander  <wilander@apple.com>
1174
1175         Add SPI to configure WebsiteDataStores with a URL for standalone web applications and use it to disable first-party website data removal in ITP
1176         https://bugs.webkit.org/show_bug.cgi?id=209634
1177         <rdar://problem/60943970>
1178
1179         Reviewed by Alex Christensen.
1180
1181         This change adds a new property to _WKWebsiteDataStoreConfiguration.h called
1182         standaloneApplicationURL with which the hosting application can inform the
1183         website data store that it's running as a standalone web application.
1184
1185         This change also forwards an existing standaloneApplicationURL as a
1186         WebCore::RegistrableDomain into ITP so that explicit exemptions can be made
1187         to first parties of standalone web applications. The exemptions made here
1188         all for all of ITP's website data removal. This part of the change is
1189         covered by the new layout tests.
1190
1191         Tests: http/tests/resourceLoadStatistics/standalone-web-application-exempt-from-website-data-deletion-database.html
1192                http/tests/resourceLoadStatistics/standalone-web-application-exempt-from-website-data-deletion.html
1193
1194         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
1195         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1196         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor):
1197         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
1198         (WebKit::ResourceLoadStatisticsStore::setStandaloneApplicationDomain):
1199         (WebKit::ResourceLoadStatisticsStore::standaloneApplicationDomain const):
1200         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1201         (WebKit::WebResourceLoadStatisticsStore::setStandaloneApplicationDomain):
1202         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1203         * NetworkProcess/NetworkSession.cpp:
1204         (WebKit::NetworkSession::NetworkSession):
1205         (WebKit::NetworkSession::forwardResourceLoadStatisticsSettings):
1206         * NetworkProcess/NetworkSession.h:
1207         * Shared/ResourceLoadStatisticsParameters.h:
1208         (WebKit::ResourceLoadStatisticsParameters::encode const):
1209         (WebKit::ResourceLoadStatisticsParameters::decode):
1210         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
1211         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
1212         (-[_WKWebsiteDataStoreConfiguration standaloneApplicationURL]):
1213         (-[_WKWebsiteDataStoreConfiguration setStandaloneApplication:]):
1214         * UIProcess/WebProcessPool.cpp:
1215         (WebKit::WebProcessPool::ensureNetworkProcess):
1216         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1217         (WebKit::WebsiteDataStore::platformSetNetworkParameters):
1218         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
1219         (WebKit::WebsiteDataStoreConfiguration::copy const):
1220         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
1221         (WebKit::WebsiteDataStoreConfiguration::standaloneApplicationURL const):
1222         (WebKit::WebsiteDataStoreConfiguration::setStandaloneApplicationURL):
1223
1224 2020-04-02  Per Arne Vollan  <pvollan@apple.com>
1225
1226         Unreviewed build fix after r259396.
1227
1228         * Shared/mac/AuxiliaryProcessMac.mm:
1229
1230 2020-04-02  David Kilzer  <ddkilzer@apple.com>
1231
1232         WebPageProxy attachment methods should return early if attachment element is not enabled
1233         <https://webkit.org/b/209451>
1234         <rdar://problem/60253260>
1235
1236         Reviewed by Chris Dumez.
1237
1238         * UIProcess/WebPageProxy.cpp:
1239         (WebKit::WebPageProxy::registerAttachmentIdentifierFromData):
1240         (WebKit::WebPageProxy::registerAttachmentIdentifierFromFilePath):
1241         (WebKit::WebPageProxy::registerAttachmentIdentifier):
1242         (WebKit::WebPageProxy::registerAttachmentsFromSerializedData):
1243         (WebKit::WebPageProxy::cloneAttachmentData):
1244         (WebKit::WebPageProxy::serializedAttachmentDataForIdentifiers):
1245         (WebKit::WebPageProxy::didInsertAttachmentWithIdentifier):
1246         - Add a message check for the attachment element being enabled.
1247         (WebKit::WebPageProxy::didRemoveAttachmentWithIdentifier): Ditto.
1248         - Also add a missing message check to validate `identifier`.
1249
1250 2020-04-02  Chris Dumez  <cdumez@apple.com>
1251
1252         [iOS] Replace UIKit background task with a RunningBoard FinishTaskInterruptable assertion
1253         https://bugs.webkit.org/show_bug.cgi?id=209825
1254         <rdar://problem/61118503>
1255
1256         Reviewed by Geoffrey Garen.
1257
1258         Replace UIKit background task with a RunningBoard FinishTaskInterruptable assertion on iOS.
1259         Our UIProcess gets terminated too frequently when the UIKit background task expires when
1260         the UIProcess holds it for longer than 30 seconds in the background. The RunningBoard
1261         FinishTaskInterruptable assertion is supposed to be equivalent but would cause suspension
1262         of our UIProcess on expiration, instead of termination.
1263
1264         * UIProcess/ios/ProcessAssertionIOS.mm:
1265         (-[WKProcessAssertionBackgroundTaskManager init]):
1266         (-[WKProcessAssertionBackgroundTaskManager _scheduleReleaseTask]):
1267         (-[WKProcessAssertionBackgroundTaskManager _cancelPendingReleaseTask]):
1268         (-[WKProcessAssertionBackgroundTaskManager _hasBackgroundTask]):
1269         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
1270         (-[WKProcessAssertionBackgroundTaskManager assertionWillInvalidate:]):
1271         (-[WKProcessAssertionBackgroundTaskManager assertion:didInvalidateWithError:]):
1272         (-[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpiration]):
1273         (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]):
1274
1275 2020-04-02  Per Arne Vollan  <pvollan@apple.com>
1276
1277         [iOS] Allow use of syscall from the WebContent sandbox
1278         https://bugs.webkit.org/show_bug.cgi?id=209920
1279         <rdar://problem/58743778>
1280
1281         Reviewed by Darin Adler.
1282
1283         Add syscall to the WebContent sandbox on iOS.
1284
1285         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1286
1287 2020-04-02  Brent Fulgham  <bfulgham@apple.com>
1288
1289         [iOS] Remove use of 'apple-signed-executable?' from Sandbox
1290         https://bugs.webkit.org/show_bug.cgi?id=209914
1291         <rdar://problem/45088481>
1292
1293         Reviewed by Per Arne Vollan.
1294
1295         Some of the rules imported from the system sandbox make decisions based on whether the software is
1296         an apple-signed executable or not. This predicate is not relevant for the WebKit processes, and
1297         should be removed (it is always apple-signed).
1298
1299         This patch makes the following changes:
1300         1. Removes all uses of 'apple-signed-executable?' (since it is always true for WebKit).
1301         2. Removed two iCloud preference reads that are not used in WebKit.
1302         3. Switches from the deprecated 'com.apple.ReportCrash.SimulateCrash' XPC service to its
1303         correct name 'com.apple.osanalytics.osanalyticshelper'.
1304
1305         Covered by existing regression tests.
1306
1307         * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
1308         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1309         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1310
1311 2020-04-01  Darin Adler  <darin@apple.com>
1312
1313         Remove all uses of live ranges from TextIterator
1314         https://bugs.webkit.org/show_bug.cgi?id=209723
1315
1316         Reviewed by Antti Koivisto.
1317
1318         * Shared/EditingRange.cpp:
1319         (WebKit::EditingRange::fromRange): Use characterRange.
1320
1321         * Shared/mac/AttributedString.h: Added a constructor that takes rvalue
1322         references so we can initialize this slightly more efficiently.
1323
1324         * Shared/mac/AttributedString.mm:
1325         (IPC::ArgumentCoder<WebKit::AttributedString>::decode): Pass rvalue
1326         references when creating an AttributedString.
1327
1328         * UIProcess/mac/TextCheckerMac.mm:
1329         (WebKit::TextChecker::updateSpellingUIWithGrammarString): Simplify the
1330         code to remove some local variables that weren't helpful.
1331
1332         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h: Made the
1333         annotatedSubstringBetweenPositions a static member function. Also used
1334         const& argument types to cut down on reference count churn a bit.
1335
1336         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
1337         (WebKit::TextCheckingControllerProxy::rangeAndOffsetRelativeToSelection):
1338         Streamlined and made this use characterCount instead of
1339         TextIterator::getLocationAndLengthFromRange.
1340         (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection): Tweaked
1341         the argument type.
1342         (WebKit::TextCheckingControllerProxy::removeAnnotationRelativeToSelection):
1343         Ditto. Also removed some unnecessary use of NSString.
1344         (WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions):
1345         Rewrote to no longer use live ranges.
1346
1347         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1348         (WebKit::WebPage::getContentsAsAttributedString): Use construction and
1349         rvalue references to tigten things up a bit.
1350
1351         * WebProcess/WebPage/WebFrame.cpp:
1352         (WebKit::WebFrame::contentsAsString const): Use a SimpleRange instead of
1353         a live range to pass to plainText.
1354         * WebProcess/WebPage/glib/WebPageGLib.cpp:
1355         (WebKit::WebPage::getPlatformEditorState const): Pass references to
1356         live ranges to plainText.
1357         * WebProcess/WebPage/ios/WebPageIOS.mm:
1358         (WebKit::WebPage::updateSelectionWithDelta): Rewrote to minimize use of
1359         live ranges.
1360         (WebKit::WebPage::requestDocumentEditingContext): Ditto.
1361         * WebProcess/WebPage/mac/WebPageMac.mm:
1362         (WebKit::WebPage::getPlatformEditorState const): Pass reference to
1363         a live range to plainText.
1364
1365 2020-04-02  David Kilzer  <ddkilzer@apple.com>
1366
1367         API::PageConfiguration may have conflicting preference values between WebPreferences and WebPreferencesStore::ValueMap instance variables
1368         <https://webkit.org/b/209678>
1369         <rdar://problem/60981271>
1370
1371         Reviewed by Brent Fulgham.
1372
1373         We fix this bug by removing
1374         API::PageConfiguration::m_preferenceValues and
1375         WebPageProxy::m_configurationPreferenceValues, and instead set
1376         values directly on the WebPreferences object, which holds values
1377         in its WebPreferencesStore instance variable.  This change only
1378         requires that the API::PageConfiguration object has
1379         m_preferences set to a valid WebPreferences object before using
1380         the settings APIs.
1381
1382         Covered by WKAttachment TestWebKitAPI tests and
1383         editing/undo-manager layout tests, among others.
1384
1385         * UIProcess/API/APIPageConfiguration.cpp:
1386         (API::PageConfiguration::copy const):
1387         - Remove use of m_preferenceValues instance variable.
1388         * UIProcess/API/APIPageConfiguration.h:
1389         - Update headers after removing WebPreferencesStore.h.
1390         (API::PageConfiguration::preferenceValues): Delete.
1391         - Remove use of m_preferenceValues instance variable.
1392
1393         * UIProcess/API/Cocoa/WKWebView.mm:
1394         (-[WKWebView _setupPageConfiguration:]):
1395         - Switch to use WebPreferences methods for settings.
1396
1397         * UIProcess/API/mac/WKView.mm:
1398         (-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
1399         - Create WebPreferences object for API::PageConfiguration
1400           object.  This is what WebProcessPool::createWebPage() does
1401           when creating a WebPageProxy object.
1402         - Switch to use WebPreferences method to set
1403           SystemLayoutDirection.
1404
1405         * UIProcess/WebPageProxy.cpp:
1406         (WebKit::WebPageProxy::WebPageProxy):
1407         - Remove initialization of m_configurationPreferenceValues.
1408         - Switch to use WebPreferences method to set
1409           DisableScreenSizeOverride.
1410         (WebKit::WebPageProxy::preferencesStore const):
1411         - Simplify this method after removing
1412           m_configurationPreferenceValues.
1413         * UIProcess/WebPageProxy.h:
1414         - Remove m_configurationPreferenceValues.
1415
1416 2020-04-02  Per Arne Vollan  <pvollan@apple.com>
1417
1418         [macOS] Remove redundant call to check in with Launch Services
1419         https://bugs.webkit.org/show_bug.cgi?id=209911
1420
1421         Reviewed by Darin Adler.
1422
1423         There is no need to explicitly check in with Launch Services or call RegisterApplication in the WebContent process,
1424         since this is handled when calling [NSApplication _accessibilityInitialize].
1425
1426         No new tests, since this only removes a redundant call, and should be covered by existing tests.
1427
1428         * Shared/mac/AuxiliaryProcessMac.mm:
1429         * WebProcess/cocoa/WebProcessCocoa.mm:
1430         (WebKit::WebProcess::platformInitializeWebProcess):
1431         (WebKit::WebProcess::updateProcessName):
1432         (WebKit::WebProcess::platformInitializeProcess):
1433
1434 2020-04-02  Alex Christensen  <achristensen@webkit.org>
1435
1436         Add SPI to restrict loading to main resources or non-network loads
1437         https://bugs.webkit.org/show_bug.cgi?id=209893
1438
1439         Reviewed by Tim Horton.
1440
1441         * Shared/WebPageCreationParameters.cpp:
1442         (WebKit::WebPageCreationParameters::encode const):
1443         (WebKit::WebPageCreationParameters::decode):
1444         * Shared/WebPageCreationParameters.h:
1445         * UIProcess/API/APIPageConfiguration.cpp:
1446         (API::PageConfiguration::copy const):
1447         * UIProcess/API/APIPageConfiguration.h:
1448         (API::PageConfiguration::loadsSubresources const):
1449         (API::PageConfiguration::setLoadsSubresources):
1450         (API::PageConfiguration::loadsFromNetwork const):
1451         (API::PageConfiguration::setLoadsFromNetwork):
1452         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1453         (-[WKWebViewConfiguration _setLoadsFromNetwork:]):
1454         (-[WKWebViewConfiguration _loadsFromNetwork]):
1455         (-[WKWebViewConfiguration _setLoadsSubresources:]):
1456         (-[WKWebViewConfiguration _loadsSubresources]):
1457         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1458         * UIProcess/WebPageProxy.cpp:
1459         * WebProcess/WebPage/WebPage.cpp:
1460         (WebKit::m_processDisplayName):
1461
1462 2020-04-02  youenn fablet  <youenn@apple.com>
1463
1464         Debug crash: ASSERTION FAILED: m_ongoingFetches.contains(task.fetchIdentifier())
1465         https://bugs.webkit.org/show_bug.cgi?id=209743
1466
1467         Reviewed by Darin Adler.
1468
1469         When context gets closed, we make ServiceWorkerFetchTask::m_serviceWorkerConnection null as it no longer
1470         needs to send messages and does not need to unregister itself.
1471
1472         Test: http/wpt/service-workers/service-worker-crashing-while-fetching.https.html
1473
1474         * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
1475         (WebKit::ServiceWorkerFetchTask::contextClosed):
1476
1477 2020-04-02  youenn fablet  <youenn@apple.com>
1478
1479         Remove synchronous termination of service workers
1480         https://bugs.webkit.org/show_bug.cgi?id=209666
1481
1482         Reviewed by Chris Dumez.
1483
1484         Update IPC code according removal of synchronous termination of service worker.
1485         Implement async-with-reply termination instead.
1486
1487         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1488         (WebKit::WebSWServerConnection::terminateWorkerFromClient):
1489         (WebKit::WebSWServerConnection::fetchTaskTimedOut):
1490         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
1491         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
1492         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1493         (WebKit::WebSWServerToContextConnection::terminateDueToUnresponsiveness):
1494         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
1495         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
1496         * WebProcess/Storage/WebServiceWorkerProvider.h:
1497         * WebProcess/Storage/WebSWClientConnection.cpp:
1498         (WebKit::WebSWClientConnection::terminateWorkerForTesting):
1499         * WebProcess/Storage/WebSWClientConnection.h:
1500         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1501         * WebProcess/Storage/WebSWContextManagerConnection.h:
1502         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1503
1504 2020-04-02  Adrian Perez de Castro  <aperez@igalia.com>
1505
1506         [WPE][GTK] Public API should not allow trying to register a special URI scheme
1507         https://bugs.webkit.org/show_bug.cgi?id=209900
1508
1509         Reviewed by Carlos Garcia Campos.
1510
1511         No new tests needed.
1512
1513         * UIProcess/API/glib/WebKitWebContext.cpp:
1514         (webkit_web_context_register_uri_scheme): Use g_return_if_fail() to
1515         check at the public API level whether the passed URI scheme is
1516         special and bail out early.
1517
1518 2020-04-02  Carlos Garcia Campos  <cgarcia@igalia.com>
1519
1520         [GTK] [2.28.0] The Yelp build crashes if DISPLAY is not set
1521         https://bugs.webkit.org/show_bug.cgi?id=209431
1522
1523         Reviewed by Carlos Alberto Lopez Perez.
1524
1525         Remove the assert when display is not X11 nor Wayland, and simply return false to ensure acceleration is not used.
1526
1527         * UIProcess/gtk/AcceleratedBackingStore.cpp:
1528         (WebKit::AcceleratedBackingStore::checkRequirements):
1529
1530 2020-04-01  Per Arne Vollan  <pvollan@apple.com>
1531
1532         [Cocoa] UTI from MIME type cache can be removed after r258915
1533         https://bugs.webkit.org/show_bug.cgi?id=209787
1534
1535         Unreviewed rollout of r257828.
1536
1537         * Shared/WebProcessCreationParameters.cpp:
1538         (WebKit::WebProcessCreationParameters::encode const):
1539         (WebKit::WebProcessCreationParameters::decode):
1540         * Shared/WebProcessCreationParameters.h:
1541         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1542         (WebKit::WebProcessPool::platformInitializeWebProcess):
1543         * WebProcess/cocoa/WebProcessCocoa.mm:
1544         (WebKit::WebProcess::platformInitializeWebProcess):
1545
1546 2020-04-01  Per Arne Vollan  <pvollan@apple.com>
1547
1548         [macOS] Deny mach-lookup access to "com.apple.lsd.mapdb" in sandbox
1549         https://bugs.webkit.org/show_bug.cgi?id=209814
1550
1551         Reviewed by Darin Adler.
1552
1553         This was done for iOS in <https://trac.webkit.org/changeset/258915>, and in order to be able to do this
1554         on macOS, checking in with Launch Services and updating the process name needs to be done after the
1555         Launch Services database mapping has been done in WebProcess::platformInitializeWebProcess. Also, the
1556         previous call to RegisterApplication has been replaced with a call to launchServicesCheckIn, since
1557         RegisterApplication is an AppKit function, and should be avoided since the WebContent process is not
1558         a NSApplication anymore.
1559
1560         Test: fast/sandbox/mac/sandbox-mach-lookup.html
1561
1562         * Shared/mac/AuxiliaryProcessMac.mm:
1563         (WebKit::AuxiliaryProcess::launchServicesCheckIn):
1564         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1565         (WebKit::WebProcessPool::platformInitializeWebProcess):
1566         * WebProcess/cocoa/WebProcessCocoa.mm:
1567         (WebKit::WebProcess::platformInitializeWebProcess):
1568         (WebKit::WebProcess::initializeProcessName):
1569         (WebKit::WebProcess::updateProcessName):
1570         (WebKit::WebProcess::platformInitializeProcess):
1571         * WebProcess/com.apple.WebProcess.sb.in:
1572
1573 2020-04-01  Chris Dumez  <cdumez@apple.com>
1574
1575         Regression(r257963) didFailProvisionalNavigation delegate no longer gets called when cancelling a cross-site provisional navigation
1576         https://bugs.webkit.org/show_bug.cgi?id=209873
1577         <rdar://problem/61132068>
1578
1579         Reviewed by Alex Christensen.
1580
1581         ProvisionalPageProxy::cancel() was calling didFailProvisionalLoadForFrame() was not passing a valid
1582         FrameInfoData struct as parameter. As a result, FrameInfoData::isMainFrame ended up being false
1583         instead of true. This was an issue because NavigationState::NavigationClient::didFailProvisionalNavigationWithError()
1584         was relying on this flag to decide whether to call webViewDidFailProvisionalNavigationWithError or
1585         webViewNavigationDidFailProvisionalLoadInSubframeWithError, since r257963.
1586
1587         Change is covered by new API tests.
1588
1589         * UIProcess/ProvisionalPageProxy.cpp:
1590         (WebKit::ProvisionalPageProxy::cancel):
1591
1592 2020-04-01  Don Olmstead  <don.olmstead@sony.com>
1593
1594         [GPUP][PlayStation] Enable GPU Process
1595         https://bugs.webkit.org/show_bug.cgi?id=209865
1596
1597         Reviewed by Eric Carlson.
1598
1599         A generic LayerHostingContext is provided in this patch. It may make sense for
1600         this to be platform specific but it may also be possible to have some shared
1601         implementation with Cocoa ports. Once there are more implementations that
1602         can be decided.
1603
1604         Add stubs for building out the GPU Process on the PlayStation port. No
1605         implementation is provided at this time but the GPU Process will compile
1606         and link with these changes.
1607
1608         * GPUProcess/media/playstation/RemoteMediaPlayerProxyPlayStation.cpp: Added.
1609         (WebKit::RemoteMediaPlayerProxy::prepareForPlayback):
1610         (WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable):
1611         (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged):
1612         (WebKit::RemoteMediaPlayerProxy::enterFullscreen):
1613         (WebKit::RemoteMediaPlayerProxy::exitFullscreen):
1614         * GPUProcess/playstation/GPUProcessMainPlayStation.cpp: Added.
1615         (WebKit::initializeAuxiliaryProcess<GPUProcess>):
1616         (WebKit::GPUProcessMain):
1617         * GPUProcess/playstation/GPUProcessPlayStation.cpp: Added.
1618         (WebKit::GPUProcess::initializeProcess):
1619         (WebKit::GPUProcess::initializeProcessName):
1620         (WebKit::GPUProcess::initializeSandbox):
1621         * Platform/generic/LayerHostingContext.h: Added.
1622         * PlatformPlayStation.cmake:
1623         * WebProcess/GPU/media/playstation/VideoLayerRemotePlayStation.cpp: Added.
1624         (WebKit::createVideoLayerRemote):
1625
1626 2020-04-01  Don Olmstead  <don.olmstead@sony.com>
1627
1628         [PlayStation] Use OBJECT libraries for WebCore and PAL
1629         https://bugs.webkit.org/show_bug.cgi?id=209835
1630
1631         Reviewed by Ross Kirsling.
1632
1633         Use the object libraries when building WebKit.
1634
1635         * PlatformPlayStation.cmake:
1636
1637 2020-04-01  Commit Queue  <commit-queue@webkit.org>
1638
1639         Unreviewed, reverting r259328.
1640         https://bugs.webkit.org/show_bug.cgi?id=209861
1641
1642         Introduced API test failures (Requested by perarne on
1643         #webkit).
1644
1645         Reverted changeset:
1646
1647         "[macOS] Deny mach-lookup access to "com.apple.lsd.mapdb" in
1648         sandbox"
1649         https://bugs.webkit.org/show_bug.cgi?id=209814
1650         https://trac.webkit.org/changeset/259328
1651
1652 2020-04-01  Brent Fulgham  <bfulgham@apple.com>
1653
1654         Convert app-bound domain categorization parameter to a method
1655         https://bugs.webkit.org/show_bug.cgi?id=209842
1656         <rdar://problem/61128744>
1657
1658         Reviewed by John Wilander.
1659
1660         SSIA.
1661
1662         Covered by existing TestWebKitAPI tests.
1663
1664         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1665
1666 2020-04-01  Alex Christensen  <achristensen@webkit.org>
1667
1668         Deprecate WKWebsiteDataStore._indexedDBDatabaseDirectory
1669         https://bugs.webkit.org/show_bug.cgi?id=209243
1670
1671         Reviewed by David Kilzer.
1672
1673         Luckily it's read-only, but we have a way to get the configuration, so let's encourage that instead.
1674
1675         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1676
1677 2020-04-01  Wenson Hsieh  <wenson_hsieh@apple.com>
1678
1679         Make WebPasteboardProxy::didModifyContentsOfPasteboard robust when pasteboardName is null
1680         https://bugs.webkit.org/show_bug.cgi?id=209848
1681         <rdar://problem/61121810>
1682
1683         Reviewed by Megan Gardner and David Kilzer.
1684
1685         Add more IPC message checks in WebPasteboardProxy; see below for more detail.
1686
1687         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
1688
1689         Rename what is currently MESSAGE_CHECK to MESSAGE_CHECK_COMPLETION, and introduce two more message check macros:
1690         MESSAGE_CHECK_WITH_RETURN_VALUE, which supports a return value, and MESSAGE_CHECK, which returns with no value.
1691
1692         (WebKit::WebPasteboardProxy::canAccessPasteboardData const):
1693
1694         Replace the early returns when pasteboardName is empty or when the web process for the given connection is null
1695         with `MESSAGE_CHECK`s. When the web content process is well-behaved, these early returns should never be hit.
1696
1697         (WebKit::WebPasteboardProxy::didModifyContentsOfPasteboard):
1698
1699         Similarly, replace this early return with a message check, and additionally `MESSAGE_CHECK` when the pasteboard
1700         name is empty. This addresses the main issue caught by this radar.
1701
1702         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
1703
1704 2020-04-01  Victor M. Jaquez <vjaquez@igalia.com>
1705
1706         Bump libwebrtc to M82
1707         https://bugs.webkit.org/show_bug.cgi?id=209542
1708
1709         Reviewed by Eric Carlson and Youenn Fablet.
1710
1711         Update include paths to latest libwebrtc paths.
1712
1713         * WebProcess/Network/webrtc/LibWebRTCResolver.h:
1714         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
1715
1716 2020-04-01  youenn fablet  <youenn@apple.com>
1717
1718         Support resolution of IPv6 STUN/TURN addresses
1719         https://bugs.webkit.org/show_bug.cgi?id=209808
1720
1721         Reviewed by Eric Carlson.
1722
1723         Update code to support IPv6 addresses when doing DNS resolution of TURN/STUN servers.
1724         Refactor code to share more code between Cocoa ports and non Cocoa ports.
1725         Manually tested with external IPv6 TURN servers.
1726
1727         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
1728         (WebKit::NetworkRTCProvider::createResolver):
1729         * NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp:
1730         (WebKit::resolvedName):
1731
1732 2020-03-31  Megan Gardner  <megan_gardner@apple.com>
1733
1734         Dismiss color picker on color selection on MacCatalyst
1735         https://bugs.webkit.org/show_bug.cgi?id=209840
1736         <rdar://problem/46793808>
1737
1738         Reviewed by Darin Adler.
1739
1740         To have correct behavior on mac, we need to dismiss the color picker popover once
1741         a color has been selected.
1742
1743         * UIProcess/ios/forms/WKFormColorControl.mm:
1744         (-[WKColorPopover initWithView:]):
1745         * UIProcess/ios/forms/WKFormColorPicker.h:
1746         * UIProcess/ios/forms/WKFormColorPicker.mm:
1747         (-[WKColorPicker initWithView:]):
1748         (-[WKColorPicker initWithView:inPopover:]):
1749         (-[WKColorPicker colorMatrixView:didTapColorButton:]):
1750
1751 2020-03-31  Simon Fraser  <simon.fraser@apple.com>
1752
1753         Add type traits for ScrollableArea, and other cleanup
1754         https://bugs.webkit.org/show_bug.cgi?id=209838
1755
1756         Reviewed by Chris Dumez.
1757
1758         Because PDFPlugin inherits from both Plugin and ScrollableArea, expand out its SPECIALIZE_TYPE_TRAITS macros
1759         and change the macros to use the isFoo() pattern.
1760
1761         * WebProcess/Plugins/Netscape/NetscapePlugin.h:
1762         * WebProcess/Plugins/PDF/PDFPlugin.h:
1763         (isType):
1764         * WebProcess/Plugins/Plugin.h:
1765         (WebKit::Plugin::isPluginProxy const):
1766         (WebKit::Plugin::isNetscapePlugin const):
1767         (WebKit::Plugin::isPDFPlugin const):
1768         * WebProcess/Plugins/PluginProxy.h:
1769
1770 2020-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
1771
1772         Datalist option's label not used
1773         https://bugs.webkit.org/show_bug.cgi?id=201768
1774         <rdar://problem/55361186>
1775
1776         Reviewed by Darin Adler.
1777
1778         Add support on macOS for showing option labels in datalist suggestions.
1779
1780         * Shared/WebCoreArgumentCoders.cpp:
1781         (IPC::ArgumentCoder<DataListSuggestionInformation>::encode): Deleted.
1782         (IPC::ArgumentCoder<DataListSuggestionInformation>::decode): Deleted.
1783         * Shared/WebCoreArgumentCoders.h:
1784
1785         Remove WebCoreArgumentCoders logic for encoding and decoding DataListSuggestionInformation. See
1786         DataListSuggestionInformation.h in WebCore for more detail.
1787
1788         * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp:
1789         (WebKit::WebDataListSuggestionsDropdownGtk::show):
1790
1791         Tweak GTK code to adjust for the change from `String` to `DataListSuggestion`.
1792
1793         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
1794         (-[WKDataListSuggestionsControl didSelectOptionAtIndex:]):
1795         (-[WKDataListSuggestionsControl textSuggestions]):
1796         (-[WKDataListSuggestionsControl suggestionAtIndex:]):
1797
1798         Adjust some iOS codepaths to use DataListSuggestion::value as the value string to display.
1799
1800         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
1801
1802         Tweak several UI constants. A suggestion cell may now be either 20 or 40pt tall, depending on whether it has
1803         label text to show.
1804
1805         Currently, the maximum combined height of the table view cells is 120 (not including spacing between cells and
1806         vertical padding around the top and bottom of the table view), since the maximum number of cells to show is 6
1807         and each cell is 20pt tall. Maintain this constant by making the maximum cell height 120, which accomodates
1808         either three labeled cells, or 6 unlabeled cells (i.e. to match shipping behavior).
1809
1810         (-[WKDataListSuggestionView initWithFrame:]):
1811         (-[WKDataListSuggestionView layout]):
1812
1813         Maintain two text fields or value and (optionally) label text: `_valueField` and `_labelField`. The value field
1814         fills the bounds of the cell in the case where there is no label text, but fills only the top half of the cell
1815         in the case where there is label text. The label field takes the bottom half of the cell in this case.
1816
1817         Additionally, add a divider view that may appear at the very bottom of each cell. This divider view is present
1818         when one or more suggestions in the datalist are labeled.
1819
1820         (-[WKDataListSuggestionView setValue:label:]):
1821
1822         Renamed from -setText:. Add a label string argument as well.
1823
1824         (-[WKDataListSuggestionView setShouldShowBottomDivider:]):
1825
1826         Add getters and setters for the -shouldShowBottomDivider property, which can be used to make the divider view
1827         visible or hidden.
1828
1829         (-[WKDataListSuggestionView shouldShowBottomDivider]):
1830         (-[WKDataListSuggestionView setBackgroundStyle:]):
1831
1832         Use -[NSColor secondaryLabelColor] for the label text field.
1833
1834         (shouldShowDividersBetweenCells):
1835
1836         Add a helper method to determine whether the table view should be showing clear dividers between each item.
1837         We only do so if there are one or more labels to be shown.
1838
1839         (-[WKDataListSuggestionsController initWithInformation:inView:]):
1840         (-[WKDataListSuggestionsController currentSelectedString]):
1841         (-[WKDataListSuggestionsController updateWithInformation:]):
1842         (-[WKDataListSuggestionsController moveSelectionByDirection:]):
1843
1844         Drive-by fix: scroll to reveal each selected row when using the arrow keys to navigate between items.
1845
1846         (-[WKDataListSuggestionsController dropdownRectForElementRect:]):
1847         (-[WKDataListSuggestionsController tableView:heightOfRow:]):
1848
1849         Return either `dropdownRowHeightWithoutLabel` or `dropdownRowHeightWithLabel`, depending on whether there is
1850         label text to be shown in that suggestion cell.
1851
1852         (-[WKDataListSuggestionsController tableView:viewForTableColumn:row:]):
1853         (-[WKDataListSuggestionView setText:]): Deleted.
1854         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1855         (WebKit::WebChromeClient::canShowDataListSuggestionLabels const):
1856         * WebProcess/WebCoreSupport/WebChromeClient.h:
1857
1858 2020-03-31  Per Arne Vollan  <pvollan@apple.com>
1859
1860         [macOS] Deny mach-lookup access to "com.apple.lsd.mapdb" in sandbox
1861         https://bugs.webkit.org/show_bug.cgi?id=209814
1862
1863         Reviewed by Darin Adler.
1864
1865         This was done for iOS in <https://trac.webkit.org/changeset/258915>, and in order to be able to do this
1866         on macOS, checking in with Launch Services and updating the process name needs to be done after the
1867         Launch Services database mapping has been done in WebProcess::platformInitializeWebProcess. Also, the
1868         previous call to RegisterApplication has been replaced with a call to launchServicesCheckIn, since
1869         RegisterApplication is an AppKit function, and should be avoided since the WebContent process is not
1870         a NSApplication anymore.
1871
1872         Test: fast/sandbox/mac/sandbox-mach-lookup.html
1873
1874         * Shared/mac/AuxiliaryProcessMac.mm:
1875         (WebKit::AuxiliaryProcess::launchServicesCheckIn):
1876         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1877         (WebKit::WebProcessPool::platformInitializeWebProcess):
1878         * WebProcess/cocoa/WebProcessCocoa.mm:
1879         (WebKit::WebProcess::platformInitializeWebProcess):
1880         (WebKit::WebProcess::initializeProcessName):
1881         (WebKit::WebProcess::updateProcessName):
1882         (WebKit::WebProcess::platformInitializeProcess):
1883         * WebProcess/com.apple.WebProcess.sb.in:
1884
1885 2020-03-31  Don Olmstead  <don.olmstead@sony.com>
1886
1887         [PlayStation] Fix build breaks after r259112
1888         https://bugs.webkit.org/show_bug.cgi?id=209830
1889
1890         Unreviewed build fix.
1891
1892         Replace PLATFORM(WPE) with USE(LIBWPE) within WebWheelEvent.
1893
1894         * Shared/WebEvent.h:
1895         * Shared/WebWheelEvent.cpp:
1896         (WebKit::WebWheelEvent::encode const):
1897         (WebKit::WebWheelEvent::decode):
1898
1899 2020-03-31  Alex Christensen  <achristensen@webkit.org>
1900
1901         Send correct UserContentControllerIdentifier after using SPI WKWebpagePreferences._userContentController
1902         https://bugs.webkit.org/show_bug.cgi?id=209833
1903
1904         Reviewed by Tim Hatcher.
1905
1906         Covered by an API test.  I knew something was broken in r259307 and this was it.
1907
1908         * Shared/UserContentControllerParameters.cpp:
1909         (WebKit::UserContentControllerParameters::encode const):
1910         (WebKit::UserContentControllerParameters::decode):
1911         * Shared/UserContentControllerParameters.h:
1912         * Shared/WebPageCreationParameters.cpp:
1913         (WebKit::WebPageCreationParameters::encode const):
1914         (WebKit::WebPageCreationParameters::decode):
1915         * Shared/WebPageCreationParameters.h:
1916         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
1917         (WebKit::WebUserContentControllerProxy::parameters const):
1918         * UIProcess/WebPageProxy.cpp:
1919         * WebProcess/WebPage/WebPage.cpp:
1920
1921 2020-03-31  Fujii Hironori  <Hironori.Fujii@sony.com>
1922
1923         Deduplicate WebsiteDataStore::parameters() of Cocoa port and non-Cocoa port
1924         https://bugs.webkit.org/show_bug.cgi?id=209644
1925
1926         Reviewed by Youenn Fablet.
1927
1928         WinCairo WTR was failing an assertion ensuring
1929         ResourceLoadStatistics was enabled in
1930         NetworkSession::setThirdPartyCookieBlockingMode while running
1931         LayoutTests with useEphemeralSession=true becuase
1932         ResourceLoadStatisticsParameters was not set in
1933         WebsiteDataStoreParameters.
1934
1935         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1936         (WebKit::WebsiteDataStore::platformSetNetworkParameters): Added.
1937         (WebKit::WebsiteDataStore::parameters): Deleted.
1938         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1939         (WebKit::WebsiteDataStore::parameters):
1940         * UIProcess/WebsiteData/WebsiteDataStore.h:
1941
1942 2020-03-31  Brent Fulgham  <bfulgham@apple.com>
1943
1944         Allow WKAppBoundDomains to be initialized with eTLD+1 only (no protocol)
1945         https://bugs.webkit.org/show_bug.cgi?id=209839
1946         <rdar://problem/61129400>
1947
1948         Reviewed by Darin Adler.
1949
1950         Create a convenience mode for WKAppBoundDomains that assumes https if the user does
1951         not supply the full URL. This doesn't effect the behavior of the app-bound domains
1952         because we only deal in RegistrableDomains.
1953
1954         Tested by TestWebKitAPI.
1955
1956         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1957         (WebKit::WebsiteDataStore::initializeAppBoundDomains): If the protocol is missing from
1958         a domain supplied by WKAppBoundDomains, assume it was https.
1959
1960 2020-03-31  Brent Fulgham  <bfulgham@apple.com>
1961
1962         [macOS] Update sandbox rules for correct sanitizer paths in current OS releases
1963         https://bugs.webkit.org/show_bug.cgi?id=209818
1964         <rdar://problem/58422996>
1965
1966         Reviewed by Per Arne Vollan.
1967
1968         Update the sandbox rules to allow access to the new system Asan library
1969         locations.
1970
1971         * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: Note: Don't bother leaving
1972         the old location in this sandbox, since it is not being used on any shipping
1973         software.
1974         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
1975         * WebProcess/com.apple.WebProcess.sb.in:
1976
1977 2020-03-31  Sihui Liu  <sihui_liu@apple.com>
1978
1979         IndexedDB: destroy WebIDBServer when session is removed in network process
1980         https://bugs.webkit.org/show_bug.cgi?id=209606
1981         <rdar://problem/59310081>
1982
1983         Reviewed by Geoffrey Garen.
1984
1985         Tested manually to verify WebIDBServer is removed and its thread ends when session is removed.
1986
1987         * NetworkProcess/IndexedDB/WebIDBServer.cpp:
1988         (WebKit::WebIDBServer::~WebIDBServer):
1989         (WebKit::WebIDBServer::addConnection):
1990         (WebKit::WebIDBServer::removeConnection):
1991         (WebKit::WebIDBServer::close):
1992         * NetworkProcess/IndexedDB/WebIDBServer.h:
1993         * NetworkProcess/NetworkProcess.cpp:
1994         (WebKit::NetworkProcess::destroySession):
1995         (WebKit::NetworkProcess::connectionToWebProcessClosed):
1996
1997 2020-03-31  Chris Dumez  <cdumez@apple.com>
1998
1999         Regression(r253357) DeviceMotionEvent acceleration and rotationRate are null
2000         https://bugs.webkit.org/show_bug.cgi?id=209831
2001         <rdar://problem/60720953>
2002
2003         Reviewed by Darin Adler.
2004
2005         * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.h:
2006         * UIProcess/ios/WebDeviceOrientationUpdateProviderProxy.mm:
2007         (WebKit::WebDeviceOrientationUpdateProviderProxy::motionChanged):
2008         * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp:
2009         (WebKit::WebDeviceOrientationUpdateProvider::deviceMotionChanged):
2010         * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.h:
2011         * WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.messages.in:
2012
2013 2020-03-31  Alex Christensen  <achristensen@webkit.org>
2014
2015         Add SPI WKWebpagePreferences._userContentController
2016         https://bugs.webkit.org/show_bug.cgi?id=209795
2017
2018         Reviewed by Tim Hatcher.
2019
2020         This will allow us to switch which WKUserContentController we are using at decidePolicyForNavigationAction time
2021         like we do WKWebsiteDataStores.  This is only allowed with main frame navigations.
2022
2023         To do this I moved UserContentControllerParameters into their own struct.
2024         I remove unused WebsitePoliciesData.websiteDataStoreParameters.
2025         I pass an API::WebsitePolicies* further down the chain instead of switching to Optional<WebsitePoliciesData>,
2026         which allows us to access the WebUserContentControllerProxy* from the former in WebPageProxy::creationParameters.
2027         I removed an unused WebsitePolicies constructor.
2028         I added a missing copied member variable in WebsitePolicies::copy.
2029
2030         * NetworkProcess/NetworkSession.cpp:
2031         * Shared/UserContentControllerParameters.cpp: Added.
2032         (WebKit::UserContentControllerParameters::encode const):
2033         (WebKit::UserContentControllerParameters::decode):
2034         * Shared/UserContentControllerParameters.h: Added.
2035         * Shared/WebPageCreationParameters.cpp:
2036         (WebKit::WebPageCreationParameters::encode const):
2037         (WebKit::WebPageCreationParameters::decode):
2038         * Shared/WebPageCreationParameters.h:
2039         * Shared/WebsitePoliciesData.cpp:
2040         (WebKit::WebsitePoliciesData::encode const):
2041         (WebKit::WebsitePoliciesData::decode):
2042         * Shared/WebsitePoliciesData.h:
2043         * Sources.txt:
2044         * UIProcess/API/APIWebsitePolicies.cpp:
2045         (API::WebsitePolicies::copy const):
2046         (API::WebsitePolicies::setUserContentController):
2047         (API::WebsitePolicies::data):
2048         (API::WebsitePolicies::WebsitePolicies): Deleted.
2049         * UIProcess/API/APIWebsitePolicies.h:
2050         * UIProcess/API/C/WKPage.cpp:
2051         (WKPageUpdateWebsitePolicies):
2052         * UIProcess/API/Cocoa/WKWebView.mm:
2053         (-[WKWebView _updateWebpagePreferences:]):
2054         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
2055         (-[WKWebpagePreferences _userContentController]):
2056         (-[WKWebpagePreferences _setUserContentController:]):
2057         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
2058         * UIProcess/Cocoa/NavigationState.mm:
2059         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2060         * UIProcess/ProvisionalPageProxy.cpp:
2061         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
2062         (WebKit::ProvisionalPageProxy::initializeWebPage):
2063         (WebKit::ProvisionalPageProxy::goToBackForwardItem):
2064         * UIProcess/ProvisionalPageProxy.h:
2065         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2066         (WebKit::WebUserContentControllerProxy::addProcess):
2067         (WebKit::WebUserContentControllerProxy::parameters const):
2068         (WebKit::WebUserContentControllerProxy::contentRuleListData const):
2069         (WebKit::WebUserContentControllerProxy::contentRuleListData): Deleted.
2070         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2071         * UIProcess/WebPageProxy.cpp:
2072         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2073         (WebKit::WebPageProxy::receivedPolicyDecision):
2074         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2075         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2076         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2077         (WebKit::WebPageProxy::decidePolicyForResponseShared):
2078         * UIProcess/WebPageProxy.h:
2079         * UIProcess/WebProcessProxy.cpp:
2080         (WebKit::WebProcessProxy::addWebUserContentControllerProxy):
2081         * UIProcess/WebProcessProxy.h:
2082         * WebKit.xcodeproj/project.pbxproj:
2083         * WebProcess/WebPage/WebPage.cpp:
2084         (WebKit::m_processDisplayName):
2085         * WebProcess/WebProcess.cpp:
2086         (WebKit::WebProcess::didReceiveMessage):
2087
2088 2020-03-31  Alex Christensen  <achristensen@webkit.org>
2089
2090         Remove call to PageConfiguration::setUserContentController added in r225765
2091         https://bugs.webkit.org/show_bug.cgi?id=209828
2092         <rdar://problem/61114052>
2093
2094         Reviewed by Brian Weinstein.
2095
2096         r225765 added a way for a certain Mac application to use WKWebViewConfiguration._pageGroup to set its WKUserContentController.
2097         That Mac application has transitioned to setting the WKUserContentController manually, and this workaround needs to be removed
2098         for that application's WKUserContentControllers to continue working as desired.  I verified this fixes that application, and
2099         it is the only user of WKWebViewConfiguration._pageGroup and all other applications will have no change in behavior.
2100
2101         * UIProcess/API/Cocoa/WKWebView.mm:
2102         (-[WKWebView _setupPageConfiguration:]):
2103
2104 2020-03-31  Brent Fulgham  <bfulgham@apple.com>
2105
2106         [macOS] Add additional IPC permission needed by Security.framework
2107         https://bugs.webkit.org/show_bug.cgi?id=209815
2108         <rdar://problem/60892378>
2109
2110         Reviewed by Per Arne Vollan.
2111
2112         Add missing permission needed for recent macOS releases.
2113
2114         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2115
2116 2020-03-31  Per Arne Vollan  <pvollan@apple.com>
2117
2118         Silence preference write sandbox violations in the WebContent process
2119         https://bugs.webkit.org/show_bug.cgi?id=209806
2120
2121         Reviewed by Brent Fulgham.
2122
2123         When CFPrefs direct mode is enabled in the WebContent process, the UI process will notify the WebContent about preference changes.
2124         When receiving these notifications, the WebContent process will  use the CFPrefs API to update the value of these preferences
2125         in-process, which will also attempt to write these values to disk. Writing the preference values to disk is unnecessary, and will
2126         also be denied by the sandbox, so the sandbox violations should be silenced.
2127
2128         No new tests, no behavior change.
2129
2130         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2131         * WebProcess/com.apple.WebProcess.sb.in:
2132
2133 2020-03-31  Devin Rousso  <drousso@apple.com>
2134
2135         REGRESSION: (r259236) [ iOS and Catalina wk2 Debug ] ASSERTION FAILED: m_debugLoggingEnabled in WebKit::ResourceLoadStatisticsStore::debugBroadcastConsoleMessage
2136         https://bugs.webkit.org/show_bug.cgi?id=209810
2137         <rdar://problem/61106971>
2138
2139         Unreviewed, covered by existing tests.
2140
2141         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
2142         (WebKit::ResourceLoadStatisticsStore::debugBroadcastConsoleMessage):
2143         Remove the assertion since `debugBroadcastConsoleMessage` is also called when turning off
2144         debug logging mode via `setResourceLoadStatisticsDebugMode`. Fundamentally, it's just a
2145         wrapper function for `broadcastConsoleMessage` anyways, so it doesn't need to be gated.
2146
2147 2020-03-31  Pablo Saavedra  <psaavedra@igalia.com>
2148
2149         Several refactorings done in the MemoryPressureMonitor.cpp
2150         https://bugs.webkit.org/show_bug.cgi?id=209464
2151
2152         Reviewed by Adrian Perez de Castro.
2153
2154         1) toIntegralType() parses the C-string str interpreting its content
2155         as an `unsigned long long int` which is more appropriate for
2156         the size_t (unsigned integer type) variables used by the
2157         MemoryPressureMonitor functions in counterpoint of atoll() what
2158         returns a `long long int`.
2159
2160         This change also controls if the parsing was succesful. In negative
2161         case returns `notSet`.
2162
2163         2) Added the getCgroupFileValue() function what encapsulates the
2164         manipulation of the opened files in the `/sys/fs/cgroup` hierarchy.
2165         This change simplify the code avoding unnecessary code repetion.
2166
2167         3) getCgroupControllerPath() now checks if there is a `name=systemd`
2168         controller listed in the `/proc/self/cgroup`. This important for
2169         cgroup v2 activated with `systemd.unified_cgroup_hierarchy=yes`
2170         through the Linux kernel cmdline. The unified hierarchy simplies
2171         path of the controllers under the same directory (check the
2172         "Deprecated v1 Core Features" section in the Linux Kernel
2173         documentation fir cgroup v2 [1]):
2174
2175             Multiple hierarchies including named ones are not supported
2176
2177         [1] https://www.kernel.org/doc/Documentation/cgroup-v2.txt
2178
2179         4) Because 3) the patch composited for cgroupV2 changes
2180         getMemoryUsageWithCgroup() slightly. The name of the controller
2181         is not needed anymore.
2182
2183         5) For cgroup v2, the MemoryTotal is calculated as the minimum
2184         between memory.high and memory.max.
2185
2186         * UIProcess/linux/MemoryPressureMonitor.cpp:
2187         (WebKit::lowWatermarkPages):
2188         (WebKit::getCgroupFileValue):
2189         (WebKit::getMemoryTotalWithCgroup):
2190         (WebKit::getMemoryUsageWithCgroup):
2191         (WebKit::getCgroupControllerPath):
2192         (WebKit::systemMemoryUsedAsPercentage):
2193         (WebKit::getCgroupController): Deleted.
2194
2195 2020-03-31  Zan Dobersek  <zdobersek@igalia.com>
2196
2197         [GTK][WPE] Jumpy rendering of fixed-element layers while scrolling
2198         https://bugs.webkit.org/show_bug.cgi?id=209466
2199
2200         Reviewed by Carlos Garcia Campos.
2201
2202         Move the Nicosia::SceneIntegration ownership into the
2203         CompositingCoordinator class, along with the SceneIntegration::Client
2204         inheritance. LayerTreeHost in turn now implements the updateScene()
2205         method that triggers a scene update when invoked.
2206
2207         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2208         (WebKit::CompositingCoordinator::CompositingCoordinator):
2209         (WebKit::CompositingCoordinator::invalidate):
2210         (WebKit::CompositingCoordinator::attachLayer):
2211         (WebKit::CompositingCoordinator::requestUpdate):
2212         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2213         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
2214         (WebKit::LayerTreeHost::LayerTreeHost):
2215         (WebKit::LayerTreeHost::~LayerTreeHost):
2216         (WebKit::LayerTreeHost::updateScene):
2217         (WebKit::LayerTreeHost::sceneIntegration): Deleted.
2218         (WebKit::LayerTreeHost::requestUpdate): Deleted.
2219         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
2220
2221 2020-03-31  Carlos Garcia Campos  <cgarcia@igalia.com>
2222
2223         REGRESSION(r258829): [CoordinatedGraphics] Web view not updated after cross site navigation with PSON enabled
2224         https://bugs.webkit.org/show_bug.cgi?id=209741
2225
2226         Reviewed by Žan Doberšek.
2227
2228         Since r258829, the drawing area proxy of a provisional page ignores all messages until the load is
2229         committed. This is causing 2 problems for coordinated graphics drawing area. When not in accelerated compositing
2230         mode, Update message is sent before the commit is loaded, and the web process keeps waiting for the DidUpdate
2231         response message forever. When accelerated compositing mode is forced, the EnterAcceleratedCompositing message
2232         is also sent before the load is committed and ignored, so the UI process doesn't know it's in accelerated mode.
2233
2234         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
2235         (WebKit::DrawingAreaCoordinatedGraphics::scheduleRenderingUpdate): Return early if layer tree is frozen. This
2236         ensures that Update messages are not sent to the UI process while layer tree is frozen.
2237         (WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode): Disable layer flush on the newly
2238         created LayerTreeHost if layer tree is frozen. This ensures that EnterAcceleratedCompositing message is sent
2239         after the first layer flush once the layer tree is no longer frozen.
2240
2241 2020-03-30  David Kilzer  <ddkilzer@apple.com>
2242
2243         REGRESSION (r251574, r251600): _WKTextManipulationToken and _WKTextManipulationConfiguration are missing -dealloc
2244         <https://webkit.org/b/209794>
2245
2246         Reviewed by Wenson Hsieh.
2247
2248         * UIProcess/API/Cocoa/_WKTextManipulationConfiguration.mm:
2249         (-[_WKTextManipulationConfiguration dealloc]): Add.
2250         * UIProcess/API/Cocoa/_WKTextManipulationToken.mm:
2251         (-[_WKTextManipulationToken dealloc]): Add.
2252
2253 2020-03-30  John Wilander  <wilander@apple.com>
2254
2255         Experimental: Enforce SameSite=strict for domains classified as bounce trackers
2256         https://bugs.webkit.org/show_bug.cgi?id=209761
2257         <rdar://problem/59394943>
2258
2259         Reviewed by Brent Fulgham and Kate Cheney (informal).
2260
2261         This experimental feature is part of Intelligent Tracking Prevention and only enabled if
2262         ITP (Resource Load Statistics) are. A new enum WebCore::SameSiteStrictEnforcementEnabled
2263         controls the new behavior with default setting WebCore::SameSiteStrictEnforcementEnabled::No.
2264
2265         The features keeps a separate count of topFrameUniqueRedirectsToSinceSameSiteStrictEnforcement
2266         which builds up to a threshold. Once a domain goes above the threshold, its cookies are
2267         rewritten as SameSite=strict and the topFrameUniqueRedirectsToSinceSameSiteStrictEnforcement
2268         counter for that domain is reset, effectively giving the domain a new chance to change its
2269         behavior.
2270
2271         Test infrastructure is added to allow for layout tests.
2272
2273         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2274         (WebKit::ResourceLoadStatisticsDatabaseStore::createUniqueIndices):
2275         (WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
2276         (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships):
2277         (WebKit::CompletionHandler<void):
2278         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
2279         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2280         (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
2281         (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectTo):
2282         (WebKit::ResourceLoadStatisticsMemoryStore::shouldEnforceSameSiteStrictFor):
2283         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor):
2284         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
2285         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
2286         (WebKit::ResourceLoadStatisticsStore::setSameSiteStrictEnforcementEnabled):
2287         (WebKit::ResourceLoadStatisticsStore::isSameSiteStrictEnforcementEnabled const):
2288         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2289         (WebKit::WebResourceLoadStatisticsStore::setSameSiteStrictEnforcementEnabled):
2290         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2291         (WebKit::RegistrableDomainsToDeleteOrRestrictWebsiteDataFor::isolatedCopy const):
2292         (WebKit::RegistrableDomainsToDeleteOrRestrictWebsiteDataFor::isEmpty const):
2293         * NetworkProcess/NetworkProcess.cpp:
2294         (WebKit::NetworkProcess::setShouldEnbleSameSiteStrictEnforcementForTesting):
2295         * NetworkProcess/NetworkProcess.h:
2296         * NetworkProcess/NetworkProcess.messages.in:
2297             Added SetShouldEnbleSameSiteStrictEnforcementForTesting.
2298         * NetworkProcess/NetworkSession.cpp:
2299         (WebKit::NetworkSession::NetworkSession):
2300         (WebKit::NetworkSession::forwardResourceLoadStatisticsSettings):
2301         (WebKit::NetworkSession::deleteAndRestrictWebsiteDataForRegistrableDomains):
2302         (WebKit::NetworkSession::setShouldEnbleSameSiteStrictEnforcement):
2303         * NetworkProcess/NetworkSession.h:
2304         * Scripts/webkit/messages.py:
2305             IPC instructions to find WebCore::SameSiteStrictEnforcementEnabled in
2306             WebCore/NetworkStorageSession.h. 
2307         * Shared/ResourceLoadStatisticsParameters.h:
2308         (WebKit::ResourceLoadStatisticsParameters::encode const):
2309         (WebKit::ResourceLoadStatisticsParameters::decode):
2310         * Shared/WebPreferences.yaml:
2311         * UIProcess/API/APINavigation.h:
2312         (API::Navigation::setIsLoadedWithNavigationShared):
2313         (API::Navigation::isLoadedWithNavigationShared const):
2314             Keeps track of how a navigation occurs to make sure that
2315             WebPageProxy::logFrameNavigation() can capture navigations initiated by the
2316             user through the hosting application.
2317         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2318         (WKWebsiteDataStoreStatisticsResetToConsistentState):
2319         * UIProcess/Network/NetworkProcessProxy.cpp:
2320         (WebKit::NetworkProcessProxy::setShouldEnbleSameSiteStrictEnforcementForTesting):
2321         * UIProcess/Network/NetworkProcessProxy.h:
2322         * UIProcess/WebPageProxy.cpp:
2323         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
2324             See comment above for API::Navigation.
2325         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2326             See comment above for API::Navigation.
2327         * UIProcess/WebProcessPool.cpp:
2328         (WebKit::WebProcessPool::ensureNetworkProcess):
2329         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2330         (WebKit::WebsiteDataStore::parameters):
2331         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2332         (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldEnbleSameSiteStrictEnforcementForTesting):
2333         * UIProcess/WebsiteData/WebsiteDataStore.h:
2334
2335 2020-03-30  Andres Gonzalez  <andresg_22@apple.com>
2336
2337         Cache [WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames] to avoid hitting often the main thread in isolated tree mode.
2338         https://bugs.webkit.org/show_bug.cgi?id=209767
2339
2340         Reviewed by Chris Fleizach.
2341
2342         [WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]
2343         is called often in isolated tree mode causing a dispatch to the main thread.
2344         This change caches this value so it doesn't keep hitting the main thread.
2345
2346         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
2347         (-[WKAccessibilityWebPageObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
2348
2349 2020-03-30  Chris Dumez  <cdumez@apple.com>
2350
2351         WebKit should take a foreground assertion for offscreen loads when the app is foreground
2352         https://bugs.webkit.org/show_bug.cgi?id=209748
2353         <rdar://problem/59169812>
2354
2355         Reviewed by Geoffrey Garen.
2356
2357         * UIProcess/API/APIPageConfiguration.h:
2358
2359 2020-03-30  Chris Dumez  <cdumez@apple.com>
2360
2361         REGRESSION (r259211): ASSERT(window) in applicationType() under shouldUseForegroundPriorityForClientNavigation()
2362         https://bugs.webkit.org/show_bug.cgi?id=209759
2363
2364         Reviewed by Darin Adler.
2365
2366         Make sure to not call applicationType() with a null window. This patch maintains previous behavior
2367         in release builds.
2368
2369         * UIProcess/WebPageProxy.cpp:
2370         (WebKit::WebPageProxy::loadRequest):
2371         (WebKit::WebPageProxy::loadFile):
2372         (WebKit::WebPageProxy::loadData):
2373         * UIProcess/WebPageProxy.h:
2374         * UIProcess/ios/PageClientImplIOS.mm:
2375         (WebKit::PageClientImpl::isApplicationVisible):
2376         * UIProcess/ios/WebPageProxyIOS.mm:
2377         (WebKit::WebPageProxy::shouldForceForegroundPriorityForClientNavigation const):
2378         (WebKit::WebPageProxy::shouldUseForegroundPriorityForClientNavigation const): Deleted.
2379
2380 2020-03-30  Don Olmstead  <don.olmstead@sony.com>
2381
2382         Non-unified build fixes late March 2020 edition
2383         https://bugs.webkit.org/show_bug.cgi?id=209781
2384
2385         Unreviewed build fix.
2386
2387         * NetworkProcess/NetworkDataTask.cpp:
2388
2389 2020-03-30  Kate Cheney  <katherine_cheney@apple.com>
2390
2391         Known app-bound domain protocols should not check the app-bound domain list
2392         https://bugs.webkit.org/show_bug.cgi?id=209755
2393         <rdar://problem/60875376> 
2394
2395         Reviewed by Chris Dumez.
2396
2397         This patch checks if a url should be treated as app-bound based on
2398         protocol before deciding to check the app-bound domain list.
2399         It is wasteful to check the app-bound domain list when some protocols
2400         are automatically considered app-bound.
2401
2402         Existing behavior should be maintained, this is tested by existing
2403         In-App Browser Privacy layout and API tests.
2404
2405         * UIProcess/WebPageProxy.cpp:
2406         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
2407         (WebKit::shouldBeTreatedAsAppBound): Deleted.
2408         We can remove the check for the url protocol here because we are
2409         doing it instead in WebsiteDataStore::beginAppBoundDomainCheck.
2410         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2411         Changed if PLATFORM(COCOA) to if PLATFORM(IOS_FAMILY) because it
2412         is unnecessary to check the app-bound domain list for other
2413         platforms (the values returned would be ignored in
2414         setIsNavigatingToAppBoundDomain).
2415
2416         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2417         (WebKit::shouldTreatURLProtocolAsAppBound):
2418         (WebKit::WebsiteDataStore::beginAppBoundDomainCheck):
2419         * UIProcess/WebsiteData/WebsiteDataStore.h:
2420
2421 2020-03-30  David Kilzer  <ddkilzer@apple.com>
2422
2423         REGRESSION (r256756): -[WKPreferenceObserver init]: Instance variable used while 'self' is not set to the result of '[(super or self) init...]'
2424         <https://webkit.org/b/209765>
2425
2426         Reviewed by Darin Adler.
2427
2428         * UIProcess/Cocoa/PreferenceObserver.mm:
2429         (-[WKPreferenceObserver init]): Call `[self init]` and set
2430         `self` to fix the clang static analyzer warning.
2431
2432 2020-03-30  Ryan Haddad  <ryanhaddad@apple.com>
2433
2434         Unreviewed, reverting r259211.
2435
2436         Caused API test assertion failures on iOS
2437
2438         Reverted changeset:
2439
2440         "WebKit should take a foreground assertion for offscreen loads
2441         when the app is foreground"
2442         https://bugs.webkit.org/show_bug.cgi?id=209748
2443         https://trac.webkit.org/changeset/259211
2444
2445 2020-03-30  Devin Rousso  <drousso@apple.com>
2446
2447         Web Inspector: provide a way to log messages from the network process
2448         https://bugs.webkit.org/show_bug.cgi?id=204775
2449
2450         Reviewed by Brian Burg.
2451
2452         ITP can be influenced by multiple pages simultaneously, meaning that sending a console
2453         message to the Web Inspector that's connected to the page that caused a change may not be
2454         useful as developers often don't test in complete isolation. As such, having a way to
2455         broadcast a console message to all Web Inspectors ensures that any changes caused by any
2456         page are always able to be seen, no matter which page is being actively inspected.
2457
2458         * NetworkProcess/NetworkProcess.h:
2459         * NetworkProcess/NetworkProcess.cpp:
2460         (WebKit::NetworkProcess::broadcastConsoleMessage): Added.
2461         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2462         * NetworkProcess/NetworkConnectionToWebProcess.h:
2463         (WebKit::NetworkConnectionToWebProcess::broadcastConsoleMessage): Added.
2464         * WebProcess/Network/NetworkProcessConnection.messages.in:
2465         * WebProcess/Network/NetworkProcessConnection.h:
2466         * WebProcess/Network/NetworkProcessConnection.cpp:
2467         (WebKit::NetworkProcessConnection::broadcastConsoleMessage): Added.
2468         * WebProcess/WebProcess.h:
2469         * WebProcess/WebProcess.cpp:
2470         (WebKit::WebProcess::webFrames const): Added.
2471         Broadcasted console messages are relayed from the network process to the web process via the
2472         functions above in the order that they are written.
2473
2474         * NetworkProcess/NetworkSession.cpp:
2475         (WebKit::NetworkSession::NetworkSession):
2476         * NetworkProcess/AdClickAttributionManager.h:
2477         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
2478         * NetworkProcess/AdClickAttributionManager.cpp:
2479         (WebKit::AdClickAttributionManager::storeUnconverted):
2480         (WebKit::AdClickAttributionManager::handleConversion):
2481         (WebKit::AdClickAttributionManager::convert):
2482         (WebKit::AdClickAttributionManager::fireConversionRequest):
2483
2484         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
2485         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
2486         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
2487         (WebKit::ResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
2488         (WebKit::ResourceLoadStatisticsStore::debugBroadcastConsoleMessage): Added.
2489         (WebKit::ResourceLoadStatisticsStore::debugLogDomainsInBatches):
2490         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2491         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess):
2492         (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener):
2493         (WebKit::ResourceLoadStatisticsDatabaseStore::ensurePrevalentResourcesForDebugMode):
2494         (WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking):
2495         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2496         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
2497         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
2498         (WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode):
2499         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking):
2500
2501         * NetworkProcess/NetworkResourceLoader.cpp:
2502         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2503         Send a console message for the result of `WebCore::AdClickAttribution::parseConversionRequest`.
2504
2505 2020-03-30  Per Arne Vollan  <pvollan@apple.com>
2506
2507         Unreviewed build fix after r259200.
2508
2509         * WebProcess/WebSleepDisablerClient.cpp:
2510         (WebKit::WebSleepDisablerClient::didCreateSleepDisabler):
2511         (WebKit::WebSleepDisablerClient::didDestroySleepDisabler):
2512         * WebProcess/WebSleepDisablerClient.h:
2513
2514 2020-03-30  Chris Dumez  <cdumez@apple.com>
2515
2516         WebKit should take a foreground assertion for offscreen loads when the app is foreground
2517         https://bugs.webkit.org/show_bug.cgi?id=209748
2518         <rdar://problem/59169812>
2519
2520         Reviewed by Geoffrey Garen.
2521
2522         * UIProcess/API/APIPageConfiguration.h:
2523
2524 2020-03-30  Chris Dumez  <cdumez@apple.com>
2525
2526         Regression(r246188) WebProcess is launched too eagerly when [WKWebView _restoreSessionState] is called
2527         https://bugs.webkit.org/show_bug.cgi?id=207908
2528         <rdar://problem/59619323>
2529
2530         Reviewed by Darin Adler.
2531
2532         Since r246188, the WebProcess is launched eagerly when [WKWebView _restoreSessionState] is called. This is bad
2533         for performance because we are unable to leverage the process cache at this point (since we don't know which
2534         domain will be loaded).
2535
2536         This patch thus reverts r246188 and fixes what r246188 was trying to address in a different way. If the process
2537         was not launched yet when restoreSessionState() is called, the session state properly gets sent to the WebProcess
2538         after launch, via the WebPageCreationParameters. What was missing at that point was that the session state was
2539         restore by an API Request. To fix this, we now pass an extra itemStatesWereRestoredByAPIRequest flag in
2540         WebPageCreationParameters.
2541
2542         * Shared/WebPageCreationParameters.cpp:
2543         (WebKit::WebPageCreationParameters::encode const):
2544         (WebKit::WebPageCreationParameters::decode):
2545         * Shared/WebPageCreationParameters.h:
2546         * UIProcess/WebPageProxy.cpp:
2547         (WebKit::WebPageProxy::restoreFromSessionState):
2548         * UIProcess/WebPageProxy.h:
2549         * WebProcess/WebPage/WebPage.cpp:
2550         (WebKit::m_processDisplayName):
2551
2552 2020-03-30  Wenson Hsieh  <wenson_hsieh@apple.com>
2553
2554         [Cocoa] Minor code cleanup around WebDataListSuggestionsDropdown
2555         https://bugs.webkit.org/show_bug.cgi?id=209747
2556
2557         Reviewed by Tim Horton.
2558
2559         Refactor WKDataListSuggestionsController and WKDataListSuggestionsControl, such that their `_dropdown`s are
2560         `WeakPtr`s instead of raw pointers. Also, make `-showSuggestionsDropdown:` take a reference instead of a
2561         pointer, since the argument is always `this` (and assumed to be non-null).
2562
2563         No change in behavior.
2564
2565         * UIProcess/WebDataListSuggestionsDropdown.h:
2566         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
2567         (WebKit::WebDataListSuggestionsDropdownIOS::show):
2568         (-[WKDataListSuggestionsControl showSuggestionsDropdown:activationType:]):
2569         (-[WKDataListSuggestionsPicker showSuggestionsDropdown:activationType:]):
2570         (-[WKDataListSuggestionsPopover showSuggestionsDropdown:activationType:]):
2571         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
2572         (WebKit::WebDataListSuggestionsDropdownMac::show):
2573         (-[WKDataListSuggestionsController showSuggestionsDropdown:]):
2574
2575 2020-03-30  David Kilzer  <ddkilzer@apple.com>
2576
2577         NetworkConnectionToWebProcess::registerFileBlobURL should validate its parameters
2578         <https://webkit.org/b/209713>
2579         <rdar://problem/60097168>
2580
2581         Reviewed by Youenn Fablet.
2582
2583         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2584         (WebKit::NetworkConnectionToWebProcess::registerFileBlobURL):
2585         - Add message check to validate `url` parameter.
2586
2587 2020-03-30  Per Arne Vollan  <pvollan@apple.com>
2588
2589         [Cocoa] Sleep disabling should be performed in the UI process
2590         https://bugs.webkit.org/show_bug.cgi?id=209676
2591
2592         Reviewed by Darin Adler.
2593
2594         Since sleep disabling is causing communication with the power management service, it should be performed in the UI process.
2595         The UI process will be notified by the WebContent process about sleep disablers being created and destroyed, and will perform
2596         the actual sleep disabling and enabling.
2597
2598         * Scripts/webkit/messages.py:
2599         * Sources.txt:
2600         * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
2601         * UIProcess/API/Cocoa/WKWebViewTesting.mm:
2602         (-[WKWebView _hasSleepDisabler]):
2603         * UIProcess/WebProcessProxy.cpp:
2604         (WebKit::WebProcessProxy::didCreateSleepDisabler):
2605         (WebKit::WebProcessProxy::didDestroySleepDisabler):
2606         (WebKit::WebProcessProxy::hasSleepDisabler):
2607         * UIProcess/WebProcessProxy.h:
2608         * UIProcess/WebProcessProxy.messages.in:
2609         * WebKit.xcodeproj/project.pbxproj:
2610         * WebProcess/GPU/media/RemoteLegacyCDM.cpp:
2611         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp:
2612         * WebProcess/GPU/media/ios/RemoteMediaSessionHelper.h:
2613         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
2614         * WebProcess/WebSleepDisablerClient.cpp: Added.
2615         (WebKit::WebSleepDisablerClient::didCreateSleepDisabler):
2616         (WebKit::WebSleepDisablerClient::didDestroySleepDisabler):
2617         * WebProcess/WebSleepDisablerClient.h: Added.
2618         * WebProcess/cocoa/WebProcessCocoa.mm:
2619         (WebKit::WebProcess::platformInitializeWebProcess):
2620
2621 2020-03-30  Wenson Hsieh  <wenson_hsieh@apple.com>
2622
2623         [macOS] Datalist dropdown suggestions table can be scrolled too far
2624         https://bugs.webkit.org/show_bug.cgi?id=209721
2625
2626         Reviewed by Tim Horton.
2627
2628         WKDataListSuggestionTableView's enclosing scroll view is set to an incorrect size while laying out the table
2629         view, due to AppKit logic that attempts to adjust the size of the table view's enclosing scroll view after we've
2630         already attempted to set the frame of the scroll view under the overridden call to -layout.
2631
2632         Fix this by refactoring the logic around the suggestion table view's enclosing scroll view; currently,
2633         WKDataListSuggestionTableView overrides -enclosingScrollView to return its own NSScrollView, which it sizes
2634         underneath an overridden call to -layout. This is a bit strange, since the table view is actually a subview of
2635         the scroll view it owns; the fact that laying out the table view causes an ancestor view to change size (and
2636         subsequently invalidate the table view's layout) seems to be what breaks AppKit's enclosing scroll view
2637         adjustment logic.
2638
2639         Instead, we can have own both the table view and the table view's enclosing scroll view.
2640
2641         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
2642         (-[WKDataListSuggestionTableView initWithElementRect:]):
2643         (-[WKDataListSuggestionsController initWithInformation:inView:]):
2644
2645         Move the scroll view initialization logic out of -[WKDataListSuggestionTableView initWithElementRect:] and into
2646         this method. This also means that we can initialize the scroll view with the bounds of the window's content
2647         view, instead of waiting until we lay out the table view underneath the scroll view.
2648
2649         (-[WKDataListSuggestionsController updateWithInformation:]):
2650         (-[WKDataListSuggestionsController invalidate]):
2651
2652         Clear out and remove _scrollView as well when we tear down the controller.
2653
2654         (-[WKDataListSuggestionsController showSuggestionsDropdown:]):
2655         (-[WKDataListSuggestionTableView layout]): Deleted.
2656         (-[WKDataListSuggestionTableView enclosingScrollView]): Deleted.
2657         (-[WKDataListSuggestionTableView removeFromSuperviewWithoutNeedingDisplay]): Deleted.
2658
2659         Now that the controller owns the scroll view, we don't need to override these anymore.
2660
2661 2020-03-29  Antoine Quint  <graouts@apple.com>
2662
2663         [AutoSizing] Bring back the old auto-sizing code as a deprecated codepath for compatibility reasons
2664         https://bugs.webkit.org/show_bug.cgi?id=209669
2665         <rdar://problem/60111081>
2666
2667         Reviewed by Alan Bujtas and Darin Adler.
2668
2669         We changed the auto-sizing code for webkit.org/b/196743 in r244098, but some clients need it and we bring it back
2670         via a new dedicated -[WKWebView _setSizeToContentAutoSizeMaximumSize:] SPI.
2671
2672         * Shared/WebPageCreationParameters.cpp:
2673         (WebKit::WebPageCreationParameters::encode const):
2674         (WebKit::WebPageCreationParameters::decode):
2675         * Shared/WebPageCreationParameters.h:
2676         * UIProcess/API/Cocoa/WKViewPrivate.h:
2677         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2678         * UIProcess/API/mac/WKView.mm:
2679         (-[WKView sizeToContentAutoSizeMaximumSize]):
2680         (-[WKView setSizeToContentAutoSizeMaximumSize:]):
2681         * UIProcess/API/mac/WKWebViewMac.mm:
2682         (-[WKWebView _sizeToContentAutoSizeMaximumSize]):
2683         (-[WKWebView _setSizeToContentAutoSizeMaximumSize:]):
2684         * UIProcess/Cocoa/WebViewImpl.h:
2685         * UIProcess/Cocoa/WebViewImpl.mm:
2686         (WebKit::WebViewImpl::setSizeToContentAutoSizeMaximumSize):
2687         (WebKit::WebViewImpl::sizeToContentAutoSizeMaximumSize const):
2688         (WebKit::WebViewImpl::setIntrinsicContentSize):
2689         * UIProcess/DrawingAreaProxy.h:
2690         (WebKit::DrawingAreaProxy::sizeToContentAutoSizeMaximumSizeDidChange):
2691         * UIProcess/WebPageProxy.cpp:
2692         * UIProcess/WebPageProxy.h:
2693         (WebKit::WebPageProxy::sizeToContentAutoSizeMaximumSize const):
2694         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
2695         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2696         (WebKit::TiledCoreAnimationDrawingAreaProxy::sizeToContentAutoSizeMaximumSizeDidChange):
2697         (WebKit::TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry):
2698         (WebKit::TiledCoreAnimationDrawingAreaProxy::willSendUpdateGeometry):
2699         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2700         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
2701         * WebProcess/WebPage/WebPage.cpp:
2702         (WebKit::m_processDisplayName):
2703         (WebKit::WebPage::reinitializeWebPage):
2704         (WebKit::WebPage::setMinimumSizeForAutoLayout):
2705         (WebKit::WebPage::setSizeToContentAutoSizeMaximumSize):
2706         (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded):
2707         * WebProcess/WebPage/WebPage.h:
2708         (WebKit::WebPage::sizeToContentAutoSizeMaximumSize const):
2709         * WebProcess/WebPage/WebPage.messages.in:
2710         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2711         (WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
2712
2713 2020-03-29  Darin Adler  <darin@apple.com>
2714
2715         Move TextIterator::rangeFromLocationAndLength off of live ranges
2716         https://bugs.webkit.org/show_bug.cgi?id=209408
2717
2718         Reviewed by Antti Koivisto.
2719
2720         * Shared/EditingRange.cpp:
2721         (WebKit::EditingRange::toRange): Use CharacterRange,
2722         resolveCharacterLocation/Range.
2723
2724         * Shared/EditingRange.h: Added a FIXME about replacing with CharacterRange.
2725
2726         * Shared/WebCoreArgumentCoders.cpp:
2727         (IPC::ArgumentCoder<CharacterRange>::encode): Added.
2728         (IPC::ArgumentCoder<CharacterRange>::decode): Added.
2729         (IPC::ArgumentCoder<GrammarDetail>::encode): Updated to use CharacterRange.
2730         (IPC::ArgumentCoder<GrammarDetail>::decode): Ditto.
2731         (IPC::ArgumentCoder<TextCheckingResult>::encode): Ditto.
2732         (IPC::ArgumentCoder<TextCheckingResult>::decode): Ditto.
2733         * Shared/WebCoreArgumentCoders.h: Added CharacterRange.
2734
2735         * UIProcess/Cocoa/WebViewImpl.mm:
2736         (WebKit::textCheckingResultFromNSTextCheckingResult): Use CharacterRange,
2737         resolveCharacterLocation/Range.
2738         * UIProcess/WebGrammarDetail.cpp:
2739         (WebKit::WebGrammarDetail::WebGrammarDetail): Ditto.
2740         * UIProcess/WebGrammarDetail.h:
2741         (WebKit::WebGrammarDetail::location const): Ditto.
2742         (WebKit::WebGrammarDetail::length const): Ditto.
2743         * UIProcess/gtk/TextCheckerGtk.cpp:
2744         (WebKit::TextChecker::checkTextOfParagraph): Ditto.
2745         * UIProcess/ios/TextCheckerIOS.mm:
2746         (WebKit::TextChecker::checkTextOfParagraph): Ditto.
2747         * UIProcess/mac/TextCheckerMac.mm:
2748         (WebKit::TextChecker::checkTextOfParagraph): Ditto.
2749         (WebKit::TextChecker::updateSpellingUIWithGrammarString): Ditto.
2750         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
2751         (WebKit::TextCheckingControllerProxy::rangeAndOffsetRelativeToSelection): Ditto.
2752         (WebKit::TextCheckingControllerProxy::replaceRelativeToSelection): Ditto.
2753         (WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions): Ditto.
2754         * WebProcess/WebPage/WebPage.cpp:
2755         (WebKit::WebPage::deleteSurrounding): Ditto.
2756         * WebProcess/WebPage/ios/WebPageIOS.mm:
2757         (WebKit::WebPage::getPlatformEditorState const): Small tweak.
2758         (WebKit::WebPage::updateSelectionWithDelta): Ditto.
2759         (WebKit::WebPage::requestDocumentEditingContext): Ditto.
2760
2761 2020-03-29  Daniel Bates  <dabates@apple.com>
2762
2763         Attempt to fix the Mac Catalyst build after r258989
2764         <https://bugs.webkit.org/show_bug.cgi?id=199960>
2765
2766         Remove code that has since been moved to WebPage::platformNeedsLayoutForEditorState().
2767
2768         * WebProcess/WebPage/ios/WebPageIOS.mm:
2769         (WebKit::WebPage::getPlatformEditorState const):
2770
2771 2020-03-29  ddkilzer@apple.com  <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
2772
2773         Build fix for: [iOS] Delay process suspension for a while after loading an app link
2774         https://bugs.webkit.org/show_bug.cgi?id=209686#c12
2775         <rdar://problem/60888891>
2776
2777         * UIProcess/Cocoa/NavigationState.mm:
2778         (WebKit::tryInterceptNavigation):
2779         - Restrict call to WebPageProxy::willOpenAppLink() to
2780           PLATFORM(IOS_FAMILY) to fix the build.
2781
2782 2020-03-29  David Kilzer  <ddkilzer@apple.com>
2783
2784         REGRESSION (r257867): [GPUP] Use-after-move in RemoteCDMInstance::createSession()
2785         <https://webkit.org/b/209712>
2786         <rdar://problem/61018795>
2787
2788         Reviewed by Darin Adler.
2789
2790         * WebProcess/GPU/media/RemoteCDMInstance.cpp:
2791         (WebKit::RemoteCDMInstance::createSession): Fix use-after-move
2792         by using RemoteCDMInstanceSession::identifier().
2793         * WebProcess/GPU/media/RemoteCDMInstanceSession.h:
2794         (RemoteCDMInstanceSession::identifier): Add getter.
2795
2796 2020-03-28  Devin Rousso  <drousso@apple.com>
2797
2798         Web Inspector: support editing cookie key/values from inspector
2799         https://bugs.webkit.org/show_bug.cgi?id=31157
2800         <rdar://problem/19281523>
2801
2802         Reviewed by Timothy Hatcher.
2803
2804         * WebProcess/WebPage/WebCookieJar.h:
2805         * WebProcess/WebPage/WebCookieJar.cpp:
2806         (WebKit::WebCookieJar::setRawCookie):
2807
2808         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2809         * NetworkProcess/NetworkConnectionToWebProcess.h:
2810         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2811         (WebKit::NetworkConnectionToWebProcess::setRawCookie): Added.
2812
2813 2020-03-28  David Kilzer  <ddkilzer@apple.com>
2814
2815         REGRESSION (r258201): Use-after-move in UserMediaCaptureManager::Source::didFail()
2816         <https://webkit.org/b/209711>
2817         <rdar://problem/61018569>
2818
2819         Reviewed by Darin Adler.
2820
2821         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2822         (WebKit::UserMediaCaptureManager::Source::didFail):
2823         - Use `m_errorMessage` to fix the use-after-move.
2824
2825 2020-03-28  Alex Christensen  <achristensen@webkit.org>
2826
2827         REGRESSION(r257963) UI process crashes when setting navigation delegate inside navigation delegate callbacks
2828         https://bugs.webkit.org/show_bug.cgi?id=209705
2829         <rdar://problem/60814765>
2830
2831         Reviewed by Darin Adler.
2832
2833         I introduced a pattern of making multiple delegate calls sequentially.  This is bad because the delegate can change.
2834         We need to go back to the WebPageProxy and get the navigation client again between calls.
2835         I manually verified this fixes the crash in the radar.
2836         Covered by modifying an existing API test to modify the navigation delegate in a callback.
2837
2838         * UIProcess/API/APINavigationClient.h:
2839         (API::NavigationClient::didStartProvisionalNavigation):
2840         (API::NavigationClient::didStartProvisionalLoadForFrame):
2841         (API::NavigationClient::didFailProvisionalNavigationWithError):
2842         (API::NavigationClient::didFailProvisionalLoadWithErrorForFrame):
2843         (API::NavigationClient::didCommitNavigation):
2844         (API::NavigationClient::didCommitLoadForFrame):
2845         (API::NavigationClient::didFinishNavigation):
2846         (API::NavigationClient::didFinishLoadForFrame):
2847         (API::NavigationClient::didFailNavigationWithError):
2848         (API::NavigationClient::didFailLoadWithErrorForFrame):
2849         * UIProcess/API/C/WKPage.cpp:
2850         (WKPageSetPageNavigationClient):
2851         * UIProcess/API/glib/WebKitNavigationClient.cpp:
2852         * UIProcess/Cocoa/NavigationState.h:
2853         * UIProcess/Cocoa/NavigationState.mm:
2854         (WebKit::NavigationState::~NavigationState):
2855         (WebKit::NavigationState::NavigationClient::didStartProvisionalNavigation):
2856         (WebKit::NavigationState::NavigationClient::didStartProvisionalLoadForFrame):
2857         (WebKit::NavigationState::NavigationClient::didFailProvisionalNavigationWithError):
2858         (WebKit::NavigationState::NavigationClient::didFailProvisionalLoadWithErrorForFrame):
2859         (WebKit::NavigationState::NavigationClient::didCommitNavigation):
2860         (WebKit::NavigationState::NavigationClient::didCommitLoadForFrame):
2861         (WebKit::NavigationState::NavigationClient::didFinishNavigation):
2862         (WebKit::NavigationState::NavigationClient::didFinishLoadForFrame):
2863         (WebKit::NavigationState::NavigationClient::didFailNavigationWithError):
2864         (WebKit::NavigationState::NavigationClient::didFailLoadWithErrorForFrame):
2865         * UIProcess/WebPageProxy.cpp:
2866         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
2867         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
2868         (WebKit::WebPageProxy::didCommitLoadForFrame):
2869         (WebKit::WebPageProxy::didFinishLoadForFrame):
2870         (WebKit::WebPageProxy::didFailLoadForFrame):
2871
2872 2020-03-28  David Kilzer  <ddkilzer@apple.com>
2873
2874         Use-after-move in NetworkProcess::addServiceWorkerSession()
2875         <https://webkit.org/b/209710>
2876         <rdar://problem/61017857>
2877
2878         Reviewed by Darin Adler.
2879
2880         * NetworkProcess/NetworkProcess.cpp:
2881         (WebKit::NetworkProcess::addServiceWorkerSession):
2882         - Use `addResult.iterator->value.databasePath` instead of the
2883           `serviceWorkerRegistrationDirectory` parameter to fix the
2884           use-after-move.
2885
2886 2020-03-28  Chris Dumez  <cdumez@apple.com>
2887
2888         [iOS] Delay process suspension for a while after loading an app link
2889         https://bugs.webkit.org/show_bug.cgi?id=209686
2890         <rdar://problem/60888891>
2891
2892         Reviewed by Darin Adler.
2893
2894         Client apps that rely on WebKit to open app links cannot call the [WKWebView _willOpenAppLink] SPI
2895         that was added in r259146. Instead, we need to call WebPageProxy::willOpenAppLink() in
2896         tryInterceptNavigation() when WebKit opens the AppLink itself.
2897
2898         * UIProcess/Cocoa/NavigationState.mm:
2899         (WebKit::tryInterceptNavigation):
2900
2901 2020-03-28  Alex Christensen  <achristensen@webkit.org>
2902
2903         Deprecate injected bundle page group SPI
2904         https://bugs.webkit.org/show_bug.cgi?id=209687
2905
2906         Reviewed by Timothy Hatcher.
2907
2908         This old code is problematic, and the use of it is being removed in rdar://problem/60987265
2909
2910         * Shared/WebPageGroupData.cpp:
2911         (WebKit::WebPageGroupData::encode const):
2912         (WebKit::WebPageGroupData::decode):
2913         * Shared/WebPageGroupData.h:
2914         * UIProcess/WebPageGroup.cpp:
2915         (WebKit::WebPageGroup::WebPageGroup):
2916         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2917         (WKBundleAddUserScript):
2918         (WKBundleAddUserStyleSheet):
2919         (WKBundleRemoveUserScript):
2920         (WKBundleRemoveUserStyleSheet):
2921         (WKBundleRemoveUserScripts):
2922         (WKBundleRemoveUserStyleSheets):
2923         (WKBundleRemoveAllUserContent):
2924         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
2925         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2926         (WebKit::InjectedBundle::addUserScript): Deleted.
2927         (WebKit::InjectedBundle::addUserStyleSheet): Deleted.
2928         (WebKit::InjectedBundle::removeUserScript): Deleted.
2929         (WebKit::InjectedBundle::removeUserStyleSheet): Deleted.
2930         (WebKit::InjectedBundle::removeUserScripts): Deleted.
2931         (WebKit::InjectedBundle::removeUserStyleSheets): Deleted.
2932         (WebKit::InjectedBundle::removeAllUserContent): Deleted.
2933         * WebProcess/InjectedBundle/InjectedBundle.h:
2934         * WebProcess/WebPage/WebPageGroupProxy.cpp:
2935         (WebKit::WebPageGroupProxy::WebPageGroupProxy):
2936         (WebKit::WebPageGroupProxy::userContentController): Deleted.
2937         * WebProcess/WebPage/WebPageGroupProxy.h:
2938
2939 2020-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2940
2941         Web content processes should not be able to arbitrarily request pasteboard data from the UI process
2942         https://bugs.webkit.org/show_bug.cgi?id=209657
2943         <rdar://problem/59611585>
2944
2945         Reviewed by Geoff Garen.
2946
2947         This patch adds a mechanism to prevent the UI process from sending pasteboard data to the web process in
2948         response to WebPasteboardProxy IPC messages, unless the user (or the WebKit client, on behalf of the user) has
2949         explicitly made the contents of the pasteboard available to a page in that web process. We determine the latter
2950         by maintaining information about the `changeCount`s of each pasteboard we allow each web process to read. This
2951         mapping is updated when either the user interacts with trusted UI (context menus, DOM paste menu) for pasting,
2952         or an API client calls into -[WKWebView paste:], as is the case when pasting via the callout bar on iOS or
2953         pasting via keyboard shortcuts (i.e. cmd + V) on macOS and iOS.
2954
2955         See per-change comments below for more details. Under normal circumstances, there should be no change in
2956         behavior; refer to the radar for more context.
2957
2958         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2959         (WebKit::WebPageProxy::grantAccessToCurrentPasteboardData):
2960
2961         Add a helper method to grant access to the data currently on the pasteboard with the given name; for now, this
2962         grants access to all related pages that reside in the same web process, but this may be refactored in a future
2963         change to make the mapping granular to each WebPageProxy rather than WebProcessProxy.
2964
2965         (Note: it is _critical_ that this method is never invoked as a result of IPC from the web process.)
2966
2967         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
2968         (WebKit::WebPasteboardProxy::grantAccessToCurrentData):
2969
2970         Helper method to grant access to the current contents on the named pasteboard. Calling this method updates
2971         `m_pasteboardNameToChangeCountAndProcessesMap`, such that the given web process is able to read from the
2972         pasteboard with the given name, as long as the `changeCount` is still the same. To implement this behavior,
2973         we either (1) add the process to an existing `WeakHashSet` of process proxies in the case where the
2974         `changeCount` is the same as it was when we added the existing `WeakHashSet`, or in all other cases, (2) add a
2975         replace the current (changeCount, processes) pair with the new change count and a weak set containing only the
2976         given WebProcessProxy.
2977
2978         (WebKit::WebPasteboardProxy::revokeAccessToAllData):
2979
2980         Helper method to revoke all pasteboard access for the given WebProcessProxy. Called when resetting state, e.g.
2981         after web process termination.
2982
2983         (WebKit::WebPasteboardProxy::canAccessPasteboardData const):
2984
2985         Private helper method to check whether an IPC message can access pasteboard data, based on the IPC::Connection
2986         used to receive the message. This helper method returns true if either the WebKit client has used SPI
2987         (both DOMPasteAllowed and JavaScriptCanAccessClipboard) to grant unmitigated access to the clipboard from the
2988         web process, or access has been previously granted due to user interaction in the UI process or API calls made
2989         directly by the WebKit client.
2990
2991         (WebKit::WebPasteboardProxy::didModifyContentsOfPasteboard):
2992
2993         Private helper method to update the pasteboard changeCount that has been granted to a given web process, in the
2994         case where that web process was also responsible for writing data to the pasteboard and the pasteboard
2995         changeCount prior to modifying the pasteboard was still valid. In other words, we should always allow a web
2996         process to read contents it has just written. This allows us to maintain the use case where a WKWebView client
2997         copies and pastes using back-to-back API calls:
2998
2999         ```
3000         [webView copy:nil];
3001         [webView paste:nil];
3002         ```
3003
3004         (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType):
3005
3006         Add a FIXME to add the `canAccessPasteboardData` check here as well. We can't do this yet because the web
3007         process currently relies on being able to read the full list of pasteboard path names when dragging over the
3008         page, but this will be fixed in a followup patch in the near future (see https://webkit.org/b/209671).
3009
3010         (WebKit::WebPasteboardProxy::getPasteboardStringForType):
3011         (WebKit::WebPasteboardProxy::getPasteboardStringsForType):
3012         (WebKit::WebPasteboardProxy::getPasteboardBufferForType):
3013         (WebKit::WebPasteboardProxy::getPasteboardColor):
3014         (WebKit::WebPasteboardProxy::getPasteboardURL):
3015
3016         In all the call sites where we ask for pasteboard data (with the exception of getPasteboardPathnamesForType, for
3017         the time being), check whether we're allowed to read pasteboard data by consulting canAccessPasteboardData. If
3018         not, return early with no data.
3019
3020         (WebKit::WebPasteboardProxy::addPasteboardTypes):
3021         (WebKit::WebPasteboardProxy::setPasteboardTypes):
3022         (WebKit::WebPasteboardProxy::setPasteboardURL):
3023         (WebKit::WebPasteboardProxy::setPasteboardColor):
3024         (WebKit::WebPasteboardProxy::setPasteboardStringForType):
3025
3026         In all the call sites where we knowingly mutate the pasteboard (and bump the changeCount as a result),
3027         additionally update the changeCount to which we've granted access on behalf of the web process that is modifying
3028         the pasteboard.
3029
3030         (WebKit::WebPasteboardProxy::urlStringSuitableForLoading):
3031         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
3032         (WebKit::WebPasteboardProxy::writeCustomData):
3033         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
3034         (WebKit::WebPasteboardProxy::readURLFromPasteboard):
3035         (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
3036         (WebKit::WebPasteboardProxy::writeURLToPasteboard):
3037         (WebKit::WebPasteboardProxy::writeWebContentToPasteboard):
3038         (WebKit::WebPasteboardProxy::writeImageToPasteboard):
3039         (WebKit::WebPasteboardProxy::writeStringToPasteboard):
3040
3041         (See comments above).
3042
3043         * UIProcess/Cocoa/WebViewImpl.mm:
3044         (WebKit::WebViewImpl::performDragOperation):
3045
3046         When performing a drop on macOS, grant temporary access to the drag pasteboard.
3047
3048         (WebKit::WebViewImpl::requestDOMPasteAccess):
3049         (WebKit::WebViewImpl::handleDOMPasteRequestWithResult):
3050
3051         If the user has granted DOM paste access, additionally grant access to the general pasteboard.
3052
3053         * UIProcess/WebPageProxy.cpp:
3054         (WebKit::isPasteCommandName):
3055         (WebKit::WebPageProxy::executeEditCommand):
3056
3057         When executing an edit command on behalf of a WebKit client, check to see if it is a paste command (one of
3058         the four that are defined in EditorCommand.cpp). If so, we grant access to the current contents of the general
3059         pasteboard.
3060
3061         * UIProcess/WebPageProxy.h:
3062         * UIProcess/WebPasteboardProxy.cpp:
3063         (WebKit::WebPasteboardProxy::webProcessProxyForConnection const):
3064
3065         Add a helper method to map a given IPC::Connection to a WebProcessProxy. While we have a list of WebProcessProxy
3066         objects, we know a priori that at most one of them will have the given connection, so returning a single
3067         `WebProcessProxy*` here is sufficient (rather than a list of `WebProcessProxy*`s).
3068
3069         (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
3070         (WebKit::WebPasteboardProxy::informationForItemAtIndex):
3071         (WebKit::WebPasteboardProxy::getPasteboardItemsCount):
3072         (WebKit::WebPasteboardProxy::readURLFromPasteboard):
3073         (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
3074         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
3075         (WebKit::WebPasteboardProxy::urlStringSuitableForLoading):
3076
3077         Update interface stubs for non-Cocoa platforms.
3078
3079         * UIProcess/WebPasteboardProxy.h:
3080         * UIProcess/WebPasteboardProxy.messages.in:
3081
3082         Decorate more IPC endpoints with `WantsConnection`, so that we can reason about the `IPC::Connection`s used to
3083         receive pasteboard messages.
3084
3085         * UIProcess/ios/WKContentViewInteraction.mm:
3086         (-[WKContentView _handleDOMPasteRequestWithResult:]):
3087
3088         If the user has granted DOM paste access, additionally grant access to the general pasteboard.
3089
3090         (-[WKContentView dropInteraction:performDrop:]):
3091
3092         When performing a drop on iOS, grant temporary access to the drag pasteboard.
3093
3094         * UIProcess/ios/WebPageProxyIOS.mm:
3095         (WebKit::WebPageProxy::willPerformPasteCommand):
3096         * UIProcess/libwpe/WebPasteboardProxyLibWPE.cpp:
3097         (WebKit::WebPasteboardProxy::readStringFromPasteboard):
3098         * UIProcess/mac/WebPageProxyMac.mm:
3099         (WebKit::WebPageProxy::platformDidSelectItemFromActiveContextMenu):
3100
3101         Grant pasteboard access when using the context menu to paste on macOS.
3102
3103         (WebKit::WebPageProxy::willPerformPasteCommand):
3104
3105         Grant pasteboard access when triggering the "Paste" edit command using WebKit SPI.
3106
3107 2020-03-27  Chris Dumez  <cdumez@apple.com>
3108
3109         [iOS] Delay process suspension for a while after loading an app link
3110         https://bugs.webkit.org/show_bug.cgi?id=209686
3111         <rdar://problem/60888891>
3112
3113         Reviewed by Darin Adler.
3114
3115         Delay process suspension for a while after loading an app link. This will allow the page's script to pass
3116         information more reliably to the native app handling the navigation.
3117
3118         This patch adds a [WKWebView _willOpenAppLink] SPI that the client needs to call before opening the
3119         app link.
3120
3121         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3122         * UIProcess/API/ios/WKWebViewIOS.mm:
3123         (-[WKWebView _willOpenAppLink]):
3124         * UIProcess/WebPageProxy.cpp:
3125         (WebKit::WebPageProxy::close):
3126         * UIProcess/WebPageProxy.h:
3127         * UIProcess/ios/WebPageProxyIOS.mm:
3128         (WebKit::WebPageProxy::willOpenAppLink):
3129
3130 2020-03-27  David Kilzer  <ddkilzer@apple.com>
3131
3132         NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked should validate its parameters
3133         <https://webkit.org/b/209614>
3134         <rdar://problem/60096304>
3135
3136         Reviewed by Alex Christensen.
3137
3138         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3139         (NETWORK_PROCESS_MESSAGE_CHECK):
3140         - Define/undef macro for killing WebContent process when an
3141           invalid IPC message is received.
3142         (WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
3143         - Use NETWORK_PROCESS_MESSAGE_CHECK to validate its parameters.
3144
3145 2020-03-27  Tim Horton  <timothy_horton@apple.com>
3146
3147         Unable to build WebKit with iOS 13.4 SDK
3148         https://bugs.webkit.org/show_bug.cgi?id=209317
3149
3150         Reviewed by Dean Jackson.
3151
3152         * Platform/spi/ios/UIKitSPI.h:
3153         One more attempt. __IPHONE_OS_VERSION_MAX_ALLOWED is inaccurate.
3154
3155 2020-03-27  Daniel Bates  <dabates@apple.com>
3156
3157         Use -_hasFocusedElement in -_didUpdateInputMode
3158         https://bugs.webkit.org/show_bug.cgi?id=209662
3159
3160         Reviewed by Wenson Hsieh.
3161
3162         Remove duplication by using -_hasFocusedElement.
3163
3164         * UIProcess/ios/WKContentViewInteraction.mm:
3165         (-[WKContentView _didUpdateInputMode:]):
3166
3167 2020-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3168
3169         DragData::containsURL() should avoid reading URL strings from the pasteboard
3170         https://bugs.webkit.org/show_bug.cgi?id=209642
3171         Work towards <rdar://problem/59611585>
3172
3173         Reviewed by Tim Horton.
3174
3175         See WebCore/ChangeLog for more details.
3176
3177         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
3178         (WebKit::WebPasteboardProxy::containsURLStringSuitableForLoading):
3179         (WebKit::WebPasteboardProxy::urlStringSuitableForLoading):
3180         * UIProcess/WebPasteboardProxy.cpp:
3181         (WebKit::WebPasteboardProxy::containsURLStringSuitableForLoading):
3182         (WebKit::WebPasteboardProxy::urlStringSuitableForLoading):
3183         * UIProcess/WebPasteboardProxy.h:
3184         * UIProcess/WebPasteboardProxy.messages.in:
3185
3186         Add IPC plumbing for the new pasteboard strategy methods: containsURLStringSuitableForLoading and
3187         urlStringSuitableForLoading.
3188
3189         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3190         (WebKit::WebPlatformStrategies::containsURLStringSuitableForLoading):
3191         (WebKit::WebPlatformStrategies::urlStringSuitableForLoading):
3192         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
3193
3194 2020-03-27  youenn fablet  <youenn@apple.com>
3195
3196         Filter DOMCache records in network process to reduce the number of records being sent to WebProcess
3197         https://bugs.webkit.org/show_bug.cgi?id=209469
3198         <rdar://problem/55207565>
3199
3200         Reviewed by Alex Christensen.
3201
3202         Receive new retrieve record options and make use of them to filter the records sent back to the WebProcess.
3203         This includes filtering the records for a given requests.
3204         This includes removing responses in case the request is made to gather all requests for Cache.keys().
3205
3206         * NetworkProcess/cache/CacheStorageEngine.cpp:
3207         (WebKit::CacheStorage::Engine::retrieveRecords):
3208         * NetworkProcess/cache/CacheStorageEngine.h:
3209         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
3210         (WebKit::CacheStorage::Cache::retrieveRecords):
3211         * NetworkProcess/cache/CacheStorageEngineCache.h:
3212         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
3213         (WebKit::CacheStorageEngineConnection::retrieveRecords):
3214         * NetworkProcess/cache/CacheStorageEngineConnection.h:
3215         * NetworkProcess/cache/CacheStorageEngineConnection.messages.in:
3216         * WebProcess/Cache/WebCacheStorageConnection.cpp:
3217         (WebKit::WebCacheStorageConnection::retrieveRecords):
3218         * WebProcess/Cache/WebCacheStorageConnection.h:
3219
3220 2020-03-27  Chris Lord  <clord@igalia.com>
3221
3222         [GTK][WPE] Enable kinetic scrolling with async scrolling
3223         https://bugs.webkit.org/show_bug.cgi?id=209230
3224
3225         Reviewed by Žan Doberšek.
3226
3227         Modify WPE mousewheel event delivery so that it includes the necessary
3228         phases needed to infer press/release times and allow for kinetic
3229         scrolling.
3230
3231         * Shared/NativeWebWheelEvent.h:
3232         * Shared/WebEvent.h:
3233         * Shared/WebWheelEvent.cpp:
3234         (WebKit::WebWheelEvent::encode const):
3235         (WebKit::WebWheelEvent::decode):
3236         * Shared/libwpe/NativeWebWheelEventLibWPE.cpp:
3237         (WebKit::NativeWebWheelEvent::NativeWebWheelEvent):
3238         * Shared/libwpe/WebEventFactory.cpp:
3239         (WebKit::WebEventFactory::createWebWheelEvent):
3240         * Shared/libwpe/WebEventFactory.h:
3241         * UIProcess/API/wpe/PageClientImpl.cpp:
3242         (WebKit::PageClientImpl::doneWithTouchEvent):
3243         * UIProcess/API/wpe/ScrollGestureController.cpp:
3244         (WebKit::ScrollGestureController::handleEvent):
3245         * UIProcess/API/wpe/ScrollGestureController.h:
3246         (WebKit::ScrollGestureController::phase):
3247         * UIProcess/API/wpe/WPEView.cpp:
3248         (WKWPE::m_backend):
3249
3250 2020-03-26  David Kilzer  <ddkilzer@apple.com>
3251
3252         NetworkConnectionToWebProcess::domCookiesForHost should validate its `host` parameter
3253         <https://webkit.org/b/209612>
3254         <rdar://problem/60097830>
3255
3256         Reviewed by Alex Christensen.
3257
3258         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3259         (NETWORK_PROCESS_MESSAGE_CHECK_COMPLETION):
3260         - Define/undef macro for killing WebContent process when an
3261           invalid IPC message is received.
3262         (WebKit::NetworkConnectionToWebProcess::domCookiesForHost):
3263         - Use NETWORK_PROCESS_MESSAGE_CHECK_COMPLETION) to validate
3264           `host` parameter.
3265
3266 2020-03-26  Chris Dumez  <cdumez@apple.com>
3267
3268         REGRESSION: Unable to show Web Inspector on empty tabs in Safari
3269         https://bugs.webkit.org/show_bug.cgi?id=209639
3270         <rdar://problem/60937524>
3271
3272         Reviewed by Darin Adler.
3273
3274         Make sure we launch the WebPageProxy's initial process when trying to inspect the
3275         page using Web Inspector (i.e. WebInspectorProxy::connect() is called).
3276
3277         * UIProcess/Inspector/WebInspectorProxy.cpp:
3278         (WebKit::WebInspectorProxy::WebInspectorProxy):
3279         - Take in a reference instead of a raw pointer as it could never be null.
3280         - Store the inspected page and add the message receiver to its process, even
3281           if the process is the dummy one (due to delayed process launch).
3282
3283         (WebKit::WebInspectorProxy::invalidate):
3284         Call reset() to avoid code duplication.
3285
3286         (WebKit::WebInspectorProxy::connect):
3287         Launch the page's initial process if necessary before trying to send IPC to that
3288         process.
3289
3290         (WebKit::WebInspectorProxy::updateForNewPageProcess):
3291         Take in a reference instead of a raw pointer as it could never be null.
3292
3293         * UIProcess/Inspector/WebInspectorProxy.h:
3294         (WebKit::WebInspectorProxy::create):
3295         Take in a reference instead of a raw pointer as it could never be null.
3296
3297         * UIProcess/WebPageProxy.cpp:
3298         (WebKit::WebPageProxy::launchProcess):
3299         Call WebInspectorProxy::reset() before launching and connecting to the new process.
3300         This is important now that the WebInspectorProxy connect to the dummy process proxy.
3301         We need to make sure the WebInspectorProxy disconnects from the dummy process proxy
3302         because we connect it to the newly launched process.
3303
3304         (WebKit::WebPageProxy::finishAttachingToWebProcess):
3305
3306 2020-03-26  Chris Dumez  <cdumez@apple.com>
3307
3308         Regression: Unable to trigger context menu on empty tabs in Safari
3309         https://bugs.webkit.org/show_bug.cgi?id=209628
3310
3311         Reviewed by Geoffrey Garen.
3312
3313         Launch the WebPageProxy's initial process if it starts processing mouse events.
3314         As an optimization, the WebPageProxy only launches its initial process when it
3315         really needs to.
3316
3317         * UIProcess/WebPageProxy.cpp:
3318         (WebKit::WebPageProxy::handleMouseEvent):
3319
3320 2020-03-26  Michael Catanzaro  <mcatanzaro@gnome.org>
3321
3322         Fix various compiler warnings
3323         https://bugs.webkit.org/show_bug.cgi?id=209438
3324
3325         Reviewed by Darin Adler.
3326
3327         * UIProcess/API/C/WKPage.cpp: Suppress -Wdeprecated-declaration warnings.
3328         (WKPageSetPageLoaderClient):
3329         (WKPageSetPagePolicyClient):
3330
3331 2020-03-26  Daniel Bates  <dabates@apple.com>
3332
3333         Rename -_isInteractingWithFocusedElement, add it to the header, and replace calls to hasFocusedElement() with it
3334         https://bugs.webkit.org/show_bug.cgi?id=209623
3335
3336         Reviewed by Simon Fraser.
3337
3338         Rename -_isInteractingWithFocusedElement to -_hasFocusedElement. For now, standardize around
3339         the convention of using -_hasFocusedElement instead of hasFocusedElement(_focusedElementInformation).
3340
3341         I think in the ideal world -_hasFocusedElement would not exist and instead -_elementDidBlur would
3342         reset the state of _focusedElementInformation to what it was when a page is first loaded. I will
3343         look to do this in a subsequent patch because it is risky. Doing so requires a careful audit of all
3344         call sites that use _focusedElementInformation as they may have inadvertently depended on stale state.
3345
3346         While I am here, I added -_hasFocusedElement to WKContentViewInteraction.h so that I can make use
3347         of it in the fix for <rdar://problem/60871807>.
3348
3349         * UIProcess/ios/WKContentViewInteraction.h:
3350         * UIProcess/ios/WKContentViewInteraction.mm:
3351         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:nodeHasBuiltInClickHandling:]):
3352         (-[WKContentView inputViewForWebView]):
3353         (-[WKContentView _selectionClipRect]):
3354         (-[WKContentView gestureRecognizerShouldBegin:]):
3355         (-[WKContentView canPerformActionForWebView:withSender:]):
3356         (-[WKContentView _hasFocusedElement]):
3357         (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:withFlags:]):
3358         (-[WKContentView selectPositionAtPoint:completionHandler:]):
3359         (-[WKContentView selectPositionAtBoundary:inDirection:fromPoint:completionHandler:]):
3360         (-[WKContentView selectTextWithGranularity:atPoint:completionHandler:]):
3361         (-[WKContentView updateSelectionWithExtentPoint:completionHandler:]):
3362         (-[WKContentView updateSelectionWithExtentPoint:withBoundary:completionHandler:]):
3363         (-[WKContentView setSelectedTextRange:]):
3364         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
3365         (-[WKContentView _updateInputContextAfterBlurringAndRefocusingElement]):
3366         (-[WKContentView _updateSelectionAssistantSuppressionState]):
3367         (-[WKContentView _autofillContext]):
3368         (hasFocusedElement): Deleted.
3369         (-[WKContentView _isInteractingWithFocusedElement]): Deleted.
3370
3371 2020-03-26  Daniel Bates  <dabates@apple.com>
3372
3373         Remove hitTestOrder from ElementContext as it is no longer need
3374         https://bugs.webkit.org/show_bug.cgi?id=209561
3375         <rdar://problem/60888305>
3376
3377         Reviewed by Wenson Hsieh.
3378
3379         Revert the temporary workaround made in r257749 as <rdar://problem/59602885>
3380         has been fixed: WebKit no longer needs to explicitly annotate the resulting
3381         elements found in textInputContextsInRect() with their hit test order.
3382         Instead client code has been updated to assume these elements are returned
3383         in hit test order.
3384
3385         * UIProcess/API/Cocoa/_WKTextInputContext.mm:
3386         (-[_WKTextInputContext _hitTestOrder]): Deleted.
3387         * UIProcess/API/Cocoa/_WKTextInputContextInternal.h:
3388         * WebProcess/WebPage/WebPage.cpp:
3389         (WebKit::WebPage::textInputContextsInRect):
3390         (WebKit::WebPage::contextForElement const):
3391
3392 2020-03-26  Tim Horton  <timothy_horton@apple.com>
3393
3394         Pinch to zoom gesture has to be repeated twice if the cursor isn't moved between gestures
3395         https://bugs.webkit.org/show_bug.cgi?id=203132
3396         <rdar://problem/27439348>
3397
3398         Reviewed by Simon Fraser.
3399
3400         * UIProcess/WebPageProxy.cpp:
3401         * UIProcess/WebPageProxy.h:
3402         * UIProcess/WebPageProxy.messages.in:
3403         * UIProcess/mac/ViewGestureControllerMac.mm:
3404         (WebKit::ViewGestureController::endMagnificationGesture):
3405         * WebProcess/WebPage/WebPage.h:
3406         * WebProcess/WebPage/WebPage.messages.in:
3407         * WebProcess/WebPage/mac/WebPageMac.mm:
3408         (WebKit::WebPage::didEndMagnificationGesture):
3409         Plumb the end of a pinch-zoom gesture to EventHandler.
3410
3411 2020-03-26  Chris Dumez  <cdumez@apple.com>
3412
3413         Regression(r258949) Safari sometimes crashes when becoming the foreground application
3414         https://bugs.webkit.org/show_bug.cgi?id=209620
3415         <rdar://problem/60930466>
3416
3417         Reviewed by Per Arne Vollan.
3418
3419         Make sure m_activationObserver gets unregistered on all Cocoa platforms, not just on iOS.
3420
3421         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3422         (WebKit::WebProcessPool::unregisterNotificationObservers):
3423
3424 2020-03-26  Daniel Bates  <dabates@apple.com>
3425
3426         WebPage::selectPositionAtPoint() does not focus an element in a non-focused frame
3427         https://bugs.webkit.org/show_bug.cgi?id=209559
3428         <rdar://problem/60887055>
3429
3430         Reviewed by Wenson Hsieh.
3431
3432         Call setFocusedFrameBeforeSelectingTextAtLocation() in WebPage::selectPositionAtPoint() to
3433         update the focused frame before performing the selection. This way the target element will
3434         be focused by the selection, if not already focused.
3435
3436         * WebProcess/WebPage/ios/WebPageIOS.mm:
3437         (WebKit::WebPage::selectPositionAtPoint):
3438
3439 2020-03-26  Fujii Hironori  <Hironori.Fujii@sony.com>
3440
3441         WebKitTestRunner should enable ResourceLoadStatistics also for non-Cocoa ports
3442         https://bugs.webkit.org/show_bug.cgi?id=209410
3443
3444         Reviewed by Youenn Fablet.
3445
3446         NetworkSession's member variables for ResourceLoadStatistics were
3447         initialized only for Cocoa port. They also should be initialized
3448         for non-Cocoa ports.
3449
3450         * NetworkProcess/NetworkSession.cpp:
3451         (WebKit::NetworkSession::NetworkSession): Added member initializers for ResourceLoadStatistics.
3452         * NetworkProcess/NetworkSession.h: Have m_resourceLoadStatisticsDirectory only if ENABLE(RESOURCE_LOAD_STATISTICS).
3453         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3454         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Removed the code to initialize member variables for ResourceLoadStatistics.
3455
3456 2020-03-26  Kate Cheney  <katherine_cheney@apple.com>
3457
3458         Guard AppBound domain protections with PLATFORM(iOS_FAMILY)
3459         https://bugs.webkit.org/show_bug.cgi?id=209615
3460         <rdar://problem/60931014>
3461
3462         Reviewed by Darin Adler.
3463
3464         * UIProcess/WebPageProxy.cpp:
3465         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
3466
3467 2020-03-26  Brent Fulgham  <bfulgham@apple.com>
3468
3469         [iOS] Deny mach lookup to 'com.apple.webinspector' in the WebContent process.
3470         https://bugs.webkit.org/show_bug.cgi?id=207170
3471         <rdar://problem/59134038>
3472
3473         Reviewed by Per Arne Vollan.
3474
3475         We now dynamically add access to the 'com.apple.webinspector' service, so we should remove the blanket
3476         allow rule from the sandbox.
3477
3478         * GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
3479         * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
3480         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3481
3482 2020-03-26  Daniel Bates  <dabates@apple.com>
3483
3484         REGRESSION (r258989): ASSERTION FAILED: !isMissingPostLayoutData in WebKit::EditorState::PostLayoutData
3485         https://bugs.webkit.org/show_bug.cgi?id=209570
3486         <rdar://problem/60895050>
3487
3488         Reviewed by Darin Adler.
3489
3490         Send an editor state update before responding to a request for position information
3491         to ensure that the UI process has up-to-date selection state. Otherwise, calling code
3492         that uses this information to determine whether to query for the selection text will
3493         cause an assertion failure.
3494
3495         This fixes the test failure TestWebKitAPI.ActionSheetTests.DataDetectorsLinkIsNotPresentedAsALink
3496         caused by r258989. Following r258989 WebKit now accurately reports whether editor state
3497         has or does not have post-layout details. Prior to this the default EditorState was marked
3498         as having post-layout data even if it did not actually have such data.
3499
3500         * WebProcess/WebPage/ios/WebPageIOS.mm:
3501         (WebKit::WebPage::getPositionInformation):
3502         (WebKit::WebPage::requestPositionInformation):
3503
3504 2020-03-26  David Quesada  <david_quesada@apple.com>
3505
3506         Add SPI to specify whether file upload panels are uploading to an enterprise-managed destination
3507         https://bugs.webkit.org/show_bug.cgi?id=209607
3508         rdar://problem/60888386
3509
3510         Reviewed by Darin Adler.
3511
3512         When presenting the file upload panel, set the UIDocumentPickerViewController.isContentManaged
3513         property to a value ultimately provided by the UI delegate. This can be used to prevent the upload
3514         of personal data to enterprise websites on managed devices configured to prevent such a transfer.
3515
3516         * Platform/spi/ios/UIKitSPI.h:
3517         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3518         * UIProcess/PageClient.h:
3519         (WebKit::PageClient::handleRunOpenPanel):
3520         * UIProcess/WebPageProxy.cpp:
3521         (WebKit::WebPageProxy::runOpenPanel):
3522         * UIProcess/ios/PageClientImplIOS.h:
3523         * UIProcess/ios/PageClientImplIOS.mm:
3524         (WebKit::PageClientImpl::handleRunOpenPanel):
3525         * UIProcess/ios/WKContentViewInteraction.h:
3526         * UIProcess/ios/WKContentViewInteraction.mm:
3527         (-[WKContentView _showRunOpenPanel:frameInfo:resultListener:]):
3528         (-[WKContentView fileUploadPanelDestinationIsManaged:]):
3529         (-[WKContentView _showRunOpenPanel:resultListener:]): Deleted.
3530         * UIProcess/ios/forms/WKFileUploadPanel.h:
3531         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3532         (-[WKFileUploadPanel showFilePickerMenu]):
3533
3534 2020-03-26  Dean Jackson  <dino@apple.com>
3535
3536         Force Touch preview on file:/// URL works while clicking on the URL is blocked
3537         https://bugs.webkit.org/show_bug.cgi?id=209589
3538         <rdar://57687893>
3539
3540         Reviewed by Antoine Quint.
3541
3542         The immediate action for links should never trigger on file: URLs.
3543
3544         * UIProcess/mac/WKImmediateActionController.mm:
3545         (-[WKImmediateActionController _defaultAnimationController]):
3546
3547 2020-03-26  Per Arne Vollan  <pvollan@apple.com>
3548
3549         [iOS] Deny mach lookup access to frontboard services in the WebContent process
3550         https://bugs.webkit.org/show_bug.cgi?id=209604
3551
3552         Reviewed by Darin Adler.
3553
3554         Deny mach lookup access to "com.apple.frontboard.systemappservices" in the WebContent process on iOS.
3555
3556         Test: fast/sandbox/ios/sandbox-mach-lookup.html
3557
3558         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3559
3560 2020-03-26  Per Arne Vollan  <pvollan@apple.com>
3561
3562         [iOS] Adopt ScreenProperties class.
3563         https://bugs.webkit.org/show_bug.cgi?id=191767
3564
3565         Reviewed by Brent Fulgham.
3566
3567         Make relevent macOS platform code cross platform.
3568
3569         * Shared/WebProcessCreationParameters.cpp:
3570         (WebKit::WebProcessCreationParameters::encode const):
3571         (WebKit::WebProcessCreationParameters::decode):
3572         * Shared/WebProcessCreationParameters.h:
3573         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3574         (WebKit::WebProcessPool::platformInitializeWebProcess):
3575         * WebProcess/WebProcess.cpp:
3576         (WebKit::WebProcess::setScreenProperties):
3577         * WebProcess/WebProcess.h:
3578         * WebProcess/WebProcess.messages.in:
3579
3580 2020-03-26  David Kilzer  <ddkilzer@apple.com>
3581
3582         MESSAGE_CHECK base macros should use UNLIKELY()
3583         <https://webkit.org/b/209581>
3584         <rdar://problem/60901307>
3585
3586         Reviewed by Youenn Fablet.
3587
3588         * Platform/IPC/Connection.h:
3589         (MESSAGE_CHECK_COMPLETION_BASE):
3590         (MESSAGE_CHECK_WITH_RETURN_VALUE_BASE):
3591         - Add UNLIKELY() macro since these code paths should not be
3592           taken under normal conditions.
3593         - Add curly braces to multi-line do-while loops per WebKit style
3594           guidelines, and is required after moving the ASSERT().
3595         - Move the ASSERT() outside the if statement since that's more
3596           idomatic.
3597
3598 2020-03-26  Per Arne Vollan  <pvollan@apple.com>
3599
3600         [Cocoa] Fix incorrect rebase
3601         https://bugs.webkit.org/show_bug.cgi?id=209600
3602
3603         Reviewed by Brent Fulgham.
3604
3605         A rebase went wrong in <https://bugs.webkit.org/show_bug.cgi?id=203214> and placed the method call to
3606         enableRemoteInspectorIfNeeded() in the wrong method. It should be called in WebProcessProxy::didFinishLaunching.
3607
3608         * UIProcess/WebProcessProxy.cpp:
3609         (WebKit::WebProcessProxy::mayBecomeUnresponsive):
3610         (WebKit::WebProcessProxy::didFinishLaunching):
3611
3612 2020-03-26  Michael Catanzaro  <mcatanzaro@gnome.org>
3613
3614         [GTK] Crash in WebKit::LayerTreeHost::LayerTreeHost with bubblewrap sandbox enabled
3615         https://bugs.webkit.org/show_bug.cgi?id=209106
3616
3617         Reviewed by Carlos Garcia Campos.
3618
3619         Don't bind the WaylandCompositor socket unless we're running under Wayland and it's actually
3620         started successfully.
3621
3622         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
3623         (WebKit::bindWayland):
3624
3625 2020-03-26  David Kilzer  <ddkilzer@apple.com>
3626
3627         VideoFullscreenManagerProxy::setupFullscreenWithID should message check videoLayerID
3628         <https://webkit.org/b/209578>
3629         <rdar://problem/60703503>
3630
3631         Reviewed by Eric Carlson.
3632
3633         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
3634         (MESSAGE_CHECK): Define (and undef) new macro for assertions.
3635         (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
3636         Change ASSERT() to MESSAGE_CHECK().
3637
3638 2020-03-26  Michael Catanzaro  <mcatanzaro@gnome.org>
3639
3640         Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s) in IPC::Connection::sendOutgoingMessage
3641         https://bugs.webkit.org/show_bug.cgi?id=146729
3642
3643         Reviewed by Carlos Garcia Campos.
3644
3645         The entire MessageInfo is passed to write(), so we have to zero the padding bytes to avoid
3646         writing uninitialized memory.
3647
3648         * Platform/IPC/unix/UnixMessage.h:
3649         (IPC::MessageInfo::MessageInfo):
3650
3651 2020-03-25  Timothy Horton  <timothy_horton@apple.com>
3652
3653         Unable to build WebKit with iOS 13.4 SDK
3654         https://bugs.webkit.org/show_bug.cgi?id=209317
3655
3656         * Platform/spi/ios/UIKitSPI.h:
3657         Address post-landing review comment; use SDK conditionals, not deployment
3658         target conditionals, since SPI headers are mimicing SDK content.
3659
3660 2020-03-25  Ryosuke Niwa  <rniwa@webkit.org>
3661
3662         Mini browser immediately hit an assertion in debug build
3663         https://bugs.webkit.org/show_bug.cgi?id=209575
3664
3665         Reviewed by Simon Fraser.
3666
3667         Use 1 instead of 0 as the desination ID to avoid hitting assertions.
3668
3669         * WebProcess/GPU/media/RemoteAudioSession.cpp:
3670         (WebKit::RemoteAudioSession::RemoteAudioSession):
3671         (WebKit::RemoteAudioSession::~RemoteAudioSession):
3672
3673 2020-03-25  Tim Horton  <timothy_horton@apple.com>
3674
3675         Unable to build WebKit with iOS 13.4 SDK
3676         https://bugs.webkit.org/show_bug.cgi?id=209317
3677
3678         Reviewed by Megan Gardner.
3679
3680         * Platform/spi/ios/UIKitSPI.h:
3681         Stop defining some UIKit SPI that is now API (hurray!).
3682
3683 2020-03-25  Per Arne Vollan  <pvollan@apple.com>
3684
3685         [macOS] Fix sandbox violations related to media playback
3686         https://bugs.webkit.org/show_bug.cgi?id=209568
3687         <rdar://problem/60262125>
3688
3689         Reviewed by Brent Fulgham.
3690
3691         Fix observed sandbox violations during media playback.
3692
3693         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3694         (WebKit::mediaRelatedMachServices):
3695
3696 2020-03-25  Daniel Bates  <dabates@apple.com>
3697
3698         Element context character rects may be in wrong coordinate system
3699         https://bugs.webkit.org/show_bug.cgi?id=209493
3700         <rdar://problem/60840261>
3701
3702         Reviewed by Wenson Hsieh.
3703
3704         Convert the character rects from content view coordinates to root view coordinates
3705         as that is the coordinate system callers of -requestDocumentContext expect.
3706
3707         * WebProcess/WebPage/ios/WebPageIOS.mm:
3708         (WebKit::WebPage::requestDocumentEditingContext):
3709
3710 2020-03-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3711
3712         Rename "data interaction pasteboard" to "drag and drop pasteboard"
3713         https://bugs.webkit.org/show_bug.cgi?id=209556
3714
3715         Reviewed by Tim Horton.
3716
3717         Adopt Pasteboard::nameOfDragPasteboard instead of the literal string "data interaction pasteboard".
3718
3719         * UIProcess/ios/WKContentViewInteraction.mm:
3720         (-[WKContentView dropInteraction:sessionDidEnter:]):
3721         (-[WKContentView dropInteraction:sessionDidUpdate:]):
3722         (-[WKContentView dropInteraction:sessionDidExit:]):
3723         (-[WKContentView dropInteraction:performDrop:]):
3724
3725 2020-03-25  Brady Eidson  <beidson@apple.com>
3726
3727         Some WKWebView.h header doc cleanup.
3728         https://bugs.webkit.org/show_bug.cgi?id=209549
3729
3730         Reviewed by Simon Fraser.
3731
3732         * UIProcess/API/Cocoa/WKWebView.h:
3733
3734 2020-03-25  Daniel Bates  <dabates@apple.com>
3735
3736         Remove newline that I accidentally added in r258989.
3737
3738         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
3739
3740 2020-03-25  Brent Fulgham  <bfulgham@apple.com>
3741
3742         Avoid logging sensitive information for all network sessions
3743         https://bugs.webkit.org/show_bug.cgi?id=209522
3744         <rdar://problem/54807157>
3745
3746         Reviewed by Alex Christensen.
3747
3748         We avoid logging sensitive information (such as visited URLs) on production builds and for ephemeral sessions.
3749
3750         We should also avoid such logging for engineering and prerelease builds to reduce the possibility of any
3751         personally identifiable information being retained in logs.
3752
3753         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3754         (WebKit::configurationForSessionID): Deny senstive logging for all sessions.
3755
3756 2020-03-24  Daniel Bates  <dabates@apple.com>
3757
3758         [iOS] ASSERTION FAILURE: !isMissingPostLayoutData in WebKit::EditorState::postLayoutData()
3759         https://bugs.webkit.org/show_bug.cgi?id=199960
3760         <rdar://problem/53323966>
3761
3762         Reviewed by Simon Fraser.
3763
3764         Refactor the computation of editor state so that we can request that a layout be performed
3765         each time we compute the editor state as part of asking the UI process to interpret a key
3766         event. The full (read: after layout) editor state is needed for UIKit to perform a deletion
3767         because UIKit wants to know how many characters are before the selection. Otherwise, we hit
3768         an assert due to the fact the last editor state sent (when the Web process asked the UI process
3769         to interpret the key) is missing layout data.
3770
3771         The refactoring also moves the Cocoa-common code out of the platform-independent WebPage.cpp
3772         file into WebPageCocoa.mm.
3773
3774         One side effect of the refactoring is that we no longer allow the platformEditorState() function
3775         to override the isMissingPostLayoutData bit. Currently it can even though the calling code, the
3776         platform independent code (PIE) in WebPage, may have attached layout data. Now the PIE code sets
3777         this bit if it attached layout data and the platformEditorState() function only attaches more
3778         layout data if that bit is set. platformEditorState() never unsets that bit (i.e. sets isMissingPostLayoutData
3779         to true).
3780
3781         The patch also removes m_isEditorStateMissingPostLayoutData in WebPage.h. This instance variable
3782         has been unused since <https://trac.webkit.org/changeset/221064/webkit>. Also we haven't been using
3783         IncludePostLayoutDataHint::No since the last reference to it was removed in <https://trac.webkit.org/changeset/244494/webkit>.
3784
3785         I also renamed platformEditorState() to getPlatformEditorState() since it has an out argument.
3786
3787         Test: editing/deleting/ios/backspace-last-character.html
3788
3789         * Shared/EditorState.h:
3790         * UIProcess/API/glib/WebKitEditorState.cpp:
3791         (webkitEditorStateCreate): Initialize _WebKitEditorStatePrivate::typingAttributes to WEBKIT_EDITOR_TYPING_ATTRIBUTE_NONE.
3792         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
3793         (WebKit::WebPage::getPlatformEditorStateCommon const): Added. Moved Cocoa-common code from WebPage.cpp to here.
3794         * WebProcess/WebPage/WebPage.cpp:
3795         (WebKit::WebPage::editorState const): Move Cocoa-common code to WebPageCocoa.mm. Change enum to
3796         track whether a layout should be performed. Keep the current behavior of only including post layout
3797         data if the frame view does not need a layout. This behavior is encoded in the enumerator ShouldPerformLayout::Default.
3798         which is the default argument value for the argument shouldPerformLayout.
3799         * WebProcess/WebPage/WebPage.h:
3800         (WebKit::WebPage::platformNeedsLayoutForEditorState const): Added. Non-Cocoa port implementation
3801         that returns false.
3802         * WebProcess/WebPage/glib/WebPageGLib.cpp:
3803         (WebKit::WebPage::getPlatformEditorState const): Early return if isMissingPostLayoutData is true.
3804         (WebKit::WebPage::platformEditorState const): Deleted.
3805         * WebProcess/WebPage/ios/WebPageIOS.mm:
3806         (WebKit::WebPage::platformNeedsLayoutForEditorState const): Added. Keep the current behavior of
3807         performing a layout if we have a composition or a hardware keyboard is attached.
3808         (WebKit::WebPage::getPlatformEditorState const): Call platformEditorStateCommon(). Bail out early
3809         if isMissingPostLayoutData is true.
3810         (WebKit::WebPage::handleEditingKeyboardEvent): The important part of this patch. Request a layout
3811         when computing the editor state that we will send to the UI process.
3812         (WebKit::WebPage::platformEditorState const): Deleted.
3813         * WebProcess/WebPage/mac/WebPageMac.mm:
3814         (WebKit::WebPage::getPlatformEditorState const): Call platformEditorStateCommon(). Bail out early
3815         if isMissingPostLayoutData is true.
3816         (WebKit::WebPage::platformEditorState const): Deleted.
3817         * WebProcess/WebPage/playstation/WebPagePlayStation.cpp:
3818         (WebKit::WebPage::getPlatformEditorState const): Update as needed.
3819         (WebKit::WebPage::platformEditorState const): Deleted.
3820         * WebProcess/WebPage/win/WebPageWin.cpp:
3821         (WebKit::WebPage::getPlatformEditorState const): Update as needed.
3822         (WebKit::WebPage::platformEditorState const): Deleted.
3823
3824 2020-03-25  Kate Cheney  <katherine_cheney@apple.com>
3825
3826         App-bound domain checks should provide more debugging details at script evaluation sites
3827         https://bugs.webkit.org/show_bug.cgi?id=209521
3828         <rdar://problem/60837954>
3829
3830         Reviewed by Chris Dumez.
3831
3832         Return an exception because that option is available here, and also add
3833         console and release logging for consistency across app-bound domain checks.
3834
3835         * WebProcess/WebPage/WebPage.cpp:
3836         (WebKit::WebPage::runJavaScript):
3837
3838 2020-03-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3839
3840         Avoid querying pasteboard strings while dragging content over a potential drop target
3841         https://bugs.webkit.org/show_bug.cgi?id=209531
3842
3843         Reviewed by Tim Horton and Ryosuke Niwa.
3844
3845         Add PasteboardStrategy and WebPasteboardProxy (IPC) plumbing; see WebCore for more details.
3846
3847         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
3848         (WebKit::WebPasteboardProxy::containsStringSafeForDOMToReadForType):
3849         * UIProcess/WebPasteboardProxy.cpp:
3850         (WebKit::WebPasteboardProxy::containsStringSafeForDOMToReadForType):
3851         * UIProcess/WebPasteboardProxy.h:
3852         * UIProcess/WebPasteboardProxy.messages.in:
3853         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3854         (WebKit::WebPlatformStrategies::containsStringSafeForDOMToReadForType):
3855         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
3856
3857 2020-03-24  Daniel Bates  <dabates@apple.com>
3858
3859         Unreviewed, reverting r258945.
3860
3861         Revert change that broke API tests while I investigate
3862         offline.
3863
3864         Reverted changeset:
3865
3866         "Element context character rects may be in wrong coordinate
3867         system"
3868         https://bugs.webkit.org/show_bug.cgi?id=209493
3869         https://trac.webkit.org/changeset/258945
3870
3871 2020-03-24  John Wilander  <wilander@apple.com>
3872
3873         Refactor ResourceLoadStatisticsStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor() to return a struct instead of a Vector of pairs
3874         https://bugs.webkit.org/show_bug.cgi?id=209463
3875         <rdar://problem/60808759>
3876
3877         Reviewed by Alex Christensen.
3878
3879         This change does three things:
3880
3881         1. Replaces the Vector<std::pair<RegistrableDomain, WebsiteDataToRemove>> with a new struct called
3882         RegistrableDomainsToDeleteOrRestrictWebsiteDataFor for sending around which domains to delete website data for.
3883
3884         2. Removes the enum WebsiteDataToRemove, replacing its structure with the members of the above mentioned struct:
3885         - domainsToDeleteAllCookiesFor
3886         - domainsToDeleteAllButHttpOnlyCookiesFor
3887         - domainsToDeleteAllNonCookieWebsiteDataFor
3888
3889         3. Consistently renames "domainsToDeleteFor" to "domainsToDeleteOrRestrictFor" in preparation for website data
3890         policies that are not about deletion, see for instance recently landed https://trac.webkit.org/changeset/258884.
3891
3892         No new tests. No changed functionality. This code is covered by several existing tests.
3893
3894         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3895         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
3896         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
3897         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor):
3898         (WebKit::ResourceLoadStatisticsMemoryStore::registrableDomainsToRemoveWebsiteDataFor): Deleted.
3899         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
3900         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
3901         (WebKit::domainsToString):
3902         (WebKit::ResourceLoadStatisticsStore::removeDataRecords):
3903         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
3904         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3905         (WebKit::WebResourceLoadStatisticsStore::deleteAndRestrictWebsiteDataForRegistrableDomains):
3906         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForRegistrableDomains): Deleted.
3907         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3908         (WebKit::RegistrableDomainsToDeleteOrRestrictWebsiteDataFor::isolatedCopy const):
3909         (WebKit::RegistrableDomainsToDeleteOrRestrictWebsiteDataFor::isEmpty const):
3910         * NetworkProcess/NetworkProcess.cpp:
3911         (WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains):
3912         (WebKit::NetworkProcess::deleteCookiesForTesting):
3913         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains): Deleted.
3914         * NetworkProcess/NetworkProcess.h:
3915         * NetworkProcess/NetworkSession.cpp:
3916         (WebKit::NetworkSession::deleteAndRestrictWebsiteDataForRegistrableDomains):
3917         (WebKit::NetworkSession::deleteWebsiteDataForRegistrableDomains): Deleted.
3918         * NetworkProcess/NetworkSession.h:
3919
3920 2020-03-24  Jiewen Tan  <jiewen_tan@apple.com>
3921
3922         [WebAuthn] Customize a bit more on the macOS LocalAuthentication prompt
3923         https://bugs.webkit.org/show_bug.cgi?id=208703
3924         <rdar://problem/60136974>
3925
3926         Reviewed by Brent Fulgham.
3927
3928         Part 2.
3929
3930         This patch adds a different LocalAuthentication prompt title for getAssertion.
3931         It also polishes the text used for makeCredential.
3932
3933         Besides that, it also enhances the iOS title strings.
3934
3935         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
3936         (WebKit::LocalAuthenticator::continueMakeCredentialAfterDecidePolicy):
3937         (WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected):
3938         * UIProcess/WebAuthentication/Cocoa/LocalConnection.h:
3939         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
3940         (WebKit::LocalConnection::verifyUser const):
3941         * UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
3942         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
3943         (WebKit::MockLocalConnection::verifyUser const):
3944
3945 2020-03-24  Kate Cheney  <katherine_cheney@apple.com>
3946
3947         Ignore in-app browser privacy checks for apps with com.apple.private.applemediaservices entitlement
3948         https://bugs.webkit.org/show_bug.cgi?id=209509
3949         <rdar://problem/60750956>
3950
3951         Reviewed by Brent Fulgham.
3952
3953         * UIProcess/WebPageProxy.cpp:
3954         (WebKit::m_ignoresAppBoundDomains):
3955         (WebKit::WebPageProxy::setIsNavigatingToAppBoundDomain):
3956         * UIProcess/WebPageProxy.h:
3957
3958 2020-03-24  Per Arne Vollan  <pvollan@apple.com>
3959
3960         [Cocoa] Fix launch time regression with CF prefs direct mode enabled
3961         https://bugs.webkit.org/show_bug.cgi?id=209244
3962         <rdar://problem/60542149>
3963
3964         Reviewed by Darin Adler.
3965
3966         When CF prefs direct mode was enabled in https://trac.webkit.org/changeset/258064/webkit, it introduced
3967         a significant launch time regression. This patch addresses this regression. The number of observed domains
3968         is reduced and domain observation is initiated later when Safari is first activated. Swizzling code is
3969         removed, since that has a performance cost in the Objective-C runtime. Normal priority instead of
3970         QOS_CLASS_BACKGROUND is used in the thread which starts the observing, since using a background priority
3971         class can lead to priority inversion. Finally, a dictionary comparison is removed when a notification
3972         about a preference change is received, since this check is redundant and doubles the cost of this method.
3973
3974         * UIProcess/Cocoa/PreferenceObserver.mm:
3975         (-[WKPreferenceObserver init]):
3976         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3977         (WebKit::WebProcessPool::platformInitialize):
3978         (WebKit::WebProcessPool::registerNotificationObservers):
3979         (WebKit::WebProcessPool::unregisterNotificationObservers):
3980         * UIProcess/WebProcessPool.h:
3981
3982 2020-03-24  Daniel Bates  <dabates@apple.com>
3983
3984         Element context character rects may be in wrong coordinate system
3985         https://bugs.webkit.org/show_bug.cgi?id=209493
3986         <rdar://problem/60840261>
3987
3988         Reviewed by Wenson Hsieh.
3989
3990         Convert the character rects from content view coordinates to root view coordinates
3991         as that is the coordinate system callers of -requestDocumentContext expect.
3992
3993         * WebProcess/WebPage/ios/WebPageIOS.mm:
3994         (WebKit::WebPage::requestDocumentEditingContext):
3995
3996 2020-03-24  Daniel Bates  <dabates@apple.com>
3997
3998         Use SimpleRange in characterRectsForRange()
3999         https://bugs.webkit.org/show_bug.cgi?id=209495
4000
4001         Reviewed by Darin Adler.
4002
4003         The function characterRectsForRange() is capable of working correctly with a SimpleRange
4004         instead of a Range. Callers currently pass a Range. So, there is still a conversion, but
4005         maybe someday they can pass a SimpleRange. This change is towards that future.
4006
4007         * WebProcess/WebPage/ios/WebPageIOS.mm:
4008         (WebKit::WebPage::requestDocumentEditingContext):
4009
4010 2020-03-24  Chris Dumez  <cdumez@apple.com>
4011
4012         Unreviewed, reverting r258928.
4013
4014         Broke the build
4015
4016         Reverted changeset:
4017
4018         "Refactor
4019         ResourceLoadStatisticsStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor()
4020         to return a struct instead of a Vector of pairs"
4021         https://bugs.webkit.org/show_bug.cgi?id=209463
4022         https://trac.webkit.org/changeset/258928
4023
4024 2020-03-24  John Wilander  <wilander@apple.com>
4025
4026         Refactor ResourceLoadStatisticsStore::registrableDomainsToDeleteOrRestrictWebsiteDataFor() to return a struct instead of a Vector of pairs
4027         https://bugs.webkit.org/show_bug.cgi?id=209463
4028         <rdar://problem/60808759>
4029
4030         Reviewed by Alex Christensen.
4031
4032         This change does three things:
4033
4034         1. Replaces the Vector<std::pair<RegistrableDomain, WebsiteDataToRemove>> with a new struct called
4035         RegistrableDomainsToDeleteOrRestrictWebsiteDataFor for sending around which domains to delete website data for.