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