REGRESSION (r232520): Crash under IPC::ArgumentCoder<WebCore::Credential>::encodePlat...
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-06-07  Dan Bernstein  <mitz@apple.com>
2
3         REGRESSION (r232520): Crash under IPC::ArgumentCoder<WebCore::Credential>::encodePlatformData
4         https://bugs.webkit.org/show_bug.cgi?id=186385
5         <rdar://problem/40853796>
6
7         Reviewed by Daniel Bates.
8
9         * Shared/mac/WebCoreArgumentCodersMac.mm:
10         (IPC::ArgumentCoder<Credential>::encodePlatformData): Fixed an incorrect cast.
11
12 2018-06-06  Per Arne Vollan  <pvollan@apple.com>
13
14         Crash in lambda function WTF::Function<void ()>::CallableWrapper<WebKit::DisplayLink::displayLinkCallback
15         https://bugs.webkit.org/show_bug.cgi?id=186370
16         <rdar://problem/39791647>
17
18         Reviewed by Brent Fulgham.
19
20         When the display link is firing, the callback function is called on the display link thread, where a lambda function
21         is created to be executed on the main thread. The WebPageProxy object is captured as a RefPtr in the lambda. This
22         might crash when executing on the main thread, since the WebPageProxy object is possibly deleted then. Capturing
23         the WebPageProxy will not prevent the object from being deleted if the destruction of the WebPageProxy object already
24         has started on the main thread when the object is captured, which sometimes is the case. Instead, we can create a
25         weak pointer to the object, which will work as intended, even if the WebPageProxy object is in the process of being
26         deleted. This also matches the display link implementation used when the WebContent process has access to the
27         WindowServer. This is not a frequent crash. I have not been able to reproduce it.
28  
29         * UIProcess/mac/DisplayLink.cpp:
30         (WebKit::DisplayLink::displayLinkCallback):
31
32 2018-06-06  Antoine Quint  <graouts@apple.com>
33
34         Rename color-filter to -apple-color-filter and do not expose it to Web content
35         https://bugs.webkit.org/show_bug.cgi?id=186306
36         <rdar://problem/39874167>
37
38         Reviewed by Simon Fraser.
39
40         Change the ColorFilter setting to no longer be exposed as an experimental feature and ensure it's turned off by default.
41         To allow internal clients to use the -apple-color-filter property, we expose a new _colorFilterEnabled property as SPI
42         to WKWebViewConfigurationPrivate.
43
44         * Shared/WebPreferences.yaml:
45         * UIProcess/API/C/WKPreferences.cpp:
46         (WKPreferencesSetColorFilterEnabled):
47         (WKPreferencesGetColorFilterEnabled):
48         * UIProcess/API/C/WKPreferencesRefPrivate.h:
49         * UIProcess/API/Cocoa/WKWebView.mm:
50         (-[WKWebView _initializeWithConfiguration:]):
51         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
52         (-[WKWebViewConfiguration init]):
53         (-[WKWebViewConfiguration copyWithZone:]):
54         (-[WKWebViewConfiguration _setAttachmentElementEnabled:]):
55         (-[WKWebViewConfiguration _colorFilterEnabled]):
56         (-[WKWebViewConfiguration _setColorFilterEnabled:]):
57         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
58
59 2018-06-06  Jer Noble  <jer.noble@apple.com>
60
61         REGRESSION (r232301) - Unable to enter video fullscreen
62         https://bugs.webkit.org/show_bug.cgi?id=186357
63         <rdar://problem/40838449>
64
65         Reviewed by Jon Lee.
66
67         Only set up the standby fullscreen element if we are in element fullscreen.
68
69         * WebProcess/FullScreen/WebFullScreenManager.cpp:
70         (WebKit::WebFullScreenManager::videoControlsManagerDidChange):
71
72 2018-06-06  Jeremy Jones  <jeremyj@apple.com>
73
74         attenuationFactor should be in range [0,1]
75         https://bugs.webkit.org/show_bug.cgi?id=186320
76         rdar://problem/40821456
77
78         Reviewed by Jer Noble.
79
80         If attenuationFactor is outside of this range it can cause false positives.
81
82         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.cpp:
83         (WebKit::FullscreenTouchSecheuristic::attenuationFactor):
84
85 2018-06-06  Tim Horton  <timothy_horton@apple.com>
86
87         Move animated resize into the layer tree transaction, and make it asynchronous
88         https://bugs.webkit.org/show_bug.cgi?id=186130
89         <rdar://problem/38477288>
90
91         Reviewed by Simon Fraser.
92
93         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
94         (WebKit::RemoteLayerTreeTransaction::setScrollPosition):
95         (WebKit::RemoteLayerTreeTransaction::dynamicViewportSizeUpdateID const):
96         (WebKit::RemoteLayerTreeTransaction::setDynamicViewportSizeUpdateID):
97         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
98         (WebKit::RemoteLayerTreeTransaction::encode const):
99         (WebKit::RemoteLayerTreeTransaction::decode):
100         * WebProcess/WebPage/WebPage.cpp:
101         (WebKit::WebPage::willCommitLayerTree):
102         Add scrollPosition to the transaction on all platforms, not just Mac.
103         Add the optional dynamicViewportSizeUpdateID to the transaction, representing
104         the most recent dynamicViewportSizeUpdate that commit contains, if any.
105
106         * Shared/ios/DynamicViewportSizeUpdate.h:
107         Added a typedef for DynamicViewportSizeUpdateID, and move the mode enum here.
108
109         * UIProcess/ios/PageClientImplIOS.h:
110         * UIProcess/ios/PageClientImplIOS.mm:
111         (WebKit::PageClientImpl::dynamicViewportUpdateChangedTarget): Deleted.
112         * UIProcess/PageClient.h:
113         * UIProcess/WebPageProxy.cpp:
114         (WebKit::WebPageProxy::resetState):
115         * UIProcess/WebPageProxy.h:
116         * UIProcess/WebPageProxy.messages.in:
117         * UIProcess/ios/WebPageProxyIOS.mm:
118         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
119         (WebKit::WebPageProxy::didCommitLayerTree):
120         (WebKit::WebPageProxy::synchronizeDynamicViewportUpdate): Deleted.
121         (WebKit::WebPageProxy::dynamicViewportUpdateChangedTarget): Deleted.
122         * WebProcess/WebPage/WebPage.h:
123         * WebProcess/WebPage/WebPage.messages.in:
124         * WebProcess/WebPage/ios/WebPageIOS.mm:
125         (WebKit::WebPage::dynamicViewportSizeUpdate):
126         (WebKit::WebPage::synchronizeDynamicViewportUpdate): Deleted.
127         Remove dynamicViewportUpdateChangedTarget and synchronizeDynamicViewportUpdate.
128         Move dynamicViewportSizeUpdateID maintenance into WKWebView.
129
130         * UIProcess/API/Cocoa/WKWebView.mm:
131         (-[WKWebView _processDidExit]):
132         Remove _resizeAnimationTransformTransactionID. We now instead pack
133         the resize ID inside the transaction, instead of separately sending
134         back a transaction ID to wait for.
135
136         (-[WKWebView _didCommitLayerTreeDuringAnimatedResize:]):
137         (-[WKWebView _didCommitLayerTree:]):
138         Added, factored out of _didCommitLayerTree:.
139         If the transaction includes the result of the most recently-sent resize,
140         store the requisite adjustments required to counter the new scale and
141         scroll offset, update the resizeAnimationView, and, if endAnimatedResize
142         has already been called, call _didCompleteAnimatedResize to tear down
143         the animation view and put things back together.
144
145         Add some code so that if a commit arrives before the resize, we update
146         the scale of the resize animation view to keep the width fitting.
147
148         (activeMaximumUnobscuredSize):
149         (activeOrientation):
150         Move these because the code that depends on them moved.
151
152         (-[WKWebView _didCompleteAnimatedResize]):
153         Broken out of _endAnimatedResize. This can now be called from
154         either endAnimatedResize or _didCommitLayerTreeDuringAnimatedResize,
155         depending on which is called first.
156
157         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
158         Don't create a new resize view if we still have one. Otherwise, we'll
159         get the view ordering all wrong when making the second one. This
160         didn't previously cause trouble, because we don't have a lot of
161         WKScrollView subviews, but it totally could.
162
163         Adopt _initialContentOffsetForScrollView just to make this code more clear.
164
165         (-[WKWebView _endAnimatedResize]):
166         (-[WKWebView _dynamicViewportUpdateChangedTargetToScale:position:nextValidLayerTreeTransactionID:]): Deleted.
167         * UIProcess/API/Cocoa/WKWebViewInternal.h:
168
169
170 2018-06-05  Per Arne Vollan  <pvollan@apple.com>
171
172         Move OpenGL display mask to screen data struct.
173         https://bugs.webkit.org/show_bug.cgi?id=186198
174         <rdar://problem/40724854>
175
176         Reviewed by Brent Fulgham.
177
178         Currently, the OpenGL display mask is a global in the WebContent process. This is not correct in all cases, since
179         it is possible to have two Web views in the same WebContent process, displayed on different displays. This can be
180         resolved by moving the OpenGL display mask to a new ScreenData struct, containing information specific to each
181         display. The display ID of the host window is used to find the OpenGL display mask when needed. This patch makes
182         the host window available when creating an IOSurface, in order to find the right OpenGL display mask. If no host
183         window is available, the OpenGL display mask of the main display is used.
184
185         * Shared/WebPageCreationParameters.cpp:
186         (WebKit::WebPageCreationParameters::encode const):
187         (WebKit::WebPageCreationParameters::decode):
188         * Shared/WebPageCreationParameters.h:
189         * Shared/WebProcessCreationParameters.cpp:
190         (WebKit::WebProcessCreationParameters::encode const):
191         (WebKit::WebProcessCreationParameters::decode):
192         * Shared/WebProcessCreationParameters.h:
193         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
194         (WebKit::WebProcessPool::platformInitializeWebProcess):
195         * UIProcess/WebPageProxy.cpp:
196         (WebKit::WebPageProxy::windowScreenDidChange):
197         (WebKit::WebPageProxy::creationParameters):
198         * UIProcess/WebProcessPool.cpp:
199         (WebKit::WebProcessPool::screenPropertiesStateChanged):
200         (WebKit::displayReconfigurationCallBack):
201         * WebProcess/WebPage/WebPage.cpp:
202         (WebKit::m_credentialsMessenger):
203         * WebProcess/WebPage/WebPage.h:
204         * WebProcess/WebPage/WebPage.messages.in:
205         * WebProcess/WebPage/mac/WebPageMac.mm:
206         (WebKit::WebPage::openGLDisplayMaskChanged): Deleted.
207         * WebProcess/WebProcess.cpp:
208         (WebKit::WebProcess::setScreenProperties):
209         * WebProcess/WebProcess.h:
210         * WebProcess/WebProcess.messages.in:
211         * WebProcess/cocoa/WebProcessCocoa.mm:
212         (WebKit::WebProcess::platformInitializeWebProcess):
213
214 2018-06-05  Keith Rollin  <krollin@apple.com>
215
216         Remove tracksResourceLoadMilestones support
217         https://bugs.webkit.org/show_bug.cgi?id=186329
218         <rdar://problem/40829898>
219
220         Reviewed by Darin Adler.
221
222         Remove the mechanism for enabling/disabling the tracking of
223         resource-load milestones. This was initially added in order to enable
224         the tracking only for Safari. However, the decision has been made to
225         enable the tracking for all WebKit clients, so it's now enabled
226         unconditionally.
227
228         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
229         (WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
230         (WebKit::NetworkConnectionToWebProcess::stopTrackingResourceLoad):
231         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTracking):
232         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTrackingForPage):
233         (WebKit::networkActivityTrackingEnabled): Deleted.
234         * NetworkProcess/NetworkProcess.cpp:
235         (WebKit::NetworkProcess::initializeNetworkProcess):
236         * NetworkProcess/NetworkProcess.h:
237         (WebKit::NetworkProcess::tracksResourceLoadMilestones const): Deleted.
238         * NetworkProcess/NetworkProcessCreationParameters.cpp:
239         (WebKit::NetworkProcessCreationParameters::encode const):
240         (WebKit::NetworkProcessCreationParameters::decode):
241         * NetworkProcess/NetworkProcessCreationParameters.h:
242         * UIProcess/API/APIProcessPoolConfiguration.cpp:
243         (API::ProcessPoolConfiguration::copy):
244         * UIProcess/API/APIProcessPoolConfiguration.h:
245         * UIProcess/API/C/WKContextConfigurationRef.cpp:
246         (WKContextConfigurationTracksResourceLoadMilestones): Deleted.
247         (WKContextConfigurationSetTracksResourceLoadMilestones): Deleted.
248         * UIProcess/API/C/WKContextConfigurationRef.h:
249         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
250         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
251         (-[_WKProcessPoolConfiguration tracksResourceLoadMilestones]): Deleted.
252         (-[_WKProcessPoolConfiguration setTracksResourceLoadMilestones:]): Deleted.
253         * UIProcess/WebProcessPool.cpp:
254         (WebKit::WebProcessPool::ensureNetworkProcess):
255
256 2018-06-05  Darin Adler  <darin@apple.com>
257
258         [Cocoa] Retire DispatchPtr, and add more move semantics and simpler #ifs to other smart pointers
259         https://bugs.webkit.org/show_bug.cgi?id=186324
260
261         Reviewed by Anders Carlsson.
262
263         * NetworkProcess/cache/NetworkCacheData.h: Use OSObjectPtr instead of
264         DispatchPtr and also use an rvalue reference in the constructor.
265         * NetworkProcess/cache/NetworkCacheDataCocoa.mm:
266         (WebKit::NetworkCache::Data::Data): Use adoptOSObject, rvalue reference
267         and WTFMove.
268         (WebKit::NetworkCache::Data::empty): Use OSObjectPtr.
269         (WebKit::NetworkCache::Data::data const): Use adoptOSObject.
270         (WebKit::NetworkCache::Data::subrange const): Ditto.
271         (WebKit::NetworkCache::concatenate): Ditto.
272         (WebKit::NetworkCache::Data::adoptMap): Ditto. Also use WTFMove.
273
274         * NetworkProcess/cache/NetworkCacheIOChannel.h: Use OSObjectPtr.
275         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
276         (WebKit::NetworkCache::IOChannel::IOChannel): Use adoptOSObject.
277         (WebKit::NetworkCache::IOChannel::read): Use OSObjectPtr.
278
279 2018-06-05  Brent Fulgham  <bfulgham@apple.com>
280
281         Adjust compile and runtime flags to match shippable state of features
282         https://bugs.webkit.org/show_bug.cgi?id=186319
283         <rdar://problem/40352045>
284
285         Reviewed by Maciej Stachowiak, Jon Lee, and others.
286
287         Change the default state of various experimental features so that they are off by default in production
288         builds, since they are still under development.
289
290         Turn 'CacheAPIEnabled' and 'SubresourceIntegrityEnabled' on by default, since both features have been
291         shipping for a full cycle and have proven to be stable in production.
292
293         * Configurations/FeatureDefines.xcconfig: Don't build ENABLE_INPUT_TYPE_COLOR
294         or ENABLE_INPUT_TYPE_COLOR_POPOVER.
295         * Shared/WebPreferences.yaml: 
296 2018-06-05  Timothy Hatcher  <timothy@apple.com>
297
298         Clean up LocalDefaultSystemAppearance and prefers-dark-interface media query
299
300         https://bugs.webkit.org/show_bug.cgi?id=186323
301         rdar://problem/38382252
302
303         Reviewed by Tim Horton.
304
305         * UIProcess/API/Cocoa/WKWebView.mm:
306         (-[WKWebView _defaultAppearance]):
307         * UIProcess/API/mac/WKView.mm:
308         (-[WKView _defaultAppearance]):
309         * UIProcess/Cocoa/WebViewImpl.h:
310         * UIProcess/Cocoa/WebViewImpl.mm:
311         (WebKit::WebViewImpl::useDefaultAppearance):
312
313 2018-06-05  Sihui Liu  <sihui_liu@apple.com>
314
315         [iOS] TestWebKitAPI.WebKit.WKHTTPCookieStoreWithoutProcessPool fails because cookies aren't flushed to file
316         https://bugs.webkit.org/show_bug.cgi?id=186303
317         <rdar://problem/40468716>
318
319         Reviewed by Geoffrey Garen.
320
321         No matter there is an observer or not, cookies in UI process should always be flushed to 
322         file when new process pool is created, such that cookies created via API can be synced to
323         network process.
324
325         * UIProcess/API/APIHTTPCookieStore.cpp:
326         (API::HTTPCookieStore::HTTPCookieStore):
327         (API::HTTPCookieStore::registerObserver):
328         (API::HTTPCookieStore::cookieManagerDestroyed):
329         (API::HTTPCookieStore::registerForNewProcessPoolNotifications):
330
331 2018-06-05  Jeremy Jones  <jeremyj@apple.com>
332
333         secheuristic should only use touch began and ended, not changed.
334         https://bugs.webkit.org/show_bug.cgi?id=186318
335         rdar://problem/39781486
336
337         Reviewed by Jer Noble.
338
339         Filter out change events so swiping gestures don't trigger the heuristic.
340
341         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
342         (-[WKFullScreenViewController _touchDetected:]):
343
344 2018-06-05  Darin Adler  <darin@apple.com>
345
346         [Cocoa] More preparation for ARC, focusing on WebKit and smart pointers
347         https://bugs.webkit.org/show_bug.cgi?id=186314
348
349         Reviewed by Anders Carlsson.
350
351         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
352         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Use __bridge for cast.
353         * NetworkProcess/mac/NetworkProcessMac.mm:
354         (WebKit::overrideSystemProxies): Ditto.
355         (WebKit::NetworkProcess::allowSpecificHTTPSCertificateForHost): Ditto.
356         * Platform/IPC/mac/ConnectionMac.mm:
357         (IPC::Connection::sendMessage): Ditto.
358         (IPC::readFromMachPort): Ditto.
359
360         * Platform/mac/StringUtilities.mm:
361         (WebKit::formattedPhoneNumberString): Use __bridge for cast and
362         CFBridgingRelease instead of an explicit autorelease.
363
364         * Shared/API/Cocoa/_WKRemoteObjectInterface.mm:
365         (initializeMethods): Use auto instead of an explicit type so that we get
366         the correct type for the result of protocol_copyProtocolList.
367
368         * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
369         (-[_WKRemoteObjectRegistry _sendInvocation:interface:]): Added a
370         bridging cast to void* because that's needed to call _Block_signature
371         under ARC and harmless outside ARC.
372
373         * Shared/API/c/cf/WKStringCF.mm:
374         (WKStringCreateWithCFString): Use __bridge for cast.
375         * Shared/API/c/cf/WKURLCF.mm:
376         (WKURLCreateWithCFURL): Ditto.
377         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
378         (WebKit::AuthenticationManager::initializeConnection): Ditto.
379         * Shared/Cocoa/DataDetectionResult.mm:
380         (WebKit::DataDetectionResult::encode const): Ditto.
381         (WebKit::DataDetectionResult::decode): Ditto.
382         * Shared/Cocoa/WKNSError.mm:
383         (-[WKNSError _web_createTarget]): Ditto.
384         * Shared/Cocoa/WKNSURLExtras.mm:
385         (-[NSURL _web_originalDataAsWTFString]): Ditto.
386
387         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
388         (WebKit::XPCServiceInitializer): Removed balanced calls to both
389         adoptOSObject and xpc_retain and instead rely on the assignment
390         operator just added to OSObjectPtr.
391
392         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
393         (WebKit::XPCServiceEventHandler): Use __bridge for cast.
394         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
395         (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer): Ditto.
396         * Shared/cf/ArgumentCodersCF.cpp:
397         (IPC::decode): Ditto.
398         * Shared/mac/ArgumentCodersMac.mm:
399         (IPC::isSerializableValue): Ditto.
400         (IPC::encode): Ditto.
401         * Shared/mac/WebCoreArgumentCodersMac.mm:
402         (IPC::encodeNSError): Ditto. Also use CFSTR("")" instead of @""
403         when we need a CFString.
404         (IPC::decodeNSError): Ditto.
405         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Ditto.
406         (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Ditto.
407         (IPC::ArgumentCoder<Credential>::encodePlatformData): Ditto.
408         (IPC::ArgumentCoder<Credential>::decodePlatformData): Ditto.
409         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode): Ditto.
410         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::decode): Ditto.
411         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData): Ditto.
412         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData): Ditto.
413         * Shared/mac/WebHitTestResultData.mm:
414         (WebKit::WebHitTestResultData::platformEncode const): Ditto.
415         (WebKit::WebHitTestResultData::platformDecode): Ditto.
416         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
417         (WKContextIsPlugInUpdateAvailable): Ditto.
418         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
419         (-[WKBrowsingContextController certificateChain]): Ditto.
420         (didStartProvisionalLoadForFrame): Ditto.
421         (didReceiveServerRedirectForProvisionalLoadForFrame): Ditto.
422         (didFailProvisionalLoadWithErrorForFrame): Ditto.
423         (didCommitLoadForFrame): Ditto.
424         (didFinishLoadForFrame): Ditto.
425         (didFailLoadWithErrorForFrame): Ditto.
426         (canAuthenticateAgainstProtectionSpaceInFrame): Ditto.
427         (didReceiveAuthenticationChallengeInFrame): Ditto.
428         (didStartProgress): Ditto.
429         (didChangeProgress): Ditto.
430         (didFinishProgress): Ditto.
431         (didChangeBackForwardList): Ditto.
432         (processDidCrash): Ditto.
433         (setUpPageLoaderClient): Ditto.
434         (setUpPagePolicyClient): Ditto.
435         * UIProcess/API/Cocoa/WKBrowsingContextGroup.mm:
436         (createWKArray): Ditto.
437         (-[WKBrowsingContextGroup addUserStyleSheet:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:mainFrameOnly:]): Ditto.
438         (-[WKBrowsingContextGroup addUserScript:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:injectionTime:mainFrameOnly:]): Ditto.
439         * UIProcess/API/Cocoa/WKConnection.mm:
440         (didReceiveMessage): Ditto.
441         (didClose): Ditto.
442         (setUpClient): Ditto.
443         * UIProcess/API/Cocoa/WKProcessGroup.mm:
444         (didCreateConnection): Ditto.
445         (getInjectedBundleInitializationUserData): Ditto.
446         (setUpInjectedBundleClient): Ditto.
447         (-[WKProcessGroup _setAllowsSpecificHTTPSCertificate:forHost:]): Ditto.
448         * UIProcess/API/Cocoa/WKProcessPool.mm:
449         (-[WKProcessPool _setAllowsSpecificHTTPSCertificate:forHost:]): Ditto.
450         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
451         (-[WKWebsiteDataStore _setProxyConfiguration:]): Ditto.
452         (-[WKWebsiteDataStore _proxyConfiguration]): Ditto.
453         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
454         (-[_WKThumbnailView _didTakeSnapshot:]): Ditto.
455
456         * UIProcess/API/Cocoa/_WKUserContentFilter.mm: Added a missing include.
457
458         * UIProcess/Authentication/mac/WebCredentialMac.mm:
459         (WebKit::chain): Use __bridge for cast.
460
461         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
462         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory):
463         Use CFBridgingRelease instead of adoptNS.
464         (WebKit::privateBrowsingSession): Use __bridge for cast.
465
466         * UIProcess/Cocoa/WebViewImpl.mm:
467         (WebKit::WebViewImpl::provideDataForPasteboard): Use __bridge for cast.
468         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
469         (WebKit::PluginInfoStore::pluginPathsInDirectory): Ditto.
470         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
471         (WebKit::recursivelyMapIOSurfaceBackingStore): Ditto.
472         * UIProcess/mac/ViewGestureControllerMac.mm:
473         (WebKit::ViewGestureController::beginSwipeGesture): Ditto.
474         * UIProcess/mac/WKFullScreenWindowController.mm:
475         (-[WKFullScreenWindowController enterFullScreen:]): Ditto.
476         * UIProcess/mac/WebPopupMenuProxyMac.mm:
477         (WebKit::WebPopupMenuProxyMac::showPopupMenu): Ditto.
478         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm:
479         (didCreatePage): Ditto.
480         (willDestroyPage): Ditto.
481         (setUpBundleClient): Ditto.
482         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
483         (didStartProvisionalLoadForFrame): Ditto.
484         (didReceiveServerRedirectForProvisionalLoadForFrame): Ditto.
485         (didFinishLoadForFrame): Ditto.
486         (globalObjectIsAvailableForFrame): Ditto.
487         (didRemoveFrameFromHierarchy): Ditto.
488         (didCommitLoadForFrame): Ditto.
489         (didFinishDocumentLoadForFrame): Ditto.
490         (didFailProvisionalLoadWithErrorForFrame): Ditto.
491         (didFailLoadWithErrorForFrame): Ditto.
492         (didSameDocumentNavigationForFrame): Ditto.
493         (didLayoutForFrame): Ditto.
494         (didReachLayoutMilestone): Ditto.
495         (didFirstVisuallyNonEmptyLayoutForFrame): Ditto.
496         (didHandleOnloadEventsForFrame): Ditto.
497         (userAgentForURL): Ditto.
498         (setUpPageLoaderClient): Ditto.
499         (willSendRequestForFrame): Ditto.
500         (didInitiateLoadForResource): Ditto.
501         (didFinishLoadForResource): Ditto.
502         (didFailLoadForResource): Ditto.
503         (setUpResourceLoadClient): Ditto.
504         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
505         (WebKit::InjectedBundle::initialize): Ditto.
506         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
507         (WebKit::NetscapePlugin::popUpContextMenu): Ditto.
508
509         * WebProcess/Plugins/PDF/PDFPlugin.h: Put functions that return NSData inside
510         an #ifdef __OBJC__ and use __bridge for cast.
511
512         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
513         (WebKit::WebDragClient::declareAndWriteDragImage): Use __bridge for cast.
514
515         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
516         (WebKit::PlatformCALayerRemoteCustom::contents const): Added a bridging cast.
517         (WebKit::PlatformCALayerRemoteCustom::setContents): Use __bridge for cast.
518         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
519         (WebKit::TiledCoreAnimationDrawingArea::commitTransientZoom): Ditto.
520         * WebProcess/WebPage/mac/WebPageMac.mm:
521         (WebKit::WebPage::setTopOverhangImage): Ditto.
522         (WebKit::WebPage::setBottomOverhangImage): Ditto.
523
524 2018-06-05  Youenn Fablet  <youenn@apple.com>
525
526         ServiceWorker registration should store any script fetched through importScripts
527         https://bugs.webkit.org/show_bug.cgi?id=182444
528         <rdar://problem/37164835>
529
530         Reviewed by Chris Dumez.
531
532         Add C API to kill storage process.
533         In case a Storage Process is closed or crashed, ensure that all its related service worker processes also exit.
534
535         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
536         * UIProcess/API/C/WKContext.cpp:
537         (WKContextTerminateStorageProcess):
538         * UIProcess/API/C/WKContextPrivate.h:
539         * WebProcess/WebProcess.cpp:
540         (WebKit::WebProcess::webToStorageProcessConnectionClosed):
541         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
542         (WebKit::WebSWContextManagerConnection::setScriptResource):
543         * WebProcess/Storage/WebSWContextManagerConnection.h:
544
545 2018-06-05  Brent Fulgham  <bfulgham@apple.com>
546
547         Revise DEFAULT_EXPERIMENTAL_FEATURES_ENABLED to work properly on Apple builds
548         https://bugs.webkit.org/show_bug.cgi?id=186286
549         <rdar://problem/40782992>
550
551         Reviewed by Dan Bernstein.
552
553         Use the WK_RELOCATABLE_FRAMEWORKS flag (which is always defined for non-production builds)
554         to define ENABLE(EXPERIMENTAL_FEATURES) so that we do not need to manually
555         change this flag when preparing for a production release.
556
557         * Configurations/FeatureDefines.xcconfig: Use WK_RELOCATABLE_FRAMEWORKS to determine whether
558         experimental features should be enabled, and use it to properly define the feature flag.
559         * Shared/WebPreferencesDefaultValues.h:
560
561 2018-06-04  Chris Dumez  <cdumez@apple.com>
562
563         Rename "Cross-Origin-Options" HTTP header to "Cross-Origin-Window-Policy"
564         https://bugs.webkit.org/show_bug.cgi?id=186287
565         <rdar://problem/40783352>
566
567         Reviewed by Youenn Fablet.
568
569         * Shared/WebPreferences.yaml:
570         * WebProcess/WebPage/WebPage.cpp:
571         (WebKit::WebPage::frameBecameRemote):
572
573 2018-06-04  Dan Bernstein  <mitz@apple.com>
574
575         Restored code signing behavior when WK_USE_RESTRICTED_ENTITLEMENTS isn’t set.
576
577         * Configurations/DebugRelease.xcconfig: Use ad-hoc code signing when
578           WK_USE_RESTRICTED_ENTITLEMENTS isn’t set.
579
580 2018-06-04  Dan Bernstein  <mitz@apple.com>
581
582         Removed a reference to a file that was deleted in r231190.
583
584         * WebKit.xcodeproj/project.pbxproj: Removed the reference to WebProcessShim.xcconfig.
585
586 2018-06-04  Chris Dumez  <cdumez@apple.com>
587
588         Update Fetch code to provide more useful exception messages
589         https://bugs.webkit.org/show_bug.cgi?id=186156
590
591         Reviewed by Youenn Fablet.
592
593         Provide more useful error messages in our Loading / Fetch code.
594
595         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
596         (WebKit::WebSWServerConnection::didFailFetch):
597         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
598         * StorageProcess/StorageProcess.cpp:
599         (WebKit::StorageProcess::didFailFetch):
600         * StorageProcess/StorageProcess.h:
601         * StorageProcess/StorageProcess.messages.in:
602         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
603         (WebKit::ServiceWorkerClientFetch::didFail):
604         (WebKit::ServiceWorkerClientFetch::continueLoadingAfterCheckingResponse):
605         * WebProcess/Storage/ServiceWorkerClientFetch.h:
606         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in:
607         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
608         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish):
609         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
610         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
611
612 2018-06-04  Wenson Hsieh  <wenson_hsieh@apple.com>
613
614         [WebKit on watchOS] Remove all uses of the EXTRA_ZOOM_MODE compiler flag
615         https://bugs.webkit.org/show_bug.cgi?id=186279
616
617         Reviewed by Tim Horton.
618
619         Replaces uses of ENABLE(EXTRA_ZOOM_MODE) with PLATFORM(WATCHOS).
620
621         * Shared/WebPreferencesDefaultValues.h:
622         * UIProcess/API/Cocoa/WKWebView.mm:
623         (-[WKWebView _initializeWithConfiguration:]):
624         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
625         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
626         (-[WKWebViewConfiguration init]):
627         * UIProcess/WebProcessProxy.cpp:
628         * UIProcess/WebProcessProxy.h:
629         * UIProcess/ios/WKContentViewInteraction.h:
630         * UIProcess/ios/WKContentViewInteraction.mm:
631         (-[WKContentView _willStartScrollingOrZooming]):
632         (-[WKContentView _didEndScrollingOrZooming]):
633         (-[WKContentView _startAssistingKeyboard]):
634         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
635         (-[WKContentView _stopAssistingNode]):
636         (-[WKContentView reloadContextViewForPresentedListViewController]):
637         (-[WKContentView _wheelChangedWithEvent:]):
638         (-[WKContentView _simulateTextEntered:]):
639         (-[WKContentView selectFormAccessoryPickerRow:]):
640         (-[WKContentView formInputLabel]):
641         (-[WKContentView setTimePickerValueToHour:minute:]):
642         * UIProcess/ios/WKScrollView.mm:
643         (-[WKScrollView initWithFrame:]):
644         (-[WKScrollView addGestureRecognizer:]):
645         * UIProcess/ios/forms/WKFileUploadPanel.mm:
646         (-[WKFileUploadPanel platformSupportsPickerViewController]):
647         * WebProcess/WebPage/ios/WebPageIOS.mm:
648         (WebKit::WebPage::platformPrefersTextLegibilityBasedZoomScaling const):
649
650 2018-06-04  Jeremy Jones  <jeremyj@apple.com>
651
652         Disable keyboard in fullscreen ios.
653         https://bugs.webkit.org/show_bug.cgi?id=186058
654
655         Reviewed by Jer Noble.
656
657         Disallow keyboard in ios fullscreen. This will still allow select keys useful for playback.
658
659         * UIProcess/WebFullScreenManagerProxy.cpp:
660         (WebKit::WebFullScreenManagerProxy::supportsFullScreen):
661
662 2018-06-04  Youenn Fablet  <youenn@apple.com>
663
664         NetworkCORSPreflightChecker should set the preflight request User-Agent header
665         https://bugs.webkit.org/show_bug.cgi?id=186254
666         <rdar://problem/40293504>
667
668         Reviewed by Chris Dumez.
669
670         Some servers misbehave if the User-Agent header is not set properly on preflight requests.
671         Set it to the same value as the request triggering the preflight.
672
673         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
674         (WebKit::NetworkCORSPreflightChecker::startPreflight):
675         * NetworkProcess/NetworkCORSPreflightChecker.h:
676         * NetworkProcess/NetworkLoadChecker.cpp:
677         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
678
679 2018-06-03  Andy Estes  <aestes@apple.com>
680
681         [Wi-Fi Assertions] Resume assertions when NetworkProcess::cancelPrepareToSuspend is called
682         https://bugs.webkit.org/show_bug.cgi?id=186247
683
684         Reviewed by Tim Horton.
685
686         Since we suspended assertions in prepareToSuspend, we need to resume them if
687         cancelPrepareToSuspend is called.
688
689         * NetworkProcess/NetworkProcess.cpp:
690         (WebKit::NetworkProcess::cancelPrepareToSuspend):
691
692 2018-06-03  Andy Estes  <aestes@apple.com>
693
694         [iOS] Add a needed networking process entitlement
695         https://bugs.webkit.org/show_bug.cgi?id=186246
696         <rdar://problem/39578861>
697
698         Reviewed by Brent Fulgham.
699
700         Also sorted the existing entitlements.
701
702         * Configurations/Network-iOS.entitlements:
703
704 2018-06-03  Brent Fulgham  <bfulgham@apple.com>
705
706         Make sure that the fencePort received over IPC has the expected disposition (SEND)
707         https://bugs.webkit.org/show_bug.cgi?id=186211
708         <rdar://problem/37814171>
709
710         Reviewed by Geoffrey Garen.
711
712         It is possible (though very unlikely) for a message to be recevied that has the wrong mach port disposition.
713         If this happens, we shouldn't manipulate the passed mach_port_t or pass it on to other API. We already
714         drop messages that violate this expectation in the IPC layer, but code handling IPC::Attachment data types
715         are not checking this value.
716
717         * WebProcess/WebPage/WebPage.cpp:
718         (WebKit::WebPage::setTopContentInsetFenced):
719         * WebProcess/cocoa/VideoFullscreenManager.mm:
720         (WebKit::VideoFullscreenManager::setVideoLayerFrameFenced):
721
722 2018-06-02  Chris Dumez  <cdumez@apple.com>
723
724         Unreviewed, rolling out r232275.
725
726         May have caused a ~1% PLT regression on iOS
727
728         Reverted changeset:
729
730         "Store 0-lifetime stylesheets / scripts into the disk cache
731         for faster history navigations"
732         https://bugs.webkit.org/show_bug.cgi?id=186060
733         https://trac.webkit.org/changeset/232275
734
735 2018-06-02  Jeremy Jones  <jeremyj@apple.com>
736
737         Make WKWebView firstResponder after entering or exiting fullscreen.
738         https://bugs.webkit.org/show_bug.cgi?id=186088
739         rdar://problem/40387859
740
741         Reviewed by Jer Noble.
742
743         Update first responder when WKWebView moves to a new window, otherwise there won't be a first responder.
744
745         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
746         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
747         (-[WKFullScreenWindowController _completedExitFullScreen]):
748
749 2018-06-02  Jeremy Jones  <jeremyj@apple.com>
750
751         Exit fullscreen when javascript alerts are presented.
752         https://bugs.webkit.org/show_bug.cgi?id=185619
753         rdar://problem/35724264
754
755         Reviewed by Jer Noble.
756
757         Prevent users from being trapped in fullscreen by alert cycles.
758         Prevent fullscreen from becoming unresponsive due to alerts hidden behind fullscreen.
759
760         Fullscreen exit is initiated here in the UI process so that fullscreen UI is torn down immediately,
761         before the alert is shown.
762
763         * UIProcess/WebPageProxy.cpp:
764         (WebKit::WebPageProxy::exitFullscreenImmediately):
765         (WebKit::WebPageProxy::runJavaScriptAlert):
766         (WebKit::WebPageProxy::runJavaScriptConfirm):
767         (WebKit::WebPageProxy::runJavaScriptPrompt):
768         * UIProcess/WebPageProxy.h:
769
770 2018-06-02  Youenn Fablet  <youenn@apple.com>
771
772         Add a sandbox profile for com.cisco.webex.plugin.gpc64 plugin
773         https://bugs.webkit.org/show_bug.cgi?id=186110
774
775         Reviewed by Brent Fulgham.
776
777         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: Webex needs to create some symlinks.
778         * Resources/PlugInSandboxProfiles/com.cisco.webex.plugin.gpc64.sb: Added.
779         * WebKit.xcodeproj/project.pbxproj:
780
781 2018-06-01  Wenson Hsieh  <wenson_hsieh@apple.com>
782
783         [Extra zoom mode] The user should always be able to double tap to zoom to a scale of at least 1
784         https://bugs.webkit.org/show_bug.cgi?id=186209
785         <rdar://problem/40529255>
786
787         Reviewed by Tim Horton.
788
789         Tweaks the way double-tap-to-zoom scales are determined in extra zoom mode. Rather than zooming to make the 50th
790         and 90th percentiles of text in the document legible, only consider the 90th percentile of text size when
791         determining zoom scale, and fix the other potential zoom scale at 1; additionally, if the zoom scales are close
792         (within 0.3 of each other), snap the lower zoom scale to the higher value.
793
794         This results in the following changes in behavior:
795         -   Enables double tap to zoom in cases where all the text in the page is already legible.
796         -   On pages with mobile viewports, usually allows the user to toggle between initial scale and a scale of 1.
797         -   If a significant portion of text is unusually small, the zoomed-in scale may exceed 1.
798
799         Test: fast/events/extrazoom/double-tap-to-zoom-with-large-text.html
800
801         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
802         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
803         (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
804
805 2018-06-01  Jeremy Jones  <jeremyj@apple.com>
806
807         Keyboard focus should exit fullscreen.
808         https://bugs.webkit.org/show_bug.cgi?id=185617
809         rdar://problem/34697938
810
811         Reviewed by Ryosuke Niwa.
812
813         While in element fullscreen, initiating keyboard focus should exit fullscreen in iOS.
814
815         * WebProcess/WebPage/WebPage.cpp:
816         (WebKit::WebPage::elementDidFocus):
817
818 2018-06-01  Chris Dumez  <cdumez@apple.com>
819
820         Regression(r230567): Unable to log into twitter.com in private sessions
821         https://bugs.webkit.org/show_bug.cgi?id=186205
822         <rdar://problem/40670799>
823
824         Reviewed by Youenn Fablet.
825
826         We were using the same SWServer for all private sessions and the SWServer's sessionID would
827         be legacyPrivateSessionID(). As a result, the service worker's sessionID would be legacyPrivateSessionID()
828         as well and would not match the sessionID of its client pages. This sessionID mismatch was 
829         causing the breakage.
830
831         Instead of using the same SWServer of all private sessions, we now go back to using a SWServer
832         per private session. However, we now make sure that the SWServer gets destroyed whenever its
833         corresponding session gets destroyed.
834
835         * NetworkProcess/NetworkProcess.cpp:
836         (WebKit::NetworkProcess::destroySession):
837         * NetworkProcess/cache/CacheStorageEngine.cpp:
838         (WebKit::CacheStorage::Engine::from):
839         * StorageProcess/StorageProcess.cpp:
840         (WebKit::StorageProcess::destroySession):
841         (WebKit::StorageProcess::swServerForSession):
842         * StorageProcess/StorageProcess.h:
843         * StorageProcess/StorageProcess.messages.in:
844         * UIProcess/WebProcessPool.cpp:
845         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
846         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
847         (WebKit::WebsiteDataStore::~WebsiteDataStore):
848
849         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
850         * UIProcess/WebsiteData/WebsiteDataStore.h:
851         (WebKit::WebsiteDataStore::weakPtrFactory const):
852         Fix memory leak caused by a reference cycle between the WebsiteDataStore and its
853         WebResourceLoadStatisticsStore, by using WeakPtr to break the cycle. This was causing
854         us to leak WebsiteDataStore objects, which would prevent the destruction of sessions.
855
856
857 2018-06-01  Youenn Fablet  <youenn@apple.com>
858
859         Add an option to restrict communication to localhost sockets
860         https://bugs.webkit.org/show_bug.cgi?id=186208
861
862         Reviewed by Eric Carlson.
863
864         Implement restriction to localhost sockets by setting any IP address to 127.0.0.1.
865         This is done on WebProcess side just before requesting to open the socket by NetworkProcess.
866
867         * WebProcess/Network/webrtc/LibWebRTCNetwork.h:
868         (WebKit::LibWebRTCNetwork::disableNonLocalhostConnections):
869         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
870         (WebKit::LibWebRTCProvider::disableNonLocalhostConnections):
871         (WebKit::LibWebRTCProvider::registerMDNSName):
872         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
873         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
874         (WebKit::prepareSocketAddress):
875         (WebKit::LibWebRTCSocketFactory::CreateServerTcpSocket):
876         (WebKit::LibWebRTCSocketFactory::CreateUdpSocket):
877         (WebKit::LibWebRTCSocketFactory::CreateClientTcpSocket):
878         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
879
880 2018-06-01  Chris Dumez  <cdumez@apple.com>
881
882         Regression(r230876): Swipe navigation snapshot may get removed too early
883         https://bugs.webkit.org/show_bug.cgi?id=186168
884         <rdar://problem/39743617>
885
886         Reviewed by Tim Horton.
887
888         The swipe navigation snapshot would get removed too early when receiving a paint
889         event after requesting a history navigation but before the provisional load has
890         actually started. This is because of the asynchronous navigation policy decision
891         which occurs after requesting to navigate. To address the issue, we now start
892         listening for events only after the provisional load has started.
893
894         * UIProcess/API/Cocoa/WKWebView.mm:
895         (-[WKWebView _didStartProvisionalLoadForMainFrame]):
896         * UIProcess/API/Cocoa/WKWebViewInternal.h:
897         * UIProcess/Cocoa/ViewGestureController.cpp:
898         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
899         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
900         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
901         * UIProcess/Cocoa/ViewGestureController.h:
902         * UIProcess/ios/PageClientImplIOS.mm:
903         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame):
904         * UIProcess/ios/ViewGestureControllerIOS.mm:
905         (WebKit::ViewGestureController::endSwipeGesture):
906         * UIProcess/mac/PageClientImplMac.h:
907         * UIProcess/mac/PageClientImplMac.mm:
908         (WebKit::PageClientImpl::didStartProvisionalLoadForMainFrame):
909         * UIProcess/mac/ViewGestureControllerMac.mm:
910         (WebKit::ViewGestureController::endSwipeGesture):
911
912 2018-06-01  Jiewen Tan  <jiewen_tan@apple.com>
913
914         Unreviewed, build fix for r232276.
915
916         iOS sandbox profiles don't preprocess macros. Therefore, remove the whole
917         macro condition block.
918
919         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
920
921 2018-06-01  Sihui Liu  <sihui_liu@apple.com>
922
923         Stop using StorageTracker.db in LocalStorageDatabaseTracker
924         https://bugs.webkit.org/show_bug.cgi?id=186104
925
926         Reviewed by Geoffrey Garen.
927
928         Stop using StorageTracker.db and stop caching origins in LocalStorageDatabaseTracker for efficiency 
929         and simplicity. Since functions in LocalStorageDatabaseTracker are not frequently called, we get 
930         little benefits from caching origins.
931
932         * Platform/Logging.h:
933         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
934         (WKKeyValueStorageManagerGetStorageDetailsByOrigin):
935         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
936         (WebKit::LocalStorageDatabaseTracker::LocalStorageDatabaseTracker):
937         (WebKit::LocalStorageDatabaseTracker::didOpenDatabaseWithOrigin):
938         (WebKit::LocalStorageDatabaseTracker::deleteDatabaseWithOrigin):
939         (WebKit::LocalStorageDatabaseTracker::deleteAllDatabases):
940         (WebKit::LocalStorageDatabaseTracker::databasesModifiedSince):
941         (WebKit::LocalStorageDatabaseTracker::origins const):
942         (WebKit::LocalStorageDatabaseTracker::originDetails):
943         (WebKit::LocalStorageDatabaseTracker::databasePath const):
944         (WebKit::fileCreationTime): Deleted.
945         (WebKit::fileModificationTime): Deleted.
946         (WebKit::LocalStorageDatabaseTracker::trackerDatabasePath const): Deleted.
947         (WebKit::LocalStorageDatabaseTracker::openTrackerDatabase): Deleted.
948         (WebKit::LocalStorageDatabaseTracker::importOriginIdentifiers): Deleted.
949         (WebKit::LocalStorageDatabaseTracker::updateTrackerDatabaseFromLocalStorageDatabaseFiles): Deleted.
950         (WebKit::LocalStorageDatabaseTracker::addDatabaseWithOriginIdentifier): Deleted.
951         (WebKit::LocalStorageDatabaseTracker::removeDatabaseWithOriginIdentifier): Deleted.
952         (WebKit::LocalStorageDatabaseTracker::pathForDatabaseWithOriginIdentifier): Deleted.
953         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
954         * UIProcess/WebStorage/StorageManager.h:
955
956 2018-06-01  Michael Catanzaro  <mcatanzaro@igalia.com>
957
958         [GTK] Crash in WebKitFaviconDatabase when pageURL is unset
959         https://bugs.webkit.org/show_bug.cgi?id=186164
960
961         Reviewed by Carlos Garcia Campos.
962
963         PageURL can legitimately be null here if JavaScript does something silly with window.open.
964
965         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
966         (webkitFaviconDatabaseSetIconURLForPageURL):
967         (webkitFaviconDatabaseSetIconForPageURL):
968
969 2018-05-31  Brian Burg  <bburg@apple.com>
970
971         [Cocoa] Web Automation: use the session delegate to perform window maximize
972         https://bugs.webkit.org/show_bug.cgi?id=186167
973         <rdar://problem/40544391>
974
975         Reviewed by Timothy Hatcher.
976
977         Add plumbing to hand off window maximizing to the session delegate.
978
979         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
980         * UIProcess/Cocoa/AutomationSessionClient.h:
981         * UIProcess/Cocoa/AutomationSessionClient.mm:
982         (WebKit::AutomationSessionClient::AutomationSessionClient):
983         (WebKit::AutomationSessionClient::requestMaximizeWindowOfPage):
984
985 2018-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
986
987         Unreviewed. Try to fix GTK+ build with old versions of GTK+ after r232390.
988
989         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
990         (WebKit::WebPopupMenuProxyGtk::showPopupMenu):
991
992 2018-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
993
994         [GTK] Switch to use a popup window with a tree view instead of a menu for option menu default implementation
995         https://bugs.webkit.org/show_bug.cgi?id=186146
996
997         Reviewed by Michael Catanzaro.
998
999         It's more convenient to use than the menu.
1000
1001         * UIProcess/API/gtk/WebKitPopupMenu.cpp:
1002         (WebKit::menuCloseCallback):
1003         (WebKit::WebKitPopupMenu::activateItem):
1004         * UIProcess/API/gtk/WebKitPopupMenu.h:
1005         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
1006         (WebKit::WebPopupMenuProxyGtk::WebPopupMenuProxyGtk):
1007         (WebKit::WebPopupMenuProxyGtk::selectItem):
1008         (WebKit::WebPopupMenuProxyGtk::activateItem):
1009         (WebKit::WebPopupMenuProxyGtk::activateItemAtPath):
1010         (WebKit::WebPopupMenuProxyGtk::treeViewRowActivatedCallback):
1011         (WebKit::WebPopupMenuProxyGtk::treeViewButtonReleaseEventCallback):
1012         (WebKit::WebPopupMenuProxyGtk::buttonPressEventCallback):
1013         (WebKit::WebPopupMenuProxyGtk::keyPressEventCallback):
1014         (WebKit::WebPopupMenuProxyGtk::createPopupMenu):
1015         (WebKit::WebPopupMenuProxyGtk::show):
1016         (WebKit::WebPopupMenuProxyGtk::showPopupMenu):
1017         (WebKit::WebPopupMenuProxyGtk::hidePopupMenu):
1018         (WebKit::WebPopupMenuProxyGtk::cancelTracking):
1019         (WebKit::WebPopupMenuProxyGtk::typeAheadFindIndex):
1020         (WebKit::WebPopupMenuProxyGtk::typeAheadFind):
1021         * UIProcess/gtk/WebPopupMenuProxyGtk.h:
1022
1023 2018-05-31  Per Arne Vollan  <pvollan@apple.com>
1024
1025         Add OpenGL display mask to WebPage creation parameters.
1026         https://bugs.webkit.org/show_bug.cgi?id=186163
1027         <rdar://problem/40634504>
1028
1029         Reviewed by Brent Fulgham.
1030
1031         To make sure the OpenGL display mask is always available, include it in the WebPage creation parameters.
1032         The OpenGL display mask is sent to the WebProcess when the platform display ID changes, but that is not
1033         early enough in all cases. If the OpenGL display mask is not set, only OpenGL software rendering is offered
1034         on some hardware configurations.
1035
1036         * Shared/WebPageCreationParameters.cpp:
1037         (WebKit::WebPageCreationParameters::encode const):
1038         (WebKit::WebPageCreationParameters::decode):
1039         * Shared/WebPageCreationParameters.h:
1040         * UIProcess/WebPageProxy.cpp:
1041         (WebKit::WebPageProxy::creationParameters):
1042         * WebProcess/WebPage/WebPage.cpp:
1043         (WebKit::m_credentialsMessenger):
1044
1045 2018-05-31  Brent Fulgham  <bfulgham@apple.com>
1046
1047         Add a rule to allow reading files with prefix /private/var/db/CVMS/cvmsCodeSignObj
1048         https://bugs.webkit.org/show_bug.cgi?id=186157
1049         <rdar://problem/40666437>
1050
1051         Reviewed by Eric Carlson.
1052
1053         * WebProcess/com.apple.WebProcess.sb.in:
1054
1055 2018-05-31  Megan Gardner  <megan_gardner@apple.com>
1056
1057         Add setting to allow override screen size to be disabled.
1058         https://bugs.webkit.org/show_bug.cgi?id=186109
1059
1060         Reviewed by Andy Estes.
1061
1062         Pipe the needed settings through to WebCore.
1063
1064         * Shared/WebPreferences.yaml:
1065         * UIProcess/WebPageProxy.cpp:
1066         (WebKit::m_configurationPreferenceValues):
1067
1068 2018-05-31  Brent Fulgham  <bfulgham@apple.com>
1069
1070         [macOS] Add JIT entitlements to WebContent process and plugin process on macOS
1071         https://bugs.webkit.org/show_bug.cgi?id=184485
1072         <rdar://problem/37556535>
1073
1074         Reviewed by Dan Bernstein.
1075
1076         This patch builds on the changes from Bug 185526 to add support for a JIT entitlement. It makes the
1077         following changes:
1078
1079         1. Adds a new 'WebContent-OSX.entitlements file that unconditionally adds the JIT entitlement for all builds.
1080         2. Modifies the PluginService.entitlements to unconditionally add the JIT entitlement.
1081
1082         * Configurations/PluginService.entitlements: Updated to add the JIT entitlement.
1083         * Configurations/WebContent-OSX.entitlements: Updated to add the JIT entitlement.
1084         * Configurations/WebContentService.xcconfig: Updated to use the new 'WebContent-OSX.entitlements' file.
1085         * WebKit.xcodeproj/project.pbxproj:
1086
1087 2018-05-31  Brent Fulgham  <bfulgham@apple.com>
1088
1089         Don't attempt to extend sandbox when running tests with mock media devices
1090         https://bugs.webkit.org/show_bug.cgi?id=186150
1091         <rdar://problem/40690875>
1092
1093         Reviewed by Alexey Proskuryakov.
1094
1095         Avoid attempting to issue a sandbox extension to actual media devices when
1096         running with Mock capture devices.
1097
1098         Also handle the 'denyNextRequest' test state outside of the USE(APPLE_INTERNAL_SDK)
1099         guards, since it is needed for Open Source builds as well.
1100
1101         * UIProcess/UserMediaProcessManager.cpp:
1102         (WebKit::UserMediaProcessManager::willCreateMediaStream):
1103
1104 2018-05-31  Antti Koivisto  <antti@apple.com>
1105
1106         WebKit memory management: Safari jetsams on some websites when zooming and scrolling
1107         https://bugs.webkit.org/show_bug.cgi?id=186091
1108         <rdar://problem/36315010>
1109
1110         Reviewed by Geoff Garen.
1111
1112         When zooming a page rapidly the visible rect and the page zoom level may get momentarily out of sync.
1113         When this happens we may generate tiles for a much larger area than needed and run out of memory
1114         building the next layer tree transaction. Running out of memory is more likely if the page has lots of
1115         tiled layers in addition to the main content layer.
1116
1117         We already have code for dealing with the scale mismatch for zoom-out case (where this would cause
1118         visibly missing tiles). This patch enables the same exact adjustment for zoom-in case (where the
1119         symptom is creating too many tiles).
1120
1121         * WebProcess/WebPage/ios/WebPageIOS.mm:
1122         (WebKit::adjustExposedRectForNewScale):
1123
1124         Do some renames to make it clear that this can both expand and contract the visible rect.
1125         Bail out if there is nothing to do.
1126
1127         (WebKit::WebPage::updateVisibleContentRects):
1128
1129         Call adjustExposedRectForNewScale directly and unconditionally.
1130
1131         (WebKit::adjustExposedRectForBoundedScale): Deleted.
1132
1133 2018-05-30  Yusuke Suzuki  <utatane.tea@gmail.com>
1134
1135         [JSC] Pass VM& parameter as much as possible
1136         https://bugs.webkit.org/show_bug.cgi?id=186085
1137
1138         Reviewed by Saam Barati.
1139
1140         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
1141         (WebKit::NPJSObject::hasMethod):
1142         (WebKit::NPJSObject::construct):
1143         (WebKit::NPJSObject::invoke):
1144
1145 2018-05-30  Brent Fulgham  <bfulgham@apple.com>
1146
1147         [macOS] WebProcess needs TCC entitlements for media capture (Take 2)
1148         https://bugs.webkit.org/show_bug.cgi?id=185526
1149         <rdar://problem/36674649>
1150
1151         Reviewed by Alexey Proskuryakov.
1152
1153         In Bug 181995 I added TCC entitlements for media capture to the macOS entitlements used for
1154         relocatable builds. These changes also need to apply to system builds of WebKit.
1155
1156         Previously we had not needed an entitlements file for system builds of WebKit, so only provided
1157         an entitlements file for our relocatable build targets. Now we need entitlements when building
1158         on recent macOS targets using internal SDKs.
1159
1160         Since these various scenarios are beginning to multiple, this patch dynamically generates the
1161         entitlements file.
1162
1163         This patch does the following:
1164
1165         1. Changes the "WebContent-OSX.entitlements" to hold the TCC entitlements needed for media capture, and rename
1166            to "WebContent-OSX-restricted.entitlements".
1167         2. Removes the unneeded "com.apple.private.xpc.domain-extension" from WebContent-OSX.entitlement, and dynamically
1168            adds it using a new build step using the script 'process-webcontent-entitlements.sh'
1169         3. Updates DebugRelease.xcconfig to use the 'Safari Engineering' signing key for internal builds.
1170         4. Updates WebContentService.xcconfig to remove the CODE_SIGN_ENTITLEMENTS_OSX_WITH_XPC_DOMAIN_EXTENSION_YES target
1171            since we no longer need a custom entitlement file for this case.
1172         5. Updates WebContentService.Development.xcconfig to remove CODE_SIGN_ENTITLEMENTS_COCOA_TOUCH_NO since it is no
1173            longer needed.
1174         6. Deletes the file Configurations/WebContent.Development.entitlements since it is no longer needed.
1175         7. Revises the WebContent process sandbox to allow camera and microphone access without needing TCC
1176            entitlements, since those cannot be applied without an internal SDK.
1177         8. Revises the UserMediaProcessManager to not pass dynamic sandbox extensions to the WebContent process
1178            when building with the public SDK since those entitlements cannot be added or consumed in Open
1179            Source builds.
1180
1181         We want to use the TCC entitlements when building with the internal SDK on recent macOS builds.
1182
1183         * Configurations/Base.xcconfig:
1184         * Configurations/DebugRelease.xcconfig:
1185         * Configurations/WebContent-OSX-restricted.entitlements: Renamed from Source/WebKit/Configurations/WebContent-OSX.entitlements.
1186         * Configurations/WebContent.Development.entitlements: Removed.
1187         * Configurations/WebContentService.Development.xcconfig:
1188         * Configurations/WebContentService.xcconfig:
1189         * Scripts/process-webcontent-entitlements.sh: Added.
1190         * UIProcess/UserMediaProcessManager.cpp:
1191         (WebKit::UserMediaProcessManager::willCreateMediaStream): Don't bother creating and sending sandbox extensions for
1192         camera and microphone control for builds that cannot support them.
1193         * WebKit.xcodeproj/project.pbxproj:
1194
1195 2018-05-30  Daniel Bates  <dabates@apple.com>
1196
1197         NavigationAction does not need to hold initiating DOM Event
1198         https://bugs.webkit.org/show_bug.cgi?id=185958
1199         <rdar://problem/40531539>
1200
1201         Reviewed by Simon Fraser.
1202
1203         Write in terms of NavigationAction::{keyStateEventData, mouseEventDataForFirstMouseEvent}().
1204
1205         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
1206         (WebKit::mouseButtonForMouseEventData):
1207         (WebKit::syntheticClickTypeForMouseEventData):
1208         (WebKit::clickLocationInRootViewCoordinatesForMouseEventData):
1209         (WebKit::InjectedBundleNavigationAction::modifiersForNavigationAction):
1210         (WebKit::InjectedBundleNavigationAction::mouseButtonForNavigationAction):
1211         (WebKit::InjectedBundleNavigationAction::syntheticClickTypeForNavigationAction):
1212         (WebKit::InjectedBundleNavigationAction::clickLocationInRootViewCoordinatesForNavigationAction):
1213         (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
1214         (WebKit::mouseEventForNavigationAction): Deleted.
1215         (WebKit::mouseButtonForMouseEvent): Deleted.
1216         (WebKit::syntheticClickTypeForMouseEvent): Deleted.
1217         (WebKit::clickLocationInRootViewCoordinatesForMouseEvent): Deleted.
1218
1219 2018-05-30  Andy Estes  <aestes@apple.com>
1220
1221         [Cocoa] Add an SPI to suppress connection termination errors from CFNetwork when network interfaces change
1222         https://bugs.webkit.org/show_bug.cgi?id=186107
1223         <rdar://problem/39338957>
1224
1225         Reviewed by Brady Eidson.
1226
1227         Added an SPI which configures a process pool's networking process to set the
1228         kCFStreamPropertyAutoErrorOnSystemChange to NO on its NSURLSessionConfigurations.
1229         This instructs CFNetwork to not terminate active connections when the system's
1230         network interfaces change.
1231
1232         * NetworkProcess/NetworkProcess.h:
1233         (WebKit::NetworkProcess::suppressesConnectionTerminationOnSystemChange const):
1234         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1235         (WebKit::NetworkProcessCreationParameters::encode const):
1236         (WebKit::NetworkProcessCreationParameters::decode):
1237         * NetworkProcess/NetworkProcessCreationParameters.h:
1238         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1239         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1240         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1241         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1242         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1243         (API::ProcessPoolConfiguration::copy):
1244         * UIProcess/API/APIProcessPoolConfiguration.h:
1245         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1246         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1247         (-[_WKProcessPoolConfiguration suppressesConnectionTerminationOnSystemChange]):
1248         (-[_WKProcessPoolConfiguration setSuppressesConnectionTerminationOnSystemChange:]):
1249         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1250         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1251
1252 2018-05-30  Youenn Fablet  <youenn@apple.com>
1253
1254         Rename FromOrigin runtime flag to CrossOriginResourcePolicy and enable it by default
1255         https://bugs.webkit.org/show_bug.cgi?id=186082
1256
1257         Reviewed by Chris Dumez.
1258
1259         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1260         (WebKit::NetworkResourceLoadParameters::encode const):
1261         (WebKit::NetworkResourceLoadParameters::decode):
1262         * NetworkProcess/NetworkResourceLoadParameters.h:
1263         * Shared/WebPreferences.yaml:
1264         * UIProcess/API/C/WKPreferences.cpp:
1265         (WKPreferencesSetCrossOriginResourcePolicyEnabled):
1266         (WKPreferencesGetCrossOriginResourcePolicyEnabled):
1267         (WKPreferencesSetFromOriginResponseHeaderEnabled): Deleted.
1268         (WKPreferencesGetFromOriginResponseHeaderEnabled): Deleted.
1269         * UIProcess/API/C/WKPreferencesRef.h:
1270         * WebProcess/Network/WebLoaderStrategy.cpp:
1271         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1272
1273 2018-05-30  Youenn Fablet  <youenn@apple.com>
1274
1275         Rename CrossOriginResourcePolicy same to same-origin
1276         https://bugs.webkit.org/show_bug.cgi?id=186080
1277
1278         Reviewed by Chris Dumez.
1279
1280         * NetworkProcess/NetworkLoadChecker.cpp:
1281         (WebKit::NetworkLoadChecker::shouldCrossOriginResourcePolicyPolicyCancelLoad):
1282
1283 2018-05-30  David Kilzer  <ddkilzer@apple.com>
1284
1285         [iOS] -[WKFullScreenViewController viewWillAppear:] should call [super viewWillAppeear:]
1286         <https://webkit.org/b/186103>
1287         <rdar://problem/40655695>
1288
1289         Reviewed by Eric Carlson.
1290
1291         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1292         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
1293         Drive-by clean up.  For consistency, we always use the same
1294         variable in the body of the `if` statement that was used in the
1295         condition.
1296         (-[WKFullScreenViewController viewWillAppear:]): Call
1297         [super viewWillAppeear:] to fulfill API contract.
1298
1299 2018-05-30  Chris Dumez  <cdumez@apple.com>
1300
1301         Take a background process assertion in WebPageProxy::callAfterNextPresentationUpdate()
1302         https://bugs.webkit.org/show_bug.cgi?id=186097
1303         <rdar://problem/40651225>
1304
1305         Reviewed by Dan Bernstein.
1306
1307         Refactor fix landed in r232298 so that we rely on the existing Callback infrastructure
1308         to take a background process assertion.
1309
1310         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1311         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
1312         * UIProcess/WebPageProxy.cpp:
1313         (WebKit::WebPageProxy::callAfterNextPresentationUpdate):
1314
1315 2018-05-30  Aditya Keerthi  <akeerthi@apple.com>
1316
1317         Fix the ENABLE(DATALIST_ELEMENT) build
1318         https://bugs.webkit.org/show_bug.cgi?id=186105
1319
1320         Reviewed by Wenson Hsieh.
1321
1322         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1323
1324 2018-05-30  Jiewen Tan  <jiewen_tan@apple.com>
1325
1326         Unreviewed, a quick build fix for r232276.
1327
1328         Enabled SecItemShim again as it turns out to be useful for CFNetwork APIs that
1329         query Keychains underneath us.
1330
1331         * NetworkProcess/ios/NetworkProcessIOS.mm:
1332         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
1333         * NetworkProcess/mac/NetworkProcessMac.mm:
1334         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
1335
1336 2018-05-30  Jer Noble  <jer.noble@apple.com>
1337
1338         Auto-pip should use main content heuristic.
1339         https://bugs.webkit.org/show_bug.cgi?id=186065
1340         <rdar://problem/35862502>
1341
1342         Reviewed by Eric Carlson.
1343
1344         Make the m_pipStandbyElement clearable, which will allow the auto-pip mechanism to be torn down. Add
1345         a WebProcess-side notification when the main content changes, to facilitate this.
1346
1347         * WebProcess/FullScreen/WebFullScreenManager.cpp:
1348         (WebKit::WebFullScreenManager::videoControlsManagerDidChange):
1349         (WebKit::WebFullScreenManager::setPIPStandbyElement):
1350         (WebKit::WebFullScreenManager::didEnterFullScreen):
1351         (WebKit::WebFullScreenManager::willExitFullScreen):
1352         * WebProcess/FullScreen/WebFullScreenManager.h:
1353         * WebProcess/WebPage/WebPage.cpp:
1354         (WebKit::WebPage::videoControlsManagerDidChange):
1355         * WebProcess/WebPage/WebPage.h:
1356         * WebProcess/cocoa/PlaybackSessionManager.h:
1357         * WebProcess/cocoa/PlaybackSessionManager.mm:
1358         (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager):
1359         (WebKit::PlaybackSessionManager::clearPlaybackControlsManager):
1360         (WebKit::PlaybackSessionManager::currentPlaybackControlsElement const):
1361
1362 2018-05-30  Jer Noble  <jer.noble@apple.com>
1363
1364         Fix a few issues in WKFullScreenViewController
1365         https://bugs.webkit.org/show_bug.cgi?id=186067
1366         <rdar://problem/40630944>
1367
1368         Reviewed by Darin Adler.
1369
1370         The check in setInterface() is checking the wrong pointer:
1371         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1372         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
1373
1374         The check in -_effectiveFullscreenInsetTop is backwards:
1375         (-[WKFullScreenViewController _effectiveFullscreenInsetTop]):
1376
1377 2018-05-30  Chris Dumez  <cdumez@apple.com>
1378
1379         Take a background process assertion in WebPageProxy::callAfterNextPresentationUpdate()
1380         https://bugs.webkit.org/show_bug.cgi?id=186097
1381         <rdar://problem/40651225>
1382
1383         Reviewed by Tim Horton.
1384
1385         Take a background process assertion in WebPageProxy::callAfterNextPresentationUpdate(). Otherwise,
1386         apps may get stuck on _doAfterNextPresentationUpdate because the WebProcess got suspended.
1387
1388         * UIProcess/WebPageProxy.cpp:
1389         (WebKit::WebPageProxy::callAfterNextPresentationUpdate):
1390
1391 2018-05-29  Tim Horton  <timothy_horton@apple.com>
1392
1393         Fix the build
1394         https://bugs.webkit.org/show_bug.cgi?id=186078
1395
1396         Unreviewed build fix.
1397
1398         * UIProcess/API/Cocoa/WKWebView.mm:
1399         (-[WKWebView _denyNextUserMediaRequest]):
1400
1401 2018-05-29  Andy Estes  <aestes@apple.com>
1402
1403         [Wi-Fi Assertions] Track whether WiFiAssertionHolder should actually hold a Wi-Fi assertion
1404         https://bugs.webkit.org/show_bug.cgi?id=185983
1405         <rdar://problem/40205486>
1406
1407         Reviewed by Tim Horton.
1408
1409         * Configurations/Network-iOS.entitlements:
1410
1411         Added a needed entitlement.
1412
1413         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1414         * NetworkProcess/cocoa/WiFiAssertionHolder.h:
1415         (WebKit::WiFiAssertionHolder::shouldHoldWiFiAssertion const):
1416
1417         Track whether WiFiAssertionHolder should actually hold a Wi-Fi assertion.
1418
1419         * NetworkProcess/cocoa/WiFiAssertionHolder.mm: Renamed from Source/WebKit/NetworkProcess/cocoa/WiFiAssertionHolder.cpp.
1420         (holdWiFiAssertion):
1421         (releaseWiFiAssertion):
1422         (WebKit::WiFiAssertionHolder::WiFiAssertionHolder):
1423         (WebKit::WiFiAssertionHolder::~WiFiAssertionHolder):
1424
1425         Changed holdWiFiAssertion() and releaseWiFiAssertion() to take the
1426         WiFiAssertionHolder as an argument.
1427
1428         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1429
1430         Added a needed sandbox extension.
1431
1432         * WebKit.xcodeproj/project.pbxproj:
1433
1434 2018-05-29  Youenn Fablet  <youenn@apple.com>
1435
1436         Add a consistency check between URL and CFURL
1437         https://bugs.webkit.org/show_bug.cgi?id=186057
1438         <rdar://problem/40258457>
1439
1440         Reviewed by Geoff Garen.
1441
1442         * Shared/Cocoa/WKNSURLExtras.mm:
1443         (+[NSURL _web_URLWithWTFString:relativeToURL:]):
1444         (urlWithWTFString): Deleted.
1445         (+[NSURL _web_URLWithWTFString:]): Deleted.
1446
1447 2018-05-29  Alex Christensen  <achristensen@webkit.org>
1448
1449         Remove unused WebPage::dummy
1450         https://bugs.webkit.org/show_bug.cgi?id=186068
1451
1452         Reviewed by Sam Weinig.
1453
1454         * WebProcess/WebPage/WebPage.cpp:
1455         (WebKit::WebPage::dummy): Deleted.
1456         * WebProcess/WebPage/WebPage.h:
1457         * WebProcess/WebPage/WebPage.messages.in:
1458
1459 2018-05-29  Per Arne Vollan  <pvollan@apple.com>
1460
1461         Create typedef for HashMap<PlatformDisplayID, ScreenProperties>
1462         https://bugs.webkit.org/show_bug.cgi?id=186056
1463
1464         Reviewed by Brent Fulgham.
1465
1466         * Shared/WebProcessCreationParameters.cpp:
1467         (WebKit::WebProcessCreationParameters::decode):
1468         * Shared/WebProcessCreationParameters.h:
1469
1470 2018-05-25  Jiewen Tan  <jiewen_tan@apple.com>
1471
1472         Tighten sandbox profiles for Networking Processes to restrict accesses to macOS/iOS Keychains
1473         https://bugs.webkit.org/show_bug.cgi?id=162948
1474         <rdar://problem/40558894>
1475
1476         Reviewed by Brent Fulgham.
1477
1478         The patch conditionally tighten sandbox profiles for Networking Processes to remove Keychain related
1479         permissions and some security permisssions that are not needed. Also it conditionally remove the
1480         Process Privilege for Networking Processes to access Credentials.
1481
1482         In addition, it remove process privilege assertions for SecItemShim as it is supposed to work in processes
1483         that don't have privileges to access Keychains and delegate all operations to UI Process via IPC. Also,
1484         the patch disables SecItemShim for Networking Process conditionally.
1485
1486         * Configurations/Network-iOS.entitlements:
1487         * NetworkProcess/NetworkProcess.cpp:
1488         (WebKit::NetworkProcess::initializeNetworkProcess):
1489         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
1490         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1491         * Shared/mac/SecItemShim.cpp:
1492         (WebKit::sendSecItemRequest):
1493         (WebKit::webSecItemCopyMatching):
1494         (WebKit::webSecItemAdd):
1495         (WebKit::webSecItemUpdate):
1496         (WebKit::webSecItemDelete):
1497         (WebKit::initializeSecItemShim):
1498
1499 2018-05-29  Chris Dumez  <cdumez@apple.com>
1500
1501         Store 0-lifetime stylesheets / scripts into the disk cache for faster history navigations
1502         https://bugs.webkit.org/show_bug.cgi?id=186060
1503         <rdar://problem/40627270>
1504
1505         Reviewed by Geoffrey Garen.
1506
1507         Tweak our storeUnconditionallyForHistoryNavigation logic to match resources whose priority
1508         is High, not just VeryHigh. Per logic in CachedResource::defaultPriorityForResourceType(Type),
1509         This now matches stylesheets and scripts in addition to main resources.
1510
1511         I found that in case of a history navigation to apple.com, a significant number of scripts
1512         and stylesheets had to be loaded from the network because our previous heuristic decided
1513         not to store them (because their priority was not VeryHigh and because their max-age was
1514         0).
1515
1516         * NetworkProcess/cache/NetworkCache.cpp:
1517         (WebKit::NetworkCache::makeStoreDecision):
1518
1519 2018-05-28  Jeff Miller  <jeffm@apple.com>
1520
1521         Expose additional WKMenuItemIdentifier strings
1522         https://bugs.webkit.org/show_bug.cgi?id=186041
1523
1524         Reviewed by Dan Bernstein.
1525
1526         Expose identifiers for media-related menu items.
1527
1528         * UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm:
1529         Define new identifiers.
1530
1531         * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
1532         Declare new identifiers.
1533
1534         * UIProcess/mac/WebContextMenuProxyMac.mm:
1535         (WebKit::menuItemIdentifier):
1536         Map to new identifiers.
1537
1538 2018-05-29  Geoffrey Garen  <ggaren@apple.com>
1539
1540         Removed some unused WebSQL trackers
1541         https://bugs.webkit.org/show_bug.cgi?id=186026
1542
1543         Reviewed by Dan Bernstein.
1544
1545         * NetworkProcess/NetworkProcess.cpp:
1546         (WebKit::NetworkProcess::NetworkProcess):
1547         * NetworkProcess/NetworkProcess.h:
1548         * WebProcess/WebProcess.cpp:
1549         (WebKit::m_nonVisibleProcessCleanupTimer):
1550         (WebKit::m_webSQLiteDatabaseTracker): Deleted.
1551         * WebProcess/WebProcess.h:
1552
1553 2018-05-29  Per Arne Vollan  <pvollan@apple.com>
1554
1555         Follow-up fixes after r228907.
1556         https://bugs.webkit.org/show_bug.cgi?id=183338
1557
1558         Reviewed by Brent Fulgham.
1559
1560         Add screen properties to the WebProcess creation parameters, instead of sending
1561         them in a message to the WebProcess just after starting it up.
1562
1563         * Shared/WebProcessCreationParameters.cpp:
1564         (WebKit::WebProcessCreationParameters::encode const):
1565         (WebKit::WebProcessCreationParameters::decode):
1566         * Shared/WebProcessCreationParameters.h:
1567         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1568         (WebKit::WebProcessPool::platformInitializeWebProcess):
1569         * UIProcess/WebProcessPool.cpp:
1570         (WebKit::WebProcessPool::initializeNewWebProcess):
1571         * WebProcess/cocoa/WebProcessCocoa.mm:
1572         (WebKit::WebProcess::platformInitializeWebProcess):
1573
1574 2018-05-29  Sihui Liu  <sihui_liu@apple.com>
1575
1576         Unable to remove IndexedDB Databases with Cocoa API removeDataOfTypes
1577         https://bugs.webkit.org/show_bug.cgi?id=185835
1578         <rdar://problem/39142257>
1579
1580         Reviewed by Chris Dumez.
1581
1582         Fix a wrong if condition: databases should be closed and deleted if websiteDataTypes contains 
1583         WebsiteDataType::IndexedDBDatabases.
1584
1585         * StorageProcess/StorageProcess.cpp:
1586         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
1587
1588 2018-05-28  Sam Weinig  <sam@webkit.org>
1589
1590         Modernize SVGRenderStyleDefs.h
1591         https://bugs.webkit.org/show_bug.cgi?id=186024
1592
1593         Reviewed by Daniel Bates.
1594
1595         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
1596         (WebKit::applyPropertiesToLayer):
1597         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1598         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
1599         Update for new enum names.
1600
1601 2018-05-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1602
1603         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.3 release.
1604
1605         * gtk/NEWS: Add release notes for 2.21.3.
1606
1607 2018-05-27  Dan Bernstein  <mitz@apple.com>
1608
1609         Reverted the changes made for https://webkit.org/b/186016
1610
1611         They broke the USE(APPLE_INTERNAL_SDK) Sierra build.
1612
1613 2018-05-27  David Kilzer  <ddkilzer@apple.com>
1614
1615         [iOS] Fix warnings about leaks found by clang static analyzer
1616         <https://webkit.org/b/186009>
1617         <rdar://problem/40574267>
1618
1619         Reviewed by Daniel Bates.
1620
1621         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
1622         (WebKit::WebAutomationSession::platformSimulateKeySequence): Fix
1623         leak of two WebEvent objects that happened in a loop.
1624         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
1625         (-[_WKPreviewControllerDelegate previewController:transitionImageForPreviewItem:contentRect:]):
1626         Fix leak of a UIImage.
1627
1628 2018-05-27  Dan Bernstein  <mitz@apple.com>
1629
1630         [Cocoa] Avoid importing directly from subumbrella frameworks
1631         https://bugs.webkit.org/show_bug.cgi?id=186016
1632
1633         Reviewed by Sam Weinig.
1634
1635         * Configurations/BaseTarget.xcconfig: Removed -iframework options from OTHER_CFLAGS and
1636           OTHER_CPLUSPLUSFLAGS.
1637         * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Import Carbon.h instead of an
1638           HIToolbox header.
1639         * UIProcess/Cocoa/WebViewImpl.mm: Ditto.
1640         * UIProcess/mac/WKPrintingView.mm: Import Quartz.h instead of a PDFKit header.
1641         * UIProcess/mac/WKTextInputWindowController.mm: Import Carbon.h instead of an HIToolbox
1642           header.
1643         * WebProcess/Plugins/PDF/PDFAnnotationTextWidgetDetails.h: Import Quartz.h instead of a
1644           PDFKit header.
1645         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h: Ditto.
1646         * WebProcess/Plugins/PDF/PDFPlugin.mm: Ditto.
1647         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: Ditto.
1648         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm: Ditto.
1649         * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm: Ditto.
1650         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: Ditto.
1651         * WebProcess/WebPage/mac/WebPageMac.mm: Ditto.
1652
1653 2018-05-25  Timothy Hatcher  <timothy@apple.com>
1654
1655         Setting drawsBackground to YES on a WKView doesn't take effect immediately
1656         https://bugs.webkit.org/show_bug.cgi?id=185885
1657         rdar://problem/39706506
1658
1659         Reviewed by Simon Fraser.
1660
1661         * UIProcess/API/Cocoa/WKWebView.mm:
1662         (-[WKWebView _initializeWithConfiguration:]): Removed setBackgroundExtendsBeyondPage(true)
1663         since it is now the default.
1664         * UIProcess/Cocoa/WebViewImpl.mm:
1665         (WebKit::WebViewImpl::setDrawsBackground): Make sure updateLayer gets called on the web view
1666         by calling setNeedsDisplay:YES.
1667         (WebKit::WebViewImpl::setBackgroundColor): Ditto.
1668         (WebKit::WebViewImpl::updateLayer): Removed dead code.
1669         * UIProcess/WebPageProxy.h: Make m_backgroundExtendsBeyondPage default to true. WebKit was
1670         always turning this on during WKWebView initializtion, which would cause the scroll
1671         shadow layer to be created, flash black because of no background, then destroyed soon
1672         after once WebKit's message to turn it on got delivered.
1673         * WebProcess/WebPage/WebPage.cpp:
1674         (WebPage::WebPage): Call setBackgroundExtendsBeyondPage earlier to avoid creating the scroll
1675         shadow layer, since backgroundShouldExtendBeyondPage defautls to false in WebCore for WK1.
1676         (WebKit::WebPage::setDrawsBackground): Use updateBackgroundRecursively to propagate the
1677         correct base background color.
1678
1679 2018-05-25  Youenn Fablet  <youenn@apple.com>
1680
1681         Migrate From-Origin to Cross-Origin-Resource-Policy
1682         https://bugs.webkit.org/show_bug.cgi?id=185840
1683
1684         Reviewed by Chris Dumez.
1685
1686         Do Cross-Origin-Resource-Policy (CORP) checks in NetworkLoadChecker instead of NetworkResourceLoader directly.
1687         Make sure CORP only applies to no-cors loads.
1688         Remove ancestor checks and only consider the document origin making the load.
1689         This means that in case of cross-origin redirection to same-origin, the redirection will be CORP-checked,
1690         the final response will not be CORP-checked but will be opaque.
1691
1692         * NetworkProcess/NetworkLoadChecker.cpp:
1693         (WebKit::NetworkLoadChecker::validateCrossOriginResourcePolicyPolicy):
1694         (WebKit::NetworkLoadChecker::validateResponse):
1695         * NetworkProcess/NetworkLoadChecker.h:
1696         * NetworkProcess/NetworkResourceLoader.cpp:
1697         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1698         (WebKit::NetworkResourceLoader::didReceiveResponse):
1699         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
1700         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
1701         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
1702         * NetworkProcess/NetworkResourceLoader.h:
1703         * WebProcess/Network/WebLoaderStrategy.cpp:
1704         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1705         Send ancestor information for navigation loads only.
1706
1707 2018-05-25  Daniel Bates  <dabates@apple.com>
1708
1709         NavigationAction should not hold a strong reference to a Document
1710         https://bugs.webkit.org/show_bug.cgi?id=185712
1711         <rdar://problem/40320916>
1712
1713         Reviewed by Brent Fulgham.
1714
1715         Update code to make use of NavigationAction::requester().
1716
1717         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1718         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1719
1720 2018-05-25  Tim Horton  <timothy_horton@apple.com>
1721
1722         Ensure that the Web Content process doesn't sleep during initialization
1723         https://bugs.webkit.org/show_bug.cgi?id=185975
1724         <rdar://problem/40548159>
1725
1726         Reviewed by Geoffrey Garen.
1727
1728         WebProcessPool::warmInitialProcess isn't worth much (or at least, as much
1729         as it could be) if the Web Content process goes to sleep in the middle
1730         of initializeWebProcess.
1731
1732         Keep the Web Content process alive until it has handled all messages
1733         sent from WebProcessPool::initializeNewWebProcess.
1734
1735         This is a significant speedup on some benchmarks I've been running
1736         that involve prewarming a process long before any content is loaded.
1737
1738         * UIProcess/WebProcessPool.cpp:
1739         (WebKit::WebProcessPool::initializeNewWebProcess):
1740
1741 2018-05-25  Chris Dumez  <cdumez@apple.com>
1742
1743         WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback() unexpectedly constructs a process pool
1744         https://bugs.webkit.org/show_bug.cgi?id=185992
1745
1746         Reviewed by Geoffrey Garen.
1747
1748         Update enableResourceLoadStatisticsAndSetTestingCallback() to pass the right parameter to processPools()
1749         to avoid constructing a process pool when none exist. Also drop the 'resourceLoadStatisticsEnabled'
1750         flag on the WebProcessPool and have it query its data store instead to know if the feature is enabled.
1751
1752         * UIProcess/WebProcessPool.cpp:
1753         (WebKit::WebProcessPool::initializeNewWebProcess):
1754         (WebKit::WebProcessPool::setResourceLoadStatisticsEnabled):
1755         * UIProcess/WebProcessPool.h:
1756         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1757         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
1758
1759 2018-05-25  Chris Dumez  <cdumez@apple.com>
1760
1761         Drop support for NSURLCache in WebKit2
1762         https://bugs.webkit.org/show_bug.cgi?id=185990
1763
1764         Reviewed by Geoffrey Garen.
1765
1766         Drop support for NSURLCache in WebKit2 now that the WebKit network cache is stable.
1767
1768         * NetworkProcess/NetworkProcess.cpp:
1769         (WebKit::NetworkProcess::setCacheModel):
1770         * NetworkProcess/NetworkProcess.h:
1771         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1772         (WebKit::NetworkProcessCreationParameters::encode const):
1773         (WebKit::NetworkProcessCreationParameters::decode):
1774         * NetworkProcess/NetworkProcessCreationParameters.h:
1775         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1776         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1777         (WebKit::NetworkProcess::clearDiskCache):
1778         (WebKit::NetworkProcess::platformSetURLCacheSize): Deleted.
1779         (WebKit::clearNSURLCache): Deleted.
1780         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1781         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1782         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1783         (): Deleted.
1784         (WebKit::NetworkSessionCocoa::setUsesNetworkCache): Deleted.
1785         * NetworkProcess/curl/NetworkProcessCurl.cpp:
1786         (WebKit::NetworkProcess::platformSetURLCacheSize): Deleted.
1787         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1788         (WebKit::NetworkProcess::platformSetURLCacheSize): Deleted.
1789         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1790         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1791         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory):
1792         (WebKit::WebProcessPool::isNetworkCacheEnabled): Deleted.
1793         * UIProcess/WebProcessPool.h:
1794         * WebProcess/WebPage/WebFrame.cpp:
1795         (WebKit::WebFrame::suggestedFilenameForResourceWithURL const):
1796         (WebKit::WebFrame::mimeTypeForResourceWithURL const):
1797         * WebProcess/WebPage/WebPage.cpp:
1798         (WebKit::WebPage::getResourceDataFromFrame):
1799         (WebKit::WebPage::hasLocalDataForURL):
1800         * WebProcess/WebPage/WebPage.h:
1801         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1802         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
1803         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
1804         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
1805         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
1806         * WebProcess/WebPage/ios/WebPageIOS.mm:
1807         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
1808         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
1809         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
1810         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
1811         * WebProcess/WebPage/mac/WebPageMac.mm:
1812         (WebKit::WebPage::accessibilityRemoteObject):
1813         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
1814         (WebKit::cachedResponseForURL): Deleted.
1815         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
1816         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
1817         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
1818         * WebProcess/WebPage/win/WebPageWin.cpp:
1819         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
1820         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
1821         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
1822         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
1823         * WebProcess/WebPage/wpe/WebPageWPE.cpp:
1824         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
1825         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
1826         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
1827         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
1828         * WebProcess/cocoa/WebProcessCocoa.mm:
1829         (WebKit::WebProcess::platformInitializeWebProcess):
1830
1831 2018-05-25  Alex Christensen  <achristensen@webkit.org>
1832
1833         Fix internal iOS builds after r232198
1834         https://bugs.webkit.org/show_bug.cgi?id=185986
1835
1836         * WebProcess/WebPage/ios/WebPageIOS.mm:
1837         (WebKit::WebPage::sendTapHighlightForNodeIfNecessary):
1838
1839 2018-05-25  Alex Christensen  <achristensen@webkit.org>
1840
1841         URL::host should return a StringView to reduce allocations
1842         https://bugs.webkit.org/show_bug.cgi?id=185986
1843
1844         Reviewed by Geoff Garen.
1845
1846         * NetworkProcess/NetworkProcess.cpp:
1847         (WebKit::fetchDiskCacheEntries):
1848         * NetworkProcess/NetworkResourceLoader.cpp:
1849         (WebKit::areFrameAncestorsSameSite):
1850         * NetworkProcess/mac/NetworkProcessMac.mm:
1851         (WebKit::overrideSystemProxies):
1852         * Shared/API/APIURL.h:
1853         (API::URL::host const):
1854         * UIProcess/Automation/WebAutomationSession.cpp:
1855         (WebKit::WebAutomationSession::addSingleCookie):
1856         (WebKit::WebAutomationSession::deleteAllCookies):
1857         * UIProcess/WebProcessProxy.cpp:
1858         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
1859         * WebProcess/Plugins/PluginView.cpp:
1860         (WebKit::PluginView::pluginDidReceiveUserInteraction):
1861         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
1862         (WebKit::WebPluginInfoProvider::populatePluginCache):
1863         * WebProcess/WebPage/WebPage.cpp:
1864         (WebKit::needsHiddenContentEditableQuirk):
1865         (WebKit::needsPlainTextQuirk):
1866         (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
1867
1868 2018-05-25  Adrian Perez de Castro  <aperez@igalia.com>
1869
1870         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.2 release.
1871
1872         * wpe/NEWS: Add release notes for the 2.21.2 release.
1873
1874 2018-05-25  Chris Dumez  <cdumez@apple.com>
1875
1876         Minor ApplicationCacheStorage clean up
1877         https://bugs.webkit.org/show_bug.cgi?id=185984
1878
1879         Reviewed by Youenn Fablet.
1880
1881         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1882         (WebKit::WebsiteDataStore::fetchDataAndApply):
1883         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1884         (WKBundlePageCopyOriginsWithApplicationCache):
1885
1886 2018-05-25  Chris Dumez  <cdumez@apple.com>
1887
1888         Avoid triggering network cache speculative revalidation for loads allowing expired content
1889         https://bugs.webkit.org/show_bug.cgi?id=185985
1890
1891         Reviewed by Antti Koivisto.
1892
1893         Avoid triggering network cache speculative revalidation for loads allowing expired content
1894         (e.g. history loads, restoring pages after crash or safari relaunch). This causes us to do
1895         unnecessary revalidations, it is both wasteful and bad for performance.
1896
1897         * NetworkProcess/cache/NetworkCache.cpp:
1898         (WebKit::NetworkCache::Cache::retrieve):
1899
1900 2018-05-25  David Kilzer  <ddkilzer@apple.com>
1901
1902         Fix issues with -dealloc methods found by clang static analyzer
1903         <https://webkit.org/b/185887>
1904
1905         Reviewed by Joseph Pecoraro.
1906
1907         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Drive-by fix
1908         to use `copy` for `mimeType` property.
1909         (-[_WKPreviewControllerDataSource initWithMIMEType:]): Drive-by
1910         fix to use `instancetype` instead of `id`.  Use -copy for
1911         `mimeType` argument to match property definition.
1912         (-[_WKPreviewControllerDataSource dealloc]): Add.  Release
1913         `_completionHandler` and `_mimeType` to fix leaks.
1914         * UIProcess/ios/WKPasswordView.mm:
1915         (-[WKPasswordView dealloc]): Add.  Release
1916         `_userDidEnterPassword` to fix leak.
1917         * UIProcess/ios/fullscreen/WKFullScreenViewController.h:
1918         Drive-by clean-up to make `location` property `copy` instead of
1919         `retain`.
1920         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1921         (-[WKFullScreenViewController dealloc]): Release `_target` and
1922         `_location` to fix leaks.
1923         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1924         (-[WKFullscreenAnimationController dealloc]): Add.  Release
1925         `_viewController` to fix leak.
1926         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
1927         (@property secondaryMaterialOverlayView): Mark explicitly as
1928         `assign` since this isn't a retained variable.
1929         (@property secondaryMaterialOverlayViewConstraints): Mark
1930         explicitly as `retain` since there is nothing to keep this
1931         object alive.
1932         (+[WKFullscreenStackView secondaryMaterialOverlayView]): Fix
1933         leak by autoreleasing the return value.
1934         (-[WKFullscreenStackView dealloc]): Release retained instance
1935         variables to fix leaks.  Note that `_stackView` and
1936         `_visualEffectView` are internally retained despite their
1937         @property declarations.
1938         (-[WKFullscreenStackView setTargetViewForSecondaryMaterialOverlay:]):
1939         Retain @property targetViewForSecondaryMaterialOverlay to match
1940         its declaration.
1941
1942 2018-05-23  Antoine Quint  <graouts@apple.com>
1943
1944         [Web Animations] Use DEFAULT_EXPERIMENTAL_FEATURES_ENABLED for Web Animations experimental features
1945         https://bugs.webkit.org/show_bug.cgi?id=185919
1946
1947         Reviewed by Dean Jackson.
1948
1949         * Shared/WebPreferences.yaml:
1950
1951 2018-05-24  Dan Bernstein  <mitz@apple.com>
1952
1953         ProcessLauncherMac.mm contains a couple of meaningless #ifndef directives
1954         https://bugs.webkit.org/show_bug.cgi?id=185973
1955
1956         Reviewed by Tim Horton.
1957
1958         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1959         (WebKit::ProcessLauncher::launchProcess): Use #if !ASSERT_DISABLED to guard statements that
1960           are only needed for an assertion, instead of #ifndef _NDEBUG, which is always true.
1961
1962 2018-05-24  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1963
1964         [GTK][WPE] Memory pressure monitor doesn't reliable notify all the subprocesses
1965         https://bugs.webkit.org/show_bug.cgi?id=184261
1966
1967         Reviewed by Carlos Garcia Campos.
1968
1969         On Linux we had two implementations for getting notifications about memory pressure events:
1970         - The memory cgroup (called systemd here).
1971         - The UIProcess memory monitor (which delivered events via a shared eventfd)
1972
1973         The problem with the first is that it was usually not working on a standard machine due to
1974         the special permissions or configurations required for memory cgroups, so the second one
1975         (eventfd) was used as a fall-back in that case.
1976         But this eventfd method is racy with more than one WebKit child process and it wasn't
1977         reliably delivering the notifications.
1978
1979         This patch removes the memory cgroup implementation and modifies the UIProcess memory monitor
1980         to deliver the events via WebKit IPC. This simplifies the code a lot and allows us to have
1981         only one implementation that should work in any Linux machine.
1982
1983         The implementation now also triggers the event with information about the criticalness of it.
1984
1985         Previously a critical event was triggered always at a 95% of pressure.
1986         Now a non-critical one is triggered at 90% and critical remains at a 95%.
1987
1988         Start triggering events early should compensate the fact than triggering the event via WebKit IPC is
1989         a bit slower than doing that via an eventfd (or than listening on the memory cgroup event controller).
1990
1991         The events are delivered to all WebKit childs: WebProcess, NetworkProcess, StorageProcess, PluginProcess.
1992
1993         In the case of the StorageProcess a dummy controller is installed, which currently does nothing,
1994         but leaves a note for a future implementation and at least allows to trigger platformReleaseMemory()
1995         that on Linux/glibc should end calling malloc_trim()
1996
1997         * NetworkProcess/NetworkProcess.cpp:
1998         (WebKit::NetworkProcess::initializeNetworkProcess):
1999         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2000         (WebKit::NetworkProcessCreationParameters::encode const):
2001         (WebKit::NetworkProcessCreationParameters::decode):
2002         * NetworkProcess/NetworkProcessCreationParameters.h:
2003         * PluginProcess/PluginProcess.cpp:
2004         (WebKit::PluginProcess::didReceiveMessage):
2005         (WebKit::PluginProcess::initializePluginProcess):
2006         * Shared/ChildProcess.cpp:
2007         (WebKit::ChildProcess::didReceiveMemoryPressureEvent):
2008         * Shared/ChildProcess.h:
2009         * Shared/ChildProcess.messages.in:
2010         * Shared/Plugins/PluginProcessCreationParameters.cpp:
2011         (WebKit::PluginProcessCreationParameters::encode const):
2012         (WebKit::PluginProcessCreationParameters::decode):
2013         * Shared/Plugins/PluginProcessCreationParameters.h:
2014         * Shared/WebProcessCreationParameters.cpp:
2015         (WebKit::WebProcessCreationParameters::encode const):
2016         (WebKit::WebProcessCreationParameters::decode):
2017         * Shared/WebProcessCreationParameters.h:
2018         * StorageProcess/StorageProcess.cpp:
2019         (WebKit::StorageProcess::initializeProcess):
2020         * UIProcess/Plugins/PluginProcessManager.cpp:
2021         (WebKit::PluginProcessManager::sendMemoryPressureEvent):
2022         * UIProcess/Plugins/PluginProcessManager.h:
2023         * UIProcess/Plugins/PluginProcessProxy.cpp:
2024         (WebKit::PluginProcessProxy::sendMemoryPressureEvent):
2025         (WebKit::PluginProcessProxy::didFinishLaunching):
2026         * UIProcess/Plugins/PluginProcessProxy.h:
2027         * UIProcess/WebProcessPool.cpp:
2028         (WebKit::WebProcessPool::sendMemoryPressureEvent):
2029         (WebKit::WebProcessPool::ensureNetworkProcess):
2030         (WebKit::WebProcessPool::initializeNewWebProcess):
2031         * UIProcess/WebProcessPool.h:
2032         (WebKit::WebProcessPool::sendToStorageProcess):
2033         * UIProcess/linux/MemoryPressureMonitor.cpp:
2034         (WebKit::pollIntervalForUsedMemoryPercentage): Fix equation for calculating the interval percentage.
2035         (WebKit::MemoryPressureMonitor::singleton):
2036         (WebKit::MemoryPressureMonitor::start):
2037         * UIProcess/linux/MemoryPressureMonitor.h:
2038         * WebProcess/WebProcess.cpp:
2039         (WebKit::WebProcess::initializeWebProcess):
2040
2041 2018-05-24  Youenn Fablet  <youenn@apple.com>
2042
2043         Update plugin search path to look for user installed plugins
2044         https://bugs.webkit.org/show_bug.cgi?id=185960
2045
2046         Reviewed by Brent Fulgham.
2047
2048         Now that UIProcess may be sandboxed, the home directory is no longer the user home directory.
2049         Update the path to still look for plugins in the user home directory.
2050
2051         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
2052         (WebKit::PluginInfoStore::pluginsDirectories):
2053
2054 2018-05-24  Jiewen Tan  <jiewen_tan@apple.com>
2055
2056         Adopt SecKeyProxy SPI in certificate based challenge response code
2057         https://bugs.webkit.org/show_bug.cgi?id=185848
2058         <rdar://problem/34586181>
2059
2060         Reviewed by Alex Christensen.
2061
2062         This patch adopts SecKeyProxy SPI in HTTPS client certificate authentication code.
2063         1) SecKeyProxy is a new SPI to relay crypto operations from one process to another. The owner process of the proxy
2064         will behave like a server, and other owners of the SecKeys created from the proxy's endpoints will then behave
2065         like clients. This client-server model allows more restricted sandbox for client processes, and meanwhile permits
2066         them to relay crypto operations to the server process while maintaining the same SecKey interfaces as used for local operations.
2067         2) Because of the client-server model, the server process, i.e. the UI Process in our case, needs to keep the proxy
2068         object alive long enough for the client process, i.e. Network Processes in our case, to finish all operations, and then destroy
2069         the proxy object afterward. The ideal place to hold such a proxy is WebsiteDataStore such that proxies could live with the
2070         corresponding network session.
2071         3) A new class called SecKeyProxyStore is then created to bind the lifetime of SecKeyProxy to the WebsiteDataStore while initializing
2072         it correctly. At the time the authentication process reaches WebPageProxy::didReceiveAuthenticationChallengeProxy where we have
2073         accesses to the WebsiteDataStore, we haven't yet been able to determine the Credential to authenticate the challenge. Therefore, we
2074         have to reserve a place in the WebsiteDataStore ahead and then fill it with the right Credential. That's why SecKeyProxyStore exists.
2075         In WebPageProxy::didReceiveAuthenticationChallengeProxy, we create a strong reference of SecKeyProxyStore which will eventually hold
2076         a strong reference of the SecKeyProxy, and move it to the WebsiteDataStore. We also create a weak reference to SecKeyProxyStore
2077         and move it to the AuthenticationChallenge. In this way, we indirectly bind the lifetime of SecKeyProxy to the WebsiteDataStore through
2078         the strong reference and also we can initialize the proxy through the weak reference while a credential is finally determined.
2079         4) Endpoints of the SecKeyProxy will be passed to the Network Process for creating the 'remote' SecKey. However, those endpoints are
2080         of NSXPCListenerEndpoint type, which can only be passed with xpc connections and are not compatible with our IPC mechanism. In order
2081         to pass endpoints around, this patch reuses the xpc connection that is used to bootstrap Network Processes from the UI Process. To do
2082         so, it sends xpc messages at the place where original IPC messages are sent and overwrites the boostrap listener of the xpc connection
2083         when Network Process is initialized. From the listener, it continues the original authentication code path.
2084         5) Tests, again, are manually covered by tlstestwebkit.org. Noted, the prompting Keychain dialog in macOS should say Safari instead of
2085         "com.apple.WebKit.Networking*" now.
2086
2087         * Shared/AuthenticationManagerCocoa.mm: Added.
2088         (WebKit::AuthenticationManager::initializeConnection):
2089         * Shared/Authentication/cocoa/AuthenticationManager.h:
2090         * Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.h:
2091         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
2092         (WebKit::AuthenticationChallengeProxy::useCredential):
2093         (WebKit::AuthenticationChallengeProxy::setSecKeyProxyStore):
2094         * UIProcess/Authentication/AuthenticationChallengeProxy.h:
2095         * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm: Added.
2096         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc const):
2097         * UIProcess/Authentication/cocoa/SecKeyProxyStore.h: Added.
2098         (WebKit::SecKeyProxyStore::create):
2099         (WebKit::SecKeyProxyStore::isInitialized const):
2100         (WebKit::SecKeyProxyStore::get const):
2101         (WebKit::SecKeyProxyStore::weakPtrFactory const):
2102         * UIProcess/Authentication/cocoa/SecKeyProxyStore.mm: Added.
2103         (WebKit::SecKeyProxyStore::initialize):
2104         * UIProcess/WebPageProxy.cpp:
2105         (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
2106         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2107         (WebKit::WebsiteDataStore::addSecKeyProxyStore):
2108         * UIProcess/WebsiteData/WebsiteDataStore.h:
2109         * WebKit.xcodeproj/project.pbxproj:
2110
2111 2018-05-24  Megan Gardner  <megan_gardner@apple.com>
2112
2113         Fix Issues with Loupe Gesture
2114         https://bugs.webkit.org/show_bug.cgi?id=185926
2115
2116         Reviewed by Tim Horton.
2117
2118         The loupe gesture was not giving us the correct selection in some situations.
2119
2120         * UIProcess/ios/WKContentViewInteraction.mm:
2121         (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]):
2122         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
2123         (-[WKContentView setSelectedTextRange:]):
2124         * WebProcess/WebPage/WebPage.h:
2125         * WebProcess/WebPage/ios/WebPageIOS.mm:
2126         (WebKit::WebPage::selectWithGesture):
2127         (WebKit::WebPage::clearSelection):
2128
2129 2018-05-24  Keith Rollin  <krollin@apple.com>
2130
2131         Don't track resource load milestones in private sessions
2132         https://bugs.webkit.org/show_bug.cgi?id=185828
2133         <rdar://problem/40424197>
2134
2135         Reviewed by Brent Fulgham.
2136
2137         Bug 184838 adds the facility for tracing the beginning and ending of
2138         resources loads and reporting so that historical information can be
2139         gathered to assess the health of the networking stack. Disable this
2140         facility for private browsing sessions.
2141
2142         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2143         (WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
2144         (WebKit::NetworkConnectionToWebProcess::stopTrackingResourceLoad):
2145         * NetworkProcess/NetworkConnectionToWebProcess.h:
2146         * NetworkProcess/NetworkResourceLoader.cpp:
2147         (WebKit::NetworkResourceLoader::start):
2148
2149 2018-05-24  Brent Fulgham  <bfulgham@apple.com>
2150
2151         REGRESSION(r224908): [macOS] Media playback not honoring custom caption styles
2152         https://bugs.webkit.org/show_bug.cgi?id=185955
2153         <rdar://problem/40339278>
2154
2155         Reviewed by Eric Carlson.
2156
2157         In r224908 I removed access to the MediaAccessibility mach port, as well as
2158         read/write access to various preferences associated with that process, as it
2159         was no longer needed by modern WebKit media routines.
2160
2161         Detailed testing reveals that read access is still needed to these preferences
2162         to properly handle custom caption styles.
2163
2164         This patch re-enables access to the media accessibility preferences.
2165
2166         * WebProcess/com.apple.WebProcess.sb.in:
2167
2168 2018-05-24  Brent Fulgham  <bfulgham@apple.com>
2169
2170         REGRESSION(r230269): ASSERTION FAILED: sendRightCount == 1 at ProcessLauncherMac.mm(218)
2171         https://bugs.webkit.org/show_bug.cgi?id=185687
2172         <rdar://problem/39386361>
2173
2174         Reviewed by Brady Eidson.
2175
2176         In r230269 I added an assertion to help identify cases where we were doing bad
2177         bookkeeping in our port send rights. I assumed that because we were adding
2178         one send right, that when we went to close down the connection that we should
2179         have only one send right.
2180         
2181         I have since discovered that this assumption is invalid, and that I should
2182         only be checking that we have AT LEAST ONE send right at the time we attempt
2183         to remove it.
2184
2185         This patch changes the assertion to confirm that we have at least one send
2186         right before we remove the send right.
2187
2188         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2189         (WebKit::ProcessLauncher::launchProcess):
2190
2191 2018-05-24  Chris Dumez  <cdumez@apple.com>
2192
2193         Some of the work in initializeLogChannelsIfNecessary() is unnecessary for release builds
2194         https://bugs.webkit.org/show_bug.cgi?id=185951
2195
2196         Reviewed by Geoffrey Garen.
2197
2198         Some of the work in initializeLogChannelsIfNecessary() is unnecessary for release builds and slows down
2199         launch time. In particular, it is unnecessary to read NSDefaults to figure out which logging channels
2200         should be enabled.
2201
2202         * Platform/foundation/LoggingFoundation.mm:
2203         (WebKit::logLevelString):
2204         * Platform/unix/LoggingUnix.cpp:
2205         (WebKit::logLevelString):
2206         * Platform/win/LoggingWin.cpp:
2207         (WebKit::logLevelString):
2208
2209 2018-05-24  Per Arne Vollan  <pvollan@apple.com>
2210
2211         Crash under WebKit::PluginProxy::destroy()
2212         https://bugs.webkit.org/show_bug.cgi?id=185841
2213         <rdar://problem/39936896>
2214
2215         Reviewed by Brent Fulgham.
2216
2217         A release assert in Connection::sencSync is failing since scripts are not allowed in this context,
2218         and the WebKit process is allowed to process incoming messages while waiting for the sync reply.
2219         In this context, scripts are disallowed in the method Element::addShadowRoot. To make sure the
2220         WebContent process will not wait indefinitely for a reply from the Plugin process, use a timeout
2221         of 1 second when sending the message.
2222
2223         * WebProcess/Plugins/PluginProxy.cpp:
2224         (WebKit::PluginProxy::destroy):
2225
2226 2018-05-24  Carlos Garcia Campos  <cgarcia@igalia.com>
2227
2228         Unreviewed. Fix GTK+ input method unit tests after r232049.
2229
2230         Unit tests don't use a WebPageProxy.
2231
2232         * UIProcess/gtk/InputMethodFilter.cpp:
2233         (WebKit::InputMethodFilter::isViewFocused const):
2234         (WebKit::InputMethodFilter::setEnabled):
2235         * UIProcess/gtk/InputMethodFilter.h:
2236
2237 2018-05-24  Carlos Garcia Campos  <cgarcia@igalia.com>
2238
2239         WebDriver: implement maximize, minimize and fullscreen window commands
2240         https://bugs.webkit.org/show_bug.cgi?id=180398
2241
2242         Reviewed by Brian Burg.
2243
2244         * UIProcess/API/APIAutomationSessionClient.h:
2245         (API::AutomationSessionClient::requestMaximizeWindowOfPage): Added to allow clients maximize the window.
2246         * UIProcess/API/glib/WebKitAutomationSession.cpp:
2247         * UIProcess/API/glib/WebKitWebViewPrivate.h:
2248         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
2249         (WindowStateEvent::WindowStateEvent): Struct to handle window state events.
2250         (WindowStateEvent::~WindowStateEvent): Complete the event.
2251         (WindowStateEvent::complete): Call the completion handler is not called already.
2252         (windowStateEventCallback): Handle window state event changes.
2253         (webkitWebViewMaximizeWindow): Try to maximize the window and wait for the event.
2254         (webkitWebViewMinimizeWindow): Try to minimize the window and wait for the event.
2255         (webkitWebViewRestoreWindow): Try to unmaximize or unminimize the window and wait for the event.
2256         * UIProcess/API/wpe/WebKitWebViewWPE.cpp:
2257         (webkitWebViewMaximizeWindow):
2258         (webkitWebViewMinimizeWindow):
2259         (webkitWebViewRestoreWindow):
2260         * UIProcess/Automation/Automation.json:
2261         * UIProcess/Automation/WebAutomationSession.cpp:
2262         (WebKit::WebAutomationSession::maximizeWindowOfBrowsingContext): Exit fullscreen, restore the window and then
2263         maximize it.
2264         (WebKit::WebAutomationSession::maximizeWindowForPage): Ask the client to maximize the window of page.
2265         * UIProcess/Automation/WebAutomationSession.h:
2266         * UIProcess/Automation/atoms/EnterFullscreen.js:
2267         (enterFullscreen): Return early if fullscreen is disabled or if window is already in fullscreen.
2268
2269 2018-05-23  Eric Carlson  <eric.carlson@apple.com>
2270
2271         Avoid loading AVFoundation to check supported MIME types if possible
2272         https://bugs.webkit.org/show_bug.cgi?id=185839
2273         <rdar://problem/40182010>
2274
2275         Reviewed by Jer Noble.
2276         
2277         * Shared/WebProcessCreationParameters.cpp:
2278         (WebKit::WebProcessCreationParameters::encode const): Encode mediaMIMETypes.
2279         (WebKit::WebProcessCreationParameters::decode): Decode mediaMIMETypes.
2280         * Shared/WebProcessCreationParameters.h:
2281
2282         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2283         (WebKit::mediaTypeCache): Static Vector of media MIME types.
2284         (WebKit::WebProcessProxy::cacheMediaMIMETypes): Cache the type list and pass it to every other
2285         process proxy.
2286         (WebKit::WebProcessProxy::cacheMediaMIMETypesInternal): Cache the type list and pass it to the
2287         web process.
2288         (WebKit::WebProcessProxy::mediaMIMETypes): Return the cached type list.
2289
2290         * UIProcess/WebProcessPool.cpp:
2291         (WebKit::WebProcessPool::initializeNewWebProcess): Set parameters.mediaMIMETypes.
2292
2293         * UIProcess/WebProcessProxy.h:
2294         * UIProcess/WebProcessProxy.messages.in: Add CacheMediaMIMETypes.
2295
2296         * WebProcess/WebProcess.h:
2297         * WebProcess/WebProcess.messages.in: Add SetMediaMIMETypes.
2298
2299         * WebProcess/cocoa/WebProcessCocoa.mm:
2300         (WebKit::WebProcess::platformInitializeWebProcess): Cache the MIME types if the list isn't
2301         empty, else register with AVFoundationMIMETypeCache to be notified when it loads types.
2302         AVFoundationMIMETypeCache to 
2303         (WebKit::WebProcess::platformTerminate): Unregister with AVFoundationMIMETypeCache.
2304         (WebKit::WebProcess::setMediaMIMETypes): Pass list of types to AVFoundationMIMETypeCache.
2305
2306 2018-05-23  Brian Burg  <bburg@apple.com>
2307
2308         Web Automation: disable process swap on navigation when an automation session is active
2309         https://bugs.webkit.org/show_bug.cgi?id=185552
2310
2311         Reviewed by Tim Horton.
2312
2313         * UIProcess/WebProcessPool.cpp:
2314         (WebKit::WebProcessPool::processForNavigationInternal):
2315         This is not intended to work right now. Opt out to avoid crashing
2316         later when a process is deallocated unexpectedly.
2317
2318 2018-05-23  Youenn Fablet  <youenn@apple.com>
2319
2320         NetworkLoadChecker should check cached redirections
2321         https://bugs.webkit.org/show_bug.cgi?id=185849
2322
2323         Reviewed by Chris Dumez.
2324
2325         * NetworkProcess/NetworkLoadChecker.cpp:
2326         (WebKit::NetworkLoadChecker::checkRedirection):
2327         Set the resource error url as done by WebCore SubresourceLoader.
2328         * NetworkProcess/NetworkResourceLoader.cpp:
2329         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2330         Pass the resource request to dispatchWillSendRedirectedRequest now needs it.
2331         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2332         Make sure that m_networkLoad is not null before cancelling it since we might be checking a cached redirection.
2333         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
2334         Ensure the redirect response is coming from the Network before adding it to the cache.
2335         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
2336         Call willSendRedirectedRequest to make sure the cached redirect is validated.
2337         * NetworkProcess/NetworkResourceLoader.h:
2338
2339 2018-05-23  Carlos Garcia Campos  <cgarcia@igalia.com>
2340
2341         [GTK] WebDriver: implement AutomationSessionClient::didDisconnectFromRemote
2342         https://bugs.webkit.org/show_bug.cgi?id=185866
2343
2344         Reviewed by Brian Burg.
2345
2346         To handle the case of the session being closed by the browser, for example in case of a network process
2347         crash. This is currently causing WebDriver tests to timeout in the bot.
2348
2349         * UIProcess/API/glib/WebKitAutomationSession.cpp: Add an implementation of didDisconnectFromRemote() to notify
2350         the WebContext that the session will be closed.
2351         * UIProcess/API/glib/WebKitWebContext.cpp: Remove the automation session when closed.
2352         * UIProcess/API/glib/WebKitWebContextPrivate.h:
2353
2354 2018-05-22  Brent Fulgham  <bfulgham@apple.com>
2355
2356         Close access to "lsopen" for non-UI process
2357         https://bugs.webkit.org/show_bug.cgi?id=185890
2358         <rdar://problem/39686511>
2359
2360         Reviewed by Alexey Proskuryakov.
2361
2362         Close down access to 'lsopen' in the iOS sandboxes. These operations are
2363         performed by the UIProcess on behalf of these helper processes.
2364
2365         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2366         * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb:
2367         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2368
2369 2018-05-22  Dean Jackson  <dino@apple.com>
2370
2371         Optimized path zoom animation needs a valid UIImage and CGRect
2372         https://bugs.webkit.org/show_bug.cgi?id=185883
2373         <rdar://problem/40306056>
2374
2375         Reviewed by Jon Lee.
2376
2377         Take the rectangle that was passed into the ResourceRequest and
2378         use it for the origin of an animation into QuickLook.
2379
2380         * Shared/WebCoreArgumentCoders.cpp:
2381         (IPC::ArgumentCoder<ResourceRequest>::encode):
2382         (IPC::ArgumentCoder<ResourceRequest>::decode):
2383         * UIProcess/Cocoa/DownloadClient.mm:
2384         (WebKit::DownloadClient::didStart):
2385         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2386         (-[_WKPreviewControllerDelegate initWithSystemPreviewController:fromRect:]):
2387         (-[_WKPreviewControllerDelegate presentingViewController]):
2388         (-[_WKPreviewControllerDelegate previewController:frameForPreviewItem:inSourceView:]):
2389         (-[_WKPreviewControllerDelegate previewController:transitionImageForPreviewItem:contentRect:]):
2390         (WebKit::SystemPreviewController::start):
2391         (-[_WKPreviewControllerDelegate initWithSystemPreviewController:]): Deleted.
2392         * UIProcess/Downloads/DownloadProxy.h:
2393         (WebKit::DownloadProxy::systemPreviewDownloadRect const):
2394         * UIProcess/SystemPreviewController.h:
2395         * UIProcess/WebPageProxy.cpp:
2396         (WebKit::WebPageProxy::syncRootViewToScreen):
2397         * UIProcess/WebPageProxy.h:
2398
2399 2018-05-22  Sihui Liu  <sihui_liu@apple.com>
2400
2401         [iOS] TestWebKitAPI.WebKit.WKHTTPCookieStoreWithoutProcessPool fails because cookies use different files with/without processpool
2402         https://bugs.webkit.org/show_bug.cgi?id=185831
2403
2404         Reviewed by Chris Dumez.
2405
2406         Started to use uiProcessCookieStorageIdentifier for iOS: make sure cookies handled without 
2407         processpool would use the same storage file as when processpool exists.
2408
2409         * NetworkProcess/NetworkProcess.h:
2410         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2411         (WebKit::NetworkProcessCreationParameters::encode const):
2412         (WebKit::NetworkProcessCreationParameters::decode):
2413         * NetworkProcess/NetworkProcessCreationParameters.h:
2414         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2415         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2416         * Shared/WebProcessCreationParameters.cpp:
2417         (WebKit::WebProcessCreationParameters::encode const):
2418         (WebKit::WebProcessCreationParameters::decode):
2419         * Shared/WebProcessCreationParameters.h:
2420         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2421         (WebKit::WebProcessPool::platformInitializeWebProcess):
2422         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2423
2424 2018-05-22  Chris Dumez  <cdumez@apple.com>
2425
2426         Regression(AsyncPolicyDelegates): Box.app login Window is blank
2427         https://bugs.webkit.org/show_bug.cgi?id=185832
2428         <rdar://problem/40307871>
2429
2430         Reviewed by Geoffrey Garen.
2431
2432         Moved WeakObjCPtr.h header from WebKit/ to wtf/ so that it can be used in
2433         WebKitLegacy code.
2434
2435         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
2436         * UIProcess/API/Cocoa/WKBrowsingContextControllerInternal.h:
2437         * UIProcess/API/Cocoa/WKConnection.mm:
2438         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
2439         * UIProcess/API/Cocoa/WKProcessGroup.mm:
2440         * UIProcess/API/Cocoa/WKProcessPool.mm:
2441         * UIProcess/API/Cocoa/WKScriptMessage.mm:
2442         * UIProcess/API/Cocoa/WKWebView.mm:
2443         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2444         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
2445         * UIProcess/API/Cocoa/_WKDownload.mm:
2446         * UIProcess/API/Cocoa/_WKElementAction.mm:
2447         * UIProcess/ApplicationStateTracker.h:
2448         * UIProcess/Cocoa/AutomationClient.h:
2449         * UIProcess/Cocoa/AutomationSessionClient.h:
2450         * UIProcess/Cocoa/DiagnosticLoggingClient.h:
2451         * UIProcess/Cocoa/DownloadClient.h:
2452         * UIProcess/Cocoa/FindClient.h:
2453         * UIProcess/Cocoa/FullscreenClient.h:
2454         * UIProcess/Cocoa/IconLoadingDelegate.h:
2455         * UIProcess/Cocoa/NavigationState.h:
2456         * UIProcess/Cocoa/UIDelegate.h:
2457         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2458         * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm:
2459         * UIProcess/Cocoa/WebViewImpl.h:
2460         * UIProcess/ios/ViewGestureControllerIOS.mm:
2461         * UIProcess/ios/WKActionSheetAssistant.mm:
2462         * UIProcess/ios/WKContentViewInteraction.mm:
2463         * UIProcess/ios/WKPDFView.mm:
2464         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
2465         * UIProcess/ios/WKScrollView.mm:
2466         * UIProcess/mac/WKInspectorViewController.mm:
2467         * UIProcess/mac/WKInspectorWKWebView.mm:
2468         * WebKit.xcodeproj/project.pbxproj:
2469         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2470
2471 2018-05-22  Sihui Liu  <sihui_liu@apple.com>
2472
2473         Conversion between SecurityOriginData and DatabaseIdentifier is asymmetric when port is null
2474         https://bugs.webkit.org/show_bug.cgi?id=185715
2475
2476         Reviewed by Geoffrey Garen.
2477
2478         Add getter for origins in WKWebsiteDataRecord for testing.
2479
2480         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
2481         (-[WKWebsiteDataRecord _originsString]):
2482         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
2483
2484
2485 2018-05-22  Brady Eidson  <beidson@apple.com>
2486
2487         Rename the "Web content is visible" process assertion.
2488         https://bugs.webkit.org/show_bug.cgi?id=185878
2489
2490         Reviewed by Chris Dumez.
2491
2492         * UIProcess/ios/ProcessAssertionIOS.mm:
2493         (WebKit::ProcessAssertion::ProcessAssertion):
2494
2495 2018-05-22  Andy Estes  <aestes@apple.com>
2496
2497         [Wi-Fi Assertions] Drop assertions on process suspension
2498         https://bugs.webkit.org/show_bug.cgi?id=185844
2499         <rdar://problem/40352319>
2500
2501         Reviewed by Daniel Bates.
2502
2503         * NetworkProcess/NetworkProcess.cpp:
2504         (WebKit::NetworkProcess::actualPrepareToSuspend):
2505         (WebKit::NetworkProcess::processDidResume):
2506         * NetworkProcess/NetworkProcess.h:
2507         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2508         (WebKit::NetworkProcess::platformPrepareToSuspend):
2509         (WebKit::NetworkProcess::platformProcessDidResume):
2510
2511 2018-05-22  Brent Fulgham  <bfulgham@apple.com>
2512
2513         REGRESSION(r229093): Re-enable Network Extension support in the WebContent process (Take 2)
2514         https://bugs.webkit.org/show_bug.cgi?id=185874
2515         <rdar://problem/40454404>
2516
2517         Reviewed by Eric Carlson.
2518
2519         Add back a necessary XPC connection after locking down the network features in r229093.
2520
2521         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2522         * WebProcess/com.apple.WebProcess.sb.in:
2523
2524 2018-05-22  Ryan Haddad  <ryanhaddad@apple.com>
2525
2526         Unreviewed, rolling out r232052.
2527
2528         Breaks internal builds.
2529
2530         Reverted changeset:
2531
2532         "Use more C++17"
2533         https://bugs.webkit.org/show_bug.cgi?id=185176
2534         https://trac.webkit.org/changeset/232052
2535
2536 2018-05-22  Alberto Garcia  <berto@igalia.com>
2537
2538         [CMake] Properly detect compiler flags, needed libs, and fallbacks for usage of 64-bit atomic operations
2539         https://bugs.webkit.org/show_bug.cgi?id=182622
2540         <rdar://problem/40292317>
2541
2542         Reviewed by Michael Catanzaro.
2543
2544         Move the test to determine whether we need to link against
2545         libatomic to the common file WebKitCompilerFlags.cmake so it can
2546         also be used for JavaScriptCore.
2547
2548         * CMakeLists.txt:
2549
2550 2018-05-22  Michael Catanzaro  <mcatanzaro@igalia.com>
2551
2552         Unreviewed, rolling out r231843.
2553
2554         Broke cross build
2555
2556         Reverted changeset:
2557
2558         "[CMake] Properly detect compiler flags, needed libs, and
2559         fallbacks for usage of 64-bit atomic operations"
2560         https://bugs.webkit.org/show_bug.cgi?id=182622
2561         https://trac.webkit.org/changeset/231843
2562
2563 2018-05-22  Carlos Garcia Campos  <cgarcia@igalia.com>
2564
2565         Crash when loading a SVG image
2566         https://bugs.webkit.org/show_bug.cgi?id=185819
2567
2568         Reviewed by Brent Fulgham.
2569
2570         This is happening in WebLoaderStrategy::scheduleLoad() when getting the value of
2571         FrameLoaderClient::pageID(). SVGImage uses the empty clients for the loader, and
2572         EmptyFrameLoaderClient::pageID() returns std::nullopt. The same happens with the frameID. This changed in
2573         r225934, when pageID() and frameID() were changed to return std::optional, EmptyFrameLoaderClient was updated to
2574         return std::nullopt instead of 0.
2575
2576         * WebProcess/Network/WebLoaderStrategy.cpp:
2577         (WebKit::WebLoaderStrategy::scheduleLoad): Use value_or(0) instead of value() to get pageID and frameID from
2578         FrameLoaderClient.
2579
2580 2018-05-21  Yusuke Suzuki  <utatane.tea@gmail.com>
2581
2582         Use more C++17
2583         https://bugs.webkit.org/show_bug.cgi?id=185176
2584
2585         Reviewed by JF Bastien.
2586
2587         * Configurations/Base.xcconfig:
2588         * DerivedSources.make:
2589
2590 2018-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2591
2592         [GTK][Wayland] UI process crash when closing the window
2593         https://bugs.webkit.org/show_bug.cgi?id=185818
2594
2595         Reviewed by Michael Catanzaro.
2596
2597         This happens when a page containing a text field is loaded but the focus remains in the url bar when the window
2598         is closed. This is because we are sending a notify-in to the IM context, but the focus is still in the URL
2599         bar. That confuses the wayland input method manager that tries to free the text of the web view IM context that has
2600         already been deleted.
2601
2602         * UIProcess/gtk/InputMethodFilter.cpp:
2603         (WebKit::InputMethodFilter::setEnabled): Only send notify-in if the view is actually focused.
2604
2605 2018-05-21  Ryosuke Niwa  <rniwa@webkit.org>
2606
2607         Remove unused and no-op WKContextSetCookieStorageDirectory
2608         https://bugs.webkit.org/show_bug.cgi?id=185857
2609
2610         Reviewed by Youenn Fablet.
2611
2612         Deleted C API which didn't do anything useful, and consequently not used by anyone.
2613
2614         * UIProcess/API/C/WKContext.cpp:
2615         (WKContextSetCookieStorageDirectory): Deleted.
2616         * UIProcess/API/C/WKContextPrivate.h:
2617         * UIProcess/WebProcessPool.h:
2618
2619 2018-05-21  Chris Nardi  <cnardi@chromium.org>
2620
2621         Remove dead exception in MediaList.appendMedium
2622         https://bugs.webkit.org/show_bug.cgi?id=185278
2623
2624         Reviewed by Chris Dumez.
2625
2626         Remove code pertaining to an exception being thrown by appendMedium().
2627
2628         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMediaList.cpp:
2629         (webkit_dom_media_list_append_medium):
2630
2631 2018-05-21  Aditya Keerthi  <akeerthi@apple.com>
2632
2633         [iOS] Click events only fire once when editing
2634         https://bugs.webkit.org/show_bug.cgi?id=185777
2635
2636         Reviewed by Tim Horton.
2637
2638         gestureRecognizerShouldBegin: was returning false for the single tap gesture when a node was being
2639         edited. This is an artifact of how the gesture was previously handled with the text selection assistant.
2640         This condition is now removed, allowing the single tap gesture to go through and correctly propagate the
2641         click event.
2642
2643         Also added an early return to _didGetTapHighlightForRequest: in order to prevent the tap highlight from
2644         being shown when the node is already being assisted.
2645
2646         * UIProcess/ios/WKContentViewInteraction.mm:
2647         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]):
2648         (-[WKContentView gestureRecognizerShouldBegin:]):
2649
2650 2018-05-21  Daniel Bates  <dabates@apple.com>
2651
2652         REGRESSION (r231107): CSP report-only policies are ignored for beacon, importScripts, fetch(), EventSource, and XHR
2653         https://bugs.webkit.org/show_bug.cgi?id=185789
2654         <rdar://problem/40380175>
2655
2656         Reviewed by Andy Estes.
2657
2658         Have NetworkLoadChecker implement the ContentSecurityPolicyClient interface and support logging
2659         console messages, sending CSP reports, and dispatching SecurityPolicyViolation events.
2660
2661         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2662         (WebKit::NetworkConnectionToWebProcess::loadPing):
2663         * NetworkProcess/NetworkLoadChecker.cpp:
2664         (WebKit::NetworkLoadChecker::NetworkLoadChecker): Modified to take a reference to the NetworkConnectionToWebProcess,
2665         the web page ID, the web frame ID, and the resource load identifier. These details are necessary
2666         in order to implement the ContentSecurityPolicyClient interface.
2667         (WebKit::NetworkLoadChecker::isAllowedByContentSecurityPolicy): Added.
2668         (WebKit::NetworkLoadChecker::continueCheckingRequest): Write in terms of isAllowedByContentSecurityPolicy().
2669         (WebKit::NetworkLoadChecker::contentSecurityPolicy): Pass ourself as the client so that we receive
2670         delegate callbacks.
2671         (WebKit::NetworkLoadChecker::addConsoleMessage): Added.
2672         (WebKit::NetworkLoadChecker::sendCSPViolationReport): Added.
2673         (WebKit::NetworkLoadChecker::enqueueSecurityPolicyViolationEvent): Added.
2674         * NetworkProcess/NetworkLoadChecker.h:
2675         * NetworkProcess/NetworkResourceLoader.cpp:
2676         (NetworkResourceLoader::enqueueSecurityPolicyViolationEvent): Added.
2677         * NetworkProcess/NetworkResourceLoader.h:
2678         * NetworkProcess/PingLoad.cpp:
2679         (WebKit::PingLoad::PingLoad): Modified to take a reference to the NetworkConnectionToWebProcess and pass
2680         this through to the NetworkLoadChecker along with the web page ID, web frame ID and resource load identifier.
2681         * NetworkProcess/PingLoad.h:
2682         * WebProcess/WebPage/WebPage.cpp:
2683         (WebKit::WebPage::enqueueSecurityPolicyViolationEvent): Added.
2684         * WebProcess/WebPage/WebPage.h:
2685         * WebProcess/WebPage/WebPage.messages.in: Add message EnqueueSecurityPolicyViolationEvent.
2686
2687 2018-05-21  Brian Burg  <bburg@apple.com>
2688
2689         Web Automation: always return an empty cookie list if document.cookieURL() is empty
2690         https://bugs.webkit.org/show_bug.cgi?id=185838
2691         <rdar://problem/37737526>
2692
2693         Reviewed by Tim Horton.
2694
2695         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2696         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
2697         This crashes in CFNetwork code because an empty cookie URL is not a valid input.
2698         Just return an empty list since there couldn't be any cookies returned.
2699
2700 2018-05-21  Brian Burg  <bburg@apple.com>
2701
2702         Web Automation: terminate the automation session if the network or storage process crashes
2703         https://bugs.webkit.org/show_bug.cgi?id=185827
2704         <rdar://problem/40424020>
2705
2706         Reviewed by Tim Horton.
2707
2708         If one of the processes crashes, the page may be in an undefined state and
2709         automation will fail in unpredictable ways. It's better to just give up immediately.
2710
2711         * UIProcess/WebProcessPool.cpp:
2712         (WebKit::WebProcessPool::networkProcessFailedToLaunch):
2713         (WebKit::WebProcessPool::storageProcessCrashed):
2714
2715 2018-05-21  Sihui Liu  <sihui_liu@apple.com>
2716
2717         Add a diskCacheSizeOverride accessor function on WKContextConfigurationRef
2718         https://bugs.webkit.org/show_bug.cgi?id=185826
2719         <rdar://problem/39732113>
2720
2721         Reviewed by Alex Christensen.
2722
2723         * UIProcess/API/C/WKContextConfigurationRef.cpp:
2724         (WKContextConfigurationDiskCacheSizeOverride):
2725         (WKContextConfigurationSetDiskCacheSizeOverride):
2726         * UIProcess/API/C/WKContextConfigurationRef.h:
2727
2728 2018-05-21  Jer Noble  <jer.noble@apple.com>
2729
2730         Complete fix for enabling modern EME by default
2731         https://bugs.webkit.org/show_bug.cgi?id=185770
2732         <rdar://problem/40368220>
2733
2734         Reviewed by Eric Carlson.
2735
2736         * Configurations/FeatureDefines.xcconfig:
2737
2738 2018-05-21  Sam Weinig  <sam@webkit.org>
2739
2740         Modernize RenderStyleConstants.h - Part 1
2741         https://bugs.webkit.org/show_bug.cgi?id=185809
2742
2743         Reviewed by Yusuke Suzuki.
2744
2745         * WebProcess/WebPage/ios/WebPageIOS.mm:
2746         (WebKit::WebPage::rangeForWebSelectionAtPosition):
2747         (WebKit::WebPage::getPositionInformation):
2748         Update for new enum names.
2749
2750 2018-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2751
2752         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.2 release.
2753
2754         * gtk/NEWS: Add release notes for 2.21.2.
2755
2756 2018-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2757
2758         Unreviewed, rolling out r222967.
2759
2760         It's not ready yet
2761
2762         Reverted changeset:
2763
2764         "[GTK][WPE] Add API to configure and enable resource load
2765         statistics"
2766         https://bugs.webkit.org/show_bug.cgi?id=177943
2767         https://trac.webkit.org/changeset/222967
2768
2769 2018-05-18  Commit Queue  <commit-queue@webkit.org>
2770
2771         Unreviewed, rolling out r231982.
2772         https://bugs.webkit.org/show_bug.cgi?id=185793
2773
2774         Caused layout test failures (Requested by realdawei on
2775         #webkit).
2776
2777         Reverted changeset:
2778
2779         "Complete fix for enabling modern EME by default"
2780         https://bugs.webkit.org/show_bug.cgi?id=185770
2781         https://trac.webkit.org/changeset/231982
2782
2783 2018-05-18  Brian Burg  <bburg@apple.com>
2784
2785         [Cocoa] Add missing nullability annotations to _WKAutomationSessionDelegate
2786         https://bugs.webkit.org/show_bug.cgi?id=185791
2787         <rdar://problem/40279891>
2788
2789         Reviewed by Tim Horton.
2790
2791         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h: If there is no dialog shown,
2792         then the delegate methods to return the dialog text may return a nil NSString.
2793
2794 2018-05-18  Youenn Fablet  <youenn@apple.com>
2795
2796         NetworkLoadChecker should cancel its content extension retrieval task when being destroyed
2797         https://bugs.webkit.org/show_bug.cgi?id=185661
2798         <rdar://problem/39985509>
2799
2800         Reviewed by Chris Dumez.
2801
2802         Make sure that the Content Extension retrieval callback checks that NetworkLoadChecker is alive.
2803         This allows stopping NetworkLoadChecker be ref counted.
2804         This in turns allows NetworkResourceLoader to delete its NetworkLoadChecker when being deleted as well.
2805         By doing so, we simplify the memory management of NetworkResourceLoader and NetworkLoadChecker.
2806
2807         * NetworkProcess/NetworkLoadChecker.cpp:
2808         (WebKit::NetworkLoadChecker::checkRequest):
2809         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
2810         * NetworkProcess/NetworkLoadChecker.h:
2811         (WebKit::NetworkLoadChecker::weakPtrFactory):
2812         * NetworkProcess/NetworkResourceLoader.cpp:
2813         * NetworkProcess/NetworkResourceLoader.h:
2814         * NetworkProcess/PingLoad.cpp:
2815         (WebKit::PingLoad::PingLoad):
2816         * NetworkProcess/PingLoad.h:
2817
2818 2018-05-18  Per Arne Vollan  <pvollan@apple.com>
2819
2820         WebProcess fails to launch
2821         https://bugs.webkit.org/show_bug.cgi?id=185140
2822
2823         Reviewed by Geoffrey Garen.
2824
2825         If the NSApplication runloop is not used in the WebContent process, launchServicesCheckIn() needs to be called
2826         in order for enableSandboxStyleFileQuarantine() to succeed. Determine at runtime if launchServicesCheckIn()
2827         should be called by checking if the NSApplication event loop is running.
2828
2829         * WebProcess/cocoa/WebProcessCocoa.mm:
2830         (WebKit::WebProcess::platformInitializeProcess):
2831
2832 2018-05-18  Jer Noble  <jer.noble@apple.com>
2833
2834         Complete fix for enabling modern EME by default
2835         https://bugs.webkit.org/show_bug.cgi?id=185770
2836         <rdar://problem/40368220>
2837
2838         Reviewed by Eric Carlson.
2839
2840         * Configurations/FeatureDefines.xcconfig:
2841
2842 2018-05-18  Brent Fulgham  <bfulgham@apple.com>
2843
2844         Convert ProcessPrivilege assertions to regular debug-only assertions
2845         https://bugs.webkit.org/show_bug.cgi?id=185775
2846         <rdar://problem/40372286>
2847
2848         Reviewed by Geoffrey Garen.
2849
2850         In Bug 184322 I added a number of RELEASE_ASSERT checks that certain
2851         UI-only calls were not being made in the WebContent process.
2852
2853         Measurements have shown that these RELEASE_ASSERTs have regressed performance
2854         by around 1% on some benchmarks, so we should convert them to normal asserts.
2855
2856         This patch changes the RELEASE_ASSERTs into ASSERTs.
2857
2858         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2859         (WebKit::WebProcessPool::platformInitializeWebProcess):
2860         * UIProcess/Cocoa/WebViewImpl.mm:
2861         (WebKit::WebViewImpl::WebViewImpl):
2862         (WebKit::WebViewImpl::becomeFirstResponder):
2863         (WebKit::WebViewImpl::pluginFocusOrWindowFocusChanged):
2864         (WebKit::WebViewImpl::validateUserInterfaceItem):
2865         (WebKit::WebViewImpl::startSpeaking):
2866         (WebKit::WebViewImpl::stopSpeaking):
2867         (WebKit::applicationFlagsForDrag):
2868         (WebKit::WebViewImpl::doneWithKeyEvent):
2869         * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm:
2870         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
2871         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
2872         (WebKit::PluginProcessProxy::enterFullscreen):
2873         (WebKit::PluginProcessProxy::beginModal):
2874         (WebKit::PluginProcessProxy::endModal):
2875         * UIProcess/mac/DisplayLink.cpp:
2876         (WebKit::DisplayLink::DisplayLink):
2877         (WebKit::DisplayLink::~DisplayLink):
2878         * UIProcess/mac/WebPageProxyMac.mm:
2879         (WebKit::WebPageProxy::getIsSpeaking):
2880         (WebKit::WebPageProxy::speak):
2881         (WebKit::WebPageProxy::stopSpeaking):
2882         (WebKit::WebPageProxy::startDisplayLink):
2883         * UIProcess/mac/WebPopupMenuProxyMac.mm:
2884         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
2885
2886 2018-05-18  Eric Carlson  <eric.carlson@apple.com>
2887
2888         Handle failure to extend sandbox gracefully
2889         https://bugs.webkit.org/show_bug.cgi?id=185779
2890         <rdar://problem/40316349>
2891
2892         Reviewed by Brent Fulgham.
2893
2894         * UIProcess/API/Cocoa/WKWebView.mm:
2895         (-[WKWebView _denyNextUserMediaRequest]): 
2896         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2897
2898         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2899         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): Don't append
2900         the request to m_grantedRequests if it failed.
2901         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess): Deny request if willCreateMediaStream
2902         fails.
2903         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2904
2905         * UIProcess/UserMediaProcessManager.cpp:
2906         (WebKit::UserMediaProcessManager::willCreateMediaStream): Don't try to extend sandbox if
2907         we fail to allocate all necessary handles.
2908         * UIProcess/UserMediaProcessManager.h:
2909         (WebKit::UserMediaProcessManager::denyNextUserMediaRequest): New, for testing.
2910
2911 2018-05-18  Antoine Quint  <graouts@apple.com>
2912
2913         [Web Animations] Turn Web Animations with CSS integration on for test runners
2914         https://bugs.webkit.org/show_bug.cgi?id=184819
2915         <rdar://problem/39597337>
2916
2917         Unreviewed. Rolling out the patch for this bug, it caused some flaky timeouts for animation suspension tests.
2918
2919         * Shared/WebPreferences.yaml:
2920
2921 2018-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2922
2923         [Extra zoom mode] Clearing text fields should dispatch input events of type "deleteContent"
2924         https://bugs.webkit.org/show_bug.cgi?id=185769
2925         <rdar://problem/40368261>
2926
2927         Reviewed by Tim Horton.
2928
2929         When setting the text of the currently focused element to the empty string, just delete the text instead of
2930         pretending to insert an empty string. This mimics deleting content using the delete key on macOS, and fires an
2931         input event with inputType "deleteContent" instead of "insertText".
2932
2933         Test: fast/forms/extrazoom/delete-content-in-text-field.html
2934
2935         * WebProcess/WebPage/WebPage.cpp:
2936         (WebKit::WebPage::setTextAsync):
2937
2938 2018-05-18  Keith Rollin  <krollin@apple.com>
2939
2940         Renamed "trackNetworkActivity" to "tracksResourceLoadMilestones"
2941         https://bugs.webkit.org/show_bug.cgi?id=185523
2942         <rdar://problem/40136361>
2943
2944         Reviewed by Geoffrey Garen.
2945
2946         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2947         (WebKit::networkActivityTrackingEnabled):
2948         * NetworkProcess/NetworkProcess.cpp:
2949         (WebKit::NetworkProcess::initializeNetworkProcess):
2950         * NetworkProcess/NetworkProcess.h:
2951         (WebKit::NetworkProcess::tracksResourceLoadMilestones const):
2952         (WebKit::NetworkProcess::trackNetworkActivity const): Deleted.
2953         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2954         (WebKit::NetworkProcessCreationParameters::encode const):
2955         (WebKit::NetworkProcessCreationParameters::decode):
2956         * NetworkProcess/NetworkProcessCreationParameters.h:
2957         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2958         (API::ProcessPoolConfiguration::copy):
2959         * UIProcess/API/APIProcessPoolConfiguration.h:
2960         * UIProcess/API/C/WKContextConfigurationRef.cpp:
2961         (WKContextConfigurationTracksResourceLoadMilestones):
2962         (WKContextConfigurationSetTracksResourceLoadMilestones):
2963         (WKContextConfigurationTrackNetworkActivity): Deleted.
2964         (WKContextConfigurationSetTrackNetworkActivity): Deleted.
2965         * UIProcess/API/C/WKContextConfigurationRef.h:
2966         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2967         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2968         (-[_WKProcessPoolConfiguration tracksResourceLoadMilestones]):
2969         (-[_WKProcessPoolConfiguration setTracksResourceLoadMilestones:]):
2970         (-[_WKProcessPoolConfiguration trackNetworkActivity]): Deleted.
2971         (-[_WKProcessPoolConfiguration setTrackNetworkActivity:]): Deleted.
2972         * UIProcess/WebProcessPool.cpp:
2973         (WebKit::WebProcessPool::ensureNetworkProcess):
2974
2975 2018-05-18  Chris Dumez  <cdumez@apple.com>
2976
2977         Avoid keeping the frame alive when ref'ing a WindowProxy
2978         https://bugs.webkit.org/show_bug.cgi?id=185737
2979         <rdar://problem/40004666>
2980
2981         Reviewed by Sam Weinig.
2982
2983         * WebProcess/Plugins/PluginView.cpp:
2984         (WebKit::PluginView::windowScriptNPObject):
2985
2986 2018-05-18  Youenn Fablet  <youenn@apple.com>
2987
2988         -Wmemset-elt-size warning in LibWebRTCSocket constructor
2989         https://bugs.webkit.org/show_bug.cgi?id=185555
2990         <rdar://problem/40217250>
2991
2992         Reviewed by Darin Adler.
2993
2994         GetOption implementation was broken in that it was not initializing properly its array of options.
2995         This patch fixes it by using an array of optional<int> which are initialized by default.
2996         When no value is set, we return the error code -1.
2997         In theory, we should go to NetworkProcess to get the actual value.
2998         Since GetOption is not used in practice, we just do this best effort implementation of storing previously set values.
2999
3000         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
3001         (WebKit::LibWebRTCSocket::LibWebRTCSocket):
3002         (WebKit::LibWebRTCSocket::GetOption):
3003         * WebProcess/Network/webrtc/LibWebRTCSocket.h:
3004
3005 2018-05-18  Antoine Quint  <graouts@apple.com>
3006
3007         [Web Animations] Turn Web Animations with CSS integration on for test runners
3008         https://bugs.webkit.org/show_bug.cgi?id=184819
3009         <rdar://problem/39597337>
3010
3011         Reviewed by Jon Lee.
3012
3013         * Shared/WebPreferences.yaml: Leave Web Animations off by default, it's up to clients
3014         to turn it on.
3015
3016 2018-05-18  Fujii Hironori  <Hironori.Fujii@sony.com>
3017
3018         [Curl] Remove unused SystemProxyWin.cpp
3019         https://bugs.webkit.org/show_bug.cgi?id=185224
3020
3021         Reviewed by Antti Koivisto.
3022
3023         SystemProxyWin is not used at the moment. Remove it.
3024
3025         * NetworkProcess/win/SystemProxyWin.cpp: Removed.
3026         * NetworkProcess/win/SystemProxyWin.h: Removed.
3027         * PlatformWin.cmake: Removed SystemProxyWin.cpp.
3028
3029 2018-05-17  Nan Wang  <n_wang@apple.com>
3030
3031         AX: [macOS] Expose the primary screen height through AX API
3032         https://bugs.webkit.org/show_bug.cgi?id=185742
3033
3034         Reviewed by Chris Fleizach.
3035
3036         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
3037         (-[WKAccessibilityWebPageObject accessibilityAttributeNames]):
3038         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
3039
3040 2018-05-17  Alex Christensen  <achristensen@webkit.org>
3041
3042         Use CompletionHandlers for DelayedReplies
3043         https://bugs.webkit.org/show_bug.cgi?id=182269
3044
3045         Reviewed by Youenn Fablet.
3046
3047         DelayedReplies should be a noncopyable, non-refcountable type.  They should be
3048         called once and only once.  This is what CompletionHandlers are for.
3049
3050         No change in behavior.  Just cleaner code.
3051
3052         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3053         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
3054         * NetworkProcess/NetworkConnectionToWebProcess.h:
3055         * NetworkProcess/NetworkResourceLoader.cpp:
3056         (WebKit::NetworkResourceLoader::SynchronousLoadData::SynchronousLoadData):
3057         (WebKit::sendReplyToSynchronousRequest):
3058         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
3059         * NetworkProcess/NetworkResourceLoader.h:
3060         * Platform/IPC/HandleMessage.h:
3061         (IPC::callMemberFunctionImpl):
3062         (IPC::callMemberFunction):
3063         (IPC::handleMessageDelayed):
3064         * PluginProcess/PluginControllerProxy.cpp:
3065         (WebKit::PluginControllerProxy::setInitializationReply):
3066         (WebKit::PluginControllerProxy::takeInitializationReply):
3067         * PluginProcess/PluginControllerProxy.h:
3068         * PluginProcess/WebProcessConnection.cpp:
3069         (WebKit::WebProcessConnection::destroyPlugin):
3070         (WebKit::WebProcessConnection::createPlugin):
3071         (WebKit::WebProcessConnection::createPluginAsynchronously):
3072         * PluginProcess/WebProcessConnection.h:
3073         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
3074         (Messages::WebPage::GetPluginProcessConnection::send):
3075         (Messages::WebPage::TestMultipleAttributes::send):
3076         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::DelayedReply): Deleted.
3077         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::~DelayedReply): Deleted.
3078         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::send): Deleted.
3079         (Messages::WebPage::TestMultipleAttributes::DelayedReply::DelayedReply): Deleted.
3080         (Messages::WebPage::TestMultipleAttributes::DelayedReply::~DelayedReply): Deleted.
3081         (Messages::WebPage::TestMultipleAttributes::DelayedReply::send): Deleted.
3082         * Scripts/webkit/LegacyMessages-expected.h:
3083         * Scripts/webkit/MessageReceiver-expected.cpp:
3084         (Messages::WebPage::GetPluginProcessConnection::send):
3085         (Messages::WebPage::TestMultipleAttributes::send):
3086         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::DelayedReply): Deleted.
3087         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::~DelayedReply): Deleted.
3088         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::send): Deleted.
3089         (Messages::WebPage::TestMultipleAttributes::DelayedReply::DelayedReply): Deleted.
3090         (Messages::WebPage::TestMultipleAttributes::DelayedReply::~DelayedReply): Deleted.
3091         (Messages::WebPage::TestMultipleAttributes::DelayedReply::send): Deleted.
3092         * Scripts/webkit/Messages-expected.h:
3093         * Scripts/webkit/messages.py:
3094         * UIProcess/Network/NetworkProcessProxy.cpp:
3095         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
3096         (WebKit::NetworkProcessProxy::networkProcessCrashed):
3097         (WebKit::NetworkProcessProxy::networkProcessFailedToLaunch):
3098         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
3099         * UIProcess/Network/NetworkProcessProxy.h:
3100         * UIProcess/Plugins/PluginProcessManager.cpp:
3101         (WebKit::PluginProcessManager::getPluginProcessConnection):
3102         * UIProcess/Plugins/PluginProcessManager.h:
3103         * UIProcess/Plugins/PluginProcessProxy.cpp:
3104         (WebKit::PluginProcessProxy::getPluginProcessConnection):
3105         (WebKit::PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch):
3106         (WebKit::PluginProcessProxy::didCreateWebProcessConnection):
3107         * UIProcess/Plugins/PluginProcessProxy.h:
3108         * UIProcess/Storage/StorageProcessProxy.cpp:
3109         (WebKit::StorageProcessProxy::getStorageProcessConnection):
3110         (WebKit::StorageProcessProxy::didClose):
3111         (WebKit::StorageProcessProxy::didCreateStorageToWebProcessConnection):
3112         * UIProcess/Storage/StorageProcessProxy.h:
3113         * UIProcess/WebPageProxy.cpp:
3114         (WebKit::ExceededDatabaseQuotaRecords::createRecord):
3115         (WebKit::WebPageProxy::receivedPolicyDecision):
3116         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
3117         (WebKit::WebPageProxy::createNewPage):
3118         (WebKit::WebPageProxy::runJavaScriptAlert):
3119         (WebKit::WebPageProxy::runJavaScriptConfirm):
3120         (WebKit::WebPageProxy::runJavaScriptPrompt):
3121         (WebKit::WebPageProxy::webGLPolicyForURL):
3122         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
3123         (WebKit::WebPageProxy::getToolbarsAreVisible):
3124         (WebKit::WebPageProxy::getMenuBarIsVisible):
3125         (WebKit::WebPageProxy::getStatusBarIsVisible):
3126         (WebKit::WebPageProxy::getWindowFrame):
3127         (WebKit::WebPageProxy::screenToRootView):
3128         (WebKit::WebPageProxy::rootViewToScreen):
3129         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
3130         (WebKit::WebPageProxy::exceededDatabaseQuota):
3131         (WebKit::WebPageProxy::reachedApplicationCacheOriginQuota):
3132         * UIProcess/WebPageProxy.h:
3133         * UIProcess/WebProcessPool.cpp:
3134         (WebKit::WebProcessPool::networkProcessCrashed):
3135         (WebKit::WebProcessPool::getNetworkProcessConnection):
3136         (WebKit::WebProcessPool::getStorageProcessConnection):
3137         * UIProcess/WebProcessPool.h:
3138         * UIProcess/WebProcessProxy.cpp:
3139         (WebKit::WebProcessProxy::getPluginProcessConnection):
3140         (WebKit::WebProcessProxy::getNetworkProcessConnection):
3141         (WebKit::WebProcessProxy::getStorageProcessConnection):
3142         * UIProcess/WebProcessProxy.h:
3143         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3144         (WebKit::WebSWContextManagerConnection::syncTerminateWorker):
3145         * WebProcess/Storage/WebSWContextManagerConnection.h:
3146         * WebProcess/WebPage/WebPage.h:
3147         * WebProcess/WebPage/ios/WebPageIOS.mm:
3148         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
3149
3150 2018-05-17  Jer Noble  <jer.noble@apple.com>
3151
3152         CRASH in -[WKFullScreenViewController _manager]
3153         https://bugs.webkit.org/show_bug.cgi?id=185745
3154         <rdar://problem/39195241>
3155
3156         Reviewed by Eric Carlson.
3157
3158         Protect against WKFullScreenViewController outliving WKWebView by making its
3159         _webView property weak. Additionally, add a sanity-check RetainPtr where _webView
3160         is referenced multiple times within a function.
3161
3162         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3163         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3164         (-[WKFullScreenWindowController initWithWebView:]):
3165         (-[WKFullScreenWindowController enterFullScreen]):
3166         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
3167         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
3168         (-[WKFullScreenWindowController _completedExitFullScreen]):
3169         (-[WKFullScreenWindowController close]):
3170         (-[WKFullScreenWindowController webViewDidRemoveFromSuperviewWhileInFullscreen]):
3171         (-[WKFullScreenWindowController _exitFullscreenImmediately]):
3172         (-[WKFullScreenWindowController _isSecure]):
3173         (-[WKFullScreenWindowController _serverTrust]):
3174         (-[WKFullScreenWindowController _updateLocationInfo]):
3175         (-[WKFullScreenWindowController _manager]):
3176         (-[WKFullScreenWindowController _startToDismissFullscreenChanged:]):
3177
3178 2018-05-17  Brent Fulgham  <bfulgham@apple.com>
3179
3180         Correct default for StorageAccess API
3181         https://bugs.webkit.org/show_bug.cgi?id=185748
3182         <rdar://problem/40220659>
3183
3184         Reviewed by Dean Jackson.
3185
3186         Flip the default state to 'true' so that the new "sticky" state
3187         for Storage Access API and attributing user interaction for
3188         Storage Access API use is applied by default.
3189
3190         * Shared/WebPreferences.yaml:
3191
3192 2018-05-17  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3193
3194         [WPE] Implement and enable FULLSCREEN_API
3195         https://bugs.webkit.org/show_bug.cgi?id=185676
3196
3197         Reviewed by Žan Doberšek.
3198
3199         Do the initial implementation of FULLSCREEN_API for WPE and
3200         enable the CMake option by default.
3201
3202         Most of the layout tests (55 of 58) are passing and the feature
3203         seems to work fine on different websites that use it.
3204
3205         * UIProcess/API/wpe/PageClientImpl.cpp:
3206         (WebKit::PageClientImpl::fullScreenManagerProxyClient):
3207         (WebKit::PageClientImpl::closeFullScreenManager):
3208         (WebKit::PageClientImpl::isFullScreen):
3209         (WebKit::PageClientImpl::enterFullScreen):
3210         (WebKit::PageClientImpl::exitFullScreen):
3211         (WebKit::PageClientImpl::beganEnterFullScreen):
3212         (WebKit::PageClientImpl::beganExitFullScreen):
3213         * UIProcess/API/wpe/PageClientImpl.h:
3214         * UIProcess/API/wpe/WPEView.h:
3215         (WKWPE::View::isFullScreen):
3216         (WKWPE::View::setFullScreen):
3217
3218 2018-05-17  Jiewen Tan  <jiewen_tan@apple.com>
3219
3220         Convert CertificateInfo into Credential in UI Process instead of Networking Process
3221         https://bugs.webkit.org/show_bug.cgi?id=185662
3222         <rdar://problem/40275561>
3223
3224         Reviewed by Alex Christensen.
3225
3226         Right now we convert CertificateInfo into Credential in the very last stage of client certificate authentication process
3227         when it reaches Networking Process. This patch moves that conversion earlier in UI Process such that we don't have to
3228         pass both Credential and CertificateInfo to Networking Process.
3229
3230         CertificateInfo is only used in macOS for C API specifically. WK2 includes macOS/iOS relies on NSURLCredential/WebCore::Credential
3231         solely. WK2 has already exercised the ability of using WebCore::Credential to do client certficate authentication. This patch therefore
3232         takes advantage of that. It converts CertficateInfo objects into Credential objects right after WebCredential is initialized, and then merge
3233         any code paths that utilizes CertficateInfo into ones that uses WebCore::Credential.
3234
3235         Covered by existing tests.
3236
3237         * Shared/Authentication/AuthenticationManager.cpp:
3238         (WebKit::AuthenticationManager::useCredentialForChallenge):
3239         (WebKit::AuthenticationManager::useCredentialForSingleChallenge):
3240         (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge): Deleted.
3241         * Shared/Authentication/AuthenticationManager.h:
3242         * Shared/Authentication/AuthenticationManager.messages.in:
3243         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
3244         (WebKit::AuthenticationChallengeProxy::useCredential):
3245         * UIProcess/Authentication/WebCredential.cpp:
3246         (WebKit::WebCredential::WebCredential):
3247         (WebKit::WebCredential::certificateInfo): Deleted.
3248         * UIProcess/Authentication/WebCredential.h:
3249         (WebKit::WebCredential::create):
3250         * UIProcess/Authentication/mac/WebCredentialMac.mm: Renamed from Source/WebKit/Shared/Authentication/mac/AuthenticationManager.mac.mm.
3251         (WebKit::leafCertificate):
3252         (WebKit::chain):
3253         (WebKit::WebCredential::WebCredential):
3254         * WebKit.xcodeproj/project.pbxproj:
3255
3256 2018-05-17  Jeremy Jones  <jeremyj@apple.com>
3257
3258         Ensure valid rects for fullsceen animation.
3259         https://bugs.webkit.org/show_bug.cgi?id=185736
3260         rdar://problem/40320174
3261
3262         Reviewed by Jer Noble.
3263
3264         Protect against zero width and height since those can make for NANs in the animation transforms.
3265
3266         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3267         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
3268         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
3269
3270 2018-05-17  Jer Noble  <jer.noble@apple.com>
3271
3272         Turn Modern EME API on by default and remove it as an experimental feature
3273         https://bugs.webkit.org/show_bug.cgi?id=185693
3274         <rdar://problem/39954396>
3275
3276         Reviewed by Eric Carlson.
3277
3278         * Shared/WebPreferences.yaml:
3279
3280 2018-05-17  Dean Jackson  <dino@apple.com>
3281
3282         Safari optimized flow should be releasing viewer to prevent memory growth with subsequent launches/closes
3283         https://bugs.webkit.org/show_bug.cgi?id=185722
3284         <rdar://problem/40247351>
3285
3286         Reviewed by Antoine Quint.
3287
3288         I made a rookie mistake in the original patch: I was holding a strong
3289         reference to "self" in a block, which was causing a retain cycle.
3290         Replace that with a WeakObjCPtr.
3291
3292         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
3293         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
3294
3295 2018-05-16  Brent Fulgham  <bfulgham@apple.com>
3296
3297         REGRESSION(r229093)[macOS] Allow network-outbound for syslog use
3298         https://bugs.webkit.org/show_bug.cgi?id=185703
3299         <rdar://problem/39778918>
3300
3301         Reviewed by Eric Carlson.
3302
3303         In r229093 I removed the 'network-outbound' permission for syslog use.
3304         Further testing has shown that this is still needed for subsystem
3305         logging in our bundle loading code.
3306
3307         This patch re-enabled network-outbound for syslog.
3308
3309         * WebProcess/com.apple.WebProcess.sb.in:
3310
3311 2018-05-16  Andy VanWagoner  <andy@vanwagoner.family>
3312
3313         Add support for Intl NumberFormat formatToParts
3314         https://bugs.webkit.org/show_bug.cgi?id=185375
3315
3316         Reviewed by Yusuke Suzuki.
3317
3318         Add flag for NumberFormat formatToParts.
3319
3320         * Configurations/FeatureDefines.xcconfig:
3321
3322 2018-05-16  Andy Estes  <aestes@apple.com>
3323
3324         [Wi-Fi Assertions] Adopt WiFiAssertionHolderAdditions
3325         https://bugs.webkit.org/show_bug.cgi?id=185685
3326         <rdar://problem/40136681>
3327
3328         Reviewed by Sam Weinig.
3329
3330         * NetworkProcess/cocoa/WiFiAssertionHolder.cpp:
3331         (WebKit::WiFiAssertionHolder::WiFiAssertionHolder):
3332         (WebKit::WiFiAssertionHolder::~WiFiAssertionHolder):
3333         (WebKit::ensureWiFiManagerClient): Deleted.
3334
3335 2018-05-16  Fujii Hironori  <Hironori.Fujii@sony.com>
3336
3337         [Win] Implement WebPage::handleEditingKeyboardEvent
3338         https://bugs.webkit.org/show_bug.cgi?id=185327
3339
3340         Reviewed by Alexey Proskuryakov.
3341
3342         * WebProcess/WebPage/win/WebPageWin.cpp:
3343         (WebKit::WebPage::handleEditingKeyboardEvent): Copied from WebKitLegacy.
3344
3345 2018-05-16  Sihui Liu  <sihui_liu@apple.com>
3346
3347         Session cookies aren't reliably set when using default WKWebSiteDataStore
3348         https://bugs.webkit.org/show_bug.cgi?id=185624
3349         <rdar://problem/39111626>
3350
3351         Reviewed by Geoffrey Garen.
3352
3353         Session cookies of default session were set in UI Process when there was no process pool, 
3354         but they were not synced (or synced slowly to) Network Process. To make these cookies visible
3355         as soon as they were set through API, we could manually set those cookies in Network Process
3356         during its initilization. 
3357
3358         * NetworkProcess/mac/RemoteNetworkingContext.mm:
3359         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
3360         * UIProcess/API/APIHTTPCookieStore.cpp:
3361         (API::HTTPCookieStore::cookies):
3362         (API::HTTPCookieStore::setCookie):
3363         (API::HTTPCookieStore::deleteCookie):
3364         * UIProcess/WebProcessPool.cpp:
3365         (WebKit::WebProcessPool::ensureNetworkProcess):
3366         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
3367         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3368         (WebKit::WebsiteDataStore::clearPendingCookies):
3369         * UIProcess/WebsiteData/WebsiteDataStore.h:
3370
3371 2018-05-16  Chris Nardi  <cnardi@chromium.org>
3372
3373         Remove Document#selectedStylesheetSet/preferredStylesheetSet
3374         https://bugs.webkit.org/show_bug.cgi?id=185381
3375
3376         Reviewed by Darin Adler.
3377
3378         Make API methods for Document#selectedStylesheetSet/preferredStylesheetSet do nothing.
3379
3380         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.h:
3381         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
3382         (webkit_dom_document_set_property):
3383         (webkit_dom_document_get_property):
3384         (webkit_dom_document_get_preferred_stylesheet_set):
3385         (webkit_dom_document_get_selected_stylesheet_set):
3386         (webkit_dom_document_set_selected_stylesheet_set):
3387
3388 2018-05-16  Alberto Garcia  <berto@igalia.com>
3389
3390         [CMake] Properly detect compiler flags, needed libs, and fallbacks for usage of 64-bit atomic operations
3391         https://bugs.webkit.org/show_bug.cgi?id=182622
3392
3393         Reviewed by Michael Catanzaro.
3394
3395         Move the test to determine whether we need to link against
3396         libatomic to the common file WebKitCompilerFlags.cmake so it can
3397         also be used for JavaScriptCore.
3398
3399         * CMakeLists.txt:
3400
3401 2018-05-15  Yusuke Suzuki  <utatane.tea@gmail.com>
3402
3403         [JSC] Check TypeInfo first before calling getCallData when we would like to check whether given object is a function
3404         https://bugs.webkit.org/show_bug.cgi?id=185601
3405
3406         Reviewed by Saam Barati.
3407
3408         * WebProcess/Plugins/Netscape/JSNPObject.h:
3409
3410 2018-05-15  Sihui Liu  <sihui_liu@apple.com>
3411
3412         StorageManager::deleteLocalStorageOriginsModifiedSince: database files get deleted before database connections close
3413         https://bugs.webkit.org/show_bug.cgi?id=185671
3414
3415         Reviewed by Geoffrey Garen.
3416
3417         We should delete database files before closing databases.
3418
3419         * UIProcess/WebStorage/LocalStorageDatabase.cpp:
3420         (WebKit::LocalStorageDatabase::updateDatabaseWithChangedItems):
3421         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
3422         (WebKit::LocalStorageDatabaseTracker::databasesModifiedSince):
3423         (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince): Deleted.
3424         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
3425         * UIProcess/WebStorage/StorageManager.cpp:
3426         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
3427
3428 2018-05-15  Dean Jackson  <dino@apple.com>
3429
3430         Launch System Preview as the download starts, rather than waiting for a response
3431         https://bugs.webkit.org/show_bug.cgi?id=185669
3432         <rdar://problem/40278181>
3433
3434         Reviewed by Tim Horton.
3435
3436         We were waiting for the RequestResponse to get a MIME-type before
3437         launching the system preview. This causes an annoying delay.
3438
3439         Instead, assume that the system preview is one of the handled
3440         mime types and launch the viewer immediately. If it gets something it
3441         didn't expect, it will show an error.
3442
3443         * UIProcess/Cocoa/DownloadClient.mm:
3444         (WebKit::DownloadClient::didStart):
3445         (WebKit::DownloadClient::didReceiveResponse):
3446         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
3447         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
3448         (WebKit::SystemPreviewController::start): Small cleanup to ensure we
3449         don't try to present twice (this shouldn't happen).
3450
3451 2018-05-15  Dean Jackson  <dino@apple.com>
3452
3453         Post-review cleanup for 185459
3454         https://bugs.webkit.org/show_bug.cgi?id=185665