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