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