Unreviewed, a quick build fix for r232276.
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-05-30  Jiewen Tan  <jiewen_tan@apple.com>
2
3         Unreviewed, a quick build fix for r232276.
4
5         Enabled SecItemShim again as it turns out to be useful for CFNetwork APIs that
6         query Keychains underneath us.
7
8         * NetworkProcess/ios/NetworkProcessIOS.mm:
9         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
10         * NetworkProcess/mac/NetworkProcessMac.mm:
11         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
12
13 2018-05-30  Jer Noble  <jer.noble@apple.com>
14
15         Auto-pip should use main content heuristic.
16         https://bugs.webkit.org/show_bug.cgi?id=186065
17         <rdar://problem/35862502>
18
19         Reviewed by Eric Carlson.
20
21         Make the m_pipStandbyElement clearable, which will allow the auto-pip mechanism to be torn down. Add
22         a WebProcess-side notification when the main content changes, to facilitate this.
23
24         * WebProcess/FullScreen/WebFullScreenManager.cpp:
25         (WebKit::WebFullScreenManager::videoControlsManagerDidChange):
26         (WebKit::WebFullScreenManager::setPIPStandbyElement):
27         (WebKit::WebFullScreenManager::didEnterFullScreen):
28         (WebKit::WebFullScreenManager::willExitFullScreen):
29         * WebProcess/FullScreen/WebFullScreenManager.h:
30         * WebProcess/WebPage/WebPage.cpp:
31         (WebKit::WebPage::videoControlsManagerDidChange):
32         * WebProcess/WebPage/WebPage.h:
33         * WebProcess/cocoa/PlaybackSessionManager.h:
34         * WebProcess/cocoa/PlaybackSessionManager.mm:
35         (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager):
36         (WebKit::PlaybackSessionManager::clearPlaybackControlsManager):
37         (WebKit::PlaybackSessionManager::currentPlaybackControlsElement const):
38
39 2018-05-30  Jer Noble  <jer.noble@apple.com>
40
41         Fix a few issues in WKFullScreenViewController
42         https://bugs.webkit.org/show_bug.cgi?id=186067
43         <rdar://problem/40630944>
44
45         Reviewed by Darin Adler.
46
47         The check in setInterface() is checking the wrong pointer:
48         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
49         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
50
51         The check in -_effectiveFullscreenInsetTop is backwards:
52         (-[WKFullScreenViewController _effectiveFullscreenInsetTop]):
53
54 2018-05-30  Chris Dumez  <cdumez@apple.com>
55
56         Take a background process assertion in WebPageProxy::callAfterNextPresentationUpdate()
57         https://bugs.webkit.org/show_bug.cgi?id=186097
58         <rdar://problem/40651225>
59
60         Reviewed by Tim Horton.
61
62         Take a background process assertion in WebPageProxy::callAfterNextPresentationUpdate(). Otherwise,
63         apps may get stuck on _doAfterNextPresentationUpdate because the WebProcess got suspended.
64
65         * UIProcess/WebPageProxy.cpp:
66         (WebKit::WebPageProxy::callAfterNextPresentationUpdate):
67
68 2018-05-29  Tim Horton  <timothy_horton@apple.com>
69
70         Fix the build
71         https://bugs.webkit.org/show_bug.cgi?id=186078
72
73         Unreviewed build fix.
74
75         * UIProcess/API/Cocoa/WKWebView.mm:
76         (-[WKWebView _denyNextUserMediaRequest]):
77
78 2018-05-29  Andy Estes  <aestes@apple.com>
79
80         [Wi-Fi Assertions] Track whether WiFiAssertionHolder should actually hold a Wi-Fi assertion
81         https://bugs.webkit.org/show_bug.cgi?id=185983
82         <rdar://problem/40205486>
83
84         Reviewed by Tim Horton.
85
86         * Configurations/Network-iOS.entitlements:
87
88         Added a needed entitlement.
89
90         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
91         * NetworkProcess/cocoa/WiFiAssertionHolder.h:
92         (WebKit::WiFiAssertionHolder::shouldHoldWiFiAssertion const):
93
94         Track whether WiFiAssertionHolder should actually hold a Wi-Fi assertion.
95
96         * NetworkProcess/cocoa/WiFiAssertionHolder.mm: Renamed from Source/WebKit/NetworkProcess/cocoa/WiFiAssertionHolder.cpp.
97         (holdWiFiAssertion):
98         (releaseWiFiAssertion):
99         (WebKit::WiFiAssertionHolder::WiFiAssertionHolder):
100         (WebKit::WiFiAssertionHolder::~WiFiAssertionHolder):
101
102         Changed holdWiFiAssertion() and releaseWiFiAssertion() to take the
103         WiFiAssertionHolder as an argument.
104
105         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
106
107         Added a needed sandbox extension.
108
109         * WebKit.xcodeproj/project.pbxproj:
110
111 2018-05-29  Youenn Fablet  <youenn@apple.com>
112
113         Add a consistency check between URL and CFURL
114         https://bugs.webkit.org/show_bug.cgi?id=186057
115         <rdar://problem/40258457>
116
117         Reviewed by Geoff Garen.
118
119         * Shared/Cocoa/WKNSURLExtras.mm:
120         (+[NSURL _web_URLWithWTFString:relativeToURL:]):
121         (urlWithWTFString): Deleted.
122         (+[NSURL _web_URLWithWTFString:]): Deleted.
123
124 2018-05-29  Alex Christensen  <achristensen@webkit.org>
125
126         Remove unused WebPage::dummy
127         https://bugs.webkit.org/show_bug.cgi?id=186068
128
129         Reviewed by Sam Weinig.
130
131         * WebProcess/WebPage/WebPage.cpp:
132         (WebKit::WebPage::dummy): Deleted.
133         * WebProcess/WebPage/WebPage.h:
134         * WebProcess/WebPage/WebPage.messages.in:
135
136 2018-05-29  Per Arne Vollan  <pvollan@apple.com>
137
138         Create typedef for HashMap<PlatformDisplayID, ScreenProperties>
139         https://bugs.webkit.org/show_bug.cgi?id=186056
140
141         Reviewed by Brent Fulgham.
142
143         * Shared/WebProcessCreationParameters.cpp:
144         (WebKit::WebProcessCreationParameters::decode):
145         * Shared/WebProcessCreationParameters.h:
146
147 2018-05-25  Jiewen Tan  <jiewen_tan@apple.com>
148
149         Tighten sandbox profiles for Networking Processes to restrict accesses to macOS/iOS Keychains
150         https://bugs.webkit.org/show_bug.cgi?id=162948
151         <rdar://problem/40558894>
152
153         Reviewed by Brent Fulgham.
154
155         The patch conditionally tighten sandbox profiles for Networking Processes to remove Keychain related
156         permissions and some security permisssions that are not needed. Also it conditionally remove the
157         Process Privilege for Networking Processes to access Credentials.
158
159         In addition, it remove process privilege assertions for SecItemShim as it is supposed to work in processes
160         that don't have privileges to access Keychains and delegate all operations to UI Process via IPC. Also,
161         the patch disables SecItemShim for Networking Process conditionally.
162
163         * Configurations/Network-iOS.entitlements:
164         * NetworkProcess/NetworkProcess.cpp:
165         (WebKit::NetworkProcess::initializeNetworkProcess):
166         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
167         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
168         * Shared/mac/SecItemShim.cpp:
169         (WebKit::sendSecItemRequest):
170         (WebKit::webSecItemCopyMatching):
171         (WebKit::webSecItemAdd):
172         (WebKit::webSecItemUpdate):
173         (WebKit::webSecItemDelete):
174         (WebKit::initializeSecItemShim):
175
176 2018-05-29  Chris Dumez  <cdumez@apple.com>
177
178         Store 0-lifetime stylesheets / scripts into the disk cache for faster history navigations
179         https://bugs.webkit.org/show_bug.cgi?id=186060
180         <rdar://problem/40627270>
181
182         Reviewed by Geoffrey Garen.
183
184         Tweak our storeUnconditionallyForHistoryNavigation logic to match resources whose priority
185         is High, not just VeryHigh. Per logic in CachedResource::defaultPriorityForResourceType(Type),
186         This now matches stylesheets and scripts in addition to main resources.
187
188         I found that in case of a history navigation to apple.com, a significant number of scripts
189         and stylesheets had to be loaded from the network because our previous heuristic decided
190         not to store them (because their priority was not VeryHigh and because their max-age was
191         0).
192
193         * NetworkProcess/cache/NetworkCache.cpp:
194         (WebKit::NetworkCache::makeStoreDecision):
195
196 2018-05-28  Jeff Miller  <jeffm@apple.com>
197
198         Expose additional WKMenuItemIdentifier strings
199         https://bugs.webkit.org/show_bug.cgi?id=186041
200
201         Reviewed by Dan Bernstein.
202
203         Expose identifiers for media-related menu items.
204
205         * UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm:
206         Define new identifiers.
207
208         * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
209         Declare new identifiers.
210
211         * UIProcess/mac/WebContextMenuProxyMac.mm:
212         (WebKit::menuItemIdentifier):
213         Map to new identifiers.
214
215 2018-05-29  Geoffrey Garen  <ggaren@apple.com>
216
217         Removed some unused WebSQL trackers
218         https://bugs.webkit.org/show_bug.cgi?id=186026
219
220         Reviewed by Dan Bernstein.
221
222         * NetworkProcess/NetworkProcess.cpp:
223         (WebKit::NetworkProcess::NetworkProcess):
224         * NetworkProcess/NetworkProcess.h:
225         * WebProcess/WebProcess.cpp:
226         (WebKit::m_nonVisibleProcessCleanupTimer):
227         (WebKit::m_webSQLiteDatabaseTracker): Deleted.
228         * WebProcess/WebProcess.h:
229
230 2018-05-29  Per Arne Vollan  <pvollan@apple.com>
231
232         Follow-up fixes after r228907.
233         https://bugs.webkit.org/show_bug.cgi?id=183338
234
235         Reviewed by Brent Fulgham.
236
237         Add screen properties to the WebProcess creation parameters, instead of sending
238         them in a message to the WebProcess just after starting it up.
239
240         * Shared/WebProcessCreationParameters.cpp:
241         (WebKit::WebProcessCreationParameters::encode const):
242         (WebKit::WebProcessCreationParameters::decode):
243         * Shared/WebProcessCreationParameters.h:
244         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
245         (WebKit::WebProcessPool::platformInitializeWebProcess):
246         * UIProcess/WebProcessPool.cpp:
247         (WebKit::WebProcessPool::initializeNewWebProcess):
248         * WebProcess/cocoa/WebProcessCocoa.mm:
249         (WebKit::WebProcess::platformInitializeWebProcess):
250
251 2018-05-29  Sihui Liu  <sihui_liu@apple.com>
252
253         Unable to remove IndexedDB Databases with Cocoa API removeDataOfTypes
254         https://bugs.webkit.org/show_bug.cgi?id=185835
255         <rdar://problem/39142257>
256
257         Reviewed by Chris Dumez.
258
259         Fix a wrong if condition: databases should be closed and deleted if websiteDataTypes contains 
260         WebsiteDataType::IndexedDBDatabases.
261
262         * StorageProcess/StorageProcess.cpp:
263         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
264
265 2018-05-28  Sam Weinig  <sam@webkit.org>
266
267         Modernize SVGRenderStyleDefs.h
268         https://bugs.webkit.org/show_bug.cgi?id=186024
269
270         Reviewed by Daniel Bates.
271
272         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
273         (WebKit::applyPropertiesToLayer):
274         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
275         (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
276         Update for new enum names.
277
278 2018-05-28  Carlos Garcia Campos  <cgarcia@igalia.com>
279
280         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.3 release.
281
282         * gtk/NEWS: Add release notes for 2.21.3.
283
284 2018-05-27  Dan Bernstein  <mitz@apple.com>
285
286         Reverted the changes made for https://webkit.org/b/186016
287
288         They broke the USE(APPLE_INTERNAL_SDK) Sierra build.
289
290 2018-05-27  David Kilzer  <ddkilzer@apple.com>
291
292         [iOS] Fix warnings about leaks found by clang static analyzer
293         <https://webkit.org/b/186009>
294         <rdar://problem/40574267>
295
296         Reviewed by Daniel Bates.
297
298         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
299         (WebKit::WebAutomationSession::platformSimulateKeySequence): Fix
300         leak of two WebEvent objects that happened in a loop.
301         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
302         (-[_WKPreviewControllerDelegate previewController:transitionImageForPreviewItem:contentRect:]):
303         Fix leak of a UIImage.
304
305 2018-05-27  Dan Bernstein  <mitz@apple.com>
306
307         [Cocoa] Avoid importing directly from subumbrella frameworks
308         https://bugs.webkit.org/show_bug.cgi?id=186016
309
310         Reviewed by Sam Weinig.
311
312         * Configurations/BaseTarget.xcconfig: Removed -iframework options from OTHER_CFLAGS and
313           OTHER_CPLUSPLUSFLAGS.
314         * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Import Carbon.h instead of an
315           HIToolbox header.
316         * UIProcess/Cocoa/WebViewImpl.mm: Ditto.
317         * UIProcess/mac/WKPrintingView.mm: Import Quartz.h instead of a PDFKit header.
318         * UIProcess/mac/WKTextInputWindowController.mm: Import Carbon.h instead of an HIToolbox
319           header.
320         * WebProcess/Plugins/PDF/PDFAnnotationTextWidgetDetails.h: Import Quartz.h instead of a
321           PDFKit header.
322         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h: Ditto.
323         * WebProcess/Plugins/PDF/PDFPlugin.mm: Ditto.
324         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: Ditto.
325         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm: Ditto.
326         * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm: Ditto.
327         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: Ditto.
328         * WebProcess/WebPage/mac/WebPageMac.mm: Ditto.
329
330 2018-05-25  Timothy Hatcher  <timothy@apple.com>
331
332         Setting drawsBackground to YES on a WKView doesn't take effect immediately
333         https://bugs.webkit.org/show_bug.cgi?id=185885
334         rdar://problem/39706506
335
336         Reviewed by Simon Fraser.
337
338         * UIProcess/API/Cocoa/WKWebView.mm:
339         (-[WKWebView _initializeWithConfiguration:]): Removed setBackgroundExtendsBeyondPage(true)
340         since it is now the default.
341         * UIProcess/Cocoa/WebViewImpl.mm:
342         (WebKit::WebViewImpl::setDrawsBackground): Make sure updateLayer gets called on the web view
343         by calling setNeedsDisplay:YES.
344         (WebKit::WebViewImpl::setBackgroundColor): Ditto.
345         (WebKit::WebViewImpl::updateLayer): Removed dead code.
346         * UIProcess/WebPageProxy.h: Make m_backgroundExtendsBeyondPage default to true. WebKit was
347         always turning this on during WKWebView initializtion, which would cause the scroll
348         shadow layer to be created, flash black because of no background, then destroyed soon
349         after once WebKit's message to turn it on got delivered.
350         * WebProcess/WebPage/WebPage.cpp:
351         (WebPage::WebPage): Call setBackgroundExtendsBeyondPage earlier to avoid creating the scroll
352         shadow layer, since backgroundShouldExtendBeyondPage defautls to false in WebCore for WK1.
353         (WebKit::WebPage::setDrawsBackground): Use updateBackgroundRecursively to propagate the
354         correct base background color.
355
356 2018-05-25  Youenn Fablet  <youenn@apple.com>
357
358         Migrate From-Origin to Cross-Origin-Resource-Policy
359         https://bugs.webkit.org/show_bug.cgi?id=185840
360
361         Reviewed by Chris Dumez.
362
363         Do Cross-Origin-Resource-Policy (CORP) checks in NetworkLoadChecker instead of NetworkResourceLoader directly.
364         Make sure CORP only applies to no-cors loads.
365         Remove ancestor checks and only consider the document origin making the load.
366         This means that in case of cross-origin redirection to same-origin, the redirection will be CORP-checked,
367         the final response will not be CORP-checked but will be opaque.
368
369         * NetworkProcess/NetworkLoadChecker.cpp:
370         (WebKit::NetworkLoadChecker::validateCrossOriginResourcePolicyPolicy):
371         (WebKit::NetworkLoadChecker::validateResponse):
372         * NetworkProcess/NetworkLoadChecker.h:
373         * NetworkProcess/NetworkResourceLoader.cpp:
374         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
375         (WebKit::NetworkResourceLoader::didReceiveResponse):
376         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
377         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
378         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
379         * NetworkProcess/NetworkResourceLoader.h:
380         * WebProcess/Network/WebLoaderStrategy.cpp:
381         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
382         Send ancestor information for navigation loads only.
383
384 2018-05-25  Daniel Bates  <dabates@apple.com>
385
386         NavigationAction should not hold a strong reference to a Document
387         https://bugs.webkit.org/show_bug.cgi?id=185712
388         <rdar://problem/40320916>
389
390         Reviewed by Brent Fulgham.
391
392         Update code to make use of NavigationAction::requester().
393
394         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
395         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
396
397 2018-05-25  Tim Horton  <timothy_horton@apple.com>
398
399         Ensure that the Web Content process doesn't sleep during initialization
400         https://bugs.webkit.org/show_bug.cgi?id=185975
401         <rdar://problem/40548159>
402
403         Reviewed by Geoffrey Garen.
404
405         WebProcessPool::warmInitialProcess isn't worth much (or at least, as much
406         as it could be) if the Web Content process goes to sleep in the middle
407         of initializeWebProcess.
408
409         Keep the Web Content process alive until it has handled all messages
410         sent from WebProcessPool::initializeNewWebProcess.
411
412         This is a significant speedup on some benchmarks I've been running
413         that involve prewarming a process long before any content is loaded.
414
415         * UIProcess/WebProcessPool.cpp:
416         (WebKit::WebProcessPool::initializeNewWebProcess):
417
418 2018-05-25  Chris Dumez  <cdumez@apple.com>
419
420         WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback() unexpectedly constructs a process pool
421         https://bugs.webkit.org/show_bug.cgi?id=185992
422
423         Reviewed by Geoffrey Garen.
424
425         Update enableResourceLoadStatisticsAndSetTestingCallback() to pass the right parameter to processPools()
426         to avoid constructing a process pool when none exist. Also drop the 'resourceLoadStatisticsEnabled'
427         flag on the WebProcessPool and have it query its data store instead to know if the feature is enabled.
428
429         * UIProcess/WebProcessPool.cpp:
430         (WebKit::WebProcessPool::initializeNewWebProcess):
431         (WebKit::WebProcessPool::setResourceLoadStatisticsEnabled):
432         * UIProcess/WebProcessPool.h:
433         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
434         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
435
436 2018-05-25  Chris Dumez  <cdumez@apple.com>
437
438         Drop support for NSURLCache in WebKit2
439         https://bugs.webkit.org/show_bug.cgi?id=185990
440
441         Reviewed by Geoffrey Garen.
442
443         Drop support for NSURLCache in WebKit2 now that the WebKit network cache is stable.
444
445         * NetworkProcess/NetworkProcess.cpp:
446         (WebKit::NetworkProcess::setCacheModel):
447         * NetworkProcess/NetworkProcess.h:
448         * NetworkProcess/NetworkProcessCreationParameters.cpp:
449         (WebKit::NetworkProcessCreationParameters::encode const):
450         (WebKit::NetworkProcessCreationParameters::decode):
451         * NetworkProcess/NetworkProcessCreationParameters.h:
452         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
453         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
454         (WebKit::NetworkProcess::clearDiskCache):
455         (WebKit::NetworkProcess::platformSetURLCacheSize): Deleted.
456         (WebKit::clearNSURLCache): Deleted.
457         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
458         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
459         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
460         (): Deleted.
461         (WebKit::NetworkSessionCocoa::setUsesNetworkCache): Deleted.
462         * NetworkProcess/curl/NetworkProcessCurl.cpp:
463         (WebKit::NetworkProcess::platformSetURLCacheSize): Deleted.
464         * NetworkProcess/soup/NetworkProcessSoup.cpp:
465         (WebKit::NetworkProcess::platformSetURLCacheSize): Deleted.
466         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
467         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
468         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory):
469         (WebKit::WebProcessPool::isNetworkCacheEnabled): Deleted.
470         * UIProcess/WebProcessPool.h:
471         * WebProcess/WebPage/WebFrame.cpp:
472         (WebKit::WebFrame::suggestedFilenameForResourceWithURL const):
473         (WebKit::WebFrame::mimeTypeForResourceWithURL const):
474         * WebProcess/WebPage/WebPage.cpp:
475         (WebKit::WebPage::getResourceDataFromFrame):
476         (WebKit::WebPage::hasLocalDataForURL):
477         * WebProcess/WebPage/WebPage.h:
478         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
479         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
480         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
481         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
482         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
483         * WebProcess/WebPage/ios/WebPageIOS.mm:
484         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
485         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
486         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
487         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
488         * WebProcess/WebPage/mac/WebPageMac.mm:
489         (WebKit::WebPage::accessibilityRemoteObject):
490         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
491         (WebKit::cachedResponseForURL): Deleted.
492         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
493         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
494         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
495         * WebProcess/WebPage/win/WebPageWin.cpp:
496         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
497         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
498         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
499         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
500         * WebProcess/WebPage/wpe/WebPageWPE.cpp:
501         (WebKit::WebPage::platformHasLocalDataForURL): Deleted.
502         (WebKit::WebPage::cachedResponseMIMETypeForURL): Deleted.
503         (WebKit::WebPage::cachedSuggestedFilenameForURL): Deleted.
504         (WebKit::WebPage::cachedResponseDataForURL): Deleted.
505         * WebProcess/cocoa/WebProcessCocoa.mm:
506         (WebKit::WebProcess::platformInitializeWebProcess):
507
508 2018-05-25  Alex Christensen  <achristensen@webkit.org>
509
510         Fix internal iOS builds after r232198
511         https://bugs.webkit.org/show_bug.cgi?id=185986
512
513         * WebProcess/WebPage/ios/WebPageIOS.mm:
514         (WebKit::WebPage::sendTapHighlightForNodeIfNecessary):
515
516 2018-05-25  Alex Christensen  <achristensen@webkit.org>
517
518         URL::host should return a StringView to reduce allocations
519         https://bugs.webkit.org/show_bug.cgi?id=185986
520
521         Reviewed by Geoff Garen.
522
523         * NetworkProcess/NetworkProcess.cpp:
524         (WebKit::fetchDiskCacheEntries):
525         * NetworkProcess/NetworkResourceLoader.cpp:
526         (WebKit::areFrameAncestorsSameSite):
527         * NetworkProcess/mac/NetworkProcessMac.mm:
528         (WebKit::overrideSystemProxies):
529         * Shared/API/APIURL.h:
530         (API::URL::host const):
531         * UIProcess/Automation/WebAutomationSession.cpp:
532         (WebKit::WebAutomationSession::addSingleCookie):
533         (WebKit::WebAutomationSession::deleteAllCookies):
534         * UIProcess/WebProcessProxy.cpp:
535         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
536         * WebProcess/Plugins/PluginView.cpp:
537         (WebKit::PluginView::pluginDidReceiveUserInteraction):
538         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
539         (WebKit::WebPluginInfoProvider::populatePluginCache):
540         * WebProcess/WebPage/WebPage.cpp:
541         (WebKit::needsHiddenContentEditableQuirk):
542         (WebKit::needsPlainTextQuirk):
543         (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
544
545 2018-05-25  Adrian Perez de Castro  <aperez@igalia.com>
546
547         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.2 release.
548
549         * wpe/NEWS: Add release notes for the 2.21.2 release.
550
551 2018-05-25  Chris Dumez  <cdumez@apple.com>
552
553         Minor ApplicationCacheStorage clean up
554         https://bugs.webkit.org/show_bug.cgi?id=185984
555
556         Reviewed by Youenn Fablet.
557
558         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
559         (WebKit::WebsiteDataStore::fetchDataAndApply):
560         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
561         (WKBundlePageCopyOriginsWithApplicationCache):
562
563 2018-05-25  Chris Dumez  <cdumez@apple.com>
564
565         Avoid triggering network cache speculative revalidation for loads allowing expired content
566         https://bugs.webkit.org/show_bug.cgi?id=185985
567
568         Reviewed by Antti Koivisto.
569
570         Avoid triggering network cache speculative revalidation for loads allowing expired content
571         (e.g. history loads, restoring pages after crash or safari relaunch). This causes us to do
572         unnecessary revalidations, it is both wasteful and bad for performance.
573
574         * NetworkProcess/cache/NetworkCache.cpp:
575         (WebKit::NetworkCache::Cache::retrieve):
576
577 2018-05-25  David Kilzer  <ddkilzer@apple.com>
578
579         Fix issues with -dealloc methods found by clang static analyzer
580         <https://webkit.org/b/185887>
581
582         Reviewed by Joseph Pecoraro.
583
584         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Drive-by fix
585         to use `copy` for `mimeType` property.
586         (-[_WKPreviewControllerDataSource initWithMIMEType:]): Drive-by
587         fix to use `instancetype` instead of `id`.  Use -copy for
588         `mimeType` argument to match property definition.
589         (-[_WKPreviewControllerDataSource dealloc]): Add.  Release
590         `_completionHandler` and `_mimeType` to fix leaks.
591         * UIProcess/ios/WKPasswordView.mm:
592         (-[WKPasswordView dealloc]): Add.  Release
593         `_userDidEnterPassword` to fix leak.
594         * UIProcess/ios/fullscreen/WKFullScreenViewController.h:
595         Drive-by clean-up to make `location` property `copy` instead of
596         `retain`.
597         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
598         (-[WKFullScreenViewController dealloc]): Release `_target` and
599         `_location` to fix leaks.
600         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
601         (-[WKFullscreenAnimationController dealloc]): Add.  Release
602         `_viewController` to fix leak.
603         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
604         (@property secondaryMaterialOverlayView): Mark explicitly as
605         `assign` since this isn't a retained variable.
606         (@property secondaryMaterialOverlayViewConstraints): Mark
607         explicitly as `retain` since there is nothing to keep this
608         object alive.
609         (+[WKFullscreenStackView secondaryMaterialOverlayView]): Fix
610         leak by autoreleasing the return value.
611         (-[WKFullscreenStackView dealloc]): Release retained instance
612         variables to fix leaks.  Note that `_stackView` and
613         `_visualEffectView` are internally retained despite their
614         @property declarations.
615         (-[WKFullscreenStackView setTargetViewForSecondaryMaterialOverlay:]):
616         Retain @property targetViewForSecondaryMaterialOverlay to match
617         its declaration.
618
619 2018-05-23  Antoine Quint  <graouts@apple.com>
620
621         [Web Animations] Use DEFAULT_EXPERIMENTAL_FEATURES_ENABLED for Web Animations experimental features
622         https://bugs.webkit.org/show_bug.cgi?id=185919
623
624         Reviewed by Dean Jackson.
625
626         * Shared/WebPreferences.yaml:
627
628 2018-05-24  Dan Bernstein  <mitz@apple.com>
629
630         ProcessLauncherMac.mm contains a couple of meaningless #ifndef directives
631         https://bugs.webkit.org/show_bug.cgi?id=185973
632
633         Reviewed by Tim Horton.
634
635         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
636         (WebKit::ProcessLauncher::launchProcess): Use #if !ASSERT_DISABLED to guard statements that
637           are only needed for an assertion, instead of #ifndef _NDEBUG, which is always true.
638
639 2018-05-24  Carlos Alberto Lopez Perez  <clopez@igalia.com>
640
641         [GTK][WPE] Memory pressure monitor doesn't reliable notify all the subprocesses
642         https://bugs.webkit.org/show_bug.cgi?id=184261
643
644         Reviewed by Carlos Garcia Campos.
645
646         On Linux we had two implementations for getting notifications about memory pressure events:
647         - The memory cgroup (called systemd here).
648         - The UIProcess memory monitor (which delivered events via a shared eventfd)
649
650         The problem with the first is that it was usually not working on a standard machine due to
651         the special permissions or configurations required for memory cgroups, so the second one
652         (eventfd) was used as a fall-back in that case.
653         But this eventfd method is racy with more than one WebKit child process and it wasn't
654         reliably delivering the notifications.
655
656         This patch removes the memory cgroup implementation and modifies the UIProcess memory monitor
657         to deliver the events via WebKit IPC. This simplifies the code a lot and allows us to have
658         only one implementation that should work in any Linux machine.
659
660         The implementation now also triggers the event with information about the criticalness of it.
661
662         Previously a critical event was triggered always at a 95% of pressure.
663         Now a non-critical one is triggered at 90% and critical remains at a 95%.
664
665         Start triggering events early should compensate the fact than triggering the event via WebKit IPC is
666         a bit slower than doing that via an eventfd (or than listening on the memory cgroup event controller).
667
668         The events are delivered to all WebKit childs: WebProcess, NetworkProcess, StorageProcess, PluginProcess.
669
670         In the case of the StorageProcess a dummy controller is installed, which currently does nothing,
671         but leaves a note for a future implementation and at least allows to trigger platformReleaseMemory()
672         that on Linux/glibc should end calling malloc_trim()
673
674         * NetworkProcess/NetworkProcess.cpp:
675         (WebKit::NetworkProcess::initializeNetworkProcess):
676         * NetworkProcess/NetworkProcessCreationParameters.cpp:
677         (WebKit::NetworkProcessCreationParameters::encode const):
678         (WebKit::NetworkProcessCreationParameters::decode):
679         * NetworkProcess/NetworkProcessCreationParameters.h:
680         * PluginProcess/PluginProcess.cpp:
681         (WebKit::PluginProcess::didReceiveMessage):
682         (WebKit::PluginProcess::initializePluginProcess):
683         * Shared/ChildProcess.cpp:
684         (WebKit::ChildProcess::didReceiveMemoryPressureEvent):
685         * Shared/ChildProcess.h:
686         * Shared/ChildProcess.messages.in:
687         * Shared/Plugins/PluginProcessCreationParameters.cpp:
688         (WebKit::PluginProcessCreationParameters::encode const):
689         (WebKit::PluginProcessCreationParameters::decode):
690         * Shared/Plugins/PluginProcessCreationParameters.h:
691         * Shared/WebProcessCreationParameters.cpp:
692         (WebKit::WebProcessCreationParameters::encode const):
693         (WebKit::WebProcessCreationParameters::decode):
694         * Shared/WebProcessCreationParameters.h:
695         * StorageProcess/StorageProcess.cpp:
696         (WebKit::StorageProcess::initializeProcess):
697         * UIProcess/Plugins/PluginProcessManager.cpp:
698         (WebKit::PluginProcessManager::sendMemoryPressureEvent):
699         * UIProcess/Plugins/PluginProcessManager.h:
700         * UIProcess/Plugins/PluginProcessProxy.cpp:
701         (WebKit::PluginProcessProxy::sendMemoryPressureEvent):
702         (WebKit::PluginProcessProxy::didFinishLaunching):
703         * UIProcess/Plugins/PluginProcessProxy.h:
704         * UIProcess/WebProcessPool.cpp:
705         (WebKit::WebProcessPool::sendMemoryPressureEvent):
706         (WebKit::WebProcessPool::ensureNetworkProcess):
707         (WebKit::WebProcessPool::initializeNewWebProcess):
708         * UIProcess/WebProcessPool.h:
709         (WebKit::WebProcessPool::sendToStorageProcess):
710         * UIProcess/linux/MemoryPressureMonitor.cpp:
711         (WebKit::pollIntervalForUsedMemoryPercentage): Fix equation for calculating the interval percentage.
712         (WebKit::MemoryPressureMonitor::singleton):
713         (WebKit::MemoryPressureMonitor::start):
714         * UIProcess/linux/MemoryPressureMonitor.h:
715         * WebProcess/WebProcess.cpp:
716         (WebKit::WebProcess::initializeWebProcess):
717
718 2018-05-24  Youenn Fablet  <youenn@apple.com>
719
720         Update plugin search path to look for user installed plugins
721         https://bugs.webkit.org/show_bug.cgi?id=185960
722
723         Reviewed by Brent Fulgham.
724
725         Now that UIProcess may be sandboxed, the home directory is no longer the user home directory.
726         Update the path to still look for plugins in the user home directory.
727
728         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
729         (WebKit::PluginInfoStore::pluginsDirectories):
730
731 2018-05-24  Jiewen Tan  <jiewen_tan@apple.com>
732
733         Adopt SecKeyProxy SPI in certificate based challenge response code
734         https://bugs.webkit.org/show_bug.cgi?id=185848
735         <rdar://problem/34586181>
736
737         Reviewed by Alex Christensen.
738
739         This patch adopts SecKeyProxy SPI in HTTPS client certificate authentication code.
740         1) SecKeyProxy is a new SPI to relay crypto operations from one process to another. The owner process of the proxy
741         will behave like a server, and other owners of the SecKeys created from the proxy's endpoints will then behave
742         like clients. This client-server model allows more restricted sandbox for client processes, and meanwhile permits
743         them to relay crypto operations to the server process while maintaining the same SecKey interfaces as used for local operations.
744         2) Because of the client-server model, the server process, i.e. the UI Process in our case, needs to keep the proxy
745         object alive long enough for the client process, i.e. Network Processes in our case, to finish all operations, and then destroy
746         the proxy object afterward. The ideal place to hold such a proxy is WebsiteDataStore such that proxies could live with the
747         corresponding network session.
748         3) A new class called SecKeyProxyStore is then created to bind the lifetime of SecKeyProxy to the WebsiteDataStore while initializing
749         it correctly. At the time the authentication process reaches WebPageProxy::didReceiveAuthenticationChallengeProxy where we have
750         accesses to the WebsiteDataStore, we haven't yet been able to determine the Credential to authenticate the challenge. Therefore, we
751         have to reserve a place in the WebsiteDataStore ahead and then fill it with the right Credential. That's why SecKeyProxyStore exists.
752         In WebPageProxy::didReceiveAuthenticationChallengeProxy, we create a strong reference of SecKeyProxyStore which will eventually hold
753         a strong reference of the SecKeyProxy, and move it to the WebsiteDataStore. We also create a weak reference to SecKeyProxyStore
754         and move it to the AuthenticationChallenge. In this way, we indirectly bind the lifetime of SecKeyProxy to the WebsiteDataStore through
755         the strong reference and also we can initialize the proxy through the weak reference while a credential is finally determined.
756         4) Endpoints of the SecKeyProxy will be passed to the Network Process for creating the 'remote' SecKey. However, those endpoints are
757         of NSXPCListenerEndpoint type, which can only be passed with xpc connections and are not compatible with our IPC mechanism. In order
758         to pass endpoints around, this patch reuses the xpc connection that is used to bootstrap Network Processes from the UI Process. To do
759         so, it sends xpc messages at the place where original IPC messages are sent and overwrites the boostrap listener of the xpc connection
760         when Network Process is initialized. From the listener, it continues the original authentication code path.
761         5) Tests, again, are manually covered by tlstestwebkit.org. Noted, the prompting Keychain dialog in macOS should say Safari instead of
762         "com.apple.WebKit.Networking*" now.
763
764         * Shared/AuthenticationManagerCocoa.mm: Added.
765         (WebKit::AuthenticationManager::initializeConnection):
766         * Shared/Authentication/cocoa/AuthenticationManager.h:
767         * Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.h:
768         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
769         (WebKit::AuthenticationChallengeProxy::useCredential):
770         (WebKit::AuthenticationChallengeProxy::setSecKeyProxyStore):
771         * UIProcess/Authentication/AuthenticationChallengeProxy.h:
772         * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm: Added.
773         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc const):
774         * UIProcess/Authentication/cocoa/SecKeyProxyStore.h: Added.
775         (WebKit::SecKeyProxyStore::create):
776         (WebKit::SecKeyProxyStore::isInitialized const):
777         (WebKit::SecKeyProxyStore::get const):
778         (WebKit::SecKeyProxyStore::weakPtrFactory const):
779         * UIProcess/Authentication/cocoa/SecKeyProxyStore.mm: Added.
780         (WebKit::SecKeyProxyStore::initialize):
781         * UIProcess/WebPageProxy.cpp:
782         (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
783         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
784         (WebKit::WebsiteDataStore::addSecKeyProxyStore):
785         * UIProcess/WebsiteData/WebsiteDataStore.h:
786         * WebKit.xcodeproj/project.pbxproj:
787
788 2018-05-24  Megan Gardner  <megan_gardner@apple.com>
789
790         Fix Issues with Loupe Gesture
791         https://bugs.webkit.org/show_bug.cgi?id=185926
792
793         Reviewed by Tim Horton.
794
795         The loupe gesture was not giving us the correct selection in some situations.
796
797         * UIProcess/ios/WKContentViewInteraction.mm:
798         (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]):
799         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
800         (-[WKContentView setSelectedTextRange:]):
801         * WebProcess/WebPage/WebPage.h:
802         * WebProcess/WebPage/ios/WebPageIOS.mm:
803         (WebKit::WebPage::selectWithGesture):
804         (WebKit::WebPage::clearSelection):
805
806 2018-05-24  Keith Rollin  <krollin@apple.com>
807
808         Don't track resource load milestones in private sessions
809         https://bugs.webkit.org/show_bug.cgi?id=185828
810         <rdar://problem/40424197>
811
812         Reviewed by Brent Fulgham.
813
814         Bug 184838 adds the facility for tracing the beginning and ending of
815         resources loads and reporting so that historical information can be
816         gathered to assess the health of the networking stack. Disable this
817         facility for private browsing sessions.
818
819         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
820         (WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
821         (WebKit::NetworkConnectionToWebProcess::stopTrackingResourceLoad):
822         * NetworkProcess/NetworkConnectionToWebProcess.h:
823         * NetworkProcess/NetworkResourceLoader.cpp:
824         (WebKit::NetworkResourceLoader::start):
825
826 2018-05-24  Brent Fulgham  <bfulgham@apple.com>
827
828         REGRESSION(r224908): [macOS] Media playback not honoring custom caption styles
829         https://bugs.webkit.org/show_bug.cgi?id=185955
830         <rdar://problem/40339278>
831
832         Reviewed by Eric Carlson.
833
834         In r224908 I removed access to the MediaAccessibility mach port, as well as
835         read/write access to various preferences associated with that process, as it
836         was no longer needed by modern WebKit media routines.
837
838         Detailed testing reveals that read access is still needed to these preferences
839         to properly handle custom caption styles.
840
841         This patch re-enables access to the media accessibility preferences.
842
843         * WebProcess/com.apple.WebProcess.sb.in:
844
845 2018-05-24  Brent Fulgham  <bfulgham@apple.com>
846
847         REGRESSION(r230269): ASSERTION FAILED: sendRightCount == 1 at ProcessLauncherMac.mm(218)
848         https://bugs.webkit.org/show_bug.cgi?id=185687
849         <rdar://problem/39386361>
850
851         Reviewed by Brady Eidson.
852
853         In r230269 I added an assertion to help identify cases where we were doing bad
854         bookkeeping in our port send rights. I assumed that because we were adding
855         one send right, that when we went to close down the connection that we should
856         have only one send right.
857         
858         I have since discovered that this assumption is invalid, and that I should
859         only be checking that we have AT LEAST ONE send right at the time we attempt
860         to remove it.
861
862         This patch changes the assertion to confirm that we have at least one send
863         right before we remove the send right.
864
865         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
866         (WebKit::ProcessLauncher::launchProcess):
867
868 2018-05-24  Chris Dumez  <cdumez@apple.com>
869
870         Some of the work in initializeLogChannelsIfNecessary() is unnecessary for release builds
871         https://bugs.webkit.org/show_bug.cgi?id=185951
872
873         Reviewed by Geoffrey Garen.
874
875         Some of the work in initializeLogChannelsIfNecessary() is unnecessary for release builds and slows down
876         launch time. In particular, it is unnecessary to read NSDefaults to figure out which logging channels
877         should be enabled.
878
879         * Platform/foundation/LoggingFoundation.mm:
880         (WebKit::logLevelString):
881         * Platform/unix/LoggingUnix.cpp:
882         (WebKit::logLevelString):
883         * Platform/win/LoggingWin.cpp:
884         (WebKit::logLevelString):
885
886 2018-05-24  Per Arne Vollan  <pvollan@apple.com>
887
888         Crash under WebKit::PluginProxy::destroy()
889         https://bugs.webkit.org/show_bug.cgi?id=185841
890         <rdar://problem/39936896>
891
892         Reviewed by Brent Fulgham.
893
894         A release assert in Connection::sencSync is failing since scripts are not allowed in this context,
895         and the WebKit process is allowed to process incoming messages while waiting for the sync reply.
896         In this context, scripts are disallowed in the method Element::addShadowRoot. To make sure the
897         WebContent process will not wait indefinitely for a reply from the Plugin process, use a timeout
898         of 1 second when sending the message.
899
900         * WebProcess/Plugins/PluginProxy.cpp:
901         (WebKit::PluginProxy::destroy):
902
903 2018-05-24  Carlos Garcia Campos  <cgarcia@igalia.com>
904
905         Unreviewed. Fix GTK+ input method unit tests after r232049.
906
907         Unit tests don't use a WebPageProxy.
908
909         * UIProcess/gtk/InputMethodFilter.cpp:
910         (WebKit::InputMethodFilter::isViewFocused const):
911         (WebKit::InputMethodFilter::setEnabled):
912         * UIProcess/gtk/InputMethodFilter.h:
913
914 2018-05-24  Carlos Garcia Campos  <cgarcia@igalia.com>
915
916         WebDriver: implement maximize, minimize and fullscreen window commands
917         https://bugs.webkit.org/show_bug.cgi?id=180398
918
919         Reviewed by Brian Burg.
920
921         * UIProcess/API/APIAutomationSessionClient.h:
922         (API::AutomationSessionClient::requestMaximizeWindowOfPage): Added to allow clients maximize the window.
923         * UIProcess/API/glib/WebKitAutomationSession.cpp:
924         * UIProcess/API/glib/WebKitWebViewPrivate.h:
925         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
926         (WindowStateEvent::WindowStateEvent): Struct to handle window state events.
927         (WindowStateEvent::~WindowStateEvent): Complete the event.
928         (WindowStateEvent::complete): Call the completion handler is not called already.
929         (windowStateEventCallback): Handle window state event changes.
930         (webkitWebViewMaximizeWindow): Try to maximize the window and wait for the event.
931         (webkitWebViewMinimizeWindow): Try to minimize the window and wait for the event.
932         (webkitWebViewRestoreWindow): Try to unmaximize or unminimize the window and wait for the event.
933         * UIProcess/API/wpe/WebKitWebViewWPE.cpp:
934         (webkitWebViewMaximizeWindow):
935         (webkitWebViewMinimizeWindow):
936         (webkitWebViewRestoreWindow):
937         * UIProcess/Automation/Automation.json:
938         * UIProcess/Automation/WebAutomationSession.cpp:
939         (WebKit::WebAutomationSession::maximizeWindowOfBrowsingContext): Exit fullscreen, restore the window and then
940         maximize it.
941         (WebKit::WebAutomationSession::maximizeWindowForPage): Ask the client to maximize the window of page.
942         * UIProcess/Automation/WebAutomationSession.h:
943         * UIProcess/Automation/atoms/EnterFullscreen.js:
944         (enterFullscreen): Return early if fullscreen is disabled or if window is already in fullscreen.
945
946 2018-05-23  Eric Carlson  <eric.carlson@apple.com>
947
948         Avoid loading AVFoundation to check supported MIME types if possible
949         https://bugs.webkit.org/show_bug.cgi?id=185839
950         <rdar://problem/40182010>
951
952         Reviewed by Jer Noble.
953         
954         * Shared/WebProcessCreationParameters.cpp:
955         (WebKit::WebProcessCreationParameters::encode const): Encode mediaMIMETypes.
956         (WebKit::WebProcessCreationParameters::decode): Decode mediaMIMETypes.
957         * Shared/WebProcessCreationParameters.h:
958
959         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
960         (WebKit::mediaTypeCache): Static Vector of media MIME types.
961         (WebKit::WebProcessProxy::cacheMediaMIMETypes): Cache the type list and pass it to every other
962         process proxy.
963         (WebKit::WebProcessProxy::cacheMediaMIMETypesInternal): Cache the type list and pass it to the
964         web process.
965         (WebKit::WebProcessProxy::mediaMIMETypes): Return the cached type list.
966
967         * UIProcess/WebProcessPool.cpp:
968         (WebKit::WebProcessPool::initializeNewWebProcess): Set parameters.mediaMIMETypes.
969
970         * UIProcess/WebProcessProxy.h:
971         * UIProcess/WebProcessProxy.messages.in: Add CacheMediaMIMETypes.
972
973         * WebProcess/WebProcess.h:
974         * WebProcess/WebProcess.messages.in: Add SetMediaMIMETypes.
975
976         * WebProcess/cocoa/WebProcessCocoa.mm:
977         (WebKit::WebProcess::platformInitializeWebProcess): Cache the MIME types if the list isn't
978         empty, else register with AVFoundationMIMETypeCache to be notified when it loads types.
979         AVFoundationMIMETypeCache to 
980         (WebKit::WebProcess::platformTerminate): Unregister with AVFoundationMIMETypeCache.
981         (WebKit::WebProcess::setMediaMIMETypes): Pass list of types to AVFoundationMIMETypeCache.
982
983 2018-05-23  Brian Burg  <bburg@apple.com>
984
985         Web Automation: disable process swap on navigation when an automation session is active
986         https://bugs.webkit.org/show_bug.cgi?id=185552
987
988         Reviewed by Tim Horton.
989
990         * UIProcess/WebProcessPool.cpp:
991         (WebKit::WebProcessPool::processForNavigationInternal):
992         This is not intended to work right now. Opt out to avoid crashing
993         later when a process is deallocated unexpectedly.
994
995 2018-05-23  Youenn Fablet  <youenn@apple.com>
996
997         NetworkLoadChecker should check cached redirections
998         https://bugs.webkit.org/show_bug.cgi?id=185849
999
1000         Reviewed by Chris Dumez.
1001
1002         * NetworkProcess/NetworkLoadChecker.cpp:
1003         (WebKit::NetworkLoadChecker::checkRedirection):
1004         Set the resource error url as done by WebCore SubresourceLoader.
1005         * NetworkProcess/NetworkResourceLoader.cpp:
1006         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1007         Pass the resource request to dispatchWillSendRedirectedRequest now needs it.
1008         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1009         Make sure that m_networkLoad is not null before cancelling it since we might be checking a cached redirection.
1010         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
1011         Ensure the redirect response is coming from the Network before adding it to the cache.
1012         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
1013         Call willSendRedirectedRequest to make sure the cached redirect is validated.
1014         * NetworkProcess/NetworkResourceLoader.h:
1015
1016 2018-05-23  Carlos Garcia Campos  <cgarcia@igalia.com>
1017
1018         [GTK] WebDriver: implement AutomationSessionClient::didDisconnectFromRemote
1019         https://bugs.webkit.org/show_bug.cgi?id=185866
1020
1021         Reviewed by Brian Burg.
1022
1023         To handle the case of the session being closed by the browser, for example in case of a network process
1024         crash. This is currently causing WebDriver tests to timeout in the bot.
1025
1026         * UIProcess/API/glib/WebKitAutomationSession.cpp: Add an implementation of didDisconnectFromRemote() to notify
1027         the WebContext that the session will be closed.
1028         * UIProcess/API/glib/WebKitWebContext.cpp: Remove the automation session when closed.
1029         * UIProcess/API/glib/WebKitWebContextPrivate.h:
1030
1031 2018-05-22  Brent Fulgham  <bfulgham@apple.com>
1032
1033         Close access to "lsopen" for non-UI process
1034         https://bugs.webkit.org/show_bug.cgi?id=185890
1035         <rdar://problem/39686511>
1036
1037         Reviewed by Alexey Proskuryakov.
1038
1039         Close down access to 'lsopen' in the iOS sandboxes. These operations are
1040         performed by the UIProcess on behalf of these helper processes.
1041
1042         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1043         * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb:
1044         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1045
1046 2018-05-22  Dean Jackson  <dino@apple.com>
1047
1048         Optimized path zoom animation needs a valid UIImage and CGRect
1049         https://bugs.webkit.org/show_bug.cgi?id=185883
1050         <rdar://problem/40306056>
1051
1052         Reviewed by Jon Lee.
1053
1054         Take the rectangle that was passed into the ResourceRequest and
1055         use it for the origin of an animation into QuickLook.
1056
1057         * Shared/WebCoreArgumentCoders.cpp:
1058         (IPC::ArgumentCoder<ResourceRequest>::encode):
1059         (IPC::ArgumentCoder<ResourceRequest>::decode):
1060         * UIProcess/Cocoa/DownloadClient.mm:
1061         (WebKit::DownloadClient::didStart):
1062         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
1063         (-[_WKPreviewControllerDelegate initWithSystemPreviewController:fromRect:]):
1064         (-[_WKPreviewControllerDelegate presentingViewController]):
1065         (-[_WKPreviewControllerDelegate previewController:frameForPreviewItem:inSourceView:]):
1066         (-[_WKPreviewControllerDelegate previewController:transitionImageForPreviewItem:contentRect:]):
1067         (WebKit::SystemPreviewController::start):
1068         (-[_WKPreviewControllerDelegate initWithSystemPreviewController:]): Deleted.
1069         * UIProcess/Downloads/DownloadProxy.h:
1070         (WebKit::DownloadProxy::systemPreviewDownloadRect const):
1071         * UIProcess/SystemPreviewController.h:
1072         * UIProcess/WebPageProxy.cpp:
1073         (WebKit::WebPageProxy::syncRootViewToScreen):
1074         * UIProcess/WebPageProxy.h:
1075
1076 2018-05-22  Sihui Liu  <sihui_liu@apple.com>
1077
1078         [iOS] TestWebKitAPI.WebKit.WKHTTPCookieStoreWithoutProcessPool fails because cookies use different files with/without processpool
1079         https://bugs.webkit.org/show_bug.cgi?id=185831
1080
1081         Reviewed by Chris Dumez.
1082
1083         Started to use uiProcessCookieStorageIdentifier for iOS: make sure cookies handled without 
1084         processpool would use the same storage file as when processpool exists.
1085
1086         * NetworkProcess/NetworkProcess.h:
1087         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1088         (WebKit::NetworkProcessCreationParameters::encode const):
1089         (WebKit::NetworkProcessCreationParameters::decode):
1090         * NetworkProcess/NetworkProcessCreationParameters.h:
1091         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1092         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1093         * Shared/WebProcessCreationParameters.cpp:
1094         (WebKit::WebProcessCreationParameters::encode const):
1095         (WebKit::WebProcessCreationParameters::decode):
1096         * Shared/WebProcessCreationParameters.h:
1097         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1098         (WebKit::WebProcessPool::platformInitializeWebProcess):
1099         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1100
1101 2018-05-22  Chris Dumez  <cdumez@apple.com>
1102
1103         Regression(AsyncPolicyDelegates): Box.app login Window is blank
1104         https://bugs.webkit.org/show_bug.cgi?id=185832
1105         <rdar://problem/40307871>
1106
1107         Reviewed by Geoffrey Garen.
1108
1109         Moved WeakObjCPtr.h header from WebKit/ to wtf/ so that it can be used in
1110         WebKitLegacy code.
1111
1112         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
1113         * UIProcess/API/Cocoa/WKBrowsingContextControllerInternal.h:
1114         * UIProcess/API/Cocoa/WKConnection.mm:
1115         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
1116         * UIProcess/API/Cocoa/WKProcessGroup.mm:
1117         * UIProcess/API/Cocoa/WKProcessPool.mm:
1118         * UIProcess/API/Cocoa/WKScriptMessage.mm:
1119         * UIProcess/API/Cocoa/WKWebView.mm:
1120         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1121         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
1122         * UIProcess/API/Cocoa/_WKDownload.mm:
1123         * UIProcess/API/Cocoa/_WKElementAction.mm:
1124         * UIProcess/ApplicationStateTracker.h:
1125         * UIProcess/Cocoa/AutomationClient.h:
1126         * UIProcess/Cocoa/AutomationSessionClient.h:
1127         * UIProcess/Cocoa/DiagnosticLoggingClient.h:
1128         * UIProcess/Cocoa/DownloadClient.h:
1129         * UIProcess/Cocoa/FindClient.h:
1130         * UIProcess/Cocoa/FullscreenClient.h:
1131         * UIProcess/Cocoa/IconLoadingDelegate.h:
1132         * UIProcess/Cocoa/NavigationState.h:
1133         * UIProcess/Cocoa/UIDelegate.h:
1134         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1135         * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm:
1136         * UIProcess/Cocoa/WebViewImpl.h:
1137         * UIProcess/ios/ViewGestureControllerIOS.mm:
1138         * UIProcess/ios/WKActionSheetAssistant.mm:
1139         * UIProcess/ios/WKContentViewInteraction.mm:
1140         * UIProcess/ios/WKPDFView.mm:
1141         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
1142         * UIProcess/ios/WKScrollView.mm:
1143         * UIProcess/mac/WKInspectorViewController.mm:
1144         * UIProcess/mac/WKInspectorWKWebView.mm:
1145         * WebKit.xcodeproj/project.pbxproj:
1146         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1147
1148 2018-05-22  Sihui Liu  <sihui_liu@apple.com>
1149
1150         Conversion between SecurityOriginData and DatabaseIdentifier is asymmetric when port is null
1151         https://bugs.webkit.org/show_bug.cgi?id=185715
1152
1153         Reviewed by Geoffrey Garen.
1154
1155         Add getter for origins in WKWebsiteDataRecord for testing.
1156
1157         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
1158         (-[WKWebsiteDataRecord _originsString]):
1159         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
1160
1161
1162 2018-05-22  Brady Eidson  <beidson@apple.com>
1163
1164         Rename the "Web content is visible" process assertion.
1165         https://bugs.webkit.org/show_bug.cgi?id=185878
1166
1167         Reviewed by Chris Dumez.
1168
1169         * UIProcess/ios/ProcessAssertionIOS.mm:
1170         (WebKit::ProcessAssertion::ProcessAssertion):
1171
1172 2018-05-22  Andy Estes  <aestes@apple.com>
1173
1174         [Wi-Fi Assertions] Drop assertions on process suspension
1175         https://bugs.webkit.org/show_bug.cgi?id=185844
1176         <rdar://problem/40352319>
1177
1178         Reviewed by Daniel Bates.
1179
1180         * NetworkProcess/NetworkProcess.cpp:
1181         (WebKit::NetworkProcess::actualPrepareToSuspend):
1182         (WebKit::NetworkProcess::processDidResume):
1183         * NetworkProcess/NetworkProcess.h:
1184         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1185         (WebKit::NetworkProcess::platformPrepareToSuspend):
1186         (WebKit::NetworkProcess::platformProcessDidResume):
1187
1188 2018-05-22  Brent Fulgham  <bfulgham@apple.com>
1189
1190         REGRESSION(r229093): Re-enable Network Extension support in the WebContent process (Take 2)
1191         https://bugs.webkit.org/show_bug.cgi?id=185874
1192         <rdar://problem/40454404>
1193
1194         Reviewed by Eric Carlson.
1195
1196         Add back a necessary XPC connection after locking down the network features in r229093.
1197
1198         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1199         * WebProcess/com.apple.WebProcess.sb.in:
1200
1201 2018-05-22  Ryan Haddad  <ryanhaddad@apple.com>
1202
1203         Unreviewed, rolling out r232052.
1204
1205         Breaks internal builds.
1206
1207         Reverted changeset:
1208
1209         "Use more C++17"
1210         https://bugs.webkit.org/show_bug.cgi?id=185176
1211         https://trac.webkit.org/changeset/232052
1212
1213 2018-05-22  Alberto Garcia  <berto@igalia.com>
1214
1215         [CMake] Properly detect compiler flags, needed libs, and fallbacks for usage of 64-bit atomic operations
1216         https://bugs.webkit.org/show_bug.cgi?id=182622
1217         <rdar://problem/40292317>
1218
1219         Reviewed by Michael Catanzaro.
1220
1221         Move the test to determine whether we need to link against
1222         libatomic to the common file WebKitCompilerFlags.cmake so it can
1223         also be used for JavaScriptCore.
1224
1225         * CMakeLists.txt:
1226
1227 2018-05-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1228
1229         Unreviewed, rolling out r231843.
1230
1231         Broke cross build
1232
1233         Reverted changeset:
1234
1235         "[CMake] Properly detect compiler flags, needed libs, and
1236         fallbacks for usage of 64-bit atomic operations"
1237         https://bugs.webkit.org/show_bug.cgi?id=182622
1238         https://trac.webkit.org/changeset/231843
1239
1240 2018-05-22  Carlos Garcia Campos  <cgarcia@igalia.com>
1241
1242         Crash when loading a SVG image
1243         https://bugs.webkit.org/show_bug.cgi?id=185819
1244
1245         Reviewed by Brent Fulgham.
1246
1247         This is happening in WebLoaderStrategy::scheduleLoad() when getting the value of
1248         FrameLoaderClient::pageID(). SVGImage uses the empty clients for the loader, and
1249         EmptyFrameLoaderClient::pageID() returns std::nullopt. The same happens with the frameID. This changed in
1250         r225934, when pageID() and frameID() were changed to return std::optional, EmptyFrameLoaderClient was updated to
1251         return std::nullopt instead of 0.
1252
1253         * WebProcess/Network/WebLoaderStrategy.cpp:
1254         (WebKit::WebLoaderStrategy::scheduleLoad): Use value_or(0) instead of value() to get pageID and frameID from
1255         FrameLoaderClient.
1256
1257 2018-05-21  Yusuke Suzuki  <utatane.tea@gmail.com>
1258
1259         Use more C++17
1260         https://bugs.webkit.org/show_bug.cgi?id=185176
1261
1262         Reviewed by JF Bastien.
1263
1264         * Configurations/Base.xcconfig:
1265         * DerivedSources.make:
1266
1267 2018-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1268
1269         [GTK][Wayland] UI process crash when closing the window
1270         https://bugs.webkit.org/show_bug.cgi?id=185818
1271
1272         Reviewed by Michael Catanzaro.
1273
1274         This happens when a page containing a text field is loaded but the focus remains in the url bar when the window
1275         is closed. This is because we are sending a notify-in to the IM context, but the focus is still in the URL
1276         bar. That confuses the wayland input method manager that tries to free the text of the web view IM context that has
1277         already been deleted.
1278
1279         * UIProcess/gtk/InputMethodFilter.cpp:
1280         (WebKit::InputMethodFilter::setEnabled): Only send notify-in if the view is actually focused.
1281
1282 2018-05-21  Ryosuke Niwa  <rniwa@webkit.org>
1283
1284         Remove unused and no-op WKContextSetCookieStorageDirectory
1285         https://bugs.webkit.org/show_bug.cgi?id=185857
1286
1287         Reviewed by Youenn Fablet.
1288
1289         Deleted C API which didn't do anything useful, and consequently not used by anyone.
1290
1291         * UIProcess/API/C/WKContext.cpp:
1292         (WKContextSetCookieStorageDirectory): Deleted.
1293         * UIProcess/API/C/WKContextPrivate.h:
1294         * UIProcess/WebProcessPool.h:
1295
1296 2018-05-21  Chris Nardi  <cnardi@chromium.org>
1297
1298         Remove dead exception in MediaList.appendMedium
1299         https://bugs.webkit.org/show_bug.cgi?id=185278
1300
1301         Reviewed by Chris Dumez.
1302
1303         Remove code pertaining to an exception being thrown by appendMedium().
1304
1305         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMediaList.cpp:
1306         (webkit_dom_media_list_append_medium):
1307
1308 2018-05-21  Aditya Keerthi  <akeerthi@apple.com>
1309
1310         [iOS] Click events only fire once when editing
1311         https://bugs.webkit.org/show_bug.cgi?id=185777
1312
1313         Reviewed by Tim Horton.
1314
1315         gestureRecognizerShouldBegin: was returning false for the single tap gesture when a node was being
1316         edited. This is an artifact of how the gesture was previously handled with the text selection assistant.
1317         This condition is now removed, allowing the single tap gesture to go through and correctly propagate the
1318         click event.
1319
1320         Also added an early return to _didGetTapHighlightForRequest: in order to prevent the tap highlight from
1321         being shown when the node is already being assisted.
1322
1323         * UIProcess/ios/WKContentViewInteraction.mm:
1324         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]):
1325         (-[WKContentView gestureRecognizerShouldBegin:]):
1326
1327 2018-05-21  Daniel Bates  <dabates@apple.com>
1328
1329         REGRESSION (r231107): CSP report-only policies are ignored for beacon, importScripts, fetch(), EventSource, and XHR
1330         https://bugs.webkit.org/show_bug.cgi?id=185789
1331         <rdar://problem/40380175>
1332
1333         Reviewed by Andy Estes.
1334
1335         Have NetworkLoadChecker implement the ContentSecurityPolicyClient interface and support logging
1336         console messages, sending CSP reports, and dispatching SecurityPolicyViolation events.
1337
1338         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1339         (WebKit::NetworkConnectionToWebProcess::loadPing):
1340         * NetworkProcess/NetworkLoadChecker.cpp:
1341         (WebKit::NetworkLoadChecker::NetworkLoadChecker): Modified to take a reference to the NetworkConnectionToWebProcess,
1342         the web page ID, the web frame ID, and the resource load identifier. These details are necessary
1343         in order to implement the ContentSecurityPolicyClient interface.
1344         (WebKit::NetworkLoadChecker::isAllowedByContentSecurityPolicy): Added.
1345         (WebKit::NetworkLoadChecker::continueCheckingRequest): Write in terms of isAllowedByContentSecurityPolicy().
1346         (WebKit::NetworkLoadChecker::contentSecurityPolicy): Pass ourself as the client so that we receive
1347         delegate callbacks.
1348         (WebKit::NetworkLoadChecker::addConsoleMessage): Added.
1349         (WebKit::NetworkLoadChecker::sendCSPViolationReport): Added.
1350         (WebKit::NetworkLoadChecker::enqueueSecurityPolicyViolationEvent): Added.
1351         * NetworkProcess/NetworkLoadChecker.h:
1352         * NetworkProcess/NetworkResourceLoader.cpp:
1353         (NetworkResourceLoader::enqueueSecurityPolicyViolationEvent): Added.
1354         * NetworkProcess/NetworkResourceLoader.h:
1355         * NetworkProcess/PingLoad.cpp:
1356         (WebKit::PingLoad::PingLoad): Modified to take a reference to the NetworkConnectionToWebProcess and pass
1357         this through to the NetworkLoadChecker along with the web page ID, web frame ID and resource load identifier.
1358         * NetworkProcess/PingLoad.h:
1359         * WebProcess/WebPage/WebPage.cpp:
1360         (WebKit::WebPage::enqueueSecurityPolicyViolationEvent): Added.
1361         * WebProcess/WebPage/WebPage.h:
1362         * WebProcess/WebPage/WebPage.messages.in: Add message EnqueueSecurityPolicyViolationEvent.
1363
1364 2018-05-21  Brian Burg  <bburg@apple.com>
1365
1366         Web Automation: always return an empty cookie list if document.cookieURL() is empty
1367         https://bugs.webkit.org/show_bug.cgi?id=185838
1368         <rdar://problem/37737526>
1369
1370         Reviewed by Tim Horton.
1371
1372         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1373         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
1374         This crashes in CFNetwork code because an empty cookie URL is not a valid input.
1375         Just return an empty list since there couldn't be any cookies returned.
1376
1377 2018-05-21  Brian Burg  <bburg@apple.com>
1378
1379         Web Automation: terminate the automation session if the network or storage process crashes
1380         https://bugs.webkit.org/show_bug.cgi?id=185827
1381         <rdar://problem/40424020>
1382
1383         Reviewed by Tim Horton.
1384
1385         If one of the processes crashes, the page may be in an undefined state and
1386         automation will fail in unpredictable ways. It's better to just give up immediately.
1387
1388         * UIProcess/WebProcessPool.cpp:
1389         (WebKit::WebProcessPool::networkProcessFailedToLaunch):
1390         (WebKit::WebProcessPool::storageProcessCrashed):
1391
1392 2018-05-21  Sihui Liu  <sihui_liu@apple.com>
1393
1394         Add a diskCacheSizeOverride accessor function on WKContextConfigurationRef
1395         https://bugs.webkit.org/show_bug.cgi?id=185826
1396         <rdar://problem/39732113>
1397
1398         Reviewed by Alex Christensen.
1399
1400         * UIProcess/API/C/WKContextConfigurationRef.cpp:
1401         (WKContextConfigurationDiskCacheSizeOverride):
1402         (WKContextConfigurationSetDiskCacheSizeOverride):
1403         * UIProcess/API/C/WKContextConfigurationRef.h:
1404
1405 2018-05-21  Jer Noble  <jer.noble@apple.com>
1406
1407         Complete fix for enabling modern EME by default
1408         https://bugs.webkit.org/show_bug.cgi?id=185770
1409         <rdar://problem/40368220>
1410
1411         Reviewed by Eric Carlson.
1412
1413         * Configurations/FeatureDefines.xcconfig:
1414
1415 2018-05-21  Sam Weinig  <sam@webkit.org>
1416
1417         Modernize RenderStyleConstants.h - Part 1
1418         https://bugs.webkit.org/show_bug.cgi?id=185809
1419
1420         Reviewed by Yusuke Suzuki.
1421
1422         * WebProcess/WebPage/ios/WebPageIOS.mm:
1423         (WebKit::WebPage::rangeForWebSelectionAtPosition):
1424         (WebKit::WebPage::getPositionInformation):
1425         Update for new enum names.
1426
1427 2018-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1428
1429         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.2 release.
1430
1431         * gtk/NEWS: Add release notes for 2.21.2.
1432
1433 2018-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1434
1435         Unreviewed, rolling out r222967.
1436
1437         It's not ready yet
1438
1439         Reverted changeset:
1440
1441         "[GTK][WPE] Add API to configure and enable resource load
1442         statistics"
1443         https://bugs.webkit.org/show_bug.cgi?id=177943
1444         https://trac.webkit.org/changeset/222967
1445
1446 2018-05-18  Commit Queue  <commit-queue@webkit.org>
1447
1448         Unreviewed, rolling out r231982.
1449         https://bugs.webkit.org/show_bug.cgi?id=185793
1450
1451         Caused layout test failures (Requested by realdawei on
1452         #webkit).
1453
1454         Reverted changeset:
1455
1456         "Complete fix for enabling modern EME by default"
1457         https://bugs.webkit.org/show_bug.cgi?id=185770
1458         https://trac.webkit.org/changeset/231982
1459
1460 2018-05-18  Brian Burg  <bburg@apple.com>
1461
1462         [Cocoa] Add missing nullability annotations to _WKAutomationSessionDelegate
1463         https://bugs.webkit.org/show_bug.cgi?id=185791
1464         <rdar://problem/40279891>
1465
1466         Reviewed by Tim Horton.
1467
1468         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h: If there is no dialog shown,
1469         then the delegate methods to return the dialog text may return a nil NSString.
1470
1471 2018-05-18  Youenn Fablet  <youenn@apple.com>
1472
1473         NetworkLoadChecker should cancel its content extension retrieval task when being destroyed
1474         https://bugs.webkit.org/show_bug.cgi?id=185661
1475         <rdar://problem/39985509>
1476
1477         Reviewed by Chris Dumez.
1478
1479         Make sure that the Content Extension retrieval callback checks that NetworkLoadChecker is alive.
1480         This allows stopping NetworkLoadChecker be ref counted.
1481         This in turns allows NetworkResourceLoader to delete its NetworkLoadChecker when being deleted as well.
1482         By doing so, we simplify the memory management of NetworkResourceLoader and NetworkLoadChecker.
1483
1484         * NetworkProcess/NetworkLoadChecker.cpp:
1485         (WebKit::NetworkLoadChecker::checkRequest):
1486         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
1487         * NetworkProcess/NetworkLoadChecker.h:
1488         (WebKit::NetworkLoadChecker::weakPtrFactory):
1489         * NetworkProcess/NetworkResourceLoader.cpp:
1490         * NetworkProcess/NetworkResourceLoader.h:
1491         * NetworkProcess/PingLoad.cpp:
1492         (WebKit::PingLoad::PingLoad):
1493         * NetworkProcess/PingLoad.h:
1494
1495 2018-05-18  Per Arne Vollan  <pvollan@apple.com>
1496
1497         WebProcess fails to launch
1498         https://bugs.webkit.org/show_bug.cgi?id=185140
1499
1500         Reviewed by Geoffrey Garen.
1501
1502         If the NSApplication runloop is not used in the WebContent process, launchServicesCheckIn() needs to be called
1503         in order for enableSandboxStyleFileQuarantine() to succeed. Determine at runtime if launchServicesCheckIn()
1504         should be called by checking if the NSApplication event loop is running.
1505
1506         * WebProcess/cocoa/WebProcessCocoa.mm:
1507         (WebKit::WebProcess::platformInitializeProcess):
1508
1509 2018-05-18  Jer Noble  <jer.noble@apple.com>
1510
1511         Complete fix for enabling modern EME by default
1512         https://bugs.webkit.org/show_bug.cgi?id=185770
1513         <rdar://problem/40368220>
1514
1515         Reviewed by Eric Carlson.
1516
1517         * Configurations/FeatureDefines.xcconfig:
1518
1519 2018-05-18  Brent Fulgham  <bfulgham@apple.com>
1520
1521         Convert ProcessPrivilege assertions to regular debug-only assertions
1522         https://bugs.webkit.org/show_bug.cgi?id=185775
1523         <rdar://problem/40372286>
1524
1525         Reviewed by Geoffrey Garen.
1526
1527         In Bug 184322 I added a number of RELEASE_ASSERT checks that certain
1528         UI-only calls were not being made in the WebContent process.
1529
1530         Measurements have shown that these RELEASE_ASSERTs have regressed performance
1531         by around 1% on some benchmarks, so we should convert them to normal asserts.
1532
1533         This patch changes the RELEASE_ASSERTs into ASSERTs.
1534
1535         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1536         (WebKit::WebProcessPool::platformInitializeWebProcess):
1537         * UIProcess/Cocoa/WebViewImpl.mm:
1538         (WebKit::WebViewImpl::WebViewImpl):
1539         (WebKit::WebViewImpl::becomeFirstResponder):
1540         (WebKit::WebViewImpl::pluginFocusOrWindowFocusChanged):
1541         (WebKit::WebViewImpl::validateUserInterfaceItem):
1542         (WebKit::WebViewImpl::startSpeaking):
1543         (WebKit::WebViewImpl::stopSpeaking):
1544         (WebKit::applicationFlagsForDrag):
1545         (WebKit::WebViewImpl::doneWithKeyEvent):
1546         * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm:
1547         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
1548         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
1549         (WebKit::PluginProcessProxy::enterFullscreen):
1550         (WebKit::PluginProcessProxy::beginModal):
1551         (WebKit::PluginProcessProxy::endModal):
1552         * UIProcess/mac/DisplayLink.cpp:
1553         (WebKit::DisplayLink::DisplayLink):
1554         (WebKit::DisplayLink::~DisplayLink):
1555         * UIProcess/mac/WebPageProxyMac.mm:
1556         (WebKit::WebPageProxy::getIsSpeaking):
1557         (WebKit::WebPageProxy::speak):
1558         (WebKit::WebPageProxy::stopSpeaking):
1559         (WebKit::WebPageProxy::startDisplayLink):
1560         * UIProcess/mac/WebPopupMenuProxyMac.mm:
1561         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
1562
1563 2018-05-18  Eric Carlson  <eric.carlson@apple.com>
1564
1565         Handle failure to extend sandbox gracefully
1566         https://bugs.webkit.org/show_bug.cgi?id=185779
1567         <rdar://problem/40316349>
1568
1569         Reviewed by Brent Fulgham.
1570
1571         * UIProcess/API/Cocoa/WKWebView.mm:
1572         (-[WKWebView _denyNextUserMediaRequest]): 
1573         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1574
1575         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1576         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): Don't append
1577         the request to m_grantedRequests if it failed.
1578         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess): Deny request if willCreateMediaStream
1579         fails.
1580         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1581
1582         * UIProcess/UserMediaProcessManager.cpp:
1583         (WebKit::UserMediaProcessManager::willCreateMediaStream): Don't try to extend sandbox if
1584         we fail to allocate all necessary handles.
1585         * UIProcess/UserMediaProcessManager.h:
1586         (WebKit::UserMediaProcessManager::denyNextUserMediaRequest): New, for testing.
1587
1588 2018-05-18  Antoine Quint  <graouts@apple.com>
1589
1590         [Web Animations] Turn Web Animations with CSS integration on for test runners
1591         https://bugs.webkit.org/show_bug.cgi?id=184819
1592         <rdar://problem/39597337>
1593
1594         Unreviewed. Rolling out the patch for this bug, it caused some flaky timeouts for animation suspension tests.
1595
1596         * Shared/WebPreferences.yaml:
1597
1598 2018-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1599
1600         [Extra zoom mode] Clearing text fields should dispatch input events of type "deleteContent"
1601         https://bugs.webkit.org/show_bug.cgi?id=185769
1602         <rdar://problem/40368261>
1603
1604         Reviewed by Tim Horton.
1605
1606         When setting the text of the currently focused element to the empty string, just delete the text instead of
1607         pretending to insert an empty string. This mimics deleting content using the delete key on macOS, and fires an
1608         input event with inputType "deleteContent" instead of "insertText".
1609
1610         Test: fast/forms/extrazoom/delete-content-in-text-field.html
1611
1612         * WebProcess/WebPage/WebPage.cpp:
1613         (WebKit::WebPage::setTextAsync):
1614
1615 2018-05-18  Keith Rollin  <krollin@apple.com>
1616
1617         Renamed "trackNetworkActivity" to "tracksResourceLoadMilestones"
1618         https://bugs.webkit.org/show_bug.cgi?id=185523
1619         <rdar://problem/40136361>
1620
1621         Reviewed by Geoffrey Garen.
1622
1623         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1624         (WebKit::networkActivityTrackingEnabled):
1625         * NetworkProcess/NetworkProcess.cpp:
1626         (WebKit::NetworkProcess::initializeNetworkProcess):
1627         * NetworkProcess/NetworkProcess.h:
1628         (WebKit::NetworkProcess::tracksResourceLoadMilestones const):
1629         (WebKit::NetworkProcess::trackNetworkActivity const): Deleted.
1630         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1631         (WebKit::NetworkProcessCreationParameters::encode const):
1632         (WebKit::NetworkProcessCreationParameters::decode):
1633         * NetworkProcess/NetworkProcessCreationParameters.h:
1634         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1635         (API::ProcessPoolConfiguration::copy):
1636         * UIProcess/API/APIProcessPoolConfiguration.h:
1637         * UIProcess/API/C/WKContextConfigurationRef.cpp:
1638         (WKContextConfigurationTracksResourceLoadMilestones):
1639         (WKContextConfigurationSetTracksResourceLoadMilestones):
1640         (WKContextConfigurationTrackNetworkActivity): Deleted.
1641         (WKContextConfigurationSetTrackNetworkActivity): Deleted.
1642         * UIProcess/API/C/WKContextConfigurationRef.h:
1643         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1644         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1645         (-[_WKProcessPoolConfiguration tracksResourceLoadMilestones]):
1646         (-[_WKProcessPoolConfiguration setTracksResourceLoadMilestones:]):
1647         (-[_WKProcessPoolConfiguration trackNetworkActivity]): Deleted.
1648         (-[_WKProcessPoolConfiguration setTrackNetworkActivity:]): Deleted.
1649         * UIProcess/WebProcessPool.cpp:
1650         (WebKit::WebProcessPool::ensureNetworkProcess):
1651
1652 2018-05-18  Chris Dumez  <cdumez@apple.com>
1653
1654         Avoid keeping the frame alive when ref'ing a WindowProxy
1655         https://bugs.webkit.org/show_bug.cgi?id=185737
1656         <rdar://problem/40004666>
1657
1658         Reviewed by Sam Weinig.
1659
1660         * WebProcess/Plugins/PluginView.cpp:
1661         (WebKit::PluginView::windowScriptNPObject):
1662
1663 2018-05-18  Youenn Fablet  <youenn@apple.com>
1664
1665         -Wmemset-elt-size warning in LibWebRTCSocket constructor
1666         https://bugs.webkit.org/show_bug.cgi?id=185555
1667         <rdar://problem/40217250>
1668
1669         Reviewed by Darin Adler.
1670
1671         GetOption implementation was broken in that it was not initializing properly its array of options.
1672         This patch fixes it by using an array of optional<int> which are initialized by default.
1673         When no value is set, we return the error code -1.
1674         In theory, we should go to NetworkProcess to get the actual value.
1675         Since GetOption is not used in practice, we just do this best effort implementation of storing previously set values.
1676
1677         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
1678         (WebKit::LibWebRTCSocket::LibWebRTCSocket):
1679         (WebKit::LibWebRTCSocket::GetOption):
1680         * WebProcess/Network/webrtc/LibWebRTCSocket.h:
1681
1682 2018-05-18  Antoine Quint  <graouts@apple.com>
1683
1684         [Web Animations] Turn Web Animations with CSS integration on for test runners
1685         https://bugs.webkit.org/show_bug.cgi?id=184819
1686         <rdar://problem/39597337>
1687
1688         Reviewed by Jon Lee.
1689
1690         * Shared/WebPreferences.yaml: Leave Web Animations off by default, it's up to clients
1691         to turn it on.
1692
1693 2018-05-18  Fujii Hironori  <Hironori.Fujii@sony.com>
1694
1695         [Curl] Remove unused SystemProxyWin.cpp
1696         https://bugs.webkit.org/show_bug.cgi?id=185224
1697
1698         Reviewed by Antti Koivisto.
1699
1700         SystemProxyWin is not used at the moment. Remove it.
1701
1702         * NetworkProcess/win/SystemProxyWin.cpp: Removed.
1703         * NetworkProcess/win/SystemProxyWin.h: Removed.
1704         * PlatformWin.cmake: Removed SystemProxyWin.cpp.
1705
1706 2018-05-17  Nan Wang  <n_wang@apple.com>
1707
1708         AX: [macOS] Expose the primary screen height through AX API
1709         https://bugs.webkit.org/show_bug.cgi?id=185742
1710
1711         Reviewed by Chris Fleizach.
1712
1713         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1714         (-[WKAccessibilityWebPageObject accessibilityAttributeNames]):
1715         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
1716
1717 2018-05-17  Alex Christensen  <achristensen@webkit.org>
1718
1719         Use CompletionHandlers for DelayedReplies
1720         https://bugs.webkit.org/show_bug.cgi?id=182269
1721
1722         Reviewed by Youenn Fablet.
1723
1724         DelayedReplies should be a noncopyable, non-refcountable type.  They should be
1725         called once and only once.  This is what CompletionHandlers are for.
1726
1727         No change in behavior.  Just cleaner code.
1728
1729         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1730         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
1731         * NetworkProcess/NetworkConnectionToWebProcess.h:
1732         * NetworkProcess/NetworkResourceLoader.cpp:
1733         (WebKit::NetworkResourceLoader::SynchronousLoadData::SynchronousLoadData):
1734         (WebKit::sendReplyToSynchronousRequest):
1735         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
1736         * NetworkProcess/NetworkResourceLoader.h:
1737         * Platform/IPC/HandleMessage.h:
1738         (IPC::callMemberFunctionImpl):
1739         (IPC::callMemberFunction):
1740         (IPC::handleMessageDelayed):
1741         * PluginProcess/PluginControllerProxy.cpp:
1742         (WebKit::PluginControllerProxy::setInitializationReply):
1743         (WebKit::PluginControllerProxy::takeInitializationReply):
1744         * PluginProcess/PluginControllerProxy.h:
1745         * PluginProcess/WebProcessConnection.cpp:
1746         (WebKit::WebProcessConnection::destroyPlugin):
1747         (WebKit::WebProcessConnection::createPlugin):
1748         (WebKit::WebProcessConnection::createPluginAsynchronously):
1749         * PluginProcess/WebProcessConnection.h:
1750         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
1751         (Messages::WebPage::GetPluginProcessConnection::send):
1752         (Messages::WebPage::TestMultipleAttributes::send):
1753         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::DelayedReply): Deleted.
1754         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::~DelayedReply): Deleted.
1755         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::send): Deleted.
1756         (Messages::WebPage::TestMultipleAttributes::DelayedReply::DelayedReply): Deleted.
1757         (Messages::WebPage::TestMultipleAttributes::DelayedReply::~DelayedReply): Deleted.
1758         (Messages::WebPage::TestMultipleAttributes::DelayedReply::send): Deleted.
1759         * Scripts/webkit/LegacyMessages-expected.h:
1760         * Scripts/webkit/MessageReceiver-expected.cpp:
1761         (Messages::WebPage::GetPluginProcessConnection::send):
1762         (Messages::WebPage::TestMultipleAttributes::send):
1763         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::DelayedReply): Deleted.
1764         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::~DelayedReply): Deleted.
1765         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::send): Deleted.
1766         (Messages::WebPage::TestMultipleAttributes::DelayedReply::DelayedReply): Deleted.
1767         (Messages::WebPage::TestMultipleAttributes::DelayedReply::~DelayedReply): Deleted.
1768         (Messages::WebPage::TestMultipleAttributes::DelayedReply::send): Deleted.
1769         * Scripts/webkit/Messages-expected.h:
1770         * Scripts/webkit/messages.py:
1771         * UIProcess/Network/NetworkProcessProxy.cpp:
1772         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
1773         (WebKit::NetworkProcessProxy::networkProcessCrashed):
1774         (WebKit::NetworkProcessProxy::networkProcessFailedToLaunch):
1775         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
1776         * UIProcess/Network/NetworkProcessProxy.h:
1777         * UIProcess/Plugins/PluginProcessManager.cpp:
1778         (WebKit::PluginProcessManager::getPluginProcessConnection):
1779         * UIProcess/Plugins/PluginProcessManager.h:
1780         * UIProcess/Plugins/PluginProcessProxy.cpp:
1781         (WebKit::PluginProcessProxy::getPluginProcessConnection):
1782         (WebKit::PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch):
1783         (WebKit::PluginProcessProxy::didCreateWebProcessConnection):
1784         * UIProcess/Plugins/PluginProcessProxy.h:
1785         * UIProcess/Storage/StorageProcessProxy.cpp:
1786         (WebKit::StorageProcessProxy::getStorageProcessConnection):
1787         (WebKit::StorageProcessProxy::didClose):
1788         (WebKit::StorageProcessProxy::didCreateStorageToWebProcessConnection):
1789         * UIProcess/Storage/StorageProcessProxy.h:
1790         * UIProcess/WebPageProxy.cpp:
1791         (WebKit::ExceededDatabaseQuotaRecords::createRecord):
1792         (WebKit::WebPageProxy::receivedPolicyDecision):
1793         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
1794         (WebKit::WebPageProxy::createNewPage):
1795         (WebKit::WebPageProxy::runJavaScriptAlert):
1796         (WebKit::WebPageProxy::runJavaScriptConfirm):
1797         (WebKit::WebPageProxy::runJavaScriptPrompt):
1798         (WebKit::WebPageProxy::webGLPolicyForURL):
1799         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
1800         (WebKit::WebPageProxy::getToolbarsAreVisible):
1801         (WebKit::WebPageProxy::getMenuBarIsVisible):
1802         (WebKit::WebPageProxy::getStatusBarIsVisible):
1803         (WebKit::WebPageProxy::getWindowFrame):
1804         (WebKit::WebPageProxy::screenToRootView):
1805         (WebKit::WebPageProxy::rootViewToScreen):
1806         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
1807         (WebKit::WebPageProxy::exceededDatabaseQuota):
1808         (WebKit::WebPageProxy::reachedApplicationCacheOriginQuota):
1809         * UIProcess/WebPageProxy.h:
1810         * UIProcess/WebProcessPool.cpp:
1811         (WebKit::WebProcessPool::networkProcessCrashed):
1812         (WebKit::WebProcessPool::getNetworkProcessConnection):
1813         (WebKit::WebProcessPool::getStorageProcessConnection):
1814         * UIProcess/WebProcessPool.h:
1815         * UIProcess/WebProcessProxy.cpp:
1816         (WebKit::WebProcessProxy::getPluginProcessConnection):
1817         (WebKit::WebProcessProxy::getNetworkProcessConnection):
1818         (WebKit::WebProcessProxy::getStorageProcessConnection):
1819         * UIProcess/WebProcessProxy.h:
1820         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1821         (WebKit::WebSWContextManagerConnection::syncTerminateWorker):
1822         * WebProcess/Storage/WebSWContextManagerConnection.h:
1823         * WebProcess/WebPage/WebPage.h:
1824         * WebProcess/WebPage/ios/WebPageIOS.mm:
1825         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
1826
1827 2018-05-17  Jer Noble  <jer.noble@apple.com>
1828
1829         CRASH in -[WKFullScreenViewController _manager]
1830         https://bugs.webkit.org/show_bug.cgi?id=185745
1831         <rdar://problem/39195241>
1832
1833         Reviewed by Eric Carlson.
1834
1835         Protect against WKFullScreenViewController outliving WKWebView by making its
1836         _webView property weak. Additionally, add a sanity-check RetainPtr where _webView
1837         is referenced multiple times within a function.
1838
1839         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1840         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1841         (-[WKFullScreenWindowController initWithWebView:]):
1842         (-[WKFullScreenWindowController enterFullScreen]):
1843         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
1844         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
1845         (-[WKFullScreenWindowController _completedExitFullScreen]):
1846         (-[WKFullScreenWindowController close]):
1847         (-[WKFullScreenWindowController webViewDidRemoveFromSuperviewWhileInFullscreen]):
1848         (-[WKFullScreenWindowController _exitFullscreenImmediately]):
1849         (-[WKFullScreenWindowController _isSecure]):
1850         (-[WKFullScreenWindowController _serverTrust]):
1851         (-[WKFullScreenWindowController _updateLocationInfo]):
1852         (-[WKFullScreenWindowController _manager]):
1853         (-[WKFullScreenWindowController _startToDismissFullscreenChanged:]):
1854
1855 2018-05-17  Brent Fulgham  <bfulgham@apple.com>
1856
1857         Correct default for StorageAccess API
1858         https://bugs.webkit.org/show_bug.cgi?id=185748
1859         <rdar://problem/40220659>
1860
1861         Reviewed by Dean Jackson.
1862
1863         Flip the default state to 'true' so that the new "sticky" state
1864         for Storage Access API and attributing user interaction for
1865         Storage Access API use is applied by default.
1866
1867         * Shared/WebPreferences.yaml:
1868
1869 2018-05-17  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1870
1871         [WPE] Implement and enable FULLSCREEN_API
1872         https://bugs.webkit.org/show_bug.cgi?id=185676
1873
1874         Reviewed by Žan Doberšek.
1875
1876         Do the initial implementation of FULLSCREEN_API for WPE and
1877         enable the CMake option by default.
1878
1879         Most of the layout tests (55 of 58) are passing and the feature
1880         seems to work fine on different websites that use it.
1881
1882         * UIProcess/API/wpe/PageClientImpl.cpp:
1883         (WebKit::PageClientImpl::fullScreenManagerProxyClient):
1884         (WebKit::PageClientImpl::closeFullScreenManager):
1885         (WebKit::PageClientImpl::isFullScreen):
1886         (WebKit::PageClientImpl::enterFullScreen):
1887         (WebKit::PageClientImpl::exitFullScreen):
1888         (WebKit::PageClientImpl::beganEnterFullScreen):
1889         (WebKit::PageClientImpl::beganExitFullScreen):
1890         * UIProcess/API/wpe/PageClientImpl.h:
1891         * UIProcess/API/wpe/WPEView.h:
1892         (WKWPE::View::isFullScreen):
1893         (WKWPE::View::setFullScreen):
1894
1895 2018-05-17  Jiewen Tan  <jiewen_tan@apple.com>
1896
1897         Convert CertificateInfo into Credential in UI Process instead of Networking Process
1898         https://bugs.webkit.org/show_bug.cgi?id=185662
1899         <rdar://problem/40275561>
1900
1901         Reviewed by Alex Christensen.
1902
1903         Right now we convert CertificateInfo into Credential in the very last stage of client certificate authentication process
1904         when it reaches Networking Process. This patch moves that conversion earlier in UI Process such that we don't have to
1905         pass both Credential and CertificateInfo to Networking Process.
1906
1907         CertificateInfo is only used in macOS for C API specifically. WK2 includes macOS/iOS relies on NSURLCredential/WebCore::Credential
1908         solely. WK2 has already exercised the ability of using WebCore::Credential to do client certficate authentication. This patch therefore
1909         takes advantage of that. It converts CertficateInfo objects into Credential objects right after WebCredential is initialized, and then merge
1910         any code paths that utilizes CertficateInfo into ones that uses WebCore::Credential.
1911
1912         Covered by existing tests.
1913
1914         * Shared/Authentication/AuthenticationManager.cpp:
1915         (WebKit::AuthenticationManager::useCredentialForChallenge):
1916         (WebKit::AuthenticationManager::useCredentialForSingleChallenge):
1917         (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge): Deleted.
1918         * Shared/Authentication/AuthenticationManager.h:
1919         * Shared/Authentication/AuthenticationManager.messages.in:
1920         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
1921         (WebKit::AuthenticationChallengeProxy::useCredential):
1922         * UIProcess/Authentication/WebCredential.cpp:
1923         (WebKit::WebCredential::WebCredential):
1924         (WebKit::WebCredential::certificateInfo): Deleted.
1925         * UIProcess/Authentication/WebCredential.h:
1926         (WebKit::WebCredential::create):
1927         * UIProcess/Authentication/mac/WebCredentialMac.mm: Renamed from Source/WebKit/Shared/Authentication/mac/AuthenticationManager.mac.mm.
1928         (WebKit::leafCertificate):
1929         (WebKit::chain):
1930         (WebKit::WebCredential::WebCredential):
1931         * WebKit.xcodeproj/project.pbxproj:
1932
1933 2018-05-17  Jeremy Jones  <jeremyj@apple.com>
1934
1935         Ensure valid rects for fullsceen animation.
1936         https://bugs.webkit.org/show_bug.cgi?id=185736
1937         rdar://problem/40320174
1938
1939         Reviewed by Jer Noble.
1940
1941         Protect against zero width and height since those can make for NANs in the animation transforms.
1942
1943         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1944         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
1945         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
1946
1947 2018-05-17  Jer Noble  <jer.noble@apple.com>
1948
1949         Turn Modern EME API on by default and remove it as an experimental feature
1950         https://bugs.webkit.org/show_bug.cgi?id=185693
1951         <rdar://problem/39954396>
1952
1953         Reviewed by Eric Carlson.
1954
1955         * Shared/WebPreferences.yaml:
1956
1957 2018-05-17  Dean Jackson  <dino@apple.com>
1958
1959         Safari optimized flow should be releasing viewer to prevent memory growth with subsequent launches/closes
1960         https://bugs.webkit.org/show_bug.cgi?id=185722
1961         <rdar://problem/40247351>
1962
1963         Reviewed by Antoine Quint.
1964
1965         I made a rookie mistake in the original patch: I was holding a strong
1966         reference to "self" in a block, which was causing a retain cycle.
1967         Replace that with a WeakObjCPtr.
1968
1969         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
1970         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
1971
1972 2018-05-16  Brent Fulgham  <bfulgham@apple.com>
1973
1974         REGRESSION(r229093)[macOS] Allow network-outbound for syslog use
1975         https://bugs.webkit.org/show_bug.cgi?id=185703
1976         <rdar://problem/39778918>
1977
1978         Reviewed by Eric Carlson.
1979
1980         In r229093 I removed the 'network-outbound' permission for syslog use.
1981         Further testing has shown that this is still needed for subsystem
1982         logging in our bundle loading code.
1983
1984         This patch re-enabled network-outbound for syslog.
1985
1986         * WebProcess/com.apple.WebProcess.sb.in:
1987
1988 2018-05-16  Andy VanWagoner  <andy@vanwagoner.family>
1989
1990         Add support for Intl NumberFormat formatToParts
1991         https://bugs.webkit.org/show_bug.cgi?id=185375
1992
1993         Reviewed by Yusuke Suzuki.
1994
1995         Add flag for NumberFormat formatToParts.
1996
1997         * Configurations/FeatureDefines.xcconfig:
1998
1999 2018-05-16  Andy Estes  <aestes@apple.com>
2000
2001         [Wi-Fi Assertions] Adopt WiFiAssertionHolderAdditions
2002         https://bugs.webkit.org/show_bug.cgi?id=185685
2003         <rdar://problem/40136681>
2004
2005         Reviewed by Sam Weinig.
2006
2007         * NetworkProcess/cocoa/WiFiAssertionHolder.cpp:
2008         (WebKit::WiFiAssertionHolder::WiFiAssertionHolder):
2009         (WebKit::WiFiAssertionHolder::~WiFiAssertionHolder):
2010         (WebKit::ensureWiFiManagerClient): Deleted.
2011
2012 2018-05-16  Fujii Hironori  <Hironori.Fujii@sony.com>
2013
2014         [Win] Implement WebPage::handleEditingKeyboardEvent
2015         https://bugs.webkit.org/show_bug.cgi?id=185327
2016
2017         Reviewed by Alexey Proskuryakov.
2018
2019         * WebProcess/WebPage/win/WebPageWin.cpp:
2020         (WebKit::WebPage::handleEditingKeyboardEvent): Copied from WebKitLegacy.
2021
2022 2018-05-16  Sihui Liu  <sihui_liu@apple.com>
2023
2024         Session cookies aren't reliably set when using default WKWebSiteDataStore
2025         https://bugs.webkit.org/show_bug.cgi?id=185624
2026         <rdar://problem/39111626>
2027
2028         Reviewed by Geoffrey Garen.
2029
2030         Session cookies of default session were set in UI Process when there was no process pool, 
2031         but they were not synced (or synced slowly to) Network Process. To make these cookies visible
2032         as soon as they were set through API, we could manually set those cookies in Network Process
2033         during its initilization. 
2034
2035         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2036         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2037         * UIProcess/API/APIHTTPCookieStore.cpp:
2038         (API::HTTPCookieStore::cookies):
2039         (API::HTTPCookieStore::setCookie):
2040         (API::HTTPCookieStore::deleteCookie):
2041         * UIProcess/WebProcessPool.cpp:
2042         (WebKit::WebProcessPool::ensureNetworkProcess):
2043         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
2044         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2045         (WebKit::WebsiteDataStore::clearPendingCookies):
2046         * UIProcess/WebsiteData/WebsiteDataStore.h:
2047
2048 2018-05-16  Chris Nardi  <cnardi@chromium.org>
2049
2050         Remove Document#selectedStylesheetSet/preferredStylesheetSet
2051         https://bugs.webkit.org/show_bug.cgi?id=185381
2052
2053         Reviewed by Darin Adler.
2054
2055         Make API methods for Document#selectedStylesheetSet/preferredStylesheetSet do nothing.
2056
2057         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.h:
2058         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
2059         (webkit_dom_document_set_property):
2060         (webkit_dom_document_get_property):
2061         (webkit_dom_document_get_preferred_stylesheet_set):
2062         (webkit_dom_document_get_selected_stylesheet_set):
2063         (webkit_dom_document_set_selected_stylesheet_set):
2064
2065 2018-05-16  Alberto Garcia  <berto@igalia.com>
2066
2067         [CMake] Properly detect compiler flags, needed libs, and fallbacks for usage of 64-bit atomic operations
2068         https://bugs.webkit.org/show_bug.cgi?id=182622
2069
2070         Reviewed by Michael Catanzaro.
2071
2072         Move the test to determine whether we need to link against
2073         libatomic to the common file WebKitCompilerFlags.cmake so it can
2074         also be used for JavaScriptCore.
2075
2076         * CMakeLists.txt:
2077
2078 2018-05-15  Yusuke Suzuki  <utatane.tea@gmail.com>
2079
2080         [JSC] Check TypeInfo first before calling getCallData when we would like to check whether given object is a function
2081         https://bugs.webkit.org/show_bug.cgi?id=185601
2082
2083         Reviewed by Saam Barati.
2084
2085         * WebProcess/Plugins/Netscape/JSNPObject.h:
2086
2087 2018-05-15  Sihui Liu  <sihui_liu@apple.com>
2088
2089         StorageManager::deleteLocalStorageOriginsModifiedSince: database files get deleted before database connections close
2090         https://bugs.webkit.org/show_bug.cgi?id=185671
2091
2092         Reviewed by Geoffrey Garen.
2093
2094         We should delete database files before closing databases.
2095
2096         * UIProcess/WebStorage/LocalStorageDatabase.cpp:
2097         (WebKit::LocalStorageDatabase::updateDatabaseWithChangedItems):
2098         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
2099         (WebKit::LocalStorageDatabaseTracker::databasesModifiedSince):
2100         (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince): Deleted.
2101         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
2102         * UIProcess/WebStorage/StorageManager.cpp:
2103         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
2104
2105 2018-05-15  Dean Jackson  <dino@apple.com>
2106
2107         Launch System Preview as the download starts, rather than waiting for a response
2108         https://bugs.webkit.org/show_bug.cgi?id=185669
2109         <rdar://problem/40278181>
2110
2111         Reviewed by Tim Horton.
2112
2113         We were waiting for the RequestResponse to get a MIME-type before
2114         launching the system preview. This causes an annoying delay.
2115
2116         Instead, assume that the system preview is one of the handled
2117         mime types and launch the viewer immediately. If it gets something it
2118         didn't expect, it will show an error.
2119
2120         * UIProcess/Cocoa/DownloadClient.mm:
2121         (WebKit::DownloadClient::didStart):
2122         (WebKit::DownloadClient::didReceiveResponse):
2123         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2124         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
2125         (WebKit::SystemPreviewController::start): Small cleanup to ensure we
2126         don't try to present twice (this shouldn't happen).
2127
2128 2018-05-15  Dean Jackson  <dino@apple.com>
2129
2130         Post-review cleanup for 185459
2131         https://bugs.webkit.org/show_bug.cgi?id=185665
2132         <rdar://problem/40276689>
2133
2134         Reviewed by Tim Horton.
2135
2136         Jon made some comments in 185459 that I'm addressing here.
2137
2138         * UIProcess/Cocoa/DownloadClient.h:
2139         * UIProcess/Cocoa/DownloadClient.mm: Guard the activity token for iOS
2140         in a way that means it will still work ok on macOS.
2141         (WebKit::DownloadClient::didStart):
2142         (WebKit::DownloadClient::processDidCrash):
2143         (WebKit::DownloadClient::didFinish):
2144         (WebKit::DownloadClient::didFail):
2145         (WebKit::DownloadClient::didCancel):
2146         (WebKit::DownloadClient::takeActivityToken):
2147         (WebKit::DownloadClient::releaseActivityTokenIfNecessary):
2148         (WebKit::DownloadClient::releaseActivityToken): Deleted.
2149
2150         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Add an early return.
2151         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
2152
2153 2018-05-15  Tadeu Zagallo  <tzagallo@apple.com>
2154
2155         Update touch event tracking types on every touch
2156         https://bugs.webkit.org/show_bug.cgi?id=184250
2157         <rdar://problem/39145092>
2158
2159         Reviewed by Geoffrey Garen.
2160
2161         The tracking types for touch events were only update on touchstart, which meant that event
2162         listeners added after the touchstart would always be treated as passive, even if explicitly
2163         setting passive to false.
2164
2165         * UIProcess/WebPageProxy.cpp:
2166         (WebKit::WebPageProxy::handleTouchEventSynchronously):
2167         (WebKit::WebPageProxy::handleTouchEvent):
2168
2169 2018-05-15  Per Arne Vollan  <pvollan@apple.com>
2170
2171         Pause display links when window is not visible.
2172         https://bugs.webkit.org/show_bug.cgi?id=185627
2173         <rdar://problem/39401106>
2174
2175         Reviewed by Simon Fraser.
2176
2177         Pause/resume display links created in the UI process when the window is hidden/shown.
2178
2179         * UIProcess/WebPageProxy.cpp:
2180         (WebKit::WebPageProxy::dispatchActivityStateChange):
2181         * UIProcess/mac/DisplayLink.cpp:
2182         (WebKit::DisplayLink::pause):
2183         (WebKit::DisplayLink::resume):
2184         * UIProcess/mac/DisplayLink.h:
2185
2186 2018-05-15  Dean Jackson  <dino@apple.com>
2187
2188         Provide UIView and UIImage for zoom transition
2189         https://bugs.webkit.org/show_bug.cgi?id=185655
2190         <rdar://problem/40267224>
2191
2192         Reviewed by Antoine Quint.
2193
2194         Provide a UIView* for the frameForPreviewItem to use as a source view.
2195         Also implement the transitionImageForPreviewItem delegate, even though
2196         we're returning nil.
2197
2198         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2199         (-[_WKPreviewControllerDelegate previewController:frameForPreviewItem:inSourceView:]):
2200         (-[_WKPreviewControllerDelegate previewController:transitionImageForPreviewItem:contentRect:]):
2201
2202 2018-05-15  Daniel Bates  <dabates@apple.com>
2203
2204         Fix the Apple Internal build
2205
2206         Make a similar change to WebKit as I did for LegacyWebKit in r231777. See <rdar://problem/40237873> for more details.
2207
2208         * UIProcess/mac/WKFullScreenWindowController.mm:
2209         (-[WKFullScreenWindowController enterFullScreen:]):
2210         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
2211         (-[WKFullScreenWindowController exitFullScreen]):
2212         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
2213         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
2214         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
2215         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
2216         (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):
2217
2218 2018-05-15  Megan Gardner  <megan_gardner@apple.com>
2219
2220         Clear selections from web content with single tap
2221         https://bugs.webkit.org/show_bug.cgi?id=185634
2222
2223         Reviewed by Tim Horton.
2224         
2225         With the switch to the single text selection assistant, we were not correctly clearing the selection when a
2226         single tap happened.
2227
2228         * UIProcess/ios/WKContentViewInteraction.mm:
2229         (-[WKContentView _singleTapCommited:]):
2230
2231 2018-05-15  Antoine Quint  <graouts@apple.com>
2232
2233         [Web Animations] Expose Web Animations CSS integration as an experimental feature
2234         https://bugs.webkit.org/show_bug.cgi?id=185647
2235
2236         Reviewed by Dean Jackson.
2237
2238         Rename the Web Animations CSS integration flag.
2239
2240         * Shared/WebPreferences.yaml:
2241         * UIProcess/API/C/WKPreferences.cpp:
2242         (WKPreferencesSetWebAnimationsCSSIntegrationEnabled):
2243         (WKPreferencesGetWebAnimationsCSSIntegrationEnabled):
2244         (WKPreferencesSetCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted.
2245         (WKPreferencesGetCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted.
2246         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2247         * UIProcess/API/Cocoa/WKPreferences.mm:
2248         (-[WKPreferences _setWebAnimationsCSSIntegrationEnabled:]):
2249         (-[WKPreferences _webAnimationsCSSIntegrationEnabled]):
2250         (-[WKPreferences _setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled:]): Deleted.
2251         (-[WKPreferences _cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled]): Deleted.
2252         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2253         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2254         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2255         (WebKit::InjectedBundle::setWebAnimationsCSSIntegrationEnabled):
2256         (WebKit::InjectedBundle::setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted.
2257         * WebProcess/InjectedBundle/InjectedBundle.h:
2258
2259 2018-05-15  Dean Jackson  <dino@apple.com>
2260
2261         Update animation when presenting QuickLook
2262         https://bugs.webkit.org/show_bug.cgi?id=185648
2263         <rdar://problem/39652624>
2264
2265         Reviewed by Antoine Quint.
2266
2267         Implement the QuickLook delegate on _WKPreviewControllerDelegate that
2268         produces a zoom-like animation when the QLPreviewController appears.
2269
2270         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2271         (-[_WKPreviewControllerDelegate previewController:frameForPreviewItem:inSourceView:]):
2272         * UIProcess/SystemPreviewController.h: Add a reference back to the page, so that
2273         the delegate implementation can access the presentingViewController.
2274         (WebKit::SystemPreviewController::page):
2275
2276 2018-05-14  Dean Jackson  <dino@apple.com>
2277
2278         Download and present System Preview
2279         https://bugs.webkit.org/show_bug.cgi?id=185459
2280         <rdar://problem/40079228>
2281
2282         Reviewed by Tim Horton.
2283
2284         Extend DownloadClient so that it can handle the case where
2285         the download was triggered by a System Preview. In this situation
2286         the result (and progress) are piped into QuickLook via the SystemPreviewController.
2287
2288         The DownloadProxy class is also extended to handle the destination
2289         filename and the size of the content.
2290
2291         Lastly, SystemPreviewController is updated to have a start(), show()
2292         and cancel() interface, and no longer adjusts page navigation.
2293
2294         * UIProcess/Cocoa/DownloadClient.h:
2295         * UIProcess/Cocoa/DownloadClient.mm: Handle the SystemPreview case, which
2296         doesn't have a download delegate, but instead needs to communicate with
2297         the SystemPreviewController, if one exists.
2298         (WebKit::DownloadClient::didStart):
2299         (WebKit::DownloadClient::didReceiveResponse):
2300         (WebKit::DownloadClient::didReceiveData):
2301         (WebKit::DownloadClient::didCreateDestination):
2302         (WebKit::DownloadClient::processDidCrash):
2303         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
2304         (WebKit::DownloadClient::didFinish):
2305         (WebKit::DownloadClient::didFail):
2306         (WebKit::DownloadClient::didCancel):
2307         (WebKit::DownloadClient::releaseActivityToken):
2308
2309         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Implement the new API.
2310         (-[_WKPreviewControllerDataSource initWithMIMEType:]):
2311         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
2312         (-[_WKPreviewControllerDataSource setProgress:]):
2313         (-[_WKPreviewControllerDataSource finish:]):
2314         (-[_WKPreviewControllerDelegate previewControllerDidDismiss:]):
2315         (WebKit::SystemPreviewController::start):
2316         (WebKit::SystemPreviewController::updateProgress):
2317         (WebKit::SystemPreviewController::finish):
2318         (WebKit::SystemPreviewController::cancel):
2319         (-[_WKPreviewControllerDataSource initWithURL:]): Deleted.
2320         (-[_WKPreviewControllerDelegate previewControllerWillDismiss:]): Deleted.
2321         (WebKit::SystemPreviewController::canPreview const): Deleted.
2322         (WebKit::SystemPreviewController::showPreview): Deleted.
2323         * UIProcess/Downloads/DownloadProxy.h: Track the destination file by name
2324         and size. Also expose a helper to identify system preview downloads.
2325         (WebKit::DownloadProxy::destinationFilename const):
2326         (WebKit::DownloadProxy::setDestinationFilename):
2327         (WebKit::DownloadProxy::expectedContentLength const):
2328         (WebKit::DownloadProxy::setExpectedContentLength):
2329         (WebKit::DownloadProxy::bytesLoaded const):
2330         (WebKit::DownloadProxy::setBytesLoaded):
2331         (WebKit::DownloadProxy::isSystemPreviewDownload const):
2332
2333         * UIProcess/SystemPreviewController.cpp: New API.
2334         (WebKit::SystemPreviewController::canPreview const):
2335         (WebKit::SystemPreviewController::sendPageBack): Deleted.
2336         (WebKit::SystemPreviewController::showPreview): Deleted.
2337         * UIProcess/SystemPreviewController.h:
2338
2339         * UIProcess/WebPageProxy.cpp:
2340         (WebKit::m_configurationPreferenceValues):
2341         (WebKit::WebPageProxy::reattachToWebProcess):
2342         (WebKit::WebPageProxy::resetState):
2343         * UIProcess/WebPageProxy.h:
2344
2345 2018-05-14  Brady Eidson  <beidson@apple.com>
2346
2347         Add an API test to guard against regressions while re-entering setDefersLoading:.
2348         <rdar://problem/37033737> and https://bugs.webkit.org/show_bug.cgi?id=185630
2349
2350         Reviewed by Chris Dumez.
2351
2352         * UIProcess/API/Cocoa/WKWebView.mm:
2353         (-[WKWebView _setDefersLoadingForTesting:]):
2354         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2355
2356         * UIProcess/WebPageProxy.cpp:
2357         (WebKit::WebPageProxy::setDefersLoadingForTesting):
2358         * UIProcess/WebPageProxy.h:
2359         * WebProcess/WebPage/WebPage.messages.in:
2360
2361 2018-05-14  Tim Horton  <timothy_horton@apple.com>
2362
2363         Use the system font by default in extra zoom mode
2364         https://bugs.webkit.org/show_bug.cgi?id=185638
2365         <rdar://problem/40230277>
2366
2367         Reviewed by Wenson Hsieh.
2368
2369         * Shared/WebPreferencesDefaultValues.h:
2370
2371 2018-05-14  Michael Catanzaro  <mcatanzaro@igalia.com>
2372
2373         Unreviewed, rolling out r231755.
2374
2375         Change is not correct
2376
2377         Reverted changeset:
2378
2379         "-Wmemset-elt-size warning in LibWebRTCSocket constructor"
2380         https://bugs.webkit.org/show_bug.cgi?id=185555
2381         https://trac.webkit.org/changeset/231755
2382
2383 2018-05-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2384
2385         [Extra zoom mode] Google search results are excessively zoomed in
2386         https://bugs.webkit.org/show_bug.cgi?id=185347
2387         <rdar://problem/39999778>
2388
2389         Reviewed by Tim Horton.
2390
2391         Adds a new experimental feature for the "disabled-adaptations" meta tag, and adds plumbing in WebKit to
2392         propagate disabled adaptation changes to the ViewportConfiguration. The experimental feature is on by default in
2393         extra zoom mode.
2394
2395         * Shared/WebPreferences.yaml:
2396         * Shared/WebPreferencesDefaultValues.h:
2397         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2398         (WebKit::WebChromeClient::dispatchDisabledAdaptationsDidChange const):
2399         * WebProcess/WebCoreSupport/WebChromeClient.h:
2400         * WebProcess/WebPage/WebPage.cpp:
2401         (WebKit::WebPage::disabledAdaptationsDidChange):
2402         * WebProcess/WebPage/WebPage.h:
2403
2404 2018-05-14  Chris Dumez  <cdumez@apple.com>
2405
2406         Overly aggressive timer throttling in service workers
2407         https://bugs.webkit.org/show_bug.cgi?id=185575
2408         <rdar://problem/40219038>
2409
2410         Reviewed by Geoff Garen.
2411
2412         After ~30 seconds, the system would put the service worker process in "App Nap",
2413         causing its timers to get aggressively throttled. This happens because the
2414         service worker processes are WebProcesses that have no visible WebPages.
2415
2416         To address the issue, we now disable process suppression for all service worker
2417         processes. This causes those processes to construct a UserActivity which prevents
2418         App Nap.
2419
2420         This patch also refactors the code a bit to avoid duplication. The ProcessSuppression
2421         suppression logic in now all on ChildProcessProxy / ChildProcess.
2422
2423         * NetworkProcess/NetworkProcess.messages.in:
2424         * PluginProcess/PluginProcess.messages.in:
2425         * Shared/ChildProcess.messages.in:
2426         * UIProcess/ChildProcessProxy.cpp:
2427         (WebKit::ChildProcessProxy::setProcessSuppressionEnabled):
2428         * UIProcess/ChildProcessProxy.h:
2429         * UIProcess/Network/NetworkProcessProxy.h:
2430         * UIProcess/Network/mac/NetworkProcessProxyMac.mm: Removed.
2431         * UIProcess/Plugins/PluginProcessProxy.h:
2432         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
2433         * UIProcess/ServiceWorkerProcessProxy.cpp:
2434         (WebKit::ServiceWorkerProcessProxy::didFinishLaunching):
2435         * UIProcess/ServiceWorkerProcessProxy.h:
2436         * UIProcess/WebProcessProxy.h:
2437         * WebKit.xcodeproj/project.pbxproj:
2438         * WebProcess/WebProcess.messages.in:
2439
2440 2018-05-14  Andy Estes  <aestes@apple.com>
2441
2442         [Wi-Fi Assertions] Allow clients to specify a context identifier
2443         https://bugs.webkit.org/show_bug.cgi?id=185620
2444         <rdar://problem/39915196>
2445
2446         Reviewed by Brady Eidson.
2447
2448         Added an SPI on _WKProcessPoolConfiguration that allows clients to specify a
2449         context identifier.
2450
2451         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2452         (WebKit::NetworkProcessCreationParameters::encode const):
2453         (WebKit::NetworkProcessCreationParameters::decode):
2454         * NetworkProcess/NetworkProcessCreationParameters.h:
2455         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2456         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2457         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2458         (API::ProcessPoolConfiguration::copy):
2459         * UIProcess/API/APIProcessPoolConfiguration.h:
2460         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2461         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2462         (-[_WKProcessPoolConfiguration wirelessContextIdentifier]):
2463         (-[_WKProcessPoolConfiguration setWirelessContextIdentifier:]):
2464         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2465         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2466
2467 2018-05-11  Brian Burg  <bburg@apple.com>
2468
2469         Web Automation: Automation.getBrowsingContext returns window origin that differs from window.screenX/Y
2470         https://bugs.webkit.org/show_bug.cgi?id=185571
2471         <rdar://problem/40180785>
2472
2473         Reviewed by Timothy Hatcher.
2474
2475         This code path was refactored to use completion handlers. It seems that the window.screenX/Y
2476         code path converts back to user coordinates but the WebDriver code path does not. Make them
2477         consistent since that is how it is spec'd and tested.
2478
2479         * UIProcess/WebPageProxy.cpp:
2480         (WebKit::WebPageProxy::getWindowFrameWithCallback):
2481         Convert the window frame to user coordinate space so it's the same as window.screenY.
2482
2483 2018-05-14  Brian Burg  <bburg@apple.com>
2484
2485         WebDriver: W3C test case actions/key.py::test_lone_keyup_sends_no_events is failing
2486         https://bugs.webkit.org/show_bug.cgi?id=185577
2487         <rdar://problem/40185478>
2488
2489         Reviewed by Timothy Hatcher.
2490
2491         This test is failing because it expects Release Actions to not emit any
2492         events if nothing has changed from the initial state. Because the two code paths
2493         for creating empty states don't actually produce the same empty state, a difference
2494         in location was detected between the two empty states. This generates a mousemove.
2495
2496         To fix this, unify the code that creates an empty state. For mouse input sources, always
2497         initialize the location to (0, 0) so that the mouse input source always has
2498         a location that is valid to click at.
2499
2500         * UIProcess/Automation/SimulatedInputDispatcher.h:
2501         Extract the type enum out of the class to avoid circular definitions of
2502         SimulatedInputSource and SimulatedInputSourceState.
2503
2504         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
2505         (WebKit::SimulatedInputSourceState::emptyStateForSourceType):
2506         Take the input source type when generating an empty state. We always want location
2507         set for a mouse input source, but not set it for other input sources like keys.
2508
2509         (WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources):
2510         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
2511         (WebKit::SimulatedInputSource::create):
2512         (WebKit::SimulatedInputSource::SimulatedInputSource):
2513         (WebKit::SimulatedInputSourceState::emptyState): Deleted.
2514         * UIProcess/Automation/WebAutomationSession.cpp:
2515         (WebKit::WebAutomationSession::WebAutomationSession):
2516         (WebKit::WebAutomationSession::inputSourceForType const):
2517         (WebKit::simulatedInputSourceTypeFromProtocolSourceType):
2518         (WebKit::WebAutomationSession::performInteractionSequence):
2519         * UIProcess/Automation/WebAutomationSession.h:
2520
2521 2018-05-14  Michael Catanzaro  <mcatanzaro@igalia.com>
2522
2523         -Wmemset-elt-size warning in LibWebRTCSocket constructor
2524         https://bugs.webkit.org/show_bug.cgi?id=185555
2525
2526         Reviewed by Youenn Fablet.
2527
2528         Add missing multiplication.
2529
2530         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
2531         (WebKit::LibWebRTCSocket::LibWebRTCSocket):
2532
2533 2018-05-14  Zan Dobersek  <zdobersek@igalia.com>
2534
2535         [GTK] REGRESSION(r231170) Build broken with Clang 5.0
2536         https://bugs.webkit.org/show_bug.cgi?id=185198
2537
2538         Reviewed by Michael Catanzaro.
2539
2540         * Shared/RTCNetwork.h: With std::optional forward declaration gone,
2541         explicitly include the WTF Optional.h header.
2542
2543 2018-05-13  Dean Jackson  <dino@apple.com>
2544
2545         WebKit2_Sim-7606.1.17.4 introduced dep cycle
2546         https://bugs.webkit.org/show_bug.cgi?id=185588
2547         <rdar://problem/40196581>
2548
2549         Reviewed by Tim Horton.
2550
2551         Soft link AssetViewer.framework to avoid a dependency cycle.
2552
2553         * Configurations/WebKit.xcconfig:
2554         * UIProcess/ios/WKSystemPreviewView.mm:
2555         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
2556
2557 2018-05-11  Daniel Bates  <dabates@apple.com>
2558
2559         X-Frame-Options: SAMEORIGIN needs to check all ancestor frames
2560         https://bugs.webkit.org/show_bug.cgi?id=185567
2561         <rdar://problem/40175008>
2562
2563         Reviewed by Brent Fulgham.
2564
2565         Change the behavior of "X-Frame-Options: SAMEORIGIN" to ensure that all ancestors frames
2566         are same-origin with the document that delivered this header. This prevents an intermediary
2567         malicious frame from clickjacking a child frame whose document is same-origin with the top-
2568         level frame. It also makes the behavior of X-Frame-Options in WebKit more closely match
2569         the behavior of X-Frame-Options in other browsers, including Chrome and Firefox.
2570         
2571         Currently a document delivered with "X-Frame-Options: SAMEORIGIN" must only be same-origin
2572         with the top-level frame's document in order to be displayed. This prevents clickjacking by
2573         a malicious page that embeds a page delivered with "X-Frame-Options: SAMEORIGIN". However,
2574         it does not protect against clickjacking of the "X-Frame-Options: SAMEORIGIN" page (victim)
2575         if embedded by an intermediate malicious iframe, say a "rogue ad", that was embedded in a
2576         document same origin with the victim page. We should protect against such attacks.
2577
2578         * NetworkProcess/NetworkResourceLoader.cpp:
2579         (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions):
2580
2581 2018-05-11  Dean Jackson  <dino@apple.com>
2582
2583         WKWebViewContentProvider should know what MIME type it was created to handle
2584         https://bugs.webkit.org/show_bug.cgi?id=185574
2585         <rdar://problem/40183049>
2586
2587         Reviewed by Tim Horton.
2588
2589         Pass the MIME type of the downloaded asset into the WKWebViewContentProvider's
2590         init method, so it can choose to do something based on that information. The
2591         PDF and LegacyPDF views don't care because they, clearly, only handle PDF. But
2592         a WKSystemPreviewView can handle multiple types.
2593
2594         * UIProcess/API/Cocoa/WKWebView.mm:
2595         (-[WKWebView _setHasCustomContentView:loadedMIMEType:]): Send the MIME type on
2596         to the WKWebViewContentProvider.
2597         * UIProcess/Cocoa/WKWebViewContentProvider.h: Add a new parameter to web_initWithFrame.
2598         * UIProcess/ios/WKLegacyPDFView.mm:
2599         (-[WKLegacyPDFView web_initWithFrame:webView:mimeType:]):
2600         (-[WKLegacyPDFView web_initWithFrame:webView:]): Deleted.
2601         * UIProcess/ios/WKPDFView.mm:
2602         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
2603         (-[WKPDFView web_initWithFrame:webView:]): Deleted.
2604         * UIProcess/ios/WKSystemPreviewView.mm:
2605         (-[WKSystemPreviewView web_initWithFrame:webView:mimeType:]):
2606         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]): Actually use
2607         the MIME type to tell QuickLook what it will be getting, rather than basing it on
2608         the file extension.
2609         (-[WKSystemPreviewView web_initWithFrame:webView:]): Deleted.
2610
2611 2018-05-11  Brent Fulgham  <bfulgham@apple.com>
2612
2613         Allow the WebContent process to read global ViewBridge preferences
2614         https://bugs.webkit.org/show_bug.cgi?id=185569
2615         <rdar://problem/40164339>
2616
2617         Reviewed by Eric Carlson.
2618
2619         Allow reads of the global /Library/Preferences/com.apple.ViewBridge.plist preference file.
2620
2621         * WebProcess/com.apple.WebProcess.sb.in:
2622
2623 2018-05-11  Megan Gardner  <megan_gardner@apple.com>
2624
2625         Cleanup canPerformActionForWebView in relation to the webSelectionAssistant being removed
2626         https://bugs.webkit.org/show_bug.cgi?id=185536
2627
2628         Reviewed by Tim Horton.
2629         
2630         The _webSelectionAssistant is now always nil, therefor many of these checks are unnecessary.
2631         Remove the check for a webSelection and clean up the logic surrounding those checks.
2632
2633         * UIProcess/ios/WKContentViewInteraction.mm:
2634         (-[WKContentView canPerformActionForWebView:withSender:]):
2635
2636 2018-05-11  Brady Eidson  <beidson@apple.com>
2637
2638         Followup to: Make sure history navigations reuse the existing process when necessary.
2639         https://bugs.webkit.org/show_bug.cgi?id=185532
2640
2641         Reviewed by Andy Estes.
2642
2643         * UIProcess/WebProcessPool.cpp:
2644         (WebKit::WebProcessPool::processForNavigationInternal): When re-using the same process,
2645           don't change the policy action.
2646
2647 2018-05-11  Charles Vazac  <cvazac@gmail.com>
2648
2649         Runtime feature flag for Server-Timing
2650         https://bugs.webkit.org/show_bug.cgi?id=184758
2651
2652         Reviewed by Youenn Fablet.
2653
2654         * Shared/WebPreferences.yaml: Added ServerTimingEnabled.
2655         * UIProcess/API/C/WKPreferences.cpp:
2656         (WKPreferencesGetServerTimingEnabled):
2657         * UIProcess/API/C/WKPreferencesRefPrivate.h: WK_EXPORT for WKPreferencesSetServerTimingEnabled.
2658         * WebProcess/Storage/WebSWContextManagerConnection.cpp: Call setServerTimingEnabled.
2659
2660 2018-05-11  Antti Koivisto  <antti@apple.com>
2661
2662         Network process should not stat() all cache files on startup to find their sizes
2663         https://bugs.webkit.org/show_bug.cgi?id=185542
2664         <rdar://problem/40092953>
2665
2666         Reviewed by Chris Dumez.
2667
2668         This is done to compute how much disk space a cache is using. While the operation happens
2669         in a background priority thread it is still quite a bit of work.
2670
2671         Large bodies are saved in separate blob files so record file sizes are capped. We can avoid work by
2672         estimating their size instead of counting it exactly.
2673
2674         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2675         (WebKit::NetworkCache::estimateRecordsSize):
2676         (WebKit::NetworkCache::Storage::synchronize):
2677
2678             Use size estimation if blob storage is in use.
2679             Remove the code that would delete empty files. Normal cache shrinking handles this.
2680
2681         (WebKit::NetworkCache::Storage::shouldStoreBodyAsBlob):
2682
2683 2018-05-11  Brady Eidson  <beidson@apple.com>
2684
2685         Make sure history navigations reuse the existing process when necessary.
2686         <rdar://problem/39746516> and https://bugs.webkit.org/show_bug.cgi?id=185532
2687
2688         Reviewed by Ryosuke Niwa.
2689
2690         If a view navigates to either a data: or blob: URL, it reuses the existing process.
2691  
2692         In such cases we need to also ensure that history navigations back will also reuse the existing process.
2693
2694         * Shared/NavigationActionData.cpp:
2695         (WebKit::NavigationActionData::encode const):
2696         (WebKit::NavigationActionData::decode):
2697         * Shared/NavigationActionData.h:
2698
2699         * UIProcess/API/APINavigation.h:
2700         (API::Navigation::setTargetItem):
2701
2702         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2703         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2704         (-[_WKProcessPoolConfiguration pageCacheEnabled]):
2705         (-[_WKProcessPoolConfiguration setPageCacheEnabled:]):
2706
2707         * UIProcess/WebPageProxy.cpp:
2708         (WebKit::WebPageProxy::receivedPolicyDecision):
2709         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2710
2711         * UIProcess/WebProcessPool.cpp:
2712         (WebKit::WebProcessPool::processForNavigationInternal): If the current and target back/forward items both
2713           came from the same process, then reuse the existing process.
2714
2715         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2716         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2717
2718 2018-05-10  Brent Fulgham  <bfulgham@apple.com>
2719
2720         REGRESSION(r231057): Encrypted media content playback failures
2721         https://bugs.webkit.org/show_bug.cgi?id=185537
2722         <rdar://problem/40038478>
2723
2724         Reviewed by Eric Carlson.
2725
2726         Put access to the SecurityServer back in the sandbox so we can validate the
2727         signatures of media encoder/decoders.
2728
2729         * WebProcess/com.apple.WebProcess.sb.in:
2730
2731 2018-05-11  Youenn Fablet  <youenn@apple.com>
2732
2733         NetworkCORSPreflightChecker should proceed when having a ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested challenge
2734         https://bugs.webkit.org/show_bug.cgi?id=185522
2735         <rdar://problem/39987152>
2736
2737         Reviewed by Brent Fulgham.
2738
2739         In case of such challenge, refuse to proceed with authentication since preflight is not using credentials.
2740         Previously, we were failing right away which is not right in case preflight is the request triggering the connection.
2741
2742         Manually tested.
2743
2744         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
2745         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
2746
2747 2018-05-10  Daniel Bates  <dabates@apple.com>
2748
2749         Use PlatformStrategies to switch between WebKit and WebKitLegacy checking of CSP frame-ancestors and X-Frame-Options
2750         https://bugs.webkit.org/show_bug.cgi?id=185412
2751
2752         Reviewed by Ryosuke Niwa.
2753
2754         Update code for renaming and write in terms of WebLoaderStrategy::shouldPerformSecurityChecks()
2755         instead of explicitly querying RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess().
2756
2757         * WebProcess/Network/WebLoaderStrategy.cpp:
2758         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2759         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
2760         (WebKit::WebLoaderStrategy::startPingLoad):
2761         (WebKit::WebLoaderStrategy::preconnectTo):
2762         (WebKit::WebLoaderStrategy::shouldPerformSecurityChecks const):
2763         (WebKit::WebLoaderStrategy::havePerformedSecurityChecks const):
2764         (WebKit::WebLoaderStrategy::isDoingLoadingSecurityChecks const): Deleted.
2765         * WebProcess/Network/WebLoaderStrategy.h:
2766         * WebProcess/WebPage/WebPage.cpp:
2767
2768 2018-05-10  Timothy Horton  <timothy_horton@apple.com>
2769
2770         Fix the build after r231393
2771         ​https://bugs.webkit.org/show_bug.cgi?id=185519
2772         <rdar://problem/40131741>
2773
2774         * Configurations/WebKit.xcconfig:
2775
2776 2018-05-10  John Wilander  <wilander@apple.com>
2777
2778         Storage Access API: Extend lifetime of cookies on successful user approval
2779         https://bugs.webkit.org/show_bug.cgi?id=185534
2780         <rdar://problem/40064547>
2781
2782         Reviewed by Brent Fulgham.
2783
2784         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
2785         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
2786             Picks up the experimental feature flag.
2787         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2788         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessInternal):
2789             Now updates the domain's user interaction timestamp if the user was
2790             prompted for this access.
2791         * UIProcess/WebResourceLoadStatisticsStore.h:
2792
2793 2018-05-10  Chris Dumez  <cdumez@apple.com>
2794
2795         [iOS] Release page load process assertion if the screen is locked
2796         https://bugs.webkit.org/show_bug.cgi?id=185333
2797
2798         Reviewed by Geoff Garen.
2799
2800         We normally take a background process assertion during page loads to allow them to complete
2801         even if the tab / app is backgrounded. We should however avoid doing so when the backgrounding
2802         is caused by the screen locking. Keeping the process assertion in this case would prevent the
2803         whole device from sleeping longer than it should, thus negatively impacting power.
2804
2805         * UIProcess/Cocoa/NavigationState.h:
2806         * UIProcess/Cocoa/NavigationState.mm:
2807         (WebKit::NavigationState::NavigationState):
2808         (WebKit::NavigationState::releaseNetworkActivityToken):
2809         (WebKit::NavigationState::didChangeIsLoading):
2810         * UIProcess/ios/WebPageProxyIOS.mm:
2811         (WebKit::WebPageProxy::applicationDidEnterBackground):
2812
2813 2018-05-10  Megan Gardner  <megan_gardner@apple.com>
2814
2815         Remove Unused Chinese/Japanese Reanalyze code
2816         https://bugs.webkit.org/show_bug.cgi?id=185529
2817
2818         Reviewed by Wenson Hsieh.
2819         
2820         The code for this has actually been completely removed from UIKit. This is unreachable 
2821         dead code that should be removed if just for cleanliness. 
2822
2823         * Platform/spi/ios/UIKitSPI.h:
2824         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2825         * UIProcess/ios/WKContentViewInteraction.h:
2826         * UIProcess/ios/WKContentViewInteraction.mm:
2827         (-[WKContentView canPerformActionForWebView:withSender:]):
2828         (-[WKContentView _reanalyzeForWebView:]): Deleted.
2829
2830 2018-05-10  Chris Dumez  <cdumez@apple.com>
2831
2832         [iOS] Apps that are not visible may not get suspended if they trigger page loads while in the background
2833         https://bugs.webkit.org/show_bug.cgi?id=185318
2834
2835         Reviewed by Geoffrey Garen.
2836
2837         Whenever there is a page load going on, we take a background process assertion to delay process
2838         suspension until this load completes. However, there is also a 3 seconds grace period after
2839         a load is complete to allow the app to trigger a new load shortly after. This grace period was
2840         introduced to support use cases where a visible app does loads in an offscreen view. However,
2841         it can be abused by apps running in the background as they could trigger new page loads while
2842         in the background to delay process suspension. This patch tightens the policy so that only
2843         apps that are currently visible get to use this grace period. Apps that are in the background
2844         get to finish their current load and will then get suspended.
2845
2846         * UIProcess/Cocoa/NavigationState.mm:
2847         (WebKit::NavigationState::didChangeIsLoading):
2848
2849 2018-05-10  Chris Dumez  <cdumez@apple.com>
2850
2851         'Cross-Origin-Options header implementation follow-up
2852         https://bugs.webkit.org/show_bug.cgi?id=185520
2853
2854         Reviewed by Ryosuke Niwa.
2855
2856         * WebProcess/WebPage/WebPage.cpp:
2857         (WebKit::WebPage::frameBecameRemote):
2858
2859 2018-05-10  Per Arne Vollan  <pvollan@apple.com>
2860
2861         Drop-down Control borders missing.
2862         https://bugs.webkit.org/show_bug.cgi?id=185500
2863         <rdar://problem/40093461>
2864
2865         Reviewed by Brent Fulgham.
2866
2867         Open sandbox for reading of some files in temp folder.
2868
2869         * WebProcess/com.apple.WebProcess.sb.in:
2870
2871 2018-05-10  Eric Carlson  <eric.carlson@apple.com>
2872
2873         [MediaStream, iOS] Don't check authorizationStatusForMediaType when using mock capture devices
2874         https://bugs.webkit.org/show_bug.cgi?id=185516
2875         <rdar://problem/36328191>
2876
2877         Reviewed by Youenn Fablet.
2878
2879         * UIProcess/Cocoa/UIDelegate.mm:
2880         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): Don't check
2881         +[AVCaptureDevice authorizationStatusForMediaType:] when using mock capture devices.
2882
2883 2018-05-10  Brent Fulgham  <bfulgham@apple.com>
2884
2885         REGRESSION(r230323): UIProcess needs to notify WebContent process of Accessibility setting changes
2886         https://bugs.webkit.org/show_bug.cgi?id=185515
2887         <rdar://problem/39627764>
2888
2889         Reviewed by Chris Fleizach.
2890
2891         The UIProcess needs to register for relevant Accessibility preference updates so that it can notify the
2892         WebContent processes that screen properties have changed.
2893
2894         This is represented by NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification.
2895
2896         Tested manually with the Accessibility preferences pane.
2897
2898         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2899         (WebKit::WebProcessPool::registerNotificationObservers): Add notification observer. When the notification
2900         is received, call 'screenPropertiesStateChanged' to message the information to the WebContent processes.
2901         (WebKit::WebProcessPool::unregisterNotificationObservers): Clean up observer.
2902         * UIProcess/WebProcessPool.cpp:
2903         (WebKit::WebProcessPool::screenPropertiesStateChanged): Added helper function.
2904         * UIProcess/WebProcessPool.h:
2905
2906 2018-05-09  Carlos Garcia Campos  <cgarcia@igalia.com>
2907
2908         WebDriver: implement advance user interactions
2909         https://bugs.webkit.org/show_bug.cgi?id=174616
2910
2911         Reviewed by Brian Burg.
2912
2913         Handle origin in case of mouse move transitions.
2914
2915         * UIProcess/Automation/Automation.json: Add MouseMoveOrigin enum and pass it as parameter of InputSourceState
2916         together with optional node handle. Also pass the frame handle to performInteractionSequence command to find the
2917         node in the current browsing context.
2918         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
2919         (WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources): Ensure we reset the location.
2920         (WebKit::SimulatedInputDispatcher::resolveLocation): Helper to resolve destination location based on current
2921         location and mouse move origin.
2922         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): Use resolveLocation() in mouse transitions.
2923         (WebKit::SimulatedInputDispatcher::run): Receive and save the frame ID.
2924         (WebKit::SimulatedInputDispatcher::finishDispatching): Reset the frame ID.
2925         * UIProcess/Automation/SimulatedInputDispatcher.h:
2926         * UIProcess/Automation/WebAutomationSession.cpp:
2927         (WebKit::WebAutomationSession::computeElementLayout): Use even numbers for the callback ID to not conflict with
2928         viewportInViewCenterPointOfElement() callbacks.
2929         (WebKit::WebAutomationSession::didComputeElementLayout): Handle computeElementLayout() or
2930         viewportInViewCenterPointOfElement() requests by calling the right callback depending on whether the ID is odd
2931         or even number.
2932         (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement): Send ComputeElementLayout message to the
2933         WebProcess using odd numbers for the callback ID to not conflict with computeElementLayout() callbacks.
2934         (WebKit::WebAutomationSession::performInteractionSequence): Handle the mouse origin and element handle.
2935         (WebKit::WebAutomationSession::cancelInteractionSequence): Pass the frame ID to the input dispatcher.
2936         * UIProcess/Automation/WebAutomationSession.h:
2937         * UIProcess/Automation/WebAutomationSessionMacros.h:
2938
2939 2018-05-09  Tim Horton  <timothy_horton@apple.com>
2940
2941         Remove the unused HAVE_OS_ACTIVITY
2942         https://bugs.webkit.org/show_bug.cgi?id=185501
2943
2944         Reviewed by Wenson Hsieh.
2945
2946         * config.h:
2947
2948 2018-05-09  Chris Dumez  <cdumez@apple.com>
2949
2950         Add initial support for 'Cross-Origin-Options' HTTP response header
2951         https://bugs.webkit.org/show_bug.cgi?id=184996
2952         <rdar://problem/39664620>
2953
2954         Reviewed by Geoff Garen.
2955
2956         * Shared/WebPreferences.yaml:
2957         Add this as an experimental feature, on by default.
2958
2959         * WebProcess/WebPage/WebPage.cpp:
2960         (WebKit::WebPage::frameBecameRemote):
2961         Make sure we pass the cross-origin options from the local Window
2962         to the remote one when transitioning.
2963
2964 2018-05-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2965
2966         [Extra zoom mode] fast/viewport/extrazoom/viewport-change-min-device-width.html sometimes fails
2967         https://bugs.webkit.org/show_bug.cgi?id=185490
2968         <rdar://problem/40097629>
2969
2970         Reviewed by Tim Horton.
2971
2972         This test is currently flaky due to incorrect logic when computing the unobscured content rect, in the slice of
2973         time after a frame load has been committed, and before the first visible content rect update from the UI process
2974         after the frame load has been committed.
2975
2976         * WebProcess/WebPage/ios/WebPageIOS.mm:
2977         (WebKit::WebPage::viewportConfigurationChanged):
2978
2979         In the case where !m_hasReceivedVisibleContentRectsAfterDidCommitLoad, we try to set the unobscured content size
2980         to be the view size divided by the initial scale. However, in extra zoom mode, `ViewportConfiguration`'s
2981         `minimumLayoutSize()` is the layout size, which is larger than the size of the view by default, so dividing this
2982         by the initial scale yields a bogus value. Instead, use `viewLayoutSize()` instead.
2983
2984         (WebKit::WebPage::updateViewportSizeForCSSViewportUnits):
2985
2986         We also try to divide the view size by the initial scale when computing the effective viewport size for `vw` and
2987         `vh`. Additionally, fix the misleading name of a variable (largestUnobscuredRect) that stores a size.
2988
2989 2018-05-09  Brent Fulgham  <bfulgham@apple.com>
2990
2991         Restrict unarchiving of bundle parameters to a set of known classes
2992         https://bugs.webkit.org/show_bug.cgi?id=185489
2993         <rdar://problem/21912401>
2994
2995         Reviewed by Ryosuke Niwa.
2996
2997         Stop accepting anything derived from NSObject, and instead only agree to unarchive objects
2998         from a set of things we actually pass as InjectedBundle parameters.
2999
3000         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
3001         (WebKit::InjectedBundle::setBundleParameter):
3002
3003 2018-05-09  Richard Houle  <rhoule@apple.com>
3004
3005         [Cocoa] Some fields are not identified as [WKWebProcessPlugInNodeHandle isTextField]
3006         https://bugs.webkit.org/show_bug.cgi?id=185260
3007         <rdar://problem/39290394>
3008
3009         INPUT element are not considered to be text fields when
3010         calling -[WKWebProcessPlugInNodeHandle isTextField]
3011         when they are of type number.
3012
3013         Reviewed by Tim Horton.
3014
3015         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
3016         (WebKit::InjectedBundleNodeHandle::isTextField const):
3017
3018 2018-05-09  Youenn Fablet  <youenn@apple.com>
3019
3020         Allow WebResourceLoader to cancel a load served from a service worker
3021         https://bugs.webkit.org/show_bug.cgi?id=185274
3022
3023         Reviewed by Chris Dumez.
3024
3025         Use FetchIdentifier instead of uint64_t.
3026         Add IPC support for cancelling a fetch from WebProcess to service worker process.
3027         Ask service worker process to cancel the fetch when its corresponding WebResourceLoader is cancelled.
3028         No change of behavior as once a WebResourceLoader is cancelled, any related IPC is not processed.
3029         A follow-up patch should try to cancel the FetchResponse load, meaning to either cancel the network load
3030         or to abort reading the readable stream.
3031
3032         * Scripts/webkit/messages.py:
3033         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3034         (WebKit::WebSWServerConnection::cancelFetch):
3035         (WebKit::WebSWServerConnection::startFetch):
3036         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
3037         (WebKit::WebSWServerConnection::didReceiveFetchData):
3038         (WebKit::WebSWServerConnection::didReceiveFetchFormData):
3039         (WebKit::WebSWServerConnection::didFinishFetch):
3040         (WebKit::WebSWServerConnection::didFailFetch):
3041         (WebKit::WebSWServerConnection::didNotHandleFetch):
3042         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3043         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
3044         * StorageProcess/StorageProcess.cpp:
3045         (WebKit::StorageProcess::didFailFetch):
3046         (WebKit::StorageProcess::didNotHandleFetch):
3047         (WebKit::StorageProcess::didReceiveFetchResponse):
3048         (WebKit::StorageProcess::didReceiveFetchData):
3049         (WebKit::StorageProcess::didReceiveFetchFormData):
3050         (WebKit::StorageProcess::didFinishFetch):
3051         * StorageProcess/StorageProcess.h:
3052         * StorageProcess/StorageProcess.messages.in:
3053         * WebProcess/Network/WebLoaderStrategy.cpp:
3054         (WebKit::WebLoaderStrategy::remove):
3055         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
3056         (WebKit::ServiceWorkerClientFetch::create):
3057         (WebKit::ServiceWorkerClientFetch::ServiceWorkerClientFetch):
3058         (WebKit::ServiceWorkerClientFetch::start):
3059         (WebKit::ServiceWorkerClientFetch::cancel):
3060         * WebProcess/Storage/ServiceWorkerClientFetch.h:
3061         * WebProcess/Storage/WebSWClientConnection.cpp:
3062         (WebKit::WebSWClientConnection::startFetch):
3063         (WebKit::WebSWClientConnection::cancelFetch):
3064         * WebProcess/Storage/WebSWClientConnection.h:
3065         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3066         (WebKit::WebSWContextManagerConnection::cancelFetch):
3067         (WebKit::WebSWContextManagerConnection::startFetch):
3068         * WebProcess/Storage/WebSWContextManagerConnection.h:
3069         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
3070         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
3071         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
3072         (WebKit::WebServiceWorkerFetchTaskClient::cancel):
3073         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
3074         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
3075         (WebKit::WebServiceWorkerProvider::handleFetch):
3076         (WebKit::WebServiceWorkerProvider::cancelFetch):
3077         (WebKit::WebServiceWorkerProvider::fetchFinished):
3078         * WebProcess/Storage/WebServiceWorkerProvider.h:
3079
3080 2018-05-09  Andy Estes  <aestes@apple.com>
3081
3082         [iOS] Consider the annotation bounds when positioning action sheets near long-pressed PDF links
3083         https://bugs.webkit.org/show_bug.cgi?id=185472
3084         <rdar://problem/39967092>
3085
3086         Reviewed by Daniel Bates.
3087
3088         Adopted new PDFHostViewControllerDelegate methods that include annotation rects
3089         when URLs and page indices are long-pressed. This allows us to avoid obscuring
3090         annotations when positioning action sheet popovers.
3091
3092         We also no longer need to convert the press location into host view coordinate
3093         space, as PDFKit now does that for us.
3094
3095         * UIProcess/ios/WKPDFView.mm:
3096         (-[WKPDFView _showActionSheetForURL:atLocation:withAnnotationRect:]):
3097         (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:withAnnotationRect:]):
3098         (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:withAnnotationRect:]):
3099         (-[WKPDFView _showActionSheetForURL:atLocation:]): Deleted.
3100         (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:]): Deleted.
3101         (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:]): Deleted.
3102
3103 2018-05-09  Andy Estes  <aestes@apple.com>
3104
3105         [iOS] Tell PDFHostViewController when animated resizes begin and end
3106         https://bugs.webkit.org/show_bug.cgi?id=185477
3107         <rdar://problem/39875372>
3108
3109         Reviewed by Anders Carlsson.
3110
3111         * UIProcess/API/Cocoa/WKWebView.mm:
3112         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
3113         (-[WKWebView _endAnimatedResize]):
3114         * UIProcess/Cocoa/WKWebViewContentProvider.h:
3115         * UIProcess/ios/WKPDFView.mm:
3116         (-[WKPDFView web_beginAnimatedResize]):
3117         (-[WKPDFView web_endAnimatedResize]):
3118
3119 2018-05-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3120
3121         Unreviewed. Update OptionsWPE.cmake and NEWS for 2.21.1 release.
3122
3123         * wpe/NEWS: Added. Add release notes for 2.21.1.
3124
3125 2018-05-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3126
3127         [WPE] Build cleanly with GCC 8 and ICU 60
3128         https://bugs.webkit.org/show_bug.cgi?id=185462
3129
3130         Reviewed by Carlos Alberto Lopez Perez.
3131
3132         * Platform/IPC/glib/GSocketMonitor.cpp:
3133         (IPC::GSocketMonitor::start): Silence -Wcast-function-type warning.
3134         * Shared/API/glib/WebKitContextMenu.cpp:
3135         (webkit_context_menu_new_with_items): Ditto.
3136
3137 2018-05-08  Sihui Liu  <sihui_liu@apple.com>
3138
3139         Adopt new async _savecookies SPI for keeping networking process active during flushing cookies
3140         https://bugs.webkit.org/show_bug.cgi?id=185261
3141         <rdar://problem/37214391>
3142
3143         Reviewed by Chris Dumez.
3144
3145         By adopting new async SPI _savecookies, we can keep networking process active(not suspended)
3146         until cookies are fully synced to disk with process assertion.
3147
3148         * NetworkProcess/NetworkProcess.cpp:
3149         (WebKit::NetworkProcess::didSyncAllCookies):
3150         * NetworkProcess/NetworkProcess.h:
3151         * NetworkProcess/NetworkProcess.messages.in:
3152         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3153         (WebKit::NetworkProcess::syncAllCookies):
3154         * UIProcess/Network/NetworkProcessProxy.cpp:
3155         (WebKit::NetworkProcessProxy::didClose):
3156         (WebKit::NetworkProcessProxy::syncAllCookies):
3157         (WebKit::NetworkProcessProxy::didSyncAllCookies):
3158         * UIProcess/Network/NetworkProcessProxy.h:
3159         * UIProcess/Network/NetworkProcessProxy.messages.in:
3160         * UIProcess/WebProcessPool.cpp:
3161         (WebKit::WebProcessPool::syncNetworkProcessCookies):
3162
3163 2018-05-08  Per Arne Vollan  <pvollan@apple.com>
3164
3165         Set colorspace in the PDF plugin.
3166         https://bugs.webkit.org/show_bug.cgi?id=185445
3167         <rdar://problem/40030981>
3168
3169         Reviewed by Simon Fraser.
3170
3171         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:
3172         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3173         (WebKit::PDFPlugin::PDFPlugin):
3174
3175 2018-05-08  Megan Gardner  <megan_gardner@apple.com>
3176
3177         Don't clear selection until we are actually interacting with a Node.
3178         https://bugs.webkit.org/show_bug.cgi?id=185455
3179
3180         Reviewed by Wenson Hsieh.
3181         
3182         The presence of TextInteractionAssistant should not be used as a proxy for it we are actually editing content.
3183         We need to check to see if we have an active node, and then we should clear the selection.
3184
3185         * UIProcess/ios/WKContentViewInteraction.mm:
3186         (-[WKContentView setSelectedTextRange:]):
3187
3188 2018-05-08  Ryan Haddad  <ryanhaddad@apple.com>
3189
3190         Unreviewed, rolling out r231486.
3191
3192         Caused service worker LayoutTest failures on macOS Debug WK2.
3193
3194         Reverted changeset:
3195
3196         "Allow WebResourceLoader to cancel a load served from a
3197         service worker"
3198         https://bugs.webkit.org/show_bug.cgi?id=185274
3199         https://trac.webkit.org/changeset/231486
3200
3201 2018-05-08  Andy Estes  <aestes@apple.com>
3202
3203         [iOS] _WKWebViewPrintFormatter should return a page count of 0 for PDF documents that do not allow printing
3204         https://bugs.webkit.org/show_bug.cgi?id=185133
3205
3206         Reviewed by Andreas Kling.
3207
3208         * UIProcess/ios/WKPDFView.mm:
3209         (-[WKPDFView _ensureDocumentForPrinting]):
3210         (-[WKPDFView _wk_pageCountForPrintFormatter:]):
3211         (-[WKPDFView _wk_printedDocument]):
3212
3213 2018-05-08  Andy Estes  <aestes@apple.com>
3214
3215         [iOS] WKPDFView remains in the view hierarchy after navigating away
3216         https://bugs.webkit.org/show_bug.cgi?id=185449
3217         <rdar://problem/39693469>
3218
3219         Reviewed by Tim Horton.
3220
3221         WKPDFView removes the PDF host view from the view hierarchy in its -dealloc
3222         method, and relies on WKWebView releasing its last reference in
3223         -_setHasCustomContentView:loadedMIMEType: when the user navigates.
3224
3225         However, WKWPDFView was capturing a strong reference to self in the block passed
3226         to +[PDFHostViewController createHostView:forExtensionIdentifier:], and PDFKit
3227         (actually UIKit) is retaining this block beyond its being called. This results in
3228         the PDF host view remaining as a child of the WKScrollView even after the user
3229         navigates to another page.
3230
3231         Changed the aforementioned block to a lambda that captures a weak reference to
3232         self to prevent WKPDFView from outliving the current navigation.
3233
3234         * UIProcess/ios/WKPDFView.mm:
3235         (-[WKPDFView retain]):
3236         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
3237
3238 2018-05-08  John Wilander  <wilander@apple.com>
3239
3240         Storage Access API: Make user opt-in sticky
3241         https://bugs.webkit.org/show_bug.cgi?id=185454
3242         <rdar://problem/40003946>
3243
3244         Reviewed by Alex Christensen.
3245
3246         This patch persists the user's choice to opt-in to access under specific domains.
3247         Such storage access should age out with the accessing domain's cookies and website
3248         data. The opt-in prompt is still an experimental feature.
3249
3250         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3251         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
3252         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
3253         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
3254         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
3255         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessInternal):
3256         (WebKit::WebResourceLoadStatisticsStore::hasUserGrantedStorageAccessThroughPrompt const):
3257         (WebKit::WebResourceLoadStatisticsStore::hasHadUnexpiredRecentUserInteraction const):
3258         * UIProcess/WebResourceLoadStatisticsStore.h:
3259
3260 2018-05-08  Daniel Bates  <dabates@apple.com>
3261
3262         Do not apply X-Frame-Options and CSP frame-ancestors to Quick Look-applicable responses in NetworkProcess
3263         https://bugs.webkit.org/show_bug.cgi?id=185442
3264         <rdar://problem/40067209>
3265
3266         Reviewed by Andy Estes.
3267
3268         Just as we exempt responses in WebContent process that will be handled by Quick Look from the Content
3269         Security Policy frame-ancestors directive and X-Frame-Options checking we need to do the same when
3270         such checks are performed in NetworkProcess following r231479.
3271
3272         HTTP responses that will be previewed using Quick Look are not considered web pages and are subject
3273         to the security model for Quick Look documents. That is, they are exempt from Content Security Policy
3274         and X-Frame-Options processing.
3275
3276         * NetworkProcess/NetworkResourceLoader.cpp:
3277         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
3278
3279 2018-05-08  Brian Burg  <bburg@apple.com>
3280
3281         REGRESSION(r230743): Mousemove events are not coalesced properly, mousemove/drag is very laggy
3282         https://bugs.webkit.org/show_bug.cgi?id=185425
3283         <rdar://problem/39323336>
3284
3285         Reviewed by Simon Fraser.
3286
3287         When mousemove events come in faster than they can be processed, we should coalesce
3288         pending mousemoves that have not yet been sent to WebProcess. This has the effect of
3289         processing the most recent mousemove location, which is the old behavior that regressed.
3290
3291         * UIProcess/WebPageProxy.cpp:
3292         (WebKit::WebPageProxy::handleMouseEvent):
3293         If there is >1 event in the mouse queue, then the first one is being processed by WebProcess
3294         and the second one is eligible for coalescing. Replace it if the last event and new event
3295         are both mousemoves.
3296
3297 2018-05-08  Per Arne Vollan  <pvollan@apple.com>
3298
3299         The PDF context menu should not be created in the WebContent process.
3300         https://bugs.webkit.org/show_bug.cgi?id=185401
3301
3302         Reviewed by Tim Horton.
3303
3304         Send a sync IPC message from the WebContent process to the UI process with the necessary context
3305         menu information when the menu is requested. The NSMenu will then be created and shown in the
3306         UI process. The reply will contain the selected menu item index.
3307
3308         * Shared/mac/PDFContextMenu.h: Added.
3309         (WebKit::PDFContextMenuItem::encode const):
3310         (WebKit::PDFContextMenuItem::decode):
3311         (WebKit::PDFContextMenu::encode const):
3312         (WebKit::PDFContextMenu::decode):
3313         * UIProcess/WebPageProxy.h:
3314         * UIProcess/WebPageProxy.messages.in:
3315         * UIProcess/mac/WebPageProxyMac.mm:
3316         (-[WKPDFMenuTarget menuItem]):
3317         (-[WKPDFMenuTarget contextMenuAction:]):
3318         (WebKit::WebPageProxy::showPDFContextMenu):
3319         * WebKit.xcodeproj/project.pbxproj:
3320         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3321         (WebKit::PDFPlugin::handleContextMenuEvent):
3322
3323 2018-05-08  Dean Jackson  <dino@apple.com>
3324
3325         System Preview links should trigger a download
3326         https://bugs.webkit.org/show_bug.cgi?id=185439
3327         <rdar://problem/40065545>
3328
3329         Reviewed by Jon Lee.
3330
3331         Encode the new field identifying a system preview. And
3332         if you encounter such a resource request, trigger
3333         a download.
3334
3335         * Shared/WebCoreArgumentCoders.cpp:
3336         (IPC::ArgumentCoder<ResourceRequest>::encode):
3337         (IPC::ArgumentCoder<ResourceRequest>::decode):
3338         * UIProcess/WebPageProxy.cpp:
3339         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3340
3341 2018-05-08  John Wilander  <wilander@apple.com>
3342
3343         Storage Access API: Add a request roundtrip to check whether prompting is needed
3344         https://bugs.webkit.org/show_bug.cgi?id=185368
3345         <rdar://problem/40011556>
3346
3347         Reviewed by Alex Christensen and Youenn Fablet.
3348
3349         This patch adds an enum WebKit::StorageAccessStatus to handle our three access
3350         states:
3351         - WebKit::StorageAccessStatus::CannotRequestAccess.
3352             This means the domain is blocked from cookie access.
3353         - WebKit::StorageAccessStatus::RequiresUserPrompt.
3354             This means that access has not been granted yet and a prompt is required.
3355         - WebKit::StorageAccessStatus::HasAccess.
3356             This either means that this domain does not need to ask for access,
3357             access was already granted, or access was granted now.
3358
3359         If the call to WebResourceLoadStatisticsStore::requestStorageAccess() comes
3360         back as WebKit::StorageAccessStatus::RequiresUserPrompt, the WebPageProxy
3361         prompts the user and if the user said yes, calls a direct
3362         WebResourceLoadStatisticsStore::grantStorageAccess().
3363
3364         Existing test cases pass because requestStorageAccessConfirm in WKPage.cpp
3365         does not have m_client.requestStorageAccessConfirm and thus returns true.
3366
3367         * UIProcess/Network/NetworkProcessProxy.messages.in:
3368             Added a missing #endif.
3369         * UIProcess/WebPageProxy.cpp:
3370         (WebKit::WebPageProxy::requestStorageAccess):
3371             Here we now handle the various cases encoded in WebKit::StorageAccessStatus.
3372         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3373         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
3374             Now covers the optional prompt case.
3375         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
3376         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
3377         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessInternal):
3378             Granting access is broken out to allow WebKit::WebPageProxy to call it
3379             directly.
3380         * UIProcess/WebResourceLoadStatisticsStore.h:
3381         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3382         (WebKit::WebsiteDataStore::requestStorageAccess):
3383         (WebKit::WebsiteDataStore::grantStorageAccess):
3384             Piping through calls from from WebKit::WebResourceLoadStatisticsStore
3385             to WebKit::WebPageProxy.
3386         * UIProcess/WebsiteData/WebsiteDataStore.h:
3387
3388 2018-05-08  Chris Dumez  <cdumez@apple.com>
3389
3390         Unreviewed, rolling out r231376 and r231458.
3391
3392         Caused some API tests failures on iOS
3393
3394         Reverted changesets:
3395
3396         "[iOS] Apps that are not visible may not get suspended if they
3397         trigger page loads while in the background"
3398         https://bugs.webkit.org/show_bug.cgi?id=185318
3399         https://trac.webkit.org/changeset/231376
3400
3401         "[iOS] Release page load process assertion if the screen is
3402         locked"
3403         https://bugs.webkit.org/show_bug.cgi?id=185333
3404         https://trac.webkit.org/changeset/231458
3405
3406 2018-05-08  Dean Jackson  <dino@apple.com>
3407
3408         Use thumbnails in System Previews
3409         https://bugs.webkit.org/show_bug.cgi?id=185397
3410         <rdar://problem/40039376>
3411
3412         Reviewed by Jon Lee.
3413
3414         A system preview that goes through the WKWebViewContentProvider will
3415         show a static thumbnail/snapshot of the item, rather than jumping
3416         directly to QuickLook.
3417
3418         This means we have to link to the AssetViewer framework. That provides
3419         a ASVThumbnailView that will trigger QuickLook for us.
3420
3421         * Configurations/WebKit.xcconfig: Link to AssetViewer.
3422
3423         * UIProcess/ios/WKSystemPreviewView.h: Better macro use. Remove some unneeded protocols.
3424         * UIProcess/ios/WKSystemPreviewView.mm:
3425         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]): Update this
3426         to use an ASVThumbnailView, when on the internal SDK (because it is private).
3427         (-[WKSystemPreviewView _layoutThumbnailView]): Use the content insets to put
3428         the thumbnail in the right place.
3429         (-[WKSystemPreviewView thumbnailView:wantsToPresentPreviewController:forItem:]):
3430         Delegate method.
3431         (-[WKSystemPreviewView web_contentView]):
3432         (-[WKSystemPreviewView web_computedContentInsetDidChange]):
3433         (-[WKSystemPreviewView numberOfPreviewItemsInPreviewController:]): Deleted.
3434         (-[WKSystemPreviewView previewController:previewItemAtIndex:]): Deleted.
3435         (-[WKSystemPreviewView previewControllerWillDismiss:]): Deleted.
3436
3437 2018-05-08  Youenn Fablet  <youenn@apple.com>
3438
3439         Allow WebResourceLoader to cancel a load served from a service worker
3440         https://bugs.webkit.org/show_bug.cgi?id=185274
3441
3442         Reviewed by Chris Dumez.
3443
3444         Use FetchIdentifier instead of uint64_t.
3445         Add IPC support for cancelling a fetch from WebProcess to service worker process.
3446         Ask service worker process to cancel the fetch when its corresponding WebResourceLoader is cancelled.
3447         No change of behavior as once a WebResourceLoader is cancelled, any related IPC is not processed.
3448         A follow-up patch should try to cancel the FetchResponse load, meaning to either cancel the network load
3449         or to abort reading the readable stream.
3450
3451         * Scripts/webkit/messages.py:
3452         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3453         (WebKit::WebSWServerConnection::cancelFetch):
3454         (WebKit::WebSWServerConnection::startFetch):
3455         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
3456         (WebKit::WebSWServerConnection::didReceiveFetchData):
3457         (WebKit::WebSWServerConnection::didReceiveFetchFormData):
3458         (WebKit::WebSWServerConnection::didFinishFetch):
3459         (WebKit::WebSWServerConnection::didFailFetch):
3460         (WebKit::WebSWServerConnection::didNotHandleFetch):