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