25b3002c468cdc0ce88b2de403af76a72b333236
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-05-23  Eric Carlson  <eric.carlson@apple.com>
2
3         Avoid loading AVFoundation to check supported MIME types if possible
4         https://bugs.webkit.org/show_bug.cgi?id=185839
5         <rdar://problem/40182010>
6
7         Reviewed by Jer Noble.
8         
9         * Shared/WebProcessCreationParameters.cpp:
10         (WebKit::WebProcessCreationParameters::encode const): Encode mediaMIMETypes.
11         (WebKit::WebProcessCreationParameters::decode): Decode mediaMIMETypes.
12         * Shared/WebProcessCreationParameters.h:
13
14         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
15         (WebKit::mediaTypeCache): Static Vector of media MIME types.
16         (WebKit::WebProcessProxy::cacheMediaMIMETypes): Cache the type list and pass it to every other
17         process proxy.
18         (WebKit::WebProcessProxy::cacheMediaMIMETypesInternal): Cache the type list and pass it to the
19         web process.
20         (WebKit::WebProcessProxy::mediaMIMETypes): Return the cached type list.
21
22         * UIProcess/WebProcessPool.cpp:
23         (WebKit::WebProcessPool::initializeNewWebProcess): Set parameters.mediaMIMETypes.
24
25         * UIProcess/WebProcessProxy.h:
26         * UIProcess/WebProcessProxy.messages.in: Add CacheMediaMIMETypes.
27
28         * WebProcess/WebProcess.h:
29         * WebProcess/WebProcess.messages.in: Add SetMediaMIMETypes.
30
31         * WebProcess/cocoa/WebProcessCocoa.mm:
32         (WebKit::WebProcess::platformInitializeWebProcess): Cache the MIME types if the list isn't
33         empty, else register with AVFoundationMIMETypeCache to be notified when it loads types.
34         AVFoundationMIMETypeCache to 
35         (WebKit::WebProcess::platformTerminate): Unregister with AVFoundationMIMETypeCache.
36         (WebKit::WebProcess::setMediaMIMETypes): Pass list of types to AVFoundationMIMETypeCache.
37
38 2018-05-23  Brian Burg  <bburg@apple.com>
39
40         Web Automation: disable process swap on navigation when an automation session is active
41         https://bugs.webkit.org/show_bug.cgi?id=185552
42
43         Reviewed by Tim Horton.
44
45         * UIProcess/WebProcessPool.cpp:
46         (WebKit::WebProcessPool::processForNavigationInternal):
47         This is not intended to work right now. Opt out to avoid crashing
48         later when a process is deallocated unexpectedly.
49
50 2018-05-23  Youenn Fablet  <youenn@apple.com>
51
52         NetworkLoadChecker should check cached redirections
53         https://bugs.webkit.org/show_bug.cgi?id=185849
54
55         Reviewed by Chris Dumez.
56
57         * NetworkProcess/NetworkLoadChecker.cpp:
58         (WebKit::NetworkLoadChecker::checkRedirection):
59         Set the resource error url as done by WebCore SubresourceLoader.
60         * NetworkProcess/NetworkResourceLoader.cpp:
61         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
62         Pass the resource request to dispatchWillSendRedirectedRequest now needs it.
63         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
64         Make sure that m_networkLoad is not null before cancelling it since we might be checking a cached redirection.
65         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
66         Ensure the redirect response is coming from the Network before adding it to the cache.
67         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
68         Call willSendRedirectedRequest to make sure the cached redirect is validated.
69         * NetworkProcess/NetworkResourceLoader.h:
70
71 2018-05-23  Carlos Garcia Campos  <cgarcia@igalia.com>
72
73         [GTK] WebDriver: implement AutomationSessionClient::didDisconnectFromRemote
74         https://bugs.webkit.org/show_bug.cgi?id=185866
75
76         Reviewed by Brian Burg.
77
78         To handle the case of the session being closed by the browser, for example in case of a network process
79         crash. This is currently causing WebDriver tests to timeout in the bot.
80
81         * UIProcess/API/glib/WebKitAutomationSession.cpp: Add an implementation of didDisconnectFromRemote() to notify
82         the WebContext that the session will be closed.
83         * UIProcess/API/glib/WebKitWebContext.cpp: Remove the automation session when closed.
84         * UIProcess/API/glib/WebKitWebContextPrivate.h:
85
86 2018-05-22  Brent Fulgham  <bfulgham@apple.com>
87
88         Close access to "lsopen" for non-UI process
89         https://bugs.webkit.org/show_bug.cgi?id=185890
90         <rdar://problem/39686511>
91
92         Reviewed by Alexey Proskuryakov.
93
94         Close down access to 'lsopen' in the iOS sandboxes. These operations are
95         performed by the UIProcess on behalf of these helper processes.
96
97         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
98         * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb:
99         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
100
101 2018-05-22  Dean Jackson  <dino@apple.com>
102
103         Optimized path zoom animation needs a valid UIImage and CGRect
104         https://bugs.webkit.org/show_bug.cgi?id=185883
105         <rdar://problem/40306056>
106
107         Reviewed by Jon Lee.
108
109         Take the rectangle that was passed into the ResourceRequest and
110         use it for the origin of an animation into QuickLook.
111
112         * Shared/WebCoreArgumentCoders.cpp:
113         (IPC::ArgumentCoder<ResourceRequest>::encode):
114         (IPC::ArgumentCoder<ResourceRequest>::decode):
115         * UIProcess/Cocoa/DownloadClient.mm:
116         (WebKit::DownloadClient::didStart):
117         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
118         (-[_WKPreviewControllerDelegate initWithSystemPreviewController:fromRect:]):
119         (-[_WKPreviewControllerDelegate presentingViewController]):
120         (-[_WKPreviewControllerDelegate previewController:frameForPreviewItem:inSourceView:]):
121         (-[_WKPreviewControllerDelegate previewController:transitionImageForPreviewItem:contentRect:]):
122         (WebKit::SystemPreviewController::start):
123         (-[_WKPreviewControllerDelegate initWithSystemPreviewController:]): Deleted.
124         * UIProcess/Downloads/DownloadProxy.h:
125         (WebKit::DownloadProxy::systemPreviewDownloadRect const):
126         * UIProcess/SystemPreviewController.h:
127         * UIProcess/WebPageProxy.cpp:
128         (WebKit::WebPageProxy::syncRootViewToScreen):
129         * UIProcess/WebPageProxy.h:
130
131 2018-05-22  Sihui Liu  <sihui_liu@apple.com>
132
133         [iOS] TestWebKitAPI.WebKit.WKHTTPCookieStoreWithoutProcessPool fails because cookies use different files with/without processpool
134         https://bugs.webkit.org/show_bug.cgi?id=185831
135
136         Reviewed by Chris Dumez.
137
138         Started to use uiProcessCookieStorageIdentifier for iOS: make sure cookies handled without 
139         processpool would use the same storage file as when processpool exists.
140
141         * NetworkProcess/NetworkProcess.h:
142         * NetworkProcess/NetworkProcessCreationParameters.cpp:
143         (WebKit::NetworkProcessCreationParameters::encode const):
144         (WebKit::NetworkProcessCreationParameters::decode):
145         * NetworkProcess/NetworkProcessCreationParameters.h:
146         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
147         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
148         * Shared/WebProcessCreationParameters.cpp:
149         (WebKit::WebProcessCreationParameters::encode const):
150         (WebKit::WebProcessCreationParameters::decode):
151         * Shared/WebProcessCreationParameters.h:
152         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
153         (WebKit::WebProcessPool::platformInitializeWebProcess):
154         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
155
156 2018-05-22  Chris Dumez  <cdumez@apple.com>
157
158         Regression(AsyncPolicyDelegates): Box.app login Window is blank
159         https://bugs.webkit.org/show_bug.cgi?id=185832
160         <rdar://problem/40307871>
161
162         Reviewed by Geoffrey Garen.
163
164         Moved WeakObjCPtr.h header from WebKit/ to wtf/ so that it can be used in
165         WebKitLegacy code.
166
167         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
168         * UIProcess/API/Cocoa/WKBrowsingContextControllerInternal.h:
169         * UIProcess/API/Cocoa/WKConnection.mm:
170         * UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
171         * UIProcess/API/Cocoa/WKProcessGroup.mm:
172         * UIProcess/API/Cocoa/WKProcessPool.mm:
173         * UIProcess/API/Cocoa/WKScriptMessage.mm:
174         * UIProcess/API/Cocoa/WKWebView.mm:
175         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
176         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
177         * UIProcess/API/Cocoa/_WKDownload.mm:
178         * UIProcess/API/Cocoa/_WKElementAction.mm:
179         * UIProcess/ApplicationStateTracker.h:
180         * UIProcess/Cocoa/AutomationClient.h:
181         * UIProcess/Cocoa/AutomationSessionClient.h:
182         * UIProcess/Cocoa/DiagnosticLoggingClient.h:
183         * UIProcess/Cocoa/DownloadClient.h:
184         * UIProcess/Cocoa/FindClient.h:
185         * UIProcess/Cocoa/FullscreenClient.h:
186         * UIProcess/Cocoa/IconLoadingDelegate.h:
187         * UIProcess/Cocoa/NavigationState.h:
188         * UIProcess/Cocoa/UIDelegate.h:
189         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
190         * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm:
191         * UIProcess/Cocoa/WebViewImpl.h:
192         * UIProcess/ios/ViewGestureControllerIOS.mm:
193         * UIProcess/ios/WKActionSheetAssistant.mm:
194         * UIProcess/ios/WKContentViewInteraction.mm:
195         * UIProcess/ios/WKPDFView.mm:
196         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
197         * UIProcess/ios/WKScrollView.mm:
198         * UIProcess/mac/WKInspectorViewController.mm:
199         * UIProcess/mac/WKInspectorWKWebView.mm:
200         * WebKit.xcodeproj/project.pbxproj:
201         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
202
203 2018-05-22  Sihui Liu  <sihui_liu@apple.com>
204
205         Conversion between SecurityOriginData and DatabaseIdentifier is asymmetric when port is null
206         https://bugs.webkit.org/show_bug.cgi?id=185715
207
208         Reviewed by Geoffrey Garen.
209
210         Add getter for origins in WKWebsiteDataRecord for testing.
211
212         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
213         (-[WKWebsiteDataRecord _originsString]):
214         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
215
216
217 2018-05-22  Brady Eidson  <beidson@apple.com>
218
219         Rename the "Web content is visible" process assertion.
220         https://bugs.webkit.org/show_bug.cgi?id=185878
221
222         Reviewed by Chris Dumez.
223
224         * UIProcess/ios/ProcessAssertionIOS.mm:
225         (WebKit::ProcessAssertion::ProcessAssertion):
226
227 2018-05-22  Andy Estes  <aestes@apple.com>
228
229         [Wi-Fi Assertions] Drop assertions on process suspension
230         https://bugs.webkit.org/show_bug.cgi?id=185844
231         <rdar://problem/40352319>
232
233         Reviewed by Daniel Bates.
234
235         * NetworkProcess/NetworkProcess.cpp:
236         (WebKit::NetworkProcess::actualPrepareToSuspend):
237         (WebKit::NetworkProcess::processDidResume):
238         * NetworkProcess/NetworkProcess.h:
239         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
240         (WebKit::NetworkProcess::platformPrepareToSuspend):
241         (WebKit::NetworkProcess::platformProcessDidResume):
242
243 2018-05-22  Brent Fulgham  <bfulgham@apple.com>
244
245         REGRESSION(r229093): Re-enable Network Extension support in the WebContent process (Take 2)
246         https://bugs.webkit.org/show_bug.cgi?id=185874
247         <rdar://problem/40454404>
248
249         Reviewed by Eric Carlson.
250
251         Add back a necessary XPC connection after locking down the network features in r229093.
252
253         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
254         * WebProcess/com.apple.WebProcess.sb.in:
255
256 2018-05-22  Ryan Haddad  <ryanhaddad@apple.com>
257
258         Unreviewed, rolling out r232052.
259
260         Breaks internal builds.
261
262         Reverted changeset:
263
264         "Use more C++17"
265         https://bugs.webkit.org/show_bug.cgi?id=185176
266         https://trac.webkit.org/changeset/232052
267
268 2018-05-22  Alberto Garcia  <berto@igalia.com>
269
270         [CMake] Properly detect compiler flags, needed libs, and fallbacks for usage of 64-bit atomic operations
271         https://bugs.webkit.org/show_bug.cgi?id=182622
272         <rdar://problem/40292317>
273
274         Reviewed by Michael Catanzaro.
275
276         Move the test to determine whether we need to link against
277         libatomic to the common file WebKitCompilerFlags.cmake so it can
278         also be used for JavaScriptCore.
279
280         * CMakeLists.txt:
281
282 2018-05-22  Michael Catanzaro  <mcatanzaro@igalia.com>
283
284         Unreviewed, rolling out r231843.
285
286         Broke cross build
287
288         Reverted changeset:
289
290         "[CMake] Properly detect compiler flags, needed libs, and
291         fallbacks for usage of 64-bit atomic operations"
292         https://bugs.webkit.org/show_bug.cgi?id=182622
293         https://trac.webkit.org/changeset/231843
294
295 2018-05-22  Carlos Garcia Campos  <cgarcia@igalia.com>
296
297         Crash when loading a SVG image
298         https://bugs.webkit.org/show_bug.cgi?id=185819
299
300         Reviewed by Brent Fulgham.
301
302         This is happening in WebLoaderStrategy::scheduleLoad() when getting the value of
303         FrameLoaderClient::pageID(). SVGImage uses the empty clients for the loader, and
304         EmptyFrameLoaderClient::pageID() returns std::nullopt. The same happens with the frameID. This changed in
305         r225934, when pageID() and frameID() were changed to return std::optional, EmptyFrameLoaderClient was updated to
306         return std::nullopt instead of 0.
307
308         * WebProcess/Network/WebLoaderStrategy.cpp:
309         (WebKit::WebLoaderStrategy::scheduleLoad): Use value_or(0) instead of value() to get pageID and frameID from
310         FrameLoaderClient.
311
312 2018-05-21  Yusuke Suzuki  <utatane.tea@gmail.com>
313
314         Use more C++17
315         https://bugs.webkit.org/show_bug.cgi?id=185176
316
317         Reviewed by JF Bastien.
318
319         * Configurations/Base.xcconfig:
320         * DerivedSources.make:
321
322 2018-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
323
324         [GTK][Wayland] UI process crash when closing the window
325         https://bugs.webkit.org/show_bug.cgi?id=185818
326
327         Reviewed by Michael Catanzaro.
328
329         This happens when a page containing a text field is loaded but the focus remains in the url bar when the window
330         is closed. This is because we are sending a notify-in to the IM context, but the focus is still in the URL
331         bar. That confuses the wayland input method manager that tries to free the text of the web view IM context that has
332         already been deleted.
333
334         * UIProcess/gtk/InputMethodFilter.cpp:
335         (WebKit::InputMethodFilter::setEnabled): Only send notify-in if the view is actually focused.
336
337 2018-05-21  Ryosuke Niwa  <rniwa@webkit.org>
338
339         Remove unused and no-op WKContextSetCookieStorageDirectory
340         https://bugs.webkit.org/show_bug.cgi?id=185857
341
342         Reviewed by Youenn Fablet.
343
344         Deleted C API which didn't do anything useful, and consequently not used by anyone.
345
346         * UIProcess/API/C/WKContext.cpp:
347         (WKContextSetCookieStorageDirectory): Deleted.
348         * UIProcess/API/C/WKContextPrivate.h:
349         * UIProcess/WebProcessPool.h:
350
351 2018-05-21  Chris Nardi  <cnardi@chromium.org>
352
353         Remove dead exception in MediaList.appendMedium
354         https://bugs.webkit.org/show_bug.cgi?id=185278
355
356         Reviewed by Chris Dumez.
357
358         Remove code pertaining to an exception being thrown by appendMedium().
359
360         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMediaList.cpp:
361         (webkit_dom_media_list_append_medium):
362
363 2018-05-21  Aditya Keerthi  <akeerthi@apple.com>
364
365         [iOS] Click events only fire once when editing
366         https://bugs.webkit.org/show_bug.cgi?id=185777
367
368         Reviewed by Tim Horton.
369
370         gestureRecognizerShouldBegin: was returning false for the single tap gesture when a node was being
371         edited. This is an artifact of how the gesture was previously handled with the text selection assistant.
372         This condition is now removed, allowing the single tap gesture to go through and correctly propagate the
373         click event.
374
375         Also added an early return to _didGetTapHighlightForRequest: in order to prevent the tap highlight from
376         being shown when the node is already being assisted.
377
378         * UIProcess/ios/WKContentViewInteraction.mm:
379         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]):
380         (-[WKContentView gestureRecognizerShouldBegin:]):
381
382 2018-05-21  Daniel Bates  <dabates@apple.com>
383
384         REGRESSION (r231107): CSP report-only policies are ignored for beacon, importScripts, fetch(), EventSource, and XHR
385         https://bugs.webkit.org/show_bug.cgi?id=185789
386         <rdar://problem/40380175>
387
388         Reviewed by Andy Estes.
389
390         Have NetworkLoadChecker implement the ContentSecurityPolicyClient interface and support logging
391         console messages, sending CSP reports, and dispatching SecurityPolicyViolation events.
392
393         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
394         (WebKit::NetworkConnectionToWebProcess::loadPing):
395         * NetworkProcess/NetworkLoadChecker.cpp:
396         (WebKit::NetworkLoadChecker::NetworkLoadChecker): Modified to take a reference to the NetworkConnectionToWebProcess,
397         the web page ID, the web frame ID, and the resource load identifier. These details are necessary
398         in order to implement the ContentSecurityPolicyClient interface.
399         (WebKit::NetworkLoadChecker::isAllowedByContentSecurityPolicy): Added.
400         (WebKit::NetworkLoadChecker::continueCheckingRequest): Write in terms of isAllowedByContentSecurityPolicy().
401         (WebKit::NetworkLoadChecker::contentSecurityPolicy): Pass ourself as the client so that we receive
402         delegate callbacks.
403         (WebKit::NetworkLoadChecker::addConsoleMessage): Added.
404         (WebKit::NetworkLoadChecker::sendCSPViolationReport): Added.
405         (WebKit::NetworkLoadChecker::enqueueSecurityPolicyViolationEvent): Added.
406         * NetworkProcess/NetworkLoadChecker.h:
407         * NetworkProcess/NetworkResourceLoader.cpp:
408         (NetworkResourceLoader::enqueueSecurityPolicyViolationEvent): Added.
409         * NetworkProcess/NetworkResourceLoader.h:
410         * NetworkProcess/PingLoad.cpp:
411         (WebKit::PingLoad::PingLoad): Modified to take a reference to the NetworkConnectionToWebProcess and pass
412         this through to the NetworkLoadChecker along with the web page ID, web frame ID and resource load identifier.
413         * NetworkProcess/PingLoad.h:
414         * WebProcess/WebPage/WebPage.cpp:
415         (WebKit::WebPage::enqueueSecurityPolicyViolationEvent): Added.
416         * WebProcess/WebPage/WebPage.h:
417         * WebProcess/WebPage/WebPage.messages.in: Add message EnqueueSecurityPolicyViolationEvent.
418
419 2018-05-21  Brian Burg  <bburg@apple.com>
420
421         Web Automation: always return an empty cookie list if document.cookieURL() is empty
422         https://bugs.webkit.org/show_bug.cgi?id=185838
423         <rdar://problem/37737526>
424
425         Reviewed by Tim Horton.
426
427         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
428         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
429         This crashes in CFNetwork code because an empty cookie URL is not a valid input.
430         Just return an empty list since there couldn't be any cookies returned.
431
432 2018-05-21  Brian Burg  <bburg@apple.com>
433
434         Web Automation: terminate the automation session if the network or storage process crashes
435         https://bugs.webkit.org/show_bug.cgi?id=185827
436         <rdar://problem/40424020>
437
438         Reviewed by Tim Horton.
439
440         If one of the processes crashes, the page may be in an undefined state and
441         automation will fail in unpredictable ways. It's better to just give up immediately.
442
443         * UIProcess/WebProcessPool.cpp:
444         (WebKit::WebProcessPool::networkProcessFailedToLaunch):
445         (WebKit::WebProcessPool::storageProcessCrashed):
446
447 2018-05-21  Sihui Liu  <sihui_liu@apple.com>
448
449         Add a diskCacheSizeOverride accessor function on WKContextConfigurationRef
450         https://bugs.webkit.org/show_bug.cgi?id=185826
451         <rdar://problem/39732113>
452
453         Reviewed by Alex Christensen.
454
455         * UIProcess/API/C/WKContextConfigurationRef.cpp:
456         (WKContextConfigurationDiskCacheSizeOverride):
457         (WKContextConfigurationSetDiskCacheSizeOverride):
458         * UIProcess/API/C/WKContextConfigurationRef.h:
459
460 2018-05-21  Jer Noble  <jer.noble@apple.com>
461
462         Complete fix for enabling modern EME by default
463         https://bugs.webkit.org/show_bug.cgi?id=185770
464         <rdar://problem/40368220>
465
466         Reviewed by Eric Carlson.
467
468         * Configurations/FeatureDefines.xcconfig:
469
470 2018-05-21  Sam Weinig  <sam@webkit.org>
471
472         Modernize RenderStyleConstants.h - Part 1
473         https://bugs.webkit.org/show_bug.cgi?id=185809
474
475         Reviewed by Yusuke Suzuki.
476
477         * WebProcess/WebPage/ios/WebPageIOS.mm:
478         (WebKit::WebPage::rangeForWebSelectionAtPosition):
479         (WebKit::WebPage::getPositionInformation):
480         Update for new enum names.
481
482 2018-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
483
484         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.2 release.
485
486         * gtk/NEWS: Add release notes for 2.21.2.
487
488 2018-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
489
490         Unreviewed, rolling out r222967.
491
492         It's not ready yet
493
494         Reverted changeset:
495
496         "[GTK][WPE] Add API to configure and enable resource load
497         statistics"
498         https://bugs.webkit.org/show_bug.cgi?id=177943
499         https://trac.webkit.org/changeset/222967
500
501 2018-05-18  Commit Queue  <commit-queue@webkit.org>
502
503         Unreviewed, rolling out r231982.
504         https://bugs.webkit.org/show_bug.cgi?id=185793
505
506         Caused layout test failures (Requested by realdawei on
507         #webkit).
508
509         Reverted changeset:
510
511         "Complete fix for enabling modern EME by default"
512         https://bugs.webkit.org/show_bug.cgi?id=185770
513         https://trac.webkit.org/changeset/231982
514
515 2018-05-18  Brian Burg  <bburg@apple.com>
516
517         [Cocoa] Add missing nullability annotations to _WKAutomationSessionDelegate
518         https://bugs.webkit.org/show_bug.cgi?id=185791
519         <rdar://problem/40279891>
520
521         Reviewed by Tim Horton.
522
523         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h: If there is no dialog shown,
524         then the delegate methods to return the dialog text may return a nil NSString.
525
526 2018-05-18  Youenn Fablet  <youenn@apple.com>
527
528         NetworkLoadChecker should cancel its content extension retrieval task when being destroyed
529         https://bugs.webkit.org/show_bug.cgi?id=185661
530         <rdar://problem/39985509>
531
532         Reviewed by Chris Dumez.
533
534         Make sure that the Content Extension retrieval callback checks that NetworkLoadChecker is alive.
535         This allows stopping NetworkLoadChecker be ref counted.
536         This in turns allows NetworkResourceLoader to delete its NetworkLoadChecker when being deleted as well.
537         By doing so, we simplify the memory management of NetworkResourceLoader and NetworkLoadChecker.
538
539         * NetworkProcess/NetworkLoadChecker.cpp:
540         (WebKit::NetworkLoadChecker::checkRequest):
541         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
542         * NetworkProcess/NetworkLoadChecker.h:
543         (WebKit::NetworkLoadChecker::weakPtrFactory):
544         * NetworkProcess/NetworkResourceLoader.cpp:
545         * NetworkProcess/NetworkResourceLoader.h:
546         * NetworkProcess/PingLoad.cpp:
547         (WebKit::PingLoad::PingLoad):
548         * NetworkProcess/PingLoad.h:
549
550 2018-05-18  Per Arne Vollan  <pvollan@apple.com>
551
552         WebProcess fails to launch
553         https://bugs.webkit.org/show_bug.cgi?id=185140
554
555         Reviewed by Geoffrey Garen.
556
557         If the NSApplication runloop is not used in the WebContent process, launchServicesCheckIn() needs to be called
558         in order for enableSandboxStyleFileQuarantine() to succeed. Determine at runtime if launchServicesCheckIn()
559         should be called by checking if the NSApplication event loop is running.
560
561         * WebProcess/cocoa/WebProcessCocoa.mm:
562         (WebKit::WebProcess::platformInitializeProcess):
563
564 2018-05-18  Jer Noble  <jer.noble@apple.com>
565
566         Complete fix for enabling modern EME by default
567         https://bugs.webkit.org/show_bug.cgi?id=185770
568         <rdar://problem/40368220>
569
570         Reviewed by Eric Carlson.
571
572         * Configurations/FeatureDefines.xcconfig:
573
574 2018-05-18  Brent Fulgham  <bfulgham@apple.com>
575
576         Convert ProcessPrivilege assertions to regular debug-only assertions
577         https://bugs.webkit.org/show_bug.cgi?id=185775
578         <rdar://problem/40372286>
579
580         Reviewed by Geoffrey Garen.
581
582         In Bug 184322 I added a number of RELEASE_ASSERT checks that certain
583         UI-only calls were not being made in the WebContent process.
584
585         Measurements have shown that these RELEASE_ASSERTs have regressed performance
586         by around 1% on some benchmarks, so we should convert them to normal asserts.
587
588         This patch changes the RELEASE_ASSERTs into ASSERTs.
589
590         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
591         (WebKit::WebProcessPool::platformInitializeWebProcess):
592         * UIProcess/Cocoa/WebViewImpl.mm:
593         (WebKit::WebViewImpl::WebViewImpl):
594         (WebKit::WebViewImpl::becomeFirstResponder):
595         (WebKit::WebViewImpl::pluginFocusOrWindowFocusChanged):
596         (WebKit::WebViewImpl::validateUserInterfaceItem):
597         (WebKit::WebViewImpl::startSpeaking):
598         (WebKit::WebViewImpl::stopSpeaking):
599         (WebKit::applicationFlagsForDrag):
600         (WebKit::WebViewImpl::doneWithKeyEvent):
601         * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm:
602         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
603         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
604         (WebKit::PluginProcessProxy::enterFullscreen):
605         (WebKit::PluginProcessProxy::beginModal):
606         (WebKit::PluginProcessProxy::endModal):
607         * UIProcess/mac/DisplayLink.cpp:
608         (WebKit::DisplayLink::DisplayLink):
609         (WebKit::DisplayLink::~DisplayLink):
610         * UIProcess/mac/WebPageProxyMac.mm:
611         (WebKit::WebPageProxy::getIsSpeaking):
612         (WebKit::WebPageProxy::speak):
613         (WebKit::WebPageProxy::stopSpeaking):
614         (WebKit::WebPageProxy::startDisplayLink):
615         * UIProcess/mac/WebPopupMenuProxyMac.mm:
616         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
617
618 2018-05-18  Eric Carlson  <eric.carlson@apple.com>
619
620         Handle failure to extend sandbox gracefully
621         https://bugs.webkit.org/show_bug.cgi?id=185779
622         <rdar://problem/40316349>
623
624         Reviewed by Brent Fulgham.
625
626         * UIProcess/API/Cocoa/WKWebView.mm:
627         (-[WKWebView _denyNextUserMediaRequest]): 
628         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
629
630         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
631         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): Don't append
632         the request to m_grantedRequests if it failed.
633         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess): Deny request if willCreateMediaStream
634         fails.
635         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
636
637         * UIProcess/UserMediaProcessManager.cpp:
638         (WebKit::UserMediaProcessManager::willCreateMediaStream): Don't try to extend sandbox if
639         we fail to allocate all necessary handles.
640         * UIProcess/UserMediaProcessManager.h:
641         (WebKit::UserMediaProcessManager::denyNextUserMediaRequest): New, for testing.
642
643 2018-05-18  Antoine Quint  <graouts@apple.com>
644
645         [Web Animations] Turn Web Animations with CSS integration on for test runners
646         https://bugs.webkit.org/show_bug.cgi?id=184819
647         <rdar://problem/39597337>
648
649         Unreviewed. Rolling out the patch for this bug, it caused some flaky timeouts for animation suspension tests.
650
651         * Shared/WebPreferences.yaml:
652
653 2018-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
654
655         [Extra zoom mode] Clearing text fields should dispatch input events of type "deleteContent"
656         https://bugs.webkit.org/show_bug.cgi?id=185769
657         <rdar://problem/40368261>
658
659         Reviewed by Tim Horton.
660
661         When setting the text of the currently focused element to the empty string, just delete the text instead of
662         pretending to insert an empty string. This mimics deleting content using the delete key on macOS, and fires an
663         input event with inputType "deleteContent" instead of "insertText".
664
665         Test: fast/forms/extrazoom/delete-content-in-text-field.html
666
667         * WebProcess/WebPage/WebPage.cpp:
668         (WebKit::WebPage::setTextAsync):
669
670 2018-05-18  Keith Rollin  <krollin@apple.com>
671
672         Renamed "trackNetworkActivity" to "tracksResourceLoadMilestones"
673         https://bugs.webkit.org/show_bug.cgi?id=185523
674         <rdar://problem/40136361>
675
676         Reviewed by Geoffrey Garen.
677
678         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
679         (WebKit::networkActivityTrackingEnabled):
680         * NetworkProcess/NetworkProcess.cpp:
681         (WebKit::NetworkProcess::initializeNetworkProcess):
682         * NetworkProcess/NetworkProcess.h:
683         (WebKit::NetworkProcess::tracksResourceLoadMilestones const):
684         (WebKit::NetworkProcess::trackNetworkActivity const): Deleted.
685         * NetworkProcess/NetworkProcessCreationParameters.cpp:
686         (WebKit::NetworkProcessCreationParameters::encode const):
687         (WebKit::NetworkProcessCreationParameters::decode):
688         * NetworkProcess/NetworkProcessCreationParameters.h:
689         * UIProcess/API/APIProcessPoolConfiguration.cpp:
690         (API::ProcessPoolConfiguration::copy):
691         * UIProcess/API/APIProcessPoolConfiguration.h:
692         * UIProcess/API/C/WKContextConfigurationRef.cpp:
693         (WKContextConfigurationTracksResourceLoadMilestones):
694         (WKContextConfigurationSetTracksResourceLoadMilestones):
695         (WKContextConfigurationTrackNetworkActivity): Deleted.
696         (WKContextConfigurationSetTrackNetworkActivity): Deleted.
697         * UIProcess/API/C/WKContextConfigurationRef.h:
698         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
699         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
700         (-[_WKProcessPoolConfiguration tracksResourceLoadMilestones]):
701         (-[_WKProcessPoolConfiguration setTracksResourceLoadMilestones:]):
702         (-[_WKProcessPoolConfiguration trackNetworkActivity]): Deleted.
703         (-[_WKProcessPoolConfiguration setTrackNetworkActivity:]): Deleted.
704         * UIProcess/WebProcessPool.cpp:
705         (WebKit::WebProcessPool::ensureNetworkProcess):
706
707 2018-05-18  Chris Dumez  <cdumez@apple.com>
708
709         Avoid keeping the frame alive when ref'ing a WindowProxy
710         https://bugs.webkit.org/show_bug.cgi?id=185737
711         <rdar://problem/40004666>
712
713         Reviewed by Sam Weinig.
714
715         * WebProcess/Plugins/PluginView.cpp:
716         (WebKit::PluginView::windowScriptNPObject):
717
718 2018-05-18  Youenn Fablet  <youenn@apple.com>
719
720         -Wmemset-elt-size warning in LibWebRTCSocket constructor
721         https://bugs.webkit.org/show_bug.cgi?id=185555
722         <rdar://problem/40217250>
723
724         Reviewed by Darin Adler.
725
726         GetOption implementation was broken in that it was not initializing properly its array of options.
727         This patch fixes it by using an array of optional<int> which are initialized by default.
728         When no value is set, we return the error code -1.
729         In theory, we should go to NetworkProcess to get the actual value.
730         Since GetOption is not used in practice, we just do this best effort implementation of storing previously set values.
731
732         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
733         (WebKit::LibWebRTCSocket::LibWebRTCSocket):
734         (WebKit::LibWebRTCSocket::GetOption):
735         * WebProcess/Network/webrtc/LibWebRTCSocket.h:
736
737 2018-05-18  Antoine Quint  <graouts@apple.com>
738
739         [Web Animations] Turn Web Animations with CSS integration on for test runners
740         https://bugs.webkit.org/show_bug.cgi?id=184819
741         <rdar://problem/39597337>
742
743         Reviewed by Jon Lee.
744
745         * Shared/WebPreferences.yaml: Leave Web Animations off by default, it's up to clients
746         to turn it on.
747
748 2018-05-18  Fujii Hironori  <Hironori.Fujii@sony.com>
749
750         [Curl] Remove unused SystemProxyWin.cpp
751         https://bugs.webkit.org/show_bug.cgi?id=185224
752
753         Reviewed by Antti Koivisto.
754
755         SystemProxyWin is not used at the moment. Remove it.
756
757         * NetworkProcess/win/SystemProxyWin.cpp: Removed.
758         * NetworkProcess/win/SystemProxyWin.h: Removed.
759         * PlatformWin.cmake: Removed SystemProxyWin.cpp.
760
761 2018-05-17  Nan Wang  <n_wang@apple.com>
762
763         AX: [macOS] Expose the primary screen height through AX API
764         https://bugs.webkit.org/show_bug.cgi?id=185742
765
766         Reviewed by Chris Fleizach.
767
768         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
769         (-[WKAccessibilityWebPageObject accessibilityAttributeNames]):
770         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
771
772 2018-05-17  Alex Christensen  <achristensen@webkit.org>
773
774         Use CompletionHandlers for DelayedReplies
775         https://bugs.webkit.org/show_bug.cgi?id=182269
776
777         Reviewed by Youenn Fablet.
778
779         DelayedReplies should be a noncopyable, non-refcountable type.  They should be
780         called once and only once.  This is what CompletionHandlers are for.
781
782         No change in behavior.  Just cleaner code.
783
784         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
785         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
786         * NetworkProcess/NetworkConnectionToWebProcess.h:
787         * NetworkProcess/NetworkResourceLoader.cpp:
788         (WebKit::NetworkResourceLoader::SynchronousLoadData::SynchronousLoadData):
789         (WebKit::sendReplyToSynchronousRequest):
790         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
791         * NetworkProcess/NetworkResourceLoader.h:
792         * Platform/IPC/HandleMessage.h:
793         (IPC::callMemberFunctionImpl):
794         (IPC::callMemberFunction):
795         (IPC::handleMessageDelayed):
796         * PluginProcess/PluginControllerProxy.cpp:
797         (WebKit::PluginControllerProxy::setInitializationReply):
798         (WebKit::PluginControllerProxy::takeInitializationReply):
799         * PluginProcess/PluginControllerProxy.h:
800         * PluginProcess/WebProcessConnection.cpp:
801         (WebKit::WebProcessConnection::destroyPlugin):
802         (WebKit::WebProcessConnection::createPlugin):
803         (WebKit::WebProcessConnection::createPluginAsynchronously):
804         * PluginProcess/WebProcessConnection.h:
805         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
806         (Messages::WebPage::GetPluginProcessConnection::send):
807         (Messages::WebPage::TestMultipleAttributes::send):
808         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::DelayedReply): Deleted.
809         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::~DelayedReply): Deleted.
810         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::send): Deleted.
811         (Messages::WebPage::TestMultipleAttributes::DelayedReply::DelayedReply): Deleted.
812         (Messages::WebPage::TestMultipleAttributes::DelayedReply::~DelayedReply): Deleted.
813         (Messages::WebPage::TestMultipleAttributes::DelayedReply::send): Deleted.
814         * Scripts/webkit/LegacyMessages-expected.h:
815         * Scripts/webkit/MessageReceiver-expected.cpp:
816         (Messages::WebPage::GetPluginProcessConnection::send):
817         (Messages::WebPage::TestMultipleAttributes::send):
818         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::DelayedReply): Deleted.
819         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::~DelayedReply): Deleted.
820         (Messages::WebPage::GetPluginProcessConnection::DelayedReply::send): Deleted.
821         (Messages::WebPage::TestMultipleAttributes::DelayedReply::DelayedReply): Deleted.
822         (Messages::WebPage::TestMultipleAttributes::DelayedReply::~DelayedReply): Deleted.
823         (Messages::WebPage::TestMultipleAttributes::DelayedReply::send): Deleted.
824         * Scripts/webkit/Messages-expected.h:
825         * Scripts/webkit/messages.py:
826         * UIProcess/Network/NetworkProcessProxy.cpp:
827         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
828         (WebKit::NetworkProcessProxy::networkProcessCrashed):
829         (WebKit::NetworkProcessProxy::networkProcessFailedToLaunch):
830         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
831         * UIProcess/Network/NetworkProcessProxy.h:
832         * UIProcess/Plugins/PluginProcessManager.cpp:
833         (WebKit::PluginProcessManager::getPluginProcessConnection):
834         * UIProcess/Plugins/PluginProcessManager.h:
835         * UIProcess/Plugins/PluginProcessProxy.cpp:
836         (WebKit::PluginProcessProxy::getPluginProcessConnection):
837         (WebKit::PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch):
838         (WebKit::PluginProcessProxy::didCreateWebProcessConnection):
839         * UIProcess/Plugins/PluginProcessProxy.h:
840         * UIProcess/Storage/StorageProcessProxy.cpp:
841         (WebKit::StorageProcessProxy::getStorageProcessConnection):
842         (WebKit::StorageProcessProxy::didClose):
843         (WebKit::StorageProcessProxy::didCreateStorageToWebProcessConnection):
844         * UIProcess/Storage/StorageProcessProxy.h:
845         * UIProcess/WebPageProxy.cpp:
846         (WebKit::ExceededDatabaseQuotaRecords::createRecord):
847         (WebKit::WebPageProxy::receivedPolicyDecision):
848         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
849         (WebKit::WebPageProxy::createNewPage):
850         (WebKit::WebPageProxy::runJavaScriptAlert):
851         (WebKit::WebPageProxy::runJavaScriptConfirm):
852         (WebKit::WebPageProxy::runJavaScriptPrompt):
853         (WebKit::WebPageProxy::webGLPolicyForURL):
854         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
855         (WebKit::WebPageProxy::getToolbarsAreVisible):
856         (WebKit::WebPageProxy::getMenuBarIsVisible):
857         (WebKit::WebPageProxy::getStatusBarIsVisible):
858         (WebKit::WebPageProxy::getWindowFrame):
859         (WebKit::WebPageProxy::screenToRootView):
860         (WebKit::WebPageProxy::rootViewToScreen):
861         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
862         (WebKit::WebPageProxy::exceededDatabaseQuota):
863         (WebKit::WebPageProxy::reachedApplicationCacheOriginQuota):
864         * UIProcess/WebPageProxy.h:
865         * UIProcess/WebProcessPool.cpp:
866         (WebKit::WebProcessPool::networkProcessCrashed):
867         (WebKit::WebProcessPool::getNetworkProcessConnection):
868         (WebKit::WebProcessPool::getStorageProcessConnection):
869         * UIProcess/WebProcessPool.h:
870         * UIProcess/WebProcessProxy.cpp:
871         (WebKit::WebProcessProxy::getPluginProcessConnection):
872         (WebKit::WebProcessProxy::getNetworkProcessConnection):
873         (WebKit::WebProcessProxy::getStorageProcessConnection):
874         * UIProcess/WebProcessProxy.h:
875         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
876         (WebKit::WebSWContextManagerConnection::syncTerminateWorker):
877         * WebProcess/Storage/WebSWContextManagerConnection.h:
878         * WebProcess/WebPage/WebPage.h:
879         * WebProcess/WebPage/ios/WebPageIOS.mm:
880         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
881
882 2018-05-17  Jer Noble  <jer.noble@apple.com>
883
884         CRASH in -[WKFullScreenViewController _manager]
885         https://bugs.webkit.org/show_bug.cgi?id=185745
886         <rdar://problem/39195241>
887
888         Reviewed by Eric Carlson.
889
890         Protect against WKFullScreenViewController outliving WKWebView by making its
891         _webView property weak. Additionally, add a sanity-check RetainPtr where _webView
892         is referenced multiple times within a function.
893
894         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
895         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
896         (-[WKFullScreenWindowController initWithWebView:]):
897         (-[WKFullScreenWindowController enterFullScreen]):
898         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
899         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
900         (-[WKFullScreenWindowController _completedExitFullScreen]):
901         (-[WKFullScreenWindowController close]):
902         (-[WKFullScreenWindowController webViewDidRemoveFromSuperviewWhileInFullscreen]):
903         (-[WKFullScreenWindowController _exitFullscreenImmediately]):
904         (-[WKFullScreenWindowController _isSecure]):
905         (-[WKFullScreenWindowController _serverTrust]):
906         (-[WKFullScreenWindowController _updateLocationInfo]):
907         (-[WKFullScreenWindowController _manager]):
908         (-[WKFullScreenWindowController _startToDismissFullscreenChanged:]):
909
910 2018-05-17  Brent Fulgham  <bfulgham@apple.com>
911
912         Correct default for StorageAccess API
913         https://bugs.webkit.org/show_bug.cgi?id=185748
914         <rdar://problem/40220659>
915
916         Reviewed by Dean Jackson.
917
918         Flip the default state to 'true' so that the new "sticky" state
919         for Storage Access API and attributing user interaction for
920         Storage Access API use is applied by default.
921
922         * Shared/WebPreferences.yaml:
923
924 2018-05-17  Carlos Alberto Lopez Perez  <clopez@igalia.com>
925
926         [WPE] Implement and enable FULLSCREEN_API
927         https://bugs.webkit.org/show_bug.cgi?id=185676
928
929         Reviewed by Žan Doberšek.
930
931         Do the initial implementation of FULLSCREEN_API for WPE and
932         enable the CMake option by default.
933
934         Most of the layout tests (55 of 58) are passing and the feature
935         seems to work fine on different websites that use it.
936
937         * UIProcess/API/wpe/PageClientImpl.cpp:
938         (WebKit::PageClientImpl::fullScreenManagerProxyClient):
939         (WebKit::PageClientImpl::closeFullScreenManager):
940         (WebKit::PageClientImpl::isFullScreen):
941         (WebKit::PageClientImpl::enterFullScreen):
942         (WebKit::PageClientImpl::exitFullScreen):
943         (WebKit::PageClientImpl::beganEnterFullScreen):
944         (WebKit::PageClientImpl::beganExitFullScreen):
945         * UIProcess/API/wpe/PageClientImpl.h:
946         * UIProcess/API/wpe/WPEView.h:
947         (WKWPE::View::isFullScreen):
948         (WKWPE::View::setFullScreen):
949
950 2018-05-17  Jiewen Tan  <jiewen_tan@apple.com>
951
952         Convert CertificateInfo into Credential in UI Process instead of Networking Process
953         https://bugs.webkit.org/show_bug.cgi?id=185662
954         <rdar://problem/40275561>
955
956         Reviewed by Alex Christensen.
957
958         Right now we convert CertificateInfo into Credential in the very last stage of client certificate authentication process
959         when it reaches Networking Process. This patch moves that conversion earlier in UI Process such that we don't have to
960         pass both Credential and CertificateInfo to Networking Process.
961
962         CertificateInfo is only used in macOS for C API specifically. WK2 includes macOS/iOS relies on NSURLCredential/WebCore::Credential
963         solely. WK2 has already exercised the ability of using WebCore::Credential to do client certficate authentication. This patch therefore
964         takes advantage of that. It converts CertficateInfo objects into Credential objects right after WebCredential is initialized, and then merge
965         any code paths that utilizes CertficateInfo into ones that uses WebCore::Credential.
966
967         Covered by existing tests.
968
969         * Shared/Authentication/AuthenticationManager.cpp:
970         (WebKit::AuthenticationManager::useCredentialForChallenge):
971         (WebKit::AuthenticationManager::useCredentialForSingleChallenge):
972         (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge): Deleted.
973         * Shared/Authentication/AuthenticationManager.h:
974         * Shared/Authentication/AuthenticationManager.messages.in:
975         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
976         (WebKit::AuthenticationChallengeProxy::useCredential):
977         * UIProcess/Authentication/WebCredential.cpp:
978         (WebKit::WebCredential::WebCredential):
979         (WebKit::WebCredential::certificateInfo): Deleted.
980         * UIProcess/Authentication/WebCredential.h:
981         (WebKit::WebCredential::create):
982         * UIProcess/Authentication/mac/WebCredentialMac.mm: Renamed from Source/WebKit/Shared/Authentication/mac/AuthenticationManager.mac.mm.
983         (WebKit::leafCertificate):
984         (WebKit::chain):
985         (WebKit::WebCredential::WebCredential):
986         * WebKit.xcodeproj/project.pbxproj:
987
988 2018-05-17  Jeremy Jones  <jeremyj@apple.com>
989
990         Ensure valid rects for fullsceen animation.
991         https://bugs.webkit.org/show_bug.cgi?id=185736
992         rdar://problem/40320174
993
994         Reviewed by Jer Noble.
995
996         Protect against zero width and height since those can make for NANs in the animation transforms.
997
998         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
999         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
1000         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
1001
1002 2018-05-17  Jer Noble  <jer.noble@apple.com>
1003
1004         Turn Modern EME API on by default and remove it as an experimental feature
1005         https://bugs.webkit.org/show_bug.cgi?id=185693
1006         <rdar://problem/39954396>
1007
1008         Reviewed by Eric Carlson.
1009
1010         * Shared/WebPreferences.yaml:
1011
1012 2018-05-17  Dean Jackson  <dino@apple.com>
1013
1014         Safari optimized flow should be releasing viewer to prevent memory growth with subsequent launches/closes
1015         https://bugs.webkit.org/show_bug.cgi?id=185722
1016         <rdar://problem/40247351>
1017
1018         Reviewed by Antoine Quint.
1019
1020         I made a rookie mistake in the original patch: I was holding a strong
1021         reference to "self" in a block, which was causing a retain cycle.
1022         Replace that with a WeakObjCPtr.
1023
1024         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
1025         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
1026
1027 2018-05-16  Brent Fulgham  <bfulgham@apple.com>
1028
1029         REGRESSION(r229093)[macOS] Allow network-outbound for syslog use
1030         https://bugs.webkit.org/show_bug.cgi?id=185703
1031         <rdar://problem/39778918>
1032
1033         Reviewed by Eric Carlson.
1034
1035         In r229093 I removed the 'network-outbound' permission for syslog use.
1036         Further testing has shown that this is still needed for subsystem
1037         logging in our bundle loading code.
1038
1039         This patch re-enabled network-outbound for syslog.
1040
1041         * WebProcess/com.apple.WebProcess.sb.in:
1042
1043 2018-05-16  Andy VanWagoner  <andy@vanwagoner.family>
1044
1045         Add support for Intl NumberFormat formatToParts
1046         https://bugs.webkit.org/show_bug.cgi?id=185375
1047
1048         Reviewed by Yusuke Suzuki.
1049
1050         Add flag for NumberFormat formatToParts.
1051
1052         * Configurations/FeatureDefines.xcconfig:
1053
1054 2018-05-16  Andy Estes  <aestes@apple.com>
1055
1056         [Wi-Fi Assertions] Adopt WiFiAssertionHolderAdditions
1057         https://bugs.webkit.org/show_bug.cgi?id=185685
1058         <rdar://problem/40136681>
1059
1060         Reviewed by Sam Weinig.
1061
1062         * NetworkProcess/cocoa/WiFiAssertionHolder.cpp:
1063         (WebKit::WiFiAssertionHolder::WiFiAssertionHolder):
1064         (WebKit::WiFiAssertionHolder::~WiFiAssertionHolder):
1065         (WebKit::ensureWiFiManagerClient): Deleted.
1066
1067 2018-05-16  Fujii Hironori  <Hironori.Fujii@sony.com>
1068
1069         [Win] Implement WebPage::handleEditingKeyboardEvent
1070         https://bugs.webkit.org/show_bug.cgi?id=185327
1071
1072         Reviewed by Alexey Proskuryakov.
1073
1074         * WebProcess/WebPage/win/WebPageWin.cpp:
1075         (WebKit::WebPage::handleEditingKeyboardEvent): Copied from WebKitLegacy.
1076
1077 2018-05-16  Sihui Liu  <sihui_liu@apple.com>
1078
1079         Session cookies aren't reliably set when using default WKWebSiteDataStore
1080         https://bugs.webkit.org/show_bug.cgi?id=185624
1081         <rdar://problem/39111626>
1082
1083         Reviewed by Geoffrey Garen.
1084
1085         Session cookies of default session were set in UI Process when there was no process pool, 
1086         but they were not synced (or synced slowly to) Network Process. To make these cookies visible
1087         as soon as they were set through API, we could manually set those cookies in Network Process
1088         during its initilization. 
1089
1090         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1091         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
1092         * UIProcess/API/APIHTTPCookieStore.cpp:
1093         (API::HTTPCookieStore::cookies):
1094         (API::HTTPCookieStore::setCookie):
1095         (API::HTTPCookieStore::deleteCookie):
1096         * UIProcess/WebProcessPool.cpp:
1097         (WebKit::WebProcessPool::ensureNetworkProcess):
1098         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
1099         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1100         (WebKit::WebsiteDataStore::clearPendingCookies):
1101         * UIProcess/WebsiteData/WebsiteDataStore.h:
1102
1103 2018-05-16  Chris Nardi  <cnardi@chromium.org>
1104
1105         Remove Document#selectedStylesheetSet/preferredStylesheetSet
1106         https://bugs.webkit.org/show_bug.cgi?id=185381
1107
1108         Reviewed by Darin Adler.
1109
1110         Make API methods for Document#selectedStylesheetSet/preferredStylesheetSet do nothing.
1111
1112         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.h:
1113         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
1114         (webkit_dom_document_set_property):
1115         (webkit_dom_document_get_property):
1116         (webkit_dom_document_get_preferred_stylesheet_set):
1117         (webkit_dom_document_get_selected_stylesheet_set):
1118         (webkit_dom_document_set_selected_stylesheet_set):
1119
1120 2018-05-16  Alberto Garcia  <berto@igalia.com>
1121
1122         [CMake] Properly detect compiler flags, needed libs, and fallbacks for usage of 64-bit atomic operations
1123         https://bugs.webkit.org/show_bug.cgi?id=182622
1124
1125         Reviewed by Michael Catanzaro.
1126
1127         Move the test to determine whether we need to link against
1128         libatomic to the common file WebKitCompilerFlags.cmake so it can
1129         also be used for JavaScriptCore.
1130
1131         * CMakeLists.txt:
1132
1133 2018-05-15  Yusuke Suzuki  <utatane.tea@gmail.com>
1134
1135         [JSC] Check TypeInfo first before calling getCallData when we would like to check whether given object is a function
1136         https://bugs.webkit.org/show_bug.cgi?id=185601
1137
1138         Reviewed by Saam Barati.
1139
1140         * WebProcess/Plugins/Netscape/JSNPObject.h:
1141
1142 2018-05-15  Sihui Liu  <sihui_liu@apple.com>
1143
1144         StorageManager::deleteLocalStorageOriginsModifiedSince: database files get deleted before database connections close
1145         https://bugs.webkit.org/show_bug.cgi?id=185671
1146
1147         Reviewed by Geoffrey Garen.
1148
1149         We should delete database files before closing databases.
1150
1151         * UIProcess/WebStorage/LocalStorageDatabase.cpp:
1152         (WebKit::LocalStorageDatabase::updateDatabaseWithChangedItems):
1153         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
1154         (WebKit::LocalStorageDatabaseTracker::databasesModifiedSince):
1155         (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince): Deleted.
1156         * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
1157         * UIProcess/WebStorage/StorageManager.cpp:
1158         (WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
1159
1160 2018-05-15  Dean Jackson  <dino@apple.com>
1161
1162         Launch System Preview as the download starts, rather than waiting for a response
1163         https://bugs.webkit.org/show_bug.cgi?id=185669
1164         <rdar://problem/40278181>
1165
1166         Reviewed by Tim Horton.
1167
1168         We were waiting for the RequestResponse to get a MIME-type before
1169         launching the system preview. This causes an annoying delay.
1170
1171         Instead, assume that the system preview is one of the handled
1172         mime types and launch the viewer immediately. If it gets something it
1173         didn't expect, it will show an error.
1174
1175         * UIProcess/Cocoa/DownloadClient.mm:
1176         (WebKit::DownloadClient::didStart):
1177         (WebKit::DownloadClient::didReceiveResponse):
1178         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
1179         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
1180         (WebKit::SystemPreviewController::start): Small cleanup to ensure we
1181         don't try to present twice (this shouldn't happen).
1182
1183 2018-05-15  Dean Jackson  <dino@apple.com>
1184
1185         Post-review cleanup for 185459
1186         https://bugs.webkit.org/show_bug.cgi?id=185665
1187         <rdar://problem/40276689>
1188
1189         Reviewed by Tim Horton.
1190
1191         Jon made some comments in 185459 that I'm addressing here.
1192
1193         * UIProcess/Cocoa/DownloadClient.h:
1194         * UIProcess/Cocoa/DownloadClient.mm: Guard the activity token for iOS
1195         in a way that means it will still work ok on macOS.
1196         (WebKit::DownloadClient::didStart):
1197         (WebKit::DownloadClient::processDidCrash):
1198         (WebKit::DownloadClient::didFinish):
1199         (WebKit::DownloadClient::didFail):
1200         (WebKit::DownloadClient::didCancel):
1201         (WebKit::DownloadClient::takeActivityToken):
1202         (WebKit::DownloadClient::releaseActivityTokenIfNecessary):
1203         (WebKit::DownloadClient::releaseActivityToken): Deleted.
1204
1205         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Add an early return.
1206         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
1207
1208 2018-05-15  Tadeu Zagallo  <tzagallo@apple.com>
1209
1210         Update touch event tracking types on every touch
1211         https://bugs.webkit.org/show_bug.cgi?id=184250
1212         <rdar://problem/39145092>
1213
1214         Reviewed by Geoffrey Garen.
1215
1216         The tracking types for touch events were only update on touchstart, which meant that event
1217         listeners added after the touchstart would always be treated as passive, even if explicitly
1218         setting passive to false.
1219
1220         * UIProcess/WebPageProxy.cpp:
1221         (WebKit::WebPageProxy::handleTouchEventSynchronously):
1222         (WebKit::WebPageProxy::handleTouchEvent):
1223
1224 2018-05-15  Per Arne Vollan  <pvollan@apple.com>
1225
1226         Pause display links when window is not visible.
1227         https://bugs.webkit.org/show_bug.cgi?id=185627
1228         <rdar://problem/39401106>
1229
1230         Reviewed by Simon Fraser.
1231
1232         Pause/resume display links created in the UI process when the window is hidden/shown.
1233
1234         * UIProcess/WebPageProxy.cpp:
1235         (WebKit::WebPageProxy::dispatchActivityStateChange):
1236         * UIProcess/mac/DisplayLink.cpp:
1237         (WebKit::DisplayLink::pause):
1238         (WebKit::DisplayLink::resume):
1239         * UIProcess/mac/DisplayLink.h:
1240
1241 2018-05-15  Dean Jackson  <dino@apple.com>
1242
1243         Provide UIView and UIImage for zoom transition
1244         https://bugs.webkit.org/show_bug.cgi?id=185655
1245         <rdar://problem/40267224>
1246
1247         Reviewed by Antoine Quint.
1248
1249         Provide a UIView* for the frameForPreviewItem to use as a source view.
1250         Also implement the transitionImageForPreviewItem delegate, even though
1251         we're returning nil.
1252
1253         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
1254         (-[_WKPreviewControllerDelegate previewController:frameForPreviewItem:inSourceView:]):
1255         (-[_WKPreviewControllerDelegate previewController:transitionImageForPreviewItem:contentRect:]):
1256
1257 2018-05-15  Daniel Bates  <dabates@apple.com>
1258
1259         Fix the Apple Internal build
1260
1261         Make a similar change to WebKit as I did for LegacyWebKit in r231777. See <rdar://problem/40237873> for more details.
1262
1263         * UIProcess/mac/WKFullScreenWindowController.mm:
1264         (-[WKFullScreenWindowController enterFullScreen:]):
1265         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
1266         (-[WKFullScreenWindowController exitFullScreen]):
1267         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
1268         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
1269         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
1270         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
1271         (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):
1272
1273 2018-05-15  Megan Gardner  <megan_gardner@apple.com>
1274
1275         Clear selections from web content with single tap
1276         https://bugs.webkit.org/show_bug.cgi?id=185634
1277
1278         Reviewed by Tim Horton.
1279         
1280         With the switch to the single text selection assistant, we were not correctly clearing the selection when a
1281         single tap happened.
1282
1283         * UIProcess/ios/WKContentViewInteraction.mm:
1284         (-[WKContentView _singleTapCommited:]):
1285
1286 2018-05-15  Antoine Quint  <graouts@apple.com>
1287
1288         [Web Animations] Expose Web Animations CSS integration as an experimental feature
1289         https://bugs.webkit.org/show_bug.cgi?id=185647
1290
1291         Reviewed by Dean Jackson.
1292
1293         Rename the Web Animations CSS integration flag.
1294
1295         * Shared/WebPreferences.yaml:
1296         * UIProcess/API/C/WKPreferences.cpp:
1297         (WKPreferencesSetWebAnimationsCSSIntegrationEnabled):
1298         (WKPreferencesGetWebAnimationsCSSIntegrationEnabled):
1299         (WKPreferencesSetCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted.
1300         (WKPreferencesGetCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted.
1301         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1302         * UIProcess/API/Cocoa/WKPreferences.mm:
1303         (-[WKPreferences _setWebAnimationsCSSIntegrationEnabled:]):
1304         (-[WKPreferences _webAnimationsCSSIntegrationEnabled]):
1305         (-[WKPreferences _setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled:]): Deleted.
1306         (-[WKPreferences _cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled]): Deleted.
1307         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1308         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1309         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1310         (WebKit::InjectedBundle::setWebAnimationsCSSIntegrationEnabled):
1311         (WebKit::InjectedBundle::setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted.
1312         * WebProcess/InjectedBundle/InjectedBundle.h:
1313
1314 2018-05-15  Dean Jackson  <dino@apple.com>
1315
1316         Update animation when presenting QuickLook
1317         https://bugs.webkit.org/show_bug.cgi?id=185648
1318         <rdar://problem/39652624>
1319
1320         Reviewed by Antoine Quint.
1321
1322         Implement the QuickLook delegate on _WKPreviewControllerDelegate that
1323         produces a zoom-like animation when the QLPreviewController appears.
1324
1325         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
1326         (-[_WKPreviewControllerDelegate previewController:frameForPreviewItem:inSourceView:]):
1327         * UIProcess/SystemPreviewController.h: Add a reference back to the page, so that
1328         the delegate implementation can access the presentingViewController.
1329         (WebKit::SystemPreviewController::page):
1330
1331 2018-05-14  Dean Jackson  <dino@apple.com>
1332
1333         Download and present System Preview
1334         https://bugs.webkit.org/show_bug.cgi?id=185459
1335         <rdar://problem/40079228>
1336
1337         Reviewed by Tim Horton.
1338
1339         Extend DownloadClient so that it can handle the case where
1340         the download was triggered by a System Preview. In this situation
1341         the result (and progress) are piped into QuickLook via the SystemPreviewController.
1342
1343         The DownloadProxy class is also extended to handle the destination
1344         filename and the size of the content.
1345
1346         Lastly, SystemPreviewController is updated to have a start(), show()
1347         and cancel() interface, and no longer adjusts page navigation.
1348
1349         * UIProcess/Cocoa/DownloadClient.h:
1350         * UIProcess/Cocoa/DownloadClient.mm: Handle the SystemPreview case, which
1351         doesn't have a download delegate, but instead needs to communicate with
1352         the SystemPreviewController, if one exists.
1353         (WebKit::DownloadClient::didStart):
1354         (WebKit::DownloadClient::didReceiveResponse):
1355         (WebKit::DownloadClient::didReceiveData):
1356         (WebKit::DownloadClient::didCreateDestination):
1357         (WebKit::DownloadClient::processDidCrash):
1358         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
1359         (WebKit::DownloadClient::didFinish):
1360         (WebKit::DownloadClient::didFail):
1361         (WebKit::DownloadClient::didCancel):
1362         (WebKit::DownloadClient::releaseActivityToken):
1363
1364         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Implement the new API.
1365         (-[_WKPreviewControllerDataSource initWithMIMEType:]):
1366         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
1367         (-[_WKPreviewControllerDataSource setProgress:]):
1368         (-[_WKPreviewControllerDataSource finish:]):
1369         (-[_WKPreviewControllerDelegate previewControllerDidDismiss:]):
1370         (WebKit::SystemPreviewController::start):
1371         (WebKit::SystemPreviewController::updateProgress):
1372         (WebKit::SystemPreviewController::finish):
1373         (WebKit::SystemPreviewController::cancel):
1374         (-[_WKPreviewControllerDataSource initWithURL:]): Deleted.
1375         (-[_WKPreviewControllerDelegate previewControllerWillDismiss:]): Deleted.
1376         (WebKit::SystemPreviewController::canPreview const): Deleted.
1377         (WebKit::SystemPreviewController::showPreview): Deleted.
1378         * UIProcess/Downloads/DownloadProxy.h: Track the destination file by name
1379         and size. Also expose a helper to identify system preview downloads.
1380         (WebKit::DownloadProxy::destinationFilename const):
1381         (WebKit::DownloadProxy::setDestinationFilename):
1382         (WebKit::DownloadProxy::expectedContentLength const):
1383         (WebKit::DownloadProxy::setExpectedContentLength):
1384         (WebKit::DownloadProxy::bytesLoaded const):
1385         (WebKit::DownloadProxy::setBytesLoaded):
1386         (WebKit::DownloadProxy::isSystemPreviewDownload const):
1387
1388         * UIProcess/SystemPreviewController.cpp: New API.
1389         (WebKit::SystemPreviewController::canPreview const):
1390         (WebKit::SystemPreviewController::sendPageBack): Deleted.
1391         (WebKit::SystemPreviewController::showPreview): Deleted.
1392         * UIProcess/SystemPreviewController.h:
1393
1394         * UIProcess/WebPageProxy.cpp:
1395         (WebKit::m_configurationPreferenceValues):
1396         (WebKit::WebPageProxy::reattachToWebProcess):
1397         (WebKit::WebPageProxy::resetState):
1398         * UIProcess/WebPageProxy.h:
1399
1400 2018-05-14  Brady Eidson  <beidson@apple.com>
1401
1402         Add an API test to guard against regressions while re-entering setDefersLoading:.
1403         <rdar://problem/37033737> and https://bugs.webkit.org/show_bug.cgi?id=185630
1404
1405         Reviewed by Chris Dumez.
1406
1407         * UIProcess/API/Cocoa/WKWebView.mm:
1408         (-[WKWebView _setDefersLoadingForTesting:]):
1409         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1410
1411         * UIProcess/WebPageProxy.cpp:
1412         (WebKit::WebPageProxy::setDefersLoadingForTesting):
1413         * UIProcess/WebPageProxy.h:
1414         * WebProcess/WebPage/WebPage.messages.in:
1415
1416 2018-05-14  Tim Horton  <timothy_horton@apple.com>
1417
1418         Use the system font by default in extra zoom mode
1419         https://bugs.webkit.org/show_bug.cgi?id=185638
1420         <rdar://problem/40230277>
1421
1422         Reviewed by Wenson Hsieh.
1423
1424         * Shared/WebPreferencesDefaultValues.h:
1425
1426 2018-05-14  Michael Catanzaro  <mcatanzaro@igalia.com>
1427
1428         Unreviewed, rolling out r231755.
1429
1430         Change is not correct
1431
1432         Reverted changeset:
1433
1434         "-Wmemset-elt-size warning in LibWebRTCSocket constructor"
1435         https://bugs.webkit.org/show_bug.cgi?id=185555
1436         https://trac.webkit.org/changeset/231755
1437
1438 2018-05-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1439
1440         [Extra zoom mode] Google search results are excessively zoomed in
1441         https://bugs.webkit.org/show_bug.cgi?id=185347
1442         <rdar://problem/39999778>
1443
1444         Reviewed by Tim Horton.
1445
1446         Adds a new experimental feature for the "disabled-adaptations" meta tag, and adds plumbing in WebKit to
1447         propagate disabled adaptation changes to the ViewportConfiguration. The experimental feature is on by default in
1448         extra zoom mode.
1449
1450         * Shared/WebPreferences.yaml:
1451         * Shared/WebPreferencesDefaultValues.h:
1452         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1453         (WebKit::WebChromeClient::dispatchDisabledAdaptationsDidChange const):
1454         * WebProcess/WebCoreSupport/WebChromeClient.h:
1455         * WebProcess/WebPage/WebPage.cpp:
1456         (WebKit::WebPage::disabledAdaptationsDidChange):
1457         * WebProcess/WebPage/WebPage.h:
1458
1459 2018-05-14  Chris Dumez  <cdumez@apple.com>
1460
1461         Overly aggressive timer throttling in service workers
1462         https://bugs.webkit.org/show_bug.cgi?id=185575
1463         <rdar://problem/40219038>
1464
1465         Reviewed by Geoff Garen.
1466
1467         After ~30 seconds, the system would put the service worker process in "App Nap",
1468         causing its timers to get aggressively throttled. This happens because the
1469         service worker processes are WebProcesses that have no visible WebPages.
1470
1471         To address the issue, we now disable process suppression for all service worker
1472         processes. This causes those processes to construct a UserActivity which prevents
1473         App Nap.
1474
1475         This patch also refactors the code a bit to avoid duplication. The ProcessSuppression
1476         suppression logic in now all on ChildProcessProxy / ChildProcess.
1477
1478         * NetworkProcess/NetworkProcess.messages.in:
1479         * PluginProcess/PluginProcess.messages.in:
1480         * Shared/ChildProcess.messages.in:
1481         * UIProcess/ChildProcessProxy.cpp:
1482         (WebKit::ChildProcessProxy::setProcessSuppressionEnabled):
1483         * UIProcess/ChildProcessProxy.h:
1484         * UIProcess/Network/NetworkProcessProxy.h:
1485         * UIProcess/Network/mac/NetworkProcessProxyMac.mm: Removed.
1486         * UIProcess/Plugins/PluginProcessProxy.h:
1487         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
1488         * UIProcess/ServiceWorkerProcessProxy.cpp:
1489         (WebKit::ServiceWorkerProcessProxy::didFinishLaunching):
1490         * UIProcess/ServiceWorkerProcessProxy.h:
1491         * UIProcess/WebProcessProxy.h:
1492         * WebKit.xcodeproj/project.pbxproj:
1493         * WebProcess/WebProcess.messages.in:
1494
1495 2018-05-14  Andy Estes  <aestes@apple.com>
1496
1497         [Wi-Fi Assertions] Allow clients to specify a context identifier
1498         https://bugs.webkit.org/show_bug.cgi?id=185620
1499         <rdar://problem/39915196>
1500
1501         Reviewed by Brady Eidson.
1502
1503         Added an SPI on _WKProcessPoolConfiguration that allows clients to specify a
1504         context identifier.
1505
1506         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1507         (WebKit::NetworkProcessCreationParameters::encode const):
1508         (WebKit::NetworkProcessCreationParameters::decode):
1509         * NetworkProcess/NetworkProcessCreationParameters.h:
1510         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1511         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
1512         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1513         (API::ProcessPoolConfiguration::copy):
1514         * UIProcess/API/APIProcessPoolConfiguration.h:
1515         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1516         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1517         (-[_WKProcessPoolConfiguration wirelessContextIdentifier]):
1518         (-[_WKProcessPoolConfiguration setWirelessContextIdentifier:]):
1519         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1520         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1521
1522 2018-05-11  Brian Burg  <bburg@apple.com>
1523
1524         Web Automation: Automation.getBrowsingContext returns window origin that differs from window.screenX/Y
1525         https://bugs.webkit.org/show_bug.cgi?id=185571
1526         <rdar://problem/40180785>
1527
1528         Reviewed by Timothy Hatcher.
1529
1530         This code path was refactored to use completion handlers. It seems that the window.screenX/Y
1531         code path converts back to user coordinates but the WebDriver code path does not. Make them
1532         consistent since that is how it is spec'd and tested.
1533
1534         * UIProcess/WebPageProxy.cpp:
1535         (WebKit::WebPageProxy::getWindowFrameWithCallback):
1536         Convert the window frame to user coordinate space so it's the same as window.screenY.
1537
1538 2018-05-14  Brian Burg  <bburg@apple.com>
1539
1540         WebDriver: W3C test case actions/key.py::test_lone_keyup_sends_no_events is failing
1541         https://bugs.webkit.org/show_bug.cgi?id=185577
1542         <rdar://problem/40185478>
1543
1544         Reviewed by Timothy Hatcher.
1545
1546         This test is failing because it expects Release Actions to not emit any
1547         events if nothing has changed from the initial state. Because the two code paths
1548         for creating empty states don't actually produce the same empty state, a difference
1549         in location was detected between the two empty states. This generates a mousemove.
1550
1551         To fix this, unify the code that creates an empty state. For mouse input sources, always
1552         initialize the location to (0, 0) so that the mouse input source always has
1553         a location that is valid to click at.
1554
1555         * UIProcess/Automation/SimulatedInputDispatcher.h:
1556         Extract the type enum out of the class to avoid circular definitions of
1557         SimulatedInputSource and SimulatedInputSourceState.
1558
1559         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
1560         (WebKit::SimulatedInputSourceState::emptyStateForSourceType):
1561         Take the input source type when generating an empty state. We always want location
1562         set for a mouse input source, but not set it for other input sources like keys.
1563
1564         (WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources):
1565         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
1566         (WebKit::SimulatedInputSource::create):
1567         (WebKit::SimulatedInputSource::SimulatedInputSource):
1568         (WebKit::SimulatedInputSourceState::emptyState): Deleted.
1569         * UIProcess/Automation/WebAutomationSession.cpp:
1570         (WebKit::WebAutomationSession::WebAutomationSession):
1571         (WebKit::WebAutomationSession::inputSourceForType const):
1572         (WebKit::simulatedInputSourceTypeFromProtocolSourceType):
1573         (WebKit::WebAutomationSession::performInteractionSequence):
1574         * UIProcess/Automation/WebAutomationSession.h:
1575
1576 2018-05-14  Michael Catanzaro  <mcatanzaro@igalia.com>
1577
1578         -Wmemset-elt-size warning in LibWebRTCSocket constructor
1579         https://bugs.webkit.org/show_bug.cgi?id=185555
1580
1581         Reviewed by Youenn Fablet.
1582
1583         Add missing multiplication.
1584
1585         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
1586         (WebKit::LibWebRTCSocket::LibWebRTCSocket):
1587
1588 2018-05-14  Zan Dobersek  <zdobersek@igalia.com>
1589
1590         [GTK] REGRESSION(r231170) Build broken with Clang 5.0
1591         https://bugs.webkit.org/show_bug.cgi?id=185198
1592
1593         Reviewed by Michael Catanzaro.
1594
1595         * Shared/RTCNetwork.h: With std::optional forward declaration gone,
1596         explicitly include the WTF Optional.h header.
1597
1598 2018-05-13  Dean Jackson  <dino@apple.com>
1599
1600         WebKit2_Sim-7606.1.17.4 introduced dep cycle
1601         https://bugs.webkit.org/show_bug.cgi?id=185588
1602         <rdar://problem/40196581>
1603
1604         Reviewed by Tim Horton.
1605
1606         Soft link AssetViewer.framework to avoid a dependency cycle.
1607
1608         * Configurations/WebKit.xcconfig:
1609         * UIProcess/ios/WKSystemPreviewView.mm:
1610         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
1611
1612 2018-05-11  Daniel Bates  <dabates@apple.com>
1613
1614         X-Frame-Options: SAMEORIGIN needs to check all ancestor frames
1615         https://bugs.webkit.org/show_bug.cgi?id=185567
1616         <rdar://problem/40175008>
1617
1618         Reviewed by Brent Fulgham.
1619
1620         Change the behavior of "X-Frame-Options: SAMEORIGIN" to ensure that all ancestors frames
1621         are same-origin with the document that delivered this header. This prevents an intermediary
1622         malicious frame from clickjacking a child frame whose document is same-origin with the top-
1623         level frame. It also makes the behavior of X-Frame-Options in WebKit more closely match
1624         the behavior of X-Frame-Options in other browsers, including Chrome and Firefox.
1625         
1626         Currently a document delivered with "X-Frame-Options: SAMEORIGIN" must only be same-origin
1627         with the top-level frame's document in order to be displayed. This prevents clickjacking by
1628         a malicious page that embeds a page delivered with "X-Frame-Options: SAMEORIGIN". However,
1629         it does not protect against clickjacking of the "X-Frame-Options: SAMEORIGIN" page (victim)
1630         if embedded by an intermediate malicious iframe, say a "rogue ad", that was embedded in a
1631         document same origin with the victim page. We should protect against such attacks.
1632
1633         * NetworkProcess/NetworkResourceLoader.cpp:
1634         (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions):
1635
1636 2018-05-11  Dean Jackson  <dino@apple.com>
1637
1638         WKWebViewContentProvider should know what MIME type it was created to handle
1639         https://bugs.webkit.org/show_bug.cgi?id=185574
1640         <rdar://problem/40183049>
1641
1642         Reviewed by Tim Horton.
1643
1644         Pass the MIME type of the downloaded asset into the WKWebViewContentProvider's
1645         init method, so it can choose to do something based on that information. The
1646         PDF and LegacyPDF views don't care because they, clearly, only handle PDF. But
1647         a WKSystemPreviewView can handle multiple types.
1648
1649         * UIProcess/API/Cocoa/WKWebView.mm:
1650         (-[WKWebView _setHasCustomContentView:loadedMIMEType:]): Send the MIME type on
1651         to the WKWebViewContentProvider.
1652         * UIProcess/Cocoa/WKWebViewContentProvider.h: Add a new parameter to web_initWithFrame.
1653         * UIProcess/ios/WKLegacyPDFView.mm:
1654         (-[WKLegacyPDFView web_initWithFrame:webView:mimeType:]):
1655         (-[WKLegacyPDFView web_initWithFrame:webView:]): Deleted.
1656         * UIProcess/ios/WKPDFView.mm:
1657         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
1658         (-[WKPDFView web_initWithFrame:webView:]): Deleted.
1659         * UIProcess/ios/WKSystemPreviewView.mm:
1660         (-[WKSystemPreviewView web_initWithFrame:webView:mimeType:]):
1661         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]): Actually use
1662         the MIME type to tell QuickLook what it will be getting, rather than basing it on
1663         the file extension.
1664         (-[WKSystemPreviewView web_initWithFrame:webView:]): Deleted.
1665
1666 2018-05-11  Brent Fulgham  <bfulgham@apple.com>
1667
1668         Allow the WebContent process to read global ViewBridge preferences
1669         https://bugs.webkit.org/show_bug.cgi?id=185569
1670         <rdar://problem/40164339>
1671
1672         Reviewed by Eric Carlson.
1673
1674         Allow reads of the global /Library/Preferences/com.apple.ViewBridge.plist preference file.
1675
1676         * WebProcess/com.apple.WebProcess.sb.in:
1677
1678 2018-05-11  Megan Gardner  <megan_gardner@apple.com>
1679
1680         Cleanup canPerformActionForWebView in relation to the webSelectionAssistant being removed
1681         https://bugs.webkit.org/show_bug.cgi?id=185536
1682
1683         Reviewed by Tim Horton.
1684         
1685         The _webSelectionAssistant is now always nil, therefor many of these checks are unnecessary.
1686         Remove the check for a webSelection and clean up the logic surrounding those checks.
1687
1688         * UIProcess/ios/WKContentViewInteraction.mm:
1689         (-[WKContentView canPerformActionForWebView:withSender:]):
1690
1691 2018-05-11  Brady Eidson  <beidson@apple.com>
1692
1693         Followup to: Make sure history navigations reuse the existing process when necessary.
1694         https://bugs.webkit.org/show_bug.cgi?id=185532
1695
1696         Reviewed by Andy Estes.
1697
1698         * UIProcess/WebProcessPool.cpp:
1699         (WebKit::WebProcessPool::processForNavigationInternal): When re-using the same process,
1700           don't change the policy action.
1701
1702 2018-05-11  Charles Vazac  <cvazac@gmail.com>
1703
1704         Runtime feature flag for Server-Timing
1705         https://bugs.webkit.org/show_bug.cgi?id=184758
1706
1707         Reviewed by Youenn Fablet.
1708
1709         * Shared/WebPreferences.yaml: Added ServerTimingEnabled.
1710         * UIProcess/API/C/WKPreferences.cpp:
1711         (WKPreferencesGetServerTimingEnabled):
1712         * UIProcess/API/C/WKPreferencesRefPrivate.h: WK_EXPORT for WKPreferencesSetServerTimingEnabled.
1713         * WebProcess/Storage/WebSWContextManagerConnection.cpp: Call setServerTimingEnabled.
1714
1715 2018-05-11  Antti Koivisto  <antti@apple.com>
1716
1717         Network process should not stat() all cache files on startup to find their sizes
1718         https://bugs.webkit.org/show_bug.cgi?id=185542
1719         <rdar://problem/40092953>
1720
1721         Reviewed by Chris Dumez.
1722
1723         This is done to compute how much disk space a cache is using. While the operation happens
1724         in a background priority thread it is still quite a bit of work.
1725
1726         Large bodies are saved in separate blob files so record file sizes are capped. We can avoid work by
1727         estimating their size instead of counting it exactly.
1728
1729         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1730         (WebKit::NetworkCache::estimateRecordsSize):
1731         (WebKit::NetworkCache::Storage::synchronize):
1732
1733             Use size estimation if blob storage is in use.
1734             Remove the code that would delete empty files. Normal cache shrinking handles this.
1735
1736         (WebKit::NetworkCache::Storage::shouldStoreBodyAsBlob):
1737
1738 2018-05-11  Brady Eidson  <beidson@apple.com>
1739
1740         Make sure history navigations reuse the existing process when necessary.
1741         <rdar://problem/39746516> and https://bugs.webkit.org/show_bug.cgi?id=185532
1742
1743         Reviewed by Ryosuke Niwa.
1744
1745         If a view navigates to either a data: or blob: URL, it reuses the existing process.
1746  
1747         In such cases we need to also ensure that history navigations back will also reuse the existing process.
1748
1749         * Shared/NavigationActionData.cpp:
1750         (WebKit::NavigationActionData::encode const):
1751         (WebKit::NavigationActionData::decode):
1752         * Shared/NavigationActionData.h:
1753
1754         * UIProcess/API/APINavigation.h:
1755         (API::Navigation::setTargetItem):
1756
1757         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1758         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1759         (-[_WKProcessPoolConfiguration pageCacheEnabled]):
1760         (-[_WKProcessPoolConfiguration setPageCacheEnabled:]):
1761
1762         * UIProcess/WebPageProxy.cpp:
1763         (WebKit::WebPageProxy::receivedPolicyDecision):
1764         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1765
1766         * UIProcess/WebProcessPool.cpp:
1767         (WebKit::WebProcessPool::processForNavigationInternal): If the current and target back/forward items both
1768           came from the same process, then reuse the existing process.
1769
1770         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1771         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1772
1773 2018-05-10  Brent Fulgham  <bfulgham@apple.com>
1774
1775         REGRESSION(r231057): Encrypted media content playback failures
1776         https://bugs.webkit.org/show_bug.cgi?id=185537
1777         <rdar://problem/40038478>
1778
1779         Reviewed by Eric Carlson.
1780
1781         Put access to the SecurityServer back in the sandbox so we can validate the
1782         signatures of media encoder/decoders.
1783
1784         * WebProcess/com.apple.WebProcess.sb.in:
1785
1786 2018-05-11  Youenn Fablet  <youenn@apple.com>
1787
1788         NetworkCORSPreflightChecker should proceed when having a ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested challenge
1789         https://bugs.webkit.org/show_bug.cgi?id=185522
1790         <rdar://problem/39987152>
1791
1792         Reviewed by Brent Fulgham.
1793
1794         In case of such challenge, refuse to proceed with authentication since preflight is not using credentials.
1795         Previously, we were failing right away which is not right in case preflight is the request triggering the connection.
1796
1797         Manually tested.
1798
1799         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
1800         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
1801
1802 2018-05-10  Daniel Bates  <dabates@apple.com>
1803
1804         Use PlatformStrategies to switch between WebKit and WebKitLegacy checking of CSP frame-ancestors and X-Frame-Options
1805         https://bugs.webkit.org/show_bug.cgi?id=185412
1806
1807         Reviewed by Ryosuke Niwa.
1808
1809         Update code for renaming and write in terms of WebLoaderStrategy::shouldPerformSecurityChecks()
1810         instead of explicitly querying RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess().
1811
1812         * WebProcess/Network/WebLoaderStrategy.cpp:
1813         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1814         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1815         (WebKit::WebLoaderStrategy::startPingLoad):
1816         (WebKit::WebLoaderStrategy::preconnectTo):
1817         (WebKit::WebLoaderStrategy::shouldPerformSecurityChecks const):
1818         (WebKit::WebLoaderStrategy::havePerformedSecurityChecks const):
1819         (WebKit::WebLoaderStrategy::isDoingLoadingSecurityChecks const): Deleted.
1820         * WebProcess/Network/WebLoaderStrategy.h:
1821         * WebProcess/WebPage/WebPage.cpp:
1822
1823 2018-05-10  Timothy Horton  <timothy_horton@apple.com>
1824
1825         Fix the build after r231393
1826         ​https://bugs.webkit.org/show_bug.cgi?id=185519
1827         <rdar://problem/40131741>
1828
1829         * Configurations/WebKit.xcconfig:
1830
1831 2018-05-10  John Wilander  <wilander@apple.com>
1832
1833         Storage Access API: Extend lifetime of cookies on successful user approval
1834         https://bugs.webkit.org/show_bug.cgi?id=185534
1835         <rdar://problem/40064547>
1836
1837         Reviewed by Brent Fulgham.
1838
1839         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
1840         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
1841             Picks up the experimental feature flag.
1842         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1843         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessInternal):
1844             Now updates the domain's user interaction timestamp if the user was
1845             prompted for this access.
1846         * UIProcess/WebResourceLoadStatisticsStore.h:
1847
1848 2018-05-10  Chris Dumez  <cdumez@apple.com>
1849
1850         [iOS] Release page load process assertion if the screen is locked
1851         https://bugs.webkit.org/show_bug.cgi?id=185333
1852
1853         Reviewed by Geoff Garen.
1854
1855         We normally take a background process assertion during page loads to allow them to complete
1856         even if the tab / app is backgrounded. We should however avoid doing so when the backgrounding
1857         is caused by the screen locking. Keeping the process assertion in this case would prevent the
1858         whole device from sleeping longer than it should, thus negatively impacting power.
1859
1860         * UIProcess/Cocoa/NavigationState.h:
1861         * UIProcess/Cocoa/NavigationState.mm:
1862         (WebKit::NavigationState::NavigationState):
1863         (WebKit::NavigationState::releaseNetworkActivityToken):
1864         (WebKit::NavigationState::didChangeIsLoading):
1865         * UIProcess/ios/WebPageProxyIOS.mm:
1866         (WebKit::WebPageProxy::applicationDidEnterBackground):
1867
1868 2018-05-10  Megan Gardner  <megan_gardner@apple.com>
1869
1870         Remove Unused Chinese/Japanese Reanalyze code
1871         https://bugs.webkit.org/show_bug.cgi?id=185529
1872
1873         Reviewed by Wenson Hsieh.
1874         
1875         The code for this has actually been completely removed from UIKit. This is unreachable 
1876         dead code that should be removed if just for cleanliness. 
1877
1878         * Platform/spi/ios/UIKitSPI.h:
1879         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1880         * UIProcess/ios/WKContentViewInteraction.h:
1881         * UIProcess/ios/WKContentViewInteraction.mm:
1882         (-[WKContentView canPerformActionForWebView:withSender:]):
1883         (-[WKContentView _reanalyzeForWebView:]): Deleted.
1884
1885 2018-05-10  Chris Dumez  <cdumez@apple.com>
1886
1887         [iOS] Apps that are not visible may not get suspended if they trigger page loads while in the background
1888         https://bugs.webkit.org/show_bug.cgi?id=185318
1889
1890         Reviewed by Geoffrey Garen.
1891
1892         Whenever there is a page load going on, we take a background process assertion to delay process
1893         suspension until this load completes. However, there is also a 3 seconds grace period after
1894         a load is complete to allow the app to trigger a new load shortly after. This grace period was
1895         introduced to support use cases where a visible app does loads in an offscreen view. However,
1896         it can be abused by apps running in the background as they could trigger new page loads while
1897         in the background to delay process suspension. This patch tightens the policy so that only
1898         apps that are currently visible get to use this grace period. Apps that are in the background
1899         get to finish their current load and will then get suspended.
1900
1901         * UIProcess/Cocoa/NavigationState.mm:
1902         (WebKit::NavigationState::didChangeIsLoading):
1903
1904 2018-05-10  Chris Dumez  <cdumez@apple.com>
1905
1906         'Cross-Origin-Options header implementation follow-up
1907         https://bugs.webkit.org/show_bug.cgi?id=185520
1908
1909         Reviewed by Ryosuke Niwa.
1910
1911         * WebProcess/WebPage/WebPage.cpp:
1912         (WebKit::WebPage::frameBecameRemote):
1913
1914 2018-05-10  Per Arne Vollan  <pvollan@apple.com>
1915
1916         Drop-down Control borders missing.
1917         https://bugs.webkit.org/show_bug.cgi?id=185500
1918         <rdar://problem/40093461>
1919
1920         Reviewed by Brent Fulgham.
1921
1922         Open sandbox for reading of some files in temp folder.
1923
1924         * WebProcess/com.apple.WebProcess.sb.in:
1925
1926 2018-05-10  Eric Carlson  <eric.carlson@apple.com>
1927
1928         [MediaStream, iOS] Don't check authorizationStatusForMediaType when using mock capture devices
1929         https://bugs.webkit.org/show_bug.cgi?id=185516
1930         <rdar://problem/36328191>
1931
1932         Reviewed by Youenn Fablet.
1933
1934         * UIProcess/Cocoa/UIDelegate.mm:
1935         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): Don't check
1936         +[AVCaptureDevice authorizationStatusForMediaType:] when using mock capture devices.
1937
1938 2018-05-10  Brent Fulgham  <bfulgham@apple.com>
1939
1940         REGRESSION(r230323): UIProcess needs to notify WebContent process of Accessibility setting changes
1941         https://bugs.webkit.org/show_bug.cgi?id=185515
1942         <rdar://problem/39627764>
1943
1944         Reviewed by Chris Fleizach.
1945
1946         The UIProcess needs to register for relevant Accessibility preference updates so that it can notify the
1947         WebContent processes that screen properties have changed.
1948
1949         This is represented by NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification.
1950
1951         Tested manually with the Accessibility preferences pane.
1952
1953         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1954         (WebKit::WebProcessPool::registerNotificationObservers): Add notification observer. When the notification
1955         is received, call 'screenPropertiesStateChanged' to message the information to the WebContent processes.
1956         (WebKit::WebProcessPool::unregisterNotificationObservers): Clean up observer.
1957         * UIProcess/WebProcessPool.cpp:
1958         (WebKit::WebProcessPool::screenPropertiesStateChanged): Added helper function.
1959         * UIProcess/WebProcessPool.h:
1960
1961 2018-05-09  Carlos Garcia Campos  <cgarcia@igalia.com>
1962
1963         WebDriver: implement advance user interactions
1964         https://bugs.webkit.org/show_bug.cgi?id=174616
1965
1966         Reviewed by Brian Burg.
1967
1968         Handle origin in case of mouse move transitions.
1969
1970         * UIProcess/Automation/Automation.json: Add MouseMoveOrigin enum and pass it as parameter of InputSourceState
1971         together with optional node handle. Also pass the frame handle to performInteractionSequence command to find the
1972         node in the current browsing context.
1973         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
1974         (WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources): Ensure we reset the location.
1975         (WebKit::SimulatedInputDispatcher::resolveLocation): Helper to resolve destination location based on current
1976         location and mouse move origin.
1977         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): Use resolveLocation() in mouse transitions.
1978         (WebKit::SimulatedInputDispatcher::run): Receive and save the frame ID.
1979         (WebKit::SimulatedInputDispatcher::finishDispatching): Reset the frame ID.
1980         * UIProcess/Automation/SimulatedInputDispatcher.h:
1981         * UIProcess/Automation/WebAutomationSession.cpp:
1982         (WebKit::WebAutomationSession::computeElementLayout): Use even numbers for the callback ID to not conflict with
1983         viewportInViewCenterPointOfElement() callbacks.
1984         (WebKit::WebAutomationSession::didComputeElementLayout): Handle computeElementLayout() or
1985         viewportInViewCenterPointOfElement() requests by calling the right callback depending on whether the ID is odd
1986         or even number.
1987         (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement): Send ComputeElementLayout message to the
1988         WebProcess using odd numbers for the callback ID to not conflict with computeElementLayout() callbacks.
1989         (WebKit::WebAutomationSession::performInteractionSequence): Handle the mouse origin and element handle.
1990         (WebKit::WebAutomationSession::cancelInteractionSequence): Pass the frame ID to the input dispatcher.
1991         * UIProcess/Automation/WebAutomationSession.h:
1992         * UIProcess/Automation/WebAutomationSessionMacros.h:
1993
1994 2018-05-09  Tim Horton  <timothy_horton@apple.com>
1995
1996         Remove the unused HAVE_OS_ACTIVITY
1997         https://bugs.webkit.org/show_bug.cgi?id=185501
1998
1999         Reviewed by Wenson Hsieh.
2000
2001         * config.h:
2002
2003 2018-05-09  Chris Dumez  <cdumez@apple.com>
2004
2005         Add initial support for 'Cross-Origin-Options' HTTP response header
2006         https://bugs.webkit.org/show_bug.cgi?id=184996
2007         <rdar://problem/39664620>
2008
2009         Reviewed by Geoff Garen.
2010
2011         * Shared/WebPreferences.yaml:
2012         Add this as an experimental feature, on by default.
2013
2014         * WebProcess/WebPage/WebPage.cpp:
2015         (WebKit::WebPage::frameBecameRemote):
2016         Make sure we pass the cross-origin options from the local Window
2017         to the remote one when transitioning.
2018
2019 2018-05-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2020
2021         [Extra zoom mode] fast/viewport/extrazoom/viewport-change-min-device-width.html sometimes fails
2022         https://bugs.webkit.org/show_bug.cgi?id=185490
2023         <rdar://problem/40097629>
2024
2025         Reviewed by Tim Horton.
2026
2027         This test is currently flaky due to incorrect logic when computing the unobscured content rect, in the slice of
2028         time after a frame load has been committed, and before the first visible content rect update from the UI process
2029         after the frame load has been committed.
2030
2031         * WebProcess/WebPage/ios/WebPageIOS.mm:
2032         (WebKit::WebPage::viewportConfigurationChanged):
2033
2034         In the case where !m_hasReceivedVisibleContentRectsAfterDidCommitLoad, we try to set the unobscured content size
2035         to be the view size divided by the initial scale. However, in extra zoom mode, `ViewportConfiguration`'s
2036         `minimumLayoutSize()` is the layout size, which is larger than the size of the view by default, so dividing this
2037         by the initial scale yields a bogus value. Instead, use `viewLayoutSize()` instead.
2038
2039         (WebKit::WebPage::updateViewportSizeForCSSViewportUnits):
2040
2041         We also try to divide the view size by the initial scale when computing the effective viewport size for `vw` and
2042         `vh`. Additionally, fix the misleading name of a variable (largestUnobscuredRect) that stores a size.
2043
2044 2018-05-09  Brent Fulgham  <bfulgham@apple.com>
2045
2046         Restrict unarchiving of bundle parameters to a set of known classes
2047         https://bugs.webkit.org/show_bug.cgi?id=185489
2048         <rdar://problem/21912401>
2049
2050         Reviewed by Ryosuke Niwa.
2051
2052         Stop accepting anything derived from NSObject, and instead only agree to unarchive objects
2053         from a set of things we actually pass as InjectedBundle parameters.
2054
2055         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
2056         (WebKit::InjectedBundle::setBundleParameter):
2057
2058 2018-05-09  Richard Houle  <rhoule@apple.com>
2059
2060         [Cocoa] Some fields are not identified as [WKWebProcessPlugInNodeHandle isTextField]
2061         https://bugs.webkit.org/show_bug.cgi?id=185260
2062         <rdar://problem/39290394>
2063
2064         INPUT element are not considered to be text fields when
2065         calling -[WKWebProcessPlugInNodeHandle isTextField]
2066         when they are of type number.
2067
2068         Reviewed by Tim Horton.
2069
2070         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
2071         (WebKit::InjectedBundleNodeHandle::isTextField const):
2072
2073 2018-05-09  Youenn Fablet  <youenn@apple.com>
2074
2075         Allow WebResourceLoader to cancel a load served from a service worker
2076         https://bugs.webkit.org/show_bug.cgi?id=185274
2077
2078         Reviewed by Chris Dumez.
2079
2080         Use FetchIdentifier instead of uint64_t.
2081         Add IPC support for cancelling a fetch from WebProcess to service worker process.
2082         Ask service worker process to cancel the fetch when its corresponding WebResourceLoader is cancelled.
2083         No change of behavior as once a WebResourceLoader is cancelled, any related IPC is not processed.
2084         A follow-up patch should try to cancel the FetchResponse load, meaning to either cancel the network load
2085         or to abort reading the readable stream.
2086
2087         * Scripts/webkit/messages.py:
2088         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2089         (WebKit::WebSWServerConnection::cancelFetch):
2090         (WebKit::WebSWServerConnection::startFetch):
2091         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
2092         (WebKit::WebSWServerConnection::didReceiveFetchData):
2093         (WebKit::WebSWServerConnection::didReceiveFetchFormData):
2094         (WebKit::WebSWServerConnection::didFinishFetch):
2095         (WebKit::WebSWServerConnection::didFailFetch):
2096         (WebKit::WebSWServerConnection::didNotHandleFetch):
2097         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2098         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2099         * StorageProcess/StorageProcess.cpp:
2100         (WebKit::StorageProcess::didFailFetch):
2101         (WebKit::StorageProcess::didNotHandleFetch):
2102         (WebKit::StorageProcess::didReceiveFetchResponse):
2103         (WebKit::StorageProcess::didReceiveFetchData):
2104         (WebKit::StorageProcess::didReceiveFetchFormData):
2105         (WebKit::StorageProcess::didFinishFetch):
2106         * StorageProcess/StorageProcess.h:
2107         * StorageProcess/StorageProcess.messages.in:
2108         * WebProcess/Network/WebLoaderStrategy.cpp:
2109         (WebKit::WebLoaderStrategy::remove):
2110         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2111         (WebKit::ServiceWorkerClientFetch::create):
2112         (WebKit::ServiceWorkerClientFetch::ServiceWorkerClientFetch):
2113         (WebKit::ServiceWorkerClientFetch::start):
2114         (WebKit::ServiceWorkerClientFetch::cancel):
2115         * WebProcess/Storage/ServiceWorkerClientFetch.h:
2116         * WebProcess/Storage/WebSWClientConnection.cpp:
2117         (WebKit::WebSWClientConnection::startFetch):
2118         (WebKit::WebSWClientConnection::cancelFetch):
2119         * WebProcess/Storage/WebSWClientConnection.h:
2120         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2121         (WebKit::WebSWContextManagerConnection::cancelFetch):
2122         (WebKit::WebSWContextManagerConnection::startFetch):
2123         * WebProcess/Storage/WebSWContextManagerConnection.h:
2124         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2125         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
2126         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
2127         (WebKit::WebServiceWorkerFetchTaskClient::cancel):
2128         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
2129         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2130         (WebKit::WebServiceWorkerProvider::handleFetch):
2131         (WebKit::WebServiceWorkerProvider::cancelFetch):
2132         (WebKit::WebServiceWorkerProvider::fetchFinished):
2133         * WebProcess/Storage/WebServiceWorkerProvider.h:
2134
2135 2018-05-09  Andy Estes  <aestes@apple.com>
2136
2137         [iOS] Consider the annotation bounds when positioning action sheets near long-pressed PDF links
2138         https://bugs.webkit.org/show_bug.cgi?id=185472
2139         <rdar://problem/39967092>
2140
2141         Reviewed by Daniel Bates.
2142
2143         Adopted new PDFHostViewControllerDelegate methods that include annotation rects
2144         when URLs and page indices are long-pressed. This allows us to avoid obscuring
2145         annotations when positioning action sheet popovers.
2146
2147         We also no longer need to convert the press location into host view coordinate
2148         space, as PDFKit now does that for us.
2149
2150         * UIProcess/ios/WKPDFView.mm:
2151         (-[WKPDFView _showActionSheetForURL:atLocation:withAnnotationRect:]):
2152         (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:withAnnotationRect:]):
2153         (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:withAnnotationRect:]):
2154         (-[WKPDFView _showActionSheetForURL:atLocation:]): Deleted.
2155         (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:]): Deleted.
2156         (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:]): Deleted.
2157
2158 2018-05-09  Andy Estes  <aestes@apple.com>
2159
2160         [iOS] Tell PDFHostViewController when animated resizes begin and end
2161         https://bugs.webkit.org/show_bug.cgi?id=185477
2162         <rdar://problem/39875372>
2163
2164         Reviewed by Anders Carlsson.
2165
2166         * UIProcess/API/Cocoa/WKWebView.mm:
2167         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
2168         (-[WKWebView _endAnimatedResize]):
2169         * UIProcess/Cocoa/WKWebViewContentProvider.h:
2170         * UIProcess/ios/WKPDFView.mm:
2171         (-[WKPDFView web_beginAnimatedResize]):
2172         (-[WKPDFView web_endAnimatedResize]):
2173
2174 2018-05-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2175
2176         Unreviewed. Update OptionsWPE.cmake and NEWS for 2.21.1 release.
2177
2178         * wpe/NEWS: Added. Add release notes for 2.21.1.
2179
2180 2018-05-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2181
2182         [WPE] Build cleanly with GCC 8 and ICU 60
2183         https://bugs.webkit.org/show_bug.cgi?id=185462
2184
2185         Reviewed by Carlos Alberto Lopez Perez.
2186
2187         * Platform/IPC/glib/GSocketMonitor.cpp:
2188         (IPC::GSocketMonitor::start): Silence -Wcast-function-type warning.
2189         * Shared/API/glib/WebKitContextMenu.cpp:
2190         (webkit_context_menu_new_with_items): Ditto.
2191
2192 2018-05-08  Sihui Liu  <sihui_liu@apple.com>
2193
2194         Adopt new async _savecookies SPI for keeping networking process active during flushing cookies
2195         https://bugs.webkit.org/show_bug.cgi?id=185261
2196         <rdar://problem/37214391>
2197
2198         Reviewed by Chris Dumez.
2199
2200         By adopting new async SPI _savecookies, we can keep networking process active(not suspended)
2201         until cookies are fully synced to disk with process assertion.
2202
2203         * NetworkProcess/NetworkProcess.cpp:
2204         (WebKit::NetworkProcess::didSyncAllCookies):
2205         * NetworkProcess/NetworkProcess.h:
2206         * NetworkProcess/NetworkProcess.messages.in:
2207         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2208         (WebKit::NetworkProcess::syncAllCookies):
2209         * UIProcess/Network/NetworkProcessProxy.cpp:
2210         (WebKit::NetworkProcessProxy::didClose):
2211         (WebKit::NetworkProcessProxy::syncAllCookies):
2212         (WebKit::NetworkProcessProxy::didSyncAllCookies):
2213         * UIProcess/Network/NetworkProcessProxy.h:
2214         * UIProcess/Network/NetworkProcessProxy.messages.in:
2215         * UIProcess/WebProcessPool.cpp:
2216         (WebKit::WebProcessPool::syncNetworkProcessCookies):
2217
2218 2018-05-08  Per Arne Vollan  <pvollan@apple.com>
2219
2220         Set colorspace in the PDF plugin.
2221         https://bugs.webkit.org/show_bug.cgi?id=185445
2222         <rdar://problem/40030981>
2223
2224         Reviewed by Simon Fraser.
2225
2226         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:
2227         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2228         (WebKit::PDFPlugin::PDFPlugin):
2229
2230 2018-05-08  Megan Gardner  <megan_gardner@apple.com>
2231
2232         Don't clear selection until we are actually interacting with a Node.
2233         https://bugs.webkit.org/show_bug.cgi?id=185455
2234
2235         Reviewed by Wenson Hsieh.
2236         
2237         The presence of TextInteractionAssistant should not be used as a proxy for it we are actually editing content.
2238         We need to check to see if we have an active node, and then we should clear the selection.
2239
2240         * UIProcess/ios/WKContentViewInteraction.mm:
2241         (-[WKContentView setSelectedTextRange:]):
2242
2243 2018-05-08  Ryan Haddad  <ryanhaddad@apple.com>
2244
2245         Unreviewed, rolling out r231486.
2246
2247         Caused service worker LayoutTest failures on macOS Debug WK2.
2248
2249         Reverted changeset:
2250
2251         "Allow WebResourceLoader to cancel a load served from a
2252         service worker"
2253         https://bugs.webkit.org/show_bug.cgi?id=185274
2254         https://trac.webkit.org/changeset/231486
2255
2256 2018-05-08  Andy Estes  <aestes@apple.com>
2257
2258         [iOS] _WKWebViewPrintFormatter should return a page count of 0 for PDF documents that do not allow printing
2259         https://bugs.webkit.org/show_bug.cgi?id=185133
2260
2261         Reviewed by Andreas Kling.
2262
2263         * UIProcess/ios/WKPDFView.mm:
2264         (-[WKPDFView _ensureDocumentForPrinting]):
2265         (-[WKPDFView _wk_pageCountForPrintFormatter:]):
2266         (-[WKPDFView _wk_printedDocument]):
2267
2268 2018-05-08  Andy Estes  <aestes@apple.com>
2269
2270         [iOS] WKPDFView remains in the view hierarchy after navigating away
2271         https://bugs.webkit.org/show_bug.cgi?id=185449
2272         <rdar://problem/39693469>
2273
2274         Reviewed by Tim Horton.
2275
2276         WKPDFView removes the PDF host view from the view hierarchy in its -dealloc
2277         method, and relies on WKWebView releasing its last reference in
2278         -_setHasCustomContentView:loadedMIMEType: when the user navigates.
2279
2280         However, WKWPDFView was capturing a strong reference to self in the block passed
2281         to +[PDFHostViewController createHostView:forExtensionIdentifier:], and PDFKit
2282         (actually UIKit) is retaining this block beyond its being called. This results in
2283         the PDF host view remaining as a child of the WKScrollView even after the user
2284         navigates to another page.
2285
2286         Changed the aforementioned block to a lambda that captures a weak reference to
2287         self to prevent WKPDFView from outliving the current navigation.
2288
2289         * UIProcess/ios/WKPDFView.mm:
2290         (-[WKPDFView retain]):
2291         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
2292
2293 2018-05-08  John Wilander  <wilander@apple.com>
2294
2295         Storage Access API: Make user opt-in sticky
2296         https://bugs.webkit.org/show_bug.cgi?id=185454
2297         <rdar://problem/40003946>
2298
2299         Reviewed by Alex Christensen.
2300
2301         This patch persists the user's choice to opt-in to access under specific domains.
2302         Such storage access should age out with the accessing domain's cookies and website
2303         data. The opt-in prompt is still an experimental feature.
2304
2305         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2306         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
2307         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
2308         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
2309         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
2310         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessInternal):
2311         (WebKit::WebResourceLoadStatisticsStore::hasUserGrantedStorageAccessThroughPrompt const):
2312         (WebKit::WebResourceLoadStatisticsStore::hasHadUnexpiredRecentUserInteraction const):
2313         * UIProcess/WebResourceLoadStatisticsStore.h:
2314
2315 2018-05-08  Daniel Bates  <dabates@apple.com>
2316
2317         Do not apply X-Frame-Options and CSP frame-ancestors to Quick Look-applicable responses in NetworkProcess
2318         https://bugs.webkit.org/show_bug.cgi?id=185442
2319         <rdar://problem/40067209>
2320
2321         Reviewed by Andy Estes.
2322
2323         Just as we exempt responses in WebContent process that will be handled by Quick Look from the Content
2324         Security Policy frame-ancestors directive and X-Frame-Options checking we need to do the same when
2325         such checks are performed in NetworkProcess following r231479.
2326
2327         HTTP responses that will be previewed using Quick Look are not considered web pages and are subject
2328         to the security model for Quick Look documents. That is, they are exempt from Content Security Policy
2329         and X-Frame-Options processing.
2330
2331         * NetworkProcess/NetworkResourceLoader.cpp:
2332         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
2333
2334 2018-05-08  Brian Burg  <bburg@apple.com>
2335
2336         REGRESSION(r230743): Mousemove events are not coalesced properly, mousemove/drag is very laggy
2337         https://bugs.webkit.org/show_bug.cgi?id=185425
2338         <rdar://problem/39323336>
2339
2340         Reviewed by Simon Fraser.
2341
2342         When mousemove events come in faster than they can be processed, we should coalesce
2343         pending mousemoves that have not yet been sent to WebProcess. This has the effect of
2344         processing the most recent mousemove location, which is the old behavior that regressed.
2345
2346         * UIProcess/WebPageProxy.cpp:
2347         (WebKit::WebPageProxy::handleMouseEvent):
2348         If there is >1 event in the mouse queue, then the first one is being processed by WebProcess
2349         and the second one is eligible for coalescing. Replace it if the last event and new event
2350         are both mousemoves.
2351
2352 2018-05-08  Per Arne Vollan  <pvollan@apple.com>
2353
2354         The PDF context menu should not be created in the WebContent process.
2355         https://bugs.webkit.org/show_bug.cgi?id=185401
2356
2357         Reviewed by Tim Horton.
2358
2359         Send a sync IPC message from the WebContent process to the UI process with the necessary context
2360         menu information when the menu is requested. The NSMenu will then be created and shown in the
2361         UI process. The reply will contain the selected menu item index.
2362
2363         * Shared/mac/PDFContextMenu.h: Added.
2364         (WebKit::PDFContextMenuItem::encode const):
2365         (WebKit::PDFContextMenuItem::decode):
2366         (WebKit::PDFContextMenu::encode const):
2367         (WebKit::PDFContextMenu::decode):
2368         * UIProcess/WebPageProxy.h:
2369         * UIProcess/WebPageProxy.messages.in:
2370         * UIProcess/mac/WebPageProxyMac.mm:
2371         (-[WKPDFMenuTarget menuItem]):
2372         (-[WKPDFMenuTarget contextMenuAction:]):
2373         (WebKit::WebPageProxy::showPDFContextMenu):
2374         * WebKit.xcodeproj/project.pbxproj:
2375         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2376         (WebKit::PDFPlugin::handleContextMenuEvent):
2377
2378 2018-05-08  Dean Jackson  <dino@apple.com>
2379
2380         System Preview links should trigger a download
2381         https://bugs.webkit.org/show_bug.cgi?id=185439
2382         <rdar://problem/40065545>
2383
2384         Reviewed by Jon Lee.
2385
2386         Encode the new field identifying a system preview. And
2387         if you encounter such a resource request, trigger
2388         a download.
2389
2390         * Shared/WebCoreArgumentCoders.cpp:
2391         (IPC::ArgumentCoder<ResourceRequest>::encode):
2392         (IPC::ArgumentCoder<ResourceRequest>::decode):
2393         * UIProcess/WebPageProxy.cpp:
2394         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2395
2396 2018-05-08  John Wilander  <wilander@apple.com>
2397
2398         Storage Access API: Add a request roundtrip to check whether prompting is needed
2399         https://bugs.webkit.org/show_bug.cgi?id=185368
2400         <rdar://problem/40011556>
2401
2402         Reviewed by Alex Christensen and Youenn Fablet.
2403
2404         This patch adds an enum WebKit::StorageAccessStatus to handle our three access
2405         states:
2406         - WebKit::StorageAccessStatus::CannotRequestAccess.
2407             This means the domain is blocked from cookie access.
2408         - WebKit::StorageAccessStatus::RequiresUserPrompt.
2409             This means that access has not been granted yet and a prompt is required.
2410         - WebKit::StorageAccessStatus::HasAccess.
2411             This either means that this domain does not need to ask for access,
2412             access was already granted, or access was granted now.
2413
2414         If the call to WebResourceLoadStatisticsStore::requestStorageAccess() comes
2415         back as WebKit::StorageAccessStatus::RequiresUserPrompt, the WebPageProxy
2416         prompts the user and if the user said yes, calls a direct
2417         WebResourceLoadStatisticsStore::grantStorageAccess().
2418
2419         Existing test cases pass because requestStorageAccessConfirm in WKPage.cpp
2420         does not have m_client.requestStorageAccessConfirm and thus returns true.
2421
2422         * UIProcess/Network/NetworkProcessProxy.messages.in:
2423             Added a missing #endif.
2424         * UIProcess/WebPageProxy.cpp:
2425         (WebKit::WebPageProxy::requestStorageAccess):
2426             Here we now handle the various cases encoded in WebKit::StorageAccessStatus.
2427         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2428         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
2429             Now covers the optional prompt case.
2430         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
2431         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
2432         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessInternal):
2433             Granting access is broken out to allow WebKit::WebPageProxy to call it
2434             directly.
2435         * UIProcess/WebResourceLoadStatisticsStore.h:
2436         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2437         (WebKit::WebsiteDataStore::requestStorageAccess):
2438         (WebKit::WebsiteDataStore::grantStorageAccess):
2439             Piping through calls from from WebKit::WebResourceLoadStatisticsStore
2440             to WebKit::WebPageProxy.
2441         * UIProcess/WebsiteData/WebsiteDataStore.h:
2442
2443 2018-05-08  Chris Dumez  <cdumez@apple.com>
2444
2445         Unreviewed, rolling out r231376 and r231458.
2446
2447         Caused some API tests failures on iOS
2448
2449         Reverted changesets:
2450
2451         "[iOS] Apps that are not visible may not get suspended if they
2452         trigger page loads while in the background"
2453         https://bugs.webkit.org/show_bug.cgi?id=185318
2454         https://trac.webkit.org/changeset/231376
2455
2456         "[iOS] Release page load process assertion if the screen is
2457         locked"
2458         https://bugs.webkit.org/show_bug.cgi?id=185333
2459         https://trac.webkit.org/changeset/231458
2460
2461 2018-05-08  Dean Jackson  <dino@apple.com>
2462
2463         Use thumbnails in System Previews
2464         https://bugs.webkit.org/show_bug.cgi?id=185397
2465         <rdar://problem/40039376>
2466
2467         Reviewed by Jon Lee.
2468
2469         A system preview that goes through the WKWebViewContentProvider will
2470         show a static thumbnail/snapshot of the item, rather than jumping
2471         directly to QuickLook.
2472
2473         This means we have to link to the AssetViewer framework. That provides
2474         a ASVThumbnailView that will trigger QuickLook for us.
2475
2476         * Configurations/WebKit.xcconfig: Link to AssetViewer.
2477
2478         * UIProcess/ios/WKSystemPreviewView.h: Better macro use. Remove some unneeded protocols.
2479         * UIProcess/ios/WKSystemPreviewView.mm:
2480         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]): Update this
2481         to use an ASVThumbnailView, when on the internal SDK (because it is private).
2482         (-[WKSystemPreviewView _layoutThumbnailView]): Use the content insets to put
2483         the thumbnail in the right place.
2484         (-[WKSystemPreviewView thumbnailView:wantsToPresentPreviewController:forItem:]):
2485         Delegate method.
2486         (-[WKSystemPreviewView web_contentView]):
2487         (-[WKSystemPreviewView web_computedContentInsetDidChange]):
2488         (-[WKSystemPreviewView numberOfPreviewItemsInPreviewController:]): Deleted.
2489         (-[WKSystemPreviewView previewController:previewItemAtIndex:]): Deleted.
2490         (-[WKSystemPreviewView previewControllerWillDismiss:]): Deleted.
2491
2492 2018-05-08  Youenn Fablet  <youenn@apple.com>
2493
2494         Allow WebResourceLoader to cancel a load served from a service worker
2495         https://bugs.webkit.org/show_bug.cgi?id=185274
2496
2497         Reviewed by Chris Dumez.
2498
2499         Use FetchIdentifier instead of uint64_t.
2500         Add IPC support for cancelling a fetch from WebProcess to service worker process.
2501         Ask service worker process to cancel the fetch when its corresponding WebResourceLoader is cancelled.
2502         No change of behavior as once a WebResourceLoader is cancelled, any related IPC is not processed.
2503         A follow-up patch should try to cancel the FetchResponse load, meaning to either cancel the network load
2504         or to abort reading the readable stream.
2505
2506         * Scripts/webkit/messages.py:
2507         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2508         (WebKit::WebSWServerConnection::cancelFetch):
2509         (WebKit::WebSWServerConnection::startFetch):
2510         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
2511         (WebKit::WebSWServerConnection::didReceiveFetchData):
2512         (WebKit::WebSWServerConnection::didReceiveFetchFormData):
2513         (WebKit::WebSWServerConnection::didFinishFetch):
2514         (WebKit::WebSWServerConnection::didFailFetch):
2515         (WebKit::WebSWServerConnection::didNotHandleFetch):
2516         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2517         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2518         * StorageProcess/StorageProcess.cpp:
2519         (WebKit::StorageProcess::didFailFetch):
2520         (WebKit::StorageProcess::didNotHandleFetch):
2521         (WebKit::StorageProcess::didReceiveFetchResponse):
2522         (WebKit::StorageProcess::didReceiveFetchData):
2523         (WebKit::StorageProcess::didReceiveFetchFormData):
2524         (WebKit::StorageProcess::didFinishFetch):
2525         * StorageProcess/StorageProcess.h:
2526         * StorageProcess/StorageProcess.messages.in:
2527         * WebProcess/Network/WebLoaderStrategy.cpp:
2528         (WebKit::WebLoaderStrategy::remove):
2529         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2530         (WebKit::ServiceWorkerClientFetch::create):
2531         (WebKit::ServiceWorkerClientFetch::ServiceWorkerClientFetch):
2532         (WebKit::ServiceWorkerClientFetch::start):
2533         (WebKit::ServiceWorkerClientFetch::cancel):
2534         * WebProcess/Storage/ServiceWorkerClientFetch.h:
2535         * WebProcess/Storage/WebSWClientConnection.cpp:
2536         (WebKit::WebSWClientConnection::startFetch):
2537         (WebKit::WebSWClientConnection::cancelFetch):
2538         * WebProcess/Storage/WebSWClientConnection.h:
2539         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2540         (WebKit::WebSWContextManagerConnection::cancelFetch):
2541         (WebKit::WebSWContextManagerConnection::startFetch):
2542         * WebProcess/Storage/WebSWContextManagerConnection.h:
2543         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2544         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
2545         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
2546         (WebKit::WebServiceWorkerFetchTaskClient::cancel):
2547         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
2548         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2549         (WebKit::WebServiceWorkerProvider::handleFetch):
2550         (WebKit::WebServiceWorkerProvider::cancelFetch):
2551         (WebKit::WebServiceWorkerProvider::fetchFinished):
2552         * WebProcess/Storage/WebServiceWorkerProvider.h:
2553
2554 2018-05-08  Antti Koivisto  <antti@apple.com>
2555
2556         Don't use mapped cache files in case of Class A/B protected app
2557         https://bugs.webkit.org/show_bug.cgi?id=185422
2558         <rdar://problem/34001688>
2559
2560         Reviewed by Chris Dumez.
2561
2562         Currently we don't use shared memory maps in these cases. This still leaves us open for crashes
2563         in the network process when the device is locked.
2564
2565         This patch disables use of blob storage (mapped cache files) in apps that use class A/B protection.
2566         Normally we use blobs for resources > 16KB. Since use of shared memory is already disabled,
2567         the only optimization lost for these apps is body data deduplication.
2568
2569         Any existing cache entries with blobs are ignored and deleted. New entries are created with
2570         body data inlined with the metadata.
2571
2572         * NetworkProcess/cache/NetworkCache.cpp:
2573         (WebKit::NetworkCache::Cache::store):
2574         * NetworkProcess/cache/NetworkCache.h:
2575         (WebKit::NetworkCache::Cache::canUseSharedMemoryForBodyData const): Deleted.
2576         * NetworkProcess/cache/NetworkCacheEntry.cpp:
2577         (WebKit::NetworkCache::Entry::initializeShareableResourceHandleFromStorageRecord const):
2578
2579             Remove the code the prevented use of shared memory in these cases. Non-mapped Data objects
2580             are never shareable.
2581
2582         (WebKit::NetworkCache::Entry::setNeedsValidation):
2583         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
2584         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
2585         (WebKit::NetworkCache::canUseSharedMemoryForPath): Deleted.
2586         * NetworkProcess/cache/NetworkCacheFileSystem.h:
2587         * NetworkProcess/cache/NetworkCacheStorage.cpp:
2588         (WebKit::NetworkCache::Storage::Storage):
2589         (WebKit::NetworkCache::Storage::mayContainBlob const):
2590         (WebKit::NetworkCache::Storage::shouldStoreBodyAsBlob):
2591         (WebKit::NetworkCache::shouldStoreBodyAsBlob): Deleted.
2592         * NetworkProcess/cache/NetworkCacheStorage.h:
2593         (WebKit::NetworkCache::Storage::canUseSharedMemoryForBodyData const): Deleted.
2594
2595 2018-05-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2596
2597         Unreviewed. Add missing exit not included in r231298.
2598
2599         * WebProcess/WebProcess.cpp:
2600         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
2601
2602 2018-05-07  Daniel Bates  <dabates@apple.com>
2603
2604         Check X-Frame-Options and CSP frame-ancestors in network process
2605         https://bugs.webkit.org/show_bug.cgi?id=185410
2606         <rdar://problem/37733934>
2607
2608         Reviewed by Ryosuke Niwa.
2609
2610         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2611         (WebKit::NetworkResourceLoadParameters::encode const): Always encode the frame ancestor origins.
2612         (WebKit::NetworkResourceLoadParameters::decode): Always decode the frame ancestor origins.
2613         * NetworkProcess/NetworkResourceLoader.cpp:
2614         (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions): Added.
2615         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions): Added.
2616         (WebKit::NetworkResourceLoader::didReceiveResponse): Check if the load needs to be interrupted due
2617         to a violation of the CSP frame-ancestors directive or X-Frame-Options. If there is a violation
2618         then stop the load.
2619         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry): Ditto.
2620         (NetworkResourceLoader::addConsoleMessage): Added.
2621         (NetworkResourceLoader::sendCSPViolationReport): Added.
2622         * NetworkProcess/NetworkResourceLoader.h:
2623         * Scripts/webkit/messages.py: Teach the generator about data types MessageLevel and MessageSource
2624         as they are both defined in file JavaScriptCore/ConsoleTypes.h as opposed to independent headers.
2625         Also tell the generator that these types should not be forward declared so that we can use these
2626         types without their JSC:: prefix in WebPage.messages.in.
2627         * WebProcess/Network/NetworkProcessConnection.cpp:
2628         (WebKit::NetworkProcessConnection::didReceiveMessage): Route WebPage messages to the appropriate
2629         web page.
2630         * WebProcess/Network/WebLoaderStrategy.cpp:
2631         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): Added message StopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied.
2632         * WebProcess/Network/WebResourceLoader.cpp:
2633         (WebKit::WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied): Added.
2634         * WebProcess/Network/WebResourceLoader.h:
2635         * WebProcess/Network/WebResourceLoader.messages.in:
2636         * WebProcess/WebPage/WebFrame.cpp:
2637         (WebKit::WebFrame::addConsoleMessage):
2638         * WebProcess/WebPage/WebFrame.h:
2639         * WebProcess/WebPage/WebPage.cpp:
2640         (WebKit::WebPage::addConsoleMessage): Added.
2641         (WebKit::WebPage::sendCSPViolationReport): Added.
2642         * WebProcess/WebPage/WebPage.h:
2643         * WebProcess/WebPage/WebPage.messages.in: Add messages AddConsoleMessage and SendCSPViolationReport
2644         for adding a console message to Web Inspector and sending a CSP report, respectively.
2645
2646 2018-05-07  Daniel Bates  <dabates@apple.com>
2647
2648         Abstract logic to log console messages and send CSP violation reports into a client
2649         https://bugs.webkit.org/show_bug.cgi?id=185393
2650         <rdar://problem/40036053>
2651
2652         Reviewed by Brent Fulgham.
2653
2654         For now, build a URL from the source origin associated with the NetworkResourceLoader
2655         and pass this to the ContentSecurityPolicy constructor.
2656
2657         Additionally, make NetworkLoadChecker::contentSecurityPolicy() non-const since it returns
2658         a non-const pointer to a ContentSecurityPolicy object; => callers can mutate this object
2659         right from under NetworkLoadChecker. Making this non-const makes this clear to a reader.
2660         Also remove the mutable keyword from the definition of NetworkLoadChecker::m_contentSecurityPolicy.
2661
2662         * NetworkProcess/NetworkLoadChecker.cpp:
2663         (WebKit::NetworkLoadChecker::contentSecurityPolicy):
2664         (WebKit::NetworkLoadChecker::contentSecurityPolicy const): Deleted.
2665         * NetworkProcess/NetworkLoadChecker.h:
2666
2667 2018-05-07  Alex Christensen  <achristensen@webkit.org>
2668
2669         WebResourceLoadStatisticsStore::requestStorageAccess should call its completion handler on the main thread
2670         https://bugs.webkit.org/show_bug.cgi?id=185403
2671
2672         Reviewed by Brent Fulgham.
2673
2674         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2675         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
2676
2677 2018-05-07  Chris Dumez  <cdumez@apple.com>
2678
2679         [iOS] Release page load process assertion if the screen is locked
2680         https://bugs.webkit.org/show_bug.cgi?id=185333
2681
2682         Reviewed by Geoffrey Garen.
2683
2684         We normally take a background process assertion during page loads to allow them to complete
2685         even if the tab / app is backgrounded. We should however avoid doing so when the backgrounding
2686         is caused by the screen locking. Keeping the process assertion in this case would prevent the
2687         whole device from sleeping longer than it should, thus negatively impacting power.
2688
2689         * UIProcess/Cocoa/NavigationState.h:
2690         * UIProcess/Cocoa/NavigationState.mm:
2691         (WebKit::NavigationState::NavigationState):
2692         (WebKit::NavigationState::releaseNetworkActivityToken):
2693         (WebKit::NavigationState::didChangeIsLoading):
2694         * UIProcess/ios/WebPageProxyIOS.mm:
2695         (WebKit::WebPageProxy::applicationDidEnterBackground):
2696
2697 2018-05-07  Brent Fulgham  <bfulgham@apple.com>
2698
2699         Add experimental feature to prompt for Storage Access API use
2700         https://bugs.webkit.org/show_bug.cgi?id=185335
2701         <rdar://problem/39994649>
2702
2703         Reviewed by Alex Christensen and Youenn Fablet.
2704
2705         Create a new experimental feature that gates the ability of WebKit clients to prompt the user when
2706         Storage Access API is invoked.
2707
2708         Currently this feature doesn't have any user-visible impact.
2709
2710         * Shared/API/APIObject.h:
2711         * Shared/API/c/WKBase.h:
2712         * Shared/WebPreferences.yaml:
2713         * UIProcess/API/APIUIClient.h:
2714         (API::UIClient::requestStorageAccessConfirm):
2715         * UIProcess/API/C/WKPage.cpp:
2716         (WebKit::RequestStorageAccessConfirmResultListener::create):
2717         (WebKit::RequestStorageAccessConfirmResultListener::~RequestStorageAccessConfirmResultListener):
2718         (WebKit::RequestStorageAccessConfirmResultListener::call):
2719         (WebKit::RequestStorageAccessConfirmResultListener::RequestStorageAccessConfirmResultListener):
2720         (WKPageRequestStorageAccessConfirmResultListenerGetTypeID):
2721         (WKPageRequestStorageAccessConfirmResultListenerCall):
2722         (WKPageSetPageUIClient):
2723         * UIProcess/API/C/WKPageUIClient.h:
2724         * UIProcess/API/Cocoa/WKPreferences.mm:
2725         (-[WKPreferences _storageAccessPromptsEnabled]):
2726         (-[WKPreferences _setStorageAccessPromptsEnabled:]):
2727         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2728         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2729         * UIProcess/Cocoa/UIDelegate.h:
2730         * UIProcess/Cocoa/UIDelegate.mm:
2731         (WebKit::UIDelegate::setDelegate):
2732         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
2733         * UIProcess/WebPageProxy.cpp:
2734         (WebKit::WebPageProxy::requestStorageAccessConfirm):
2735         * UIProcess/WebPageProxy.h:
2736         * UIProcess/WebPageProxy.messages.in:
2737         * UIProcess/WebPreferences.cpp:
2738         (WebKit::WebPreferences::update):
2739         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2740         (WebKit::WebChromeClient::requestStorageAccess):
2741
2742 2018-05-07  Dean Jackson  <dino@apple.com>
2743
2744         Use a dark gray for system preview bbackground
2745         https://bugs.webkit.org/show_bug.cgi?id=185391
2746         <rdar://problem/40035120>
2747
2748         Reviewed by Eric Carlson.
2749
2750         Throw some darker shade at this view.
2751
2752         * UIProcess/ios/WKSystemPreviewView.mm:
2753         (-[WKSystemPreviewView web_initWithFrame:webView:]):
2754
2755 2018-05-07  Don Olmstead  <don.olmstead@sony.com>
2756
2757         [Win] Add missing methods to WebChromeClient
2758         https://bugs.webkit.org/show_bug.cgi?id=185325
2759
2760         Reviewed by Brent Fulgham.
2761
2762         * WebProcess/WebCoreSupport/WebChromeClient.h:
2763
2764 2018-05-07  Megan Gardner  <megan_gardner@apple.com>
2765
2766         Allow Web Touch events to timeout
2767         https://bugs.webkit.org/show_bug.cgi?id=185282
2768
2769         Reviewed by Tim Horton.
2770         
2771         This is backwards, fixing.
2772
2773         * UIProcess/WebPageProxy.cpp:
2774         (WebKit::WebPageProxy::handleTouchEventSynchronously):
2775
2776 2018-05-07  Don Olmstead  <don.olmstead@sony.com>
2777
2778         [Win] LoggingWin is missing includes
2779         https://bugs.webkit.org/show_bug.cgi?id=185326
2780
2781         Reviewed by Per Arne Vollan.
2782
2783         * Platform/win/LoggingWin.cpp:
2784
2785 2018-05-07  Daniel Bates  <dabates@apple.com>
2786
2787         CSP should be passed the referrer
2788         https://bugs.webkit.org/show_bug.cgi?id=185367
2789
2790         Reviewed by Per Arne Vollan.
2791
2792         Pass the referrer through NetworkLoadChecker so that it can pass it to the ContentSecurityPolicy
2793         object it instantiates.
2794
2795         * NetworkProcess/NetworkLoadChecker.cpp:
2796         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
2797         (WebKit::NetworkLoadChecker::contentSecurityPolicy const):
2798         * NetworkProcess/NetworkLoadChecker.h:
2799         (WebKit::NetworkLoadChecker::create):
2800         * NetworkProcess/NetworkResourceLoader.cpp:
2801         * NetworkProcess/PingLoad.cpp:
2802         (WebKit::PingLoad::PingLoad):
2803
2804 2018-05-07  Daniel Bates  <dabates@apple.com>
2805
2806         Substitute CrossOriginPreflightResultCache::clear() for CrossOriginPreflightResultCache::empty()
2807         https://bugs.webkit.org/show_bug.cgi?id=185170
2808
2809         Reviewed by Per Arne Vollan.
2810
2811         * WebProcess/WebProcess.cpp:
2812         (WebKit::WebProcess::clearResourceCaches):
2813         (WebKit::WebProcess::deleteWebsiteData):
2814
2815 2018-05-07  Brian Burg  <bburg@apple.com>
2816
2817         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
2818         https://bugs.webkit.org/show_bug.cgi?id=184861
2819         <rdar://problem/39153768>
2820
2821         Reviewed by Timothy Hatcher.
2822
2823         We need to track how many frontends are attached to the web page (both local and remote).
2824         InspectorController propagates this out to WebKit via InspectorClient. This is then
2825         kept in UIProcess as a member of WebPageProxy. When making a decision whether to use a
2826         new process for a navigation, return early with "no" if any frontends are open for the
2827         page being navigated.
2828
2829         * UIProcess/WebPageProxy.h:
2830         (WebKit::WebPageProxy::didChangeInspectorFrontendCount):
2831         (WebKit::WebPageProxy::inspectorFrontendCount const):
2832         * UIProcess/WebPageProxy.messages.in:
2833         * UIProcess/WebProcessPool.cpp:
2834         (WebKit::WebProcessPool::processForNavigation):
2835         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
2836         (WebKit::WebInspectorClient::frontendCountChanged):
2837         * WebProcess/WebCoreSupport/WebInspectorClient.h:
2838         * WebProcess/WebPage/WebPage.cpp:
2839         (WebKit::WebPage::inspectorFrontendCountChanged):
2840         * WebProcess/WebPage/WebPage.h:
2841
2842 2018-05-04  Tim Horton  <timothy_horton@apple.com>
2843
2844         Shift to a lower-level framework for simplifying URLs
2845         https://bugs.webkit.org/show_bug.cgi?id=185334
2846
2847         Reviewed by Dan Bernstein.
2848
2849         * Configurations/WebKit.xcconfig:
2850         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2851         (-[WKFullScreenWindowController _updateLocationInfo]):
2852
2853 2018-05-04  Per Arne Vollan  <pvollan@apple.com>
2854
2855         Shutdown WindowServer connections after checking in with launch services
2856         https://bugs.webkit.org/show_bug.cgi?id=185082
2857         <rdar://problem/39613173>
2858
2859         Reviewed by Brent Fulgham.
2860
2861         When WindowServer access is blocked in the WebContent process, we should shutdown all connections
2862         after checking in with launch services.
2863
2864         * WebProcess/cocoa/WebProcessCocoa.mm:
2865         (WebKit::WebProcess::platformInitializeProcess):
2866
2867 2018-05-04  Don Olmstead  <don.olmstead@sony.com>
2868
2869         [Win][WebKit] Fix forwarding headers for Windows build
2870         https://bugs.webkit.org/show_bug.cgi?id=184412
2871
2872         Reviewed by Alex Christensen.
2873
2874         * PlatformWin.cmake:
2875         * UIProcess/API/APIAttachment.h:
2876         * UIProcess/API/APIContextMenuClient.h:
2877         * UIProcess/API/C/WKProcessTerminationReason.h:
2878         * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
2879
2880 2018-05-04  Chris Dumez  <cdumez@apple.com>
2881
2882         [iOS] Apps that are not visible may not get suspended if they trigger page loads while in the background
2883         https://bugs.webkit.org/show_bug.cgi?id=185318
2884
2885         Reviewed by Geoffrey Garen.
2886
2887         Whenever there is a page load going on, we take a background process assertion to delay process
2888         suspension until this load completes. However, there is also a 3 seconds grace period after
2889         a load is complete to allow the app to trigger a new load shortly after. This grace period was
2890         introduced to support use cases where a visible app does loads in an offscreen view. However,
2891         it can be abused by apps running in the background as they could trigger new page loads while
2892         in the background to delay process suspension. This patch tightens the policy so that only
2893         apps that are currently visible get to use this grace period. Apps that are in the background
2894         get to finish their current load and will then get suspended.
2895
2896         * UIProcess/Cocoa/NavigationState.mm:
2897         (WebKit::NavigationState::didChangeIsLoading):
2898
2899 2018-05-04  Per Arne Vollan  <pvollan@apple.com>
2900
2901         Adjust sandbox profile for simulator.
2902         https://bugs.webkit.org/show_bug.cgi?id=185319
2903
2904         Reviewed by Brent Fulgham.
2905
2906         Disable Kerberos rules, as well as rules related to NSApplication initialization.
2907
2908         * WebProcess/com.apple.WebProcess.sb.in:
2909
2910 2018-05-04  Tim Horton  <timothy_horton@apple.com>
2911
2912         Wasted time dlopening Lookup when tearing down a WKWebView
2913         https://bugs.webkit.org/show_bug.cgi?id=185310
2914         <rdar://problem/39934085>
2915
2916         Reviewed by Wenson Hsieh.
2917
2918         * UIProcess/Cocoa/WebViewImpl.h:
2919         * UIProcess/Cocoa/WebViewImpl.mm:
2920         (-[WKWindowVisibilityObserver dealloc]):
2921         (-[WKWindowVisibilityObserver startObservingLookupDismissalIfNeeded]):
2922         (WebKit::WebViewImpl::prepareForDictionaryLookup):
2923         (-[WKWindowVisibilityObserver startObservingLookupDismissal]): Deleted.
2924         Avoid un-registering as a Lookup dismissal observer if we never
2925         registered in the first place, because that involves dlopening Lookup.
2926
2927 2018-05-04  Megan Gardner  <megan_gardner@apple.com>
2928
2929         Allow Web Touch events to timeout
2930         https://bugs.webkit.org/show_bug.cgi?id=185282
2931         <rdar://problem/38728319>
2932
2933         Reviewed by Tim Horton.
2934         
2935         Web Touch events currently never time out, which blocks the user from interacting with the UI Process at all.
2936         We should allow these events to time out so that the user can interact with the rest of the UI.
2937
2938         * UIProcess/WebPageProxy.cpp:
2939         (WebKit::WebPageProxy::handleTouchEventSynchronously):
2940
2941 2018-05-04  Wenson Hsieh  <whsieh@berkeley.edu>
2942
2943         REGRESSION: [ios-simulator] 3 WKWebViewAutofillTests API test failures seen with 11.3 SDK
2944         https://bugs.webkit.org/show_bug.cgi?id=184196
2945         <rdar://problem/39054481>
2946
2947         Reviewed by Tim Horton.
2948
2949         Remove an unnecessary call to NSClassFromString, now that trunk WebKit only supports iOS 11.3+.
2950
2951         * UIProcess/ios/WKContentViewInteraction.mm:
2952         (-[WKContentView insertTextSuggestion:]):
2953
2954 2018-05-04  Youenn Fablet  <youenn@apple.com>
2955
2956         NetworkProcessProxy::didReceiveAuthenticationChallenge should take an AuthenticationChallenge r-value
2957         https://bugs.webkit.org/show_bug.cgi?id=185302
2958
2959         Reviewed by Geoffrey Garen.
2960
2961         Pass AuthenticationChallenge as an r-value since it comes from IPC.
2962         No change of behavior.
2963
2964         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
2965         (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
2966         * UIProcess/Authentication/AuthenticationChallengeProxy.h:
2967         (WebKit::AuthenticationChallengeProxy::create):
2968         * UIProcess/Downloads/DownloadProxy.cpp:
2969         (WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
2970         * UIProcess/Downloads/DownloadProxy.h:
2971         * UIProcess/Network/NetworkProcessProxy.cpp:
2972         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
2973         * UIProcess/Network/NetworkProcessProxy.h:
2974
2975 2018-05-04  Sihui Liu  <sihui_liu@apple.com>
2976
2977         Assertion failure in NetworkStorageSession::setCookie: privilege of UI process is not set
2978         https://bugs.webkit.org/show_bug.cgi?id=185262
2979
2980         Reviewed by Chris Dumez.
2981
2982         Fix an assertion failure by setting UI process privileges in constructor of WebsiteDataStore
2983         because UI process may use the cookie API before creating a WebView.
2984
2985         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2986         (WebKit::WebsiteDataStore::WebsiteDataStore):
2987
2988 2018-05-04  Per Arne Vollan  <pvollan@apple.com>
2989
2990         Adjust sandbox rules for simulator.
2991         https://bugs.webkit.org/show_bug.cgi?id=185275
2992
2993         Reviewed by Brent Fulgham.
2994
2995         Enable rules related to CoreMedia for minimal simulator.
2996
2997         * WebProcess/com.apple.WebProcess.sb.in:
2998
2999 2018-05-04  Carlos Garcia Campos  <cgarcia@igalia.com>
3000
3001         [GTK] Epiphany (GNOME Web) says "Error downloading: Service Unavailable." when trying to download an image from discogs.com
3002         https://bugs.webkit.org/show_bug.cgi?id=174730
3003
3004         Reviewed by Michael Catanzaro.
3005
3006         The problem is that we don't send any User-Agent HTTP header for downloads started by WebProcessPool::download().
3007
3008         * UIProcess/API/glib/WebKitDownload.cpp:
3009         (webkitDownloadUpdateRequest): Helper to update the cached request.
3010         (webkitDownloadStarted): Updated the cached request if we have one.
3011         (webkit_download_get_request): Use webkitDownloadUpdateRequest().
3012         * UIProcess/API/glib/WebKitDownloadClient.cpp:
3013         * UIProcess/API/glib/WebKitDownloadPrivate.h:
3014         * UIProcess/WebProcessPool.cpp:
3015         (WebKit::WebProcessPool::download): Set the User-Agent HTTP header if there isn't any.
3016
3017 2018-05-04  Carlos Garcia Campos  <cgarcia@igalia.com>
3018
3019         [GTK] Some event tests failing after r230817
3020         https://bugs.webkit.org/show_bug.cgi?id=185072
3021
3022         Reviewed by Michael Catanzaro.
3023
3024         Do not send mouse move events to the WebProcess for crossing events during testing. WTR never generates crossing
3025         events and they can confuse tests.
3026
3027         Fixes: editing/pasteboard/drag-link-with-data-transfer-adds-trusted-link-to-pasteboard.html
3028                fast/css/user-drag-none.html
3029                fast/events/context-activated-by-key-event.html
3030                fast/events/drag-selects-image.html
3031                fast/events/dropzone-005.html
3032                fast/events/mouse-click-events.html
3033                fast/events/mouse-cursor-change.html
3034
3035         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3036         (webkitWebViewBaseCrossingNotifyEvent):
3037
3038 2018-05-03  Chris Dumez  <cdumez@apple.com>
3039
3040         More aggressively terminate child processes when the connection to their parent process is severed
3041         https://bugs.webkit.org/show_bug.cgi?id=177972
3042         <rdar://problem/33317607>
3043
3044         Reviewed by Geoff Garen.
3045
3046         More aggressively terminate child processes when the connection to their parent process is severed.
3047         Previously, we would dispatch to the main thread and then exit the process. This would sometimes
3048         cause the process to say alive for 10 seconds until our watchdog would forcefully terminate the
3049         process. This could happen in particular when the main thread is blocked on a synchronous IPC.
3050
3051         * NetworkProcess/NetworkProcess.cpp:
3052         (WebKit::NetworkProcess::didClose): Deleted.
3053         * NetworkProcess/NetworkProcess.h:
3054         * PluginProcess/PluginProcess.cpp:
3055         (WebKit::PluginProcess::didClose): Deleted.
3056         * PluginProcess/PluginProcess.h:
3057         * Shared/ChildProcess.cpp:
3058         (WebKit::ChildProcess::didClose):
3059         (WebKit::didCloseOnConnectionWorkQueue):
3060         (WebKit::ChildProcess::terminationTimerFired):
3061         * Shared/ChildProcess.h:
3062         * StorageProcess/StorageProcess.cpp:
3063         (WebKit::StorageProcess::didClose): Deleted.
3064         * StorageProcess/StorageProcess.h:
3065         * WebProcess/WebProcess.cpp:
3066         (WebKit::WebProcess::didClose): Deleted.
3067         * WebProcess/WebProcess.h:
3068
3069 2018-05-03  Yusuke Suzuki  <utatane.tea@gmail.com>
3070
3071         Use default std::optional if it is provided
3072         https://bugs.webkit.org/show_bug.cgi?id=185159
3073
3074         Reviewed by Michael Catanzaro.
3075
3076         * Shared/SandboxExtension.h:
3077         (WebKit::SandboxExtension::Handle::decode):
3078         * Shared/TouchBarMenuItemData.cpp:
3079         (WebKit::TouchBarMenuItemData::decode):
3080
3081 2018-05-03  Justin Fan  <justin_fan@apple.com>
3082
3083         [WebGL] Add runtime flag for enabling ASTC support in WebGL
3084         https://bugs.webkit.org/show_bug.cgi?id=184840
3085
3086         Reviewed by Myles C. Maxfield.
3087
3088         Added runtime flag for ASTC support in WebGL, to turn on/off when extension is implemented.
3089
3090         * Shared/WebPreferences.yaml:
3091
3092 2018-05-03  Keith Rollin  <krollin@apple.com>
3093
3094         Unreviewed build fix after <https://trac.webkit.org/changeset/231282>.
3095
3096         * NetworkProcess/NetworkActivityTracker.h:
3097
3098 2018-05-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3099
3100         Ads in NYTimes app are shifted downwards by the scroll view's top content inset
3101         https://bugs.webkit.org/show_bug.cgi?id=185251
3102         <rdar://problem/39062357>
3103
3104         Reviewed by Tim Horton.
3105
3106         The NYTimes app embeds advertisements in each article's WKWebView by adding views in the WKScrollView's view
3107         hierarchy. These views are positioned using the bounding client rects of elements in the DOM (via Element
3108         ::getBoundingClientRect). Prior to r229641, WebKit would report bounding client rects inset by the content
3109         insets of WKScrollView, which means that if a top content inset X is specified on the scroll view, an element
3110         that is flush against the top of the viewport will have a bounding client rect top of -X (when it should really
3111         be 0).
3112
3113         To account for this, NYTimes adds the scroll view content insets back to the bounding client rect when
3114         determining the position of each advertisement which, after r229641, causes these views to be shifted downwards
3115         by an amount equal to the scroll view content inset top.
3116
3117         This new behavior does not affect Safari, since Safari uses SPI to explicitly set obscured insets. As such, we
3118         address this by gating the scroll view content inset fix with a linked-on-or-after check.
3119
3120         * UIProcess/API/Cocoa/WKWebView.mm:
3121         (-[WKWebView _computedObscuredInset]):
3122         * UIProcess/Cocoa/VersionChecks.h:
3123
3124 2018-05-03  Chris Dumez  <cdumez@apple.com>
3125
3126         Load hangs if the WebProcess fails to launch
3127         https://bugs.webkit.org/show_bug.cgi?id=185225
3128         <rdar://problem/38249058>
3129
3130         Reviewed by Geoff Garen.
3131
3132         When a process fails to launch, ChildProcessProxy::didFinishLaunching() gets called with an
3133         invalid connection identifier. While NetworkProcessProxy::didFinishLaunching() properly deals with
3134         this situation, WebProcessProxy::didFinishLaunching() does not. As a result, we do not attempt to
3135         relaunch the process, we do not notify the client and WebPageProxy::m_isValid stays true.
3136
3137         This patch thus updates WebProcessProxy::didFinishLaunching() to check if the connection identifier
3138         is valid and treats it as a crash. As a result, the WebPageProxies properly reset their state and
3139         the client gets notified of the crash so that it can attempt to reload.
3140
3141         * UIProcess/API/Cocoa/WKProcessPool.mm:
3142         (-[WKProcessPool _makeNextWebProcessLaunchFailForTesting]):
3143         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3144         * UIProcess/Launcher/ProcessLauncher.h:
3145         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
3146         (WebKit::ProcessLauncher::launchProcess):
3147         Add SPI to make the next WebProcess launch fail, for the purpose of API testing.
3148
3149         * UIProcess/WebProcessPool.h:
3150         * UIProcess/WebProcessProxy.cpp:
3151         (WebKit::WebProcessProxy::getLaunchOptions):
3152         (WebKit::WebProcessProxy::didClose):
3153         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
3154         (WebKit::WebProcessProxy::didFinishLaunching):
3155         * UIProcess/WebProcessProxy.h:
3156
3157 2018-05-03  Commit Queue  <commit-queue@webkit.org>
3158
3159         Unreviewed, rolling out r231223 and r231288.
3160         https://bugs.webkit.org/show_bug.cgi?id=185256
3161
3162         The change in r231223 breaks internal builds, and r231288 is a
3163         dependent change. (Requested by ryanhaddad on #webkit).
3164
3165         Reverted changesets:
3166
3167         "Use default std::optional if it is provided"
3168         https://bugs.webkit.org/show_bug.cgi?id=185159
3169         https://trac.webkit.org/changeset/231223
3170
3171         "Use pointer instead of
3172         std::optional<std::reference_wrapper<>>"
3173         https://bugs.webkit.org/show_bug.cgi?id=185186
3174         https://trac.webkit.org/changeset/231288
3175
3176 2018-05-03  Per Arne Vollan  <pvollan@apple.com>
3177
3178         An error message is written to stderr when the WebContent process is blocking WindowServer access.
3179         https://bugs.webkit.org/show_bug.cgi?id=184701
3180
3181         Reviewed by Brent Fulgham.
3182
3183         Calling 'setApplicationIsDaemon(true)' instead of 'CGSSetDenyWindowServerConnections(true)' to disable
3184         access to the WindowServer in the WebContent process, will remove this error message. After this change,
3185         the url of the WebContent process is still showing up in Activity Monitor, which previously was a
3186         problem when calling 'setApplicationIsDaemon(true)'.
3187
3188         * WebProcess/WebProcess.cpp:
3189         (WebKit::WebProcess::initializeProcess):
3190         * WebProcess/cocoa/WebProcessCocoa.mm:
3191         (WebKit::WebProcess::platformInitializeProcess):
3192
3193 2018-05-03  Ryan Haddad  <ryanhaddad@apple.com>
3194
3195         Unreviewed, rolling out r231253.
3196
3197         The API test added with this change is crashing on the bots.
3198
3199         Reverted changeset:
3200
3201         "Web Inspector: opt out of process swap on navigation if a Web
3202         Inspector frontend is connected"
3203         https://bugs.webkit.org/show_bug.cgi?id=184861
3204         https://trac.webkit.org/changeset/231253
3205
3206 2018-05-03  Brent Fulgham  <bfulgham@apple.com>
3207
3208         Re-eneable Network Extension support in the WebContent process
3209         https://bugs.webkit.org/show_bug.cgi?id=185236
3210         <rdar://problem/39883004>
3211
3212         Reviewed by Eric Carlson.
3213
3214         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3215         * WebProcess/com.apple.WebProcess.sb.in:
3216
3217 2018-05-03  Tim Horton  <timothy_horton@apple.com>
3218
3219         REGRESSION (r231014): Entitlements are not applied to XPC services on macOS
3220         https://bugs.webkit.org/show_bug.cgi?id=185241
3221
3222         Reviewed by Dan Bernstein.
3223
3224         * Configurations/BaseXPCService.xcconfig:
3225         * Configurations/WebContentService.Development.xcconfig:
3226         * Configurations/WebContentService.xcconfig:
3227
3228 2018-05-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3229
3230         REGRESSION(r222772): [GTK][WPE] WebProcess from WebKitGtk+ 2.19.9x SIGSEVs in WebKit::WebProcess::ensureNetworkProcessConnection() at Source/WebKit/WebProcess/WebProcess.cpp:1127
3231         https://bugs.webkit.org/show_bug.cgi?id=183348
3232
3233         Reviewed by Michael Catanzaro.
3234
3235         When connection doesn't exit in case of sync message failure, always exit in case of failing to send
3236         GetNetworkProcessConnection or GetStorageProcessConnection messages. This can happen when the WebView is created
3237         and destroyed quickly.
3238
3239         * WebProcess/WebProcess.cpp:
3240         (WebKit::WebProcess::ensureNetworkProcessConnection):
3241         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
3242
3243 2018-05-02  Nan Wang  <n_wang@apple.com>
3244
3245         AX: Missing kAXSWebAccessibilityEventsEnabledNotification causes a crash
3246         https://bugs.webkit.org/show_bug.cgi?id=185237
3247
3248         Reviewed by Dan Bernstein.
3249
3250         When libAccessibility.dylib is missing, the compiler would optimize out the global
3251         notification and lead to a crash. Fixed it by using the isNullFunction check instead,
3252         since we are sure the global notification would be there when the corresponding function 
3253         is available.
3254
3255         * UIProcess/API/Cocoa/WKWebView.mm:
3256         (-[WKWebView _initializeWithConfiguration:]):
3257
3258 2018-05-02  Keith Rollin  <krollin@apple.com>
3259
3260         Add facility for tracking times and results of page and resource loading
3261         https://bugs.webkit.org/show_bug.cgi?id=184838
3262         <rdar://problem/36548974>
3263
3264         Reviewed by Brent Fulgham.
3265
3266         Add NetworkActivityTracker. The idea behind this facility is to create
3267         and destroy them around networking activity that we want to track for
3268         the purpose of measuring overall network health. They can be created
3269         around the loading of pages or individual resources, and can be
3270         arranged in a parent/child hierarchy to indicate what pages the
3271         resources are part of. The NetworkActivity tracker tracks load times
3272         and results. On Cocoa, it can be integrated with CFNetwork in order to
3273         associate WebKit activity with low-level networking activity.
3274
3275         * CMakeLists.txt:
3276         * Configurations/WebKit.xcconfig:
3277         * NetworkProcess/NetworkActivityTracker.cpp: Copied from Source/WebKit/NetworkProcess/NetworkLoadParameters.h.
3278         (WebKit::NetworkActivityTracker::NetworkActivityTracker):
3279         (WebKit::NetworkActivityTracker::~NetworkActivityTracker):
3280         (WebKit::NetworkActivityTracker::setParent):
3281         (WebKit::NetworkActivityTracker::start):
3282         (WebKit::NetworkActivityTracker::complete):
3283         * NetworkProcess/NetworkActivityTracker.h: Added.
3284         (WebKit::NetworkActivityTracker::getPlatformObject):
3285         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3286         (WebKit::NetworkConnectionToWebProcess::didClose):
3287         (WebKit::NetworkConnectionToWebProcess::pageLoadCompleted):
3288         (WebKit::networkActivityTrackingEnabled):
3289         (WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
3290         (WebKit::NetworkConnectionToWebProcess::stopTrackingResourceLoad):
3291         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTracking):
3292         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTrackingForPage):
3293         (WebKit::NetworkConnectionToWebProcess::findRootNetworkActivity):
3294         (WebKit::NetworkConnectionToWebProcess::findNetworkActivityTracker):
3295         * NetworkProcess/NetworkConnectionToWebProcess.h:
3296         (WebKit::NetworkConnectionToWebProcess::ResourceNetworkActivityTracker::ResourceNetworkActivityTracker):
3297         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3298         * NetworkProcess/NetworkDataTask.cpp:
3299         (WebKit::NetworkDataTask::create):
3300         * NetworkProcess/NetworkLoadParameters.h:
3301         * NetworkProcess/NetworkProcess.cpp:
3302         (WebKit::NetworkProcess::initializeNetworkProcess):
3303         * NetworkProcess/NetworkProcess.h:
3304         (WebKit::NetworkProcess::trackNetworkActivity const):
3305         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3306         (WebKit::NetworkProcessCreationParameters::encode const):
3307         (WebKit::NetworkProcessCreationParameters::decode):
3308         * NetworkProcess/NetworkProcessCreationParameters.h:
3309         * NetworkProcess/NetworkResourceLoader.cpp:
3310         (WebKit::NetworkResourceLoader::start):
3311         (WebKit::NetworkResourceLoader::cleanup):
3312         (WebKit::NetworkResourceLoader::abort):
3313         (WebKit::NetworkResourceLoader::didFinishLoading):
3314         (WebKit::NetworkResourceLoader::didFailLoading):
3315         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
3316         (WebKit::NetworkResourceLoader::continueProcessingCachedEntryAfterDidReceiveResponse):
3317         * NetworkProcess/NetworkResourceLoader.h:
3318         * NetworkProcess/cocoa/NetworkActivityTrackerCocoa.mm: Added.
3319         (WebKit::NetworkActivityTracker::NetworkActivityTracker):
3320         (WebKit::NetworkActivityTracker::~NetworkActivityTracker):
3321         (WebKit::NetworkActivityTracker::setParent):
3322         (WebKit::NetworkActivityTracker::start):
3323         (WebKit::NetworkActivityTracker::complete):
3324         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
3325         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3326         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3327         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3328         (API::ProcessPoolConfiguration::copy):
3329         * UIProcess/API/APIProcessPoolConfiguration.h:
3330         * UIProcess/API/C/WKContextConfigurationRef.cpp:
3331         (WKContextConfigurationTrackNetworkActivity):
3332         (WKContextConfigurationSetTrackNetworkActivity):
3333         * UIProcess/API/C/WKContextConfigurationRef.h:
3334         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3335         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3336         (-[_WKProcessPoolConfiguration trackNetworkActivity]):
3337         (-[_WKProcessPoolConfiguration setTrackNetworkActivity:]):
3338         * UIProcess/WebProcessPool.cpp:
3339         (WebKit::WebProcessPool::ensureNetworkProcess):
3340         * WebKit.xcodeproj/project.pbxproj:
3341         * WebProcess/Network/WebLoaderStrategy.cpp:
3342         (WebKit::WebLoaderStrategy::pageLoadCompleted):
3343         * WebProcess/Network/WebLoaderStrategy.h:
3344
3345 2018-05-02  Jer Noble  <jer.noble@apple.com>
3346
3347         Open audio/video sandbox services for minimal simulator
3348         https://bugs.webkit.org/show_bug.cgi?id=185217
3349         <rdar://problem/39918909>
3350
3351         Reviewed by Per Arne Vollan.
3352
3353         * WebKit.xcodeproj/project.pbxproj:
3354         * WebProcess/com.apple.WebProcess.sb.in:
3355
3356 2018-05-02  Daniel Bates  <dabates@apple.com>
3357
3358         Cleanup NetworkResourceLoader::didReceiveResponse()
3359         https://bugs.webkit.org/show_bug.cgi?id=185209
3360
3361         Reviewed by Chris Dumez.
3362
3363         Use early returns to make the control flow easier to read and reason about. Disregarding a
3364         From-Origin violation, NetworkResourceLoader::didReceiveResponse() only returns NetworkLoadClient::ShouldContinueDidReceiveResponse::No
3365         when the load is for a main resource and hence it must wait for the embedding client to allow
3366         the load before continuing with it. With regards to a From-Origin violation, the network
3367         process schedules to fail the load in a subsequent turn of the event loop before returning
3368         NetworkLoadClient::ShouldContinueDidReceiveResponse::No. It return NetworkLoadClient::ShouldContinueDidReceiveResponse::No
3369         solely to tell the NetworkLoadClient to defer assuming the load is allowed (because we will
3370         fail it on the next turn of the event loop).
3371
3372         Additionally, remove all logging about the return value as we no longer have a need for
3373         such logging.
3374
3375         * NetworkProcess/NetworkResourceLoader.cpp:
3376         (WebKit::NetworkResourceLoader::didReceiveResponse):
3377
3378 2018-05-02  Alex Christensen  <achristensen@webkit.org>
3379
3380         Add WKWebsiteDataStorePrivate._proxyConfiguration SPI
3381         https://bugs.webkit.org/show_bug.cgi?id=185179
3382
3383         Reviewed by Andy Estes.
3384
3385         * NetworkProcess/NetworkSessionCreationParameters.h:
3386         (WebKit::NetworkSessionCreationParameters::encode const):
3387         (WebKit::NetworkSessionCreationParameters::decode):
3388         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3389         (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
3390         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
3391         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3392         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3393         * Shared/WebsiteDataStoreParameters.cpp:
3394         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
3395         * Shared/cf/ArgumentCodersCF.cpp:
3396         (IPC::encode):
3397         (IPC::decode):
3398         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3399         (-[WKWebsiteDataStore _setProxyConfiguration:]):
3400         (-[WKWebsiteDataStore _proxyConfiguration]):
3401         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3402         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3403         (WebKit::WebsiteDataStore::parameters):
3404         * UIProcess/WebsiteData/WebsiteDataStore.h:
3405         (WebKit::WebsiteDataStore::setProxyConfiguration):
3406         (WebKit::WebsiteDataStore::proxyConfiguration):
3407
3408 2018-05-02  Youenn Fablet  <youenn@apple.com>
3409
3410         Use NetworkLoadChecker for navigation loads
3411         https://bugs.webkit.org/show_bug.cgi?id=184892
3412         <rdar://problem/39652686>
3413
3414         Reviewed by Chris Dumez.
3415
3416         Compute whether a response is same origin in no-cors case.
3417         This allows providing more precise filtering.
3418         In case of navigate loads, set the tainting to basic which will make filtering to the minimum.
3419
3420         Pass the sourceOrigin for navigation loads as well.
3421         Enable to restrict HTTP response access for navigation load.
3422
3423         Content Blockers are disabled for now in NetworkLoadChecker for navigation loads.
3424         They should be reenabled as a follow-up.
3425
3426         Add a specific case to allow any redirection to about:// URLs.
3427         While this does not conform with the spec, this keeps the existing WebKit behavior.
3428
3429         * NetworkProcess/NetworkLoadChecker.cpp:
3430         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
3431         (WebKit::NetworkLoadChecker::validateResponse):
3432         (WebKit::NetworkLoadChecker::continueCheckingRequest):
3433         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
3434         * NetworkProcess/NetworkResourceLoader.cpp:
3435         (WebKit::NetworkResourceLoader::sanitizeResponseIfPossible):
3436         * WebProcess/Network/WebLoaderStrategy.cpp:
3437         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3438         (WebKit::WebLoaderStrategy::isDoingLoadingSecurityChecks const):
3439         We only do security checks if this runtime flag is on.
3440         * WebProcess/Network/WebLoaderStrategy.h:
3441
3442 2018-05-02  Jer Noble  <jer.noble@apple.com>
3443
3444         Make EncryptedMediaAPIEnabled an experimental feature
3445         https://bugs.webkit.org/show_bug.cgi?id=185212
3446
3447         Reviewed by Eric Carlson.
3448
3449         * Shared/WebPreferences.yaml:
3450
3451 2018-05-02  Per Arne Vollan  <pvollan@apple.com>
3452
3453         Adjust sandbox profile in simulator mode.
3454         https://bugs.webkit.org/show_bug.cgi?id=185172
3455         <rdar://problem/39876860>
3456
3457         Reviewed by Brent Fulgham.
3458
3459         Fix some sandbox violations.
3460
3461         * WebProcess/com.apple.WebProcess.sb.in:
3462
3463 2018-05-02  Brian Burg  <bburg@apple.com>
3464
3465         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
3466         https://bugs.webkit.org/show_bug.cgi?id=184861
3467         <rdar://problem/39153768>
3468
3469         Reviewed by Ryosuke Niwa.
3470
3471         We need to track how many frontends are attached to the web page (both local and remote).
3472         InspectorController propagates this out to WebKit via InspectorClient. This is then
3473         kept in UIProcess as a member of WebPageProxy. When making a decision whether to use a
3474         new process for a navigation, return early with "no" if any frontends are open for the
3475         page being navigated.
3476
3477         * UIProcess/WebPageProxy.h:
3478         (WebKit::WebPageProxy::didChangeInspectorFrontendCount):
3479         (WebKit::WebPageProxy::inspectorFrontendCount const):
3480         * UIProcess/WebPageProxy.messages.in:
3481         * UIProcess/WebProcessPool.cpp:
3482         (WebKit::WebProcessPool::processForNavigation):
3483         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
3484         (WebKit::WebInspectorClient::frontendCountChanged):
3485         * WebProcess/WebCoreSupport/WebInspectorClient.h:
3486         * WebProcess/WebPage/WebPage.cpp:
3487         (WebKit::WebPage::inspectorFrontendCountChanged):
3488         * WebProcess/WebPage/WebPage.h:
3489
3490 2018-05-02  Jer Noble  <jer.noble@apple.com>
3491
3492         Adopt -destinationWindowToExitFullScreenForWindow:
3493         https://bugs.webkit.org/show_bug.cgi?id=185204
3494         <rdar://problem/22486621>
3495
3496         Reviewed by Eric Carlson.
3497
3498         * UIProcess/mac/WKFullScreenWindowController.mm:
3499         (-[WKFullScreenWindowController destinationWindowToExitFullScreenForWindow:]):
3500
3501 2018-05-02  Per Arne Vollan  <pvollan@apple.com>
3502
3503         Disable Media capture rules in sandbox for simulator.
3504         https://bugs.webkit.org/show_bug.cgi?id=185206
3505         <rdar://problem/39910015>
3506
3507         Reviewed by Eric Carlson.
3508
3509         These rules are not relevant in this case.
3510
3511         * WebProcess/com.apple.WebProcess.sb.in:
3512
3513 2018-05-02  Eric Carlson  <eric.carlson@apple.com>
3514
3515         [iOS] Provide audio route information when invoking AirPlay picker
3516         https://bugs.webkit.org/show_bug.cgi?id=185199
3517         <rdar://problem/39853103>
3518
3519         Reviewed by Jer Noble.
3520
3521         * Scripts/webkit/messages.py:
3522         * UIProcess/PageClient.h:
3523         * UIProcess/WebPageProxy.h:
3524         * UIProcess/WebPageProxy.messages.in:
3525         * UIProcess/ios/PageClientImplIOS.h:
3526         * UIProcess/ios/PageClientImplIOS.mm:
3527         (WebKit::PageClientImpl::showPlaybackTargetPicker):  Pass route sharing policy and routing context UID.
3528
3529         * UIProcess/ios/WKContentViewInteraction.h:
3530         * UIProcess/ios/WKContentViewInteraction.mm:
3531         (-[WKContentView _showPlaybackTargetPicker:fromRect:routeSharingPolicy:routingContextUID:]): Take same.
3532         (-[WKContentView _showPlaybackTargetPicker:fromRect:]): Deleted.
3533
3534         * UIProcess/ios/WebPageProxyIOS.mm:
3535         (WebKit::WebPageProxy::showPlaybackTargetPicker): Pass route sharing policy and routing context UID.
3536
3537         * UIProcess/ios/forms/WKAirPlayRoutePicker.h:
3538         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
3539         (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:]): Take same.
3540         (-[WKAirPlayRoutePicker showFromView:]): Deleted.
3541
3542         * WebProcess/WebCoreSupport/WebChromeClient.h:
3543         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
3544         (WebKit::WebChromeClient::showPlaybackTargetPicker):
3545
3546 2018-05-02  Jer Noble  <jer.noble@apple.com>
3547
3548         Get the WebKit.framework bundle by asking for WKWebView
3549         https://bugs.webkit.org/show_bug.cgi?id=185175
3550
3551         Reviewed by Tim Horton.
3552
3553         * NetworkProcess/mac/NetworkProcessMac.mm:
3554         (WebKit::NetworkProcess::initializeSandbox):
3555         * Shared/mac/ChildProcessMac.mm:
3556         (WebKit::ChildProcess::initializeSandbox):
3557         * StorageProcess/mac/StorageProcessMac.mm:
3558         (WebKit::StorageProcess::initializeSandbox):
3559
3560 2018-05-02  Youenn Fablet  <youenn@apple.com>
3561
3562         Cannot gather srflx or relay ICE candidates on IPv6 network (ICE agent hangs?)
3563         https://bugs.webkit.org/show_bug.cgi?id=181009
3564         <rdar://problem/36144555>
3565
3566         Reviewed by Eric Carlson.
3567
3568         On iOS/IPv6 networks, STUN servers name resolution returns a zero IPv6 IP address.
3569         No error is raised which leads to sending STUN requests with that IP address.
3570         Once the request times out, the ICE candidate gathering finishes with host candidates only.
3571
3572         This patch makes WebRTC DNS resolver to send only IPv4 resolved addresses.
3573         STUN is used for NAT traversal which is for IPv4 addresses.
3574         Not sending IPv6 addresses allows terminating ICE candidate gathering sooner.
3575
3576         Manually tested on iOS with IPv4/IPv6 and IPv6 networks.
3577
3578         * NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp:
3579         (WebKit::resolvedName):
3580
3581 2018-05-02  Youenn Fablet  <youenn@apple.com>
3582
3583         CacheStorage::Engine should keep a list of initialization callback
3584         https://bugs.webkit.org/show_bug.cgi?id=185184
3585         <rdar://problem/38875651>
3586
3587         Reviewed by Antti Koivisto.
3588
3589         Keep each initialize callback in a Vector so as to compute the salt only once.
3590         Call all callbacks then in a loop.
3591
3592         * NetworkProcess/cache/CacheStorageEngine.cpp:
3593         (WebKit::CacheStorage::Engine::~Engine):
3594         (WebKit::CacheStorage::Engine::initialize):
3595         * NetworkProcess/cache/CacheStorageEngine.h:
3596
3597 2018-05-02  Jer Noble  <jer.noble@apple.com>
3598
3599         Pipe volume through PlaybackSessionManager/Proxy.
3600         https://bugs.webkit.org/show_bug.cgi?id=185182
3601
3602         Reviewed by Eric Carlson.
3603
3604         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
3605         * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
3606         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
3607         (WebKit::PlaybackSessionModelContext::setVolume):
3608         (WebKit::PlaybackSessionModelContext::volumeChanged):
3609         (WebKit::PlaybackSessionManagerProxy::volumeChanged):
3610         (WebKit::PlaybackSessionManagerProxy::setVolume):
3611         * WebProcess/cocoa/PlaybackSessionManager.h:
3612         * WebProcess/cocoa/PlaybackSessionManager.messages.in:
3613         * WebProcess/cocoa/PlaybackSessionManager.mm:
3614         (WebKit::PlaybackSessionInterfaceContext::volumeChanged):
3615         (WebKit::PlaybackSessionManager::volumeChanged):
3616         (WebKit::PlaybackSessionManager::setVolume):
3617
3618 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
3619
3620         Use default std::optional if it is provided
3621         https://bugs.webkit.org/show_bug.cgi?id=185159
3622
3623         Reviewed by JF Bastien.
3624
3625         * Shared/SandboxExtension.h:
3626         (WebKit::SandboxExtension::Handle::decode):
3627         * Shared/TouchBarMenuItemData.cpp:
3628         (WebKit::TouchBarMenuItemData::decode):
3629
3630 2018-05-01  Jer Noble  <jer.noble@apple.com>
3631
3632         Production build error in Migrate Header phase when WK_ALTERNATE_FRAMEWORKS_DIR is set to non-empty value
3633         https://bugs.webkit.org/show_bug.cgi?id=185171
3634
3635         Reviewed by Timothy Hatcher.
3636
3637         * Configurations/BaseTarget.xcconfig:
3638
3639 2018-05-01  Per Arne Vollan  <pvollan@apple.com>
3640
3641         Use correct runloop type in the WebContent process.
3642         https://bugs.webkit.org/show_bug.cgi?id=185140
3643
3644         Reviewed by Brent Fulgham.
3645
3646         Use WK_MACOS_* machinery to determine runloop type for the WebContent process.
3647
3648         * Configurations/WebContentService.xcconfig:
3649
3650 2018-05-01  Oleksandr Skachkov  <gskachkov@gmail.com>
3651
3652         WebAssembly: add support for stream APIs - JavaScript API
3653         https://bugs.webkit.org/show_bug.cgi?id=183442
3654
3655         Reviewed by Yusuke Suzuki and JF Bastien.
3656
3657         Add WEBASSEMBLY_STREAMING_API feature flag
3658
3659         * Configurations/FeatureDefines.xcconfig:
3660
3661 2018-04-30  Per Arne Vollan  <pvollan@apple.com>
3662
3663         Use correct runloop type in the WebContent process.
3664         https://bugs.webkit.org/show_bug.cgi?id=185140
3665         <rdar://problem/39585037>
3666
3667         Reviewed by Brent Fulgham.
3668
3669         The macOS target version should be used to determine the runloop type.
3670
3671         * Configurations/WebContentService.xcconfig:
3672
3673 2018-04-30  Michael Saboff  <msaboff@apple.com>
3674
3675         Eliminate WebProcessShim.dylib
3676         https://bugs.webkit.org/show_bug.cgi?id=185147
3677
3678         Reviewed by Ryosuke Niwa.
3679
3680         * Configurations/WebContentService.xcconfig:
3681         * Configurations/WebProcessShim.xcconfig: Removed.
3682         * WebKit.xcodeproj/project.pbxproj:
3683
3684 2018-04-30  Michael Saboff  <msaboff@apple.com>
3685
3686         Remove unused mac/CookieStorageShimLibrary
3687         https://bugs.webkit.org/show_bug.cgi?id=185146
3688
3689         Reviewed by Alex Christensen.
3690
3691         * Shared/mac/CookieStorageShimLibrary.cpp: Removed.
3692         * Shared/mac/CookieStorageShimLibrary.h: Removed.
3693         * WebKit.xcodeproj/project.pbxproj:
3694
3695 2018-04-30  Alex Christensen  <achristensen@webkit.org>
3696
3697         Add WKUIDelegatePrivate equivalent of WKPageContextMenuClient getContextMenuFromProposedMenuAsync
3698         https://bugs.webkit.org/show_bug.cgi?id=180955
3699
3700         Reviewed by Andy Estes.
3701
3702         * UIProcess/API/APIContextMenuClient.h:
3703         (API::ContextMenuClient::menuFromProposedMenu):
3704         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3705         * UIProcess/Cocoa/UIDelegate.h:
3706         * UIProcess/Cocoa/UIDelegate.mm:
3707         (WebKit::UIDelegate::setDelegate):
3708         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
3709         * UIProcess/mac/WebContextMenuProxyMac.mm:
3710         (WebKit::WebContextMenuProxyMac::showContextMenuWithItems):
3711
3712 2018-04-30  JF Bastien  <jfbastien@apple.com>
3713
3714         Use some C++17 features
3715         https://bugs.webkit.org/show_bug.cgi?id=185135
3716
3717         Reviewed by Alex Christensen.
3718
3719         As discussed here [0] let's move WebKit to a subset of C++17. We
3720         now require GCC 6 [1] which means that, according to [2] we can
3721         use the following C++17 language features (I removed some
3722         uninteresting ones):
3723
3724          - New auto rules for direct-list-initialization
3725          - static_assert with no message
3726          - typename in a template template parameter
3727          - Nested namespace definition
3728          - Attributes for namespaces and enumerators
3729          - u8 character literals
3730          - Allow constant evaluation for all non-type template arguments
3731          - Fold Expressions
3732          - Unary fold expressions and empty parameter packs
3733          - __has_include in preprocessor conditional
3734          - Differing begin and end types in range-based for
3735          - Improving std::pair and std::tuple
3736
3737         Consult the Tony Tables [3] to see before / after examples.
3738
3739         Of course we can use any library feature if we're willing to
3740         import them to WTF (and they don't require language support).
3741
3742
3743           [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html
3744           [1]: https://trac.webkit.org/changeset/231152/webkit
3745           [2]: https://en.cppreference.com/w/cpp/compiler_support
3746           [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md
3747
3748         * Configurations/Base.xcconfig:
3749         * DerivedSources.make:
3750         * PlatformMac.cmake:
3751
3752 2018-04-30  Wenson Hsieh  <wenson_hsieh@apple.com>
3753
3754         [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width
3755         https://bugs.webkit.org/show_bug.cgi?id=185132
3756         <rdar://problem/39834562>
3757
3758         Reviewed by Tim Horton.
3759
3760         Remove the experimental feature for `min-device-width`.
3761
3762         * Shared/WebPreferences.yaml:
3763
3764 2018-04-30  Keith Rollin  <krollin@apple.com>
3765
3766         Include breadcrumb for tracking resource loading into CFNetwork
3767         https://bugs.webkit.org/show_bug.cgi?id=184837
3768         rdar://problem/39575411
3769
3770         Reviewed by Brent Fulgham.
3771
3772         When starting the network-based loading of a resource, log the
3773         description provided by NetworkDataTask. On Cocoa, this is implemented
3774         to return the description property in NSURLSessionTask. This
3775         information better allows us to track a resource load through the
3776         WebContent process, the Networking process, and the Cocoa networking
3777         layers.
3778
3779         * NetworkProcess/NetworkDataTask.cpp:
3780         (WebKit::NetworkDataTask::description const):
3781         * NetworkProcess/NetworkDataTask.h:
3782         * NetworkProcess/NetworkLoad.cpp:
3783         (WebKit::NetworkLoad::description const):
3784         * NetworkProcess/NetworkLoad.h:
3785         * NetworkProcess/NetworkResourceLoader.cpp:
3786         (WebKit::NetworkResourceLoader::startNetworkLoad):
3787         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
3788         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3789         (WebKit::NetworkDataTaskCocoa::description const):
3790
3791 2018-04-30  Andy Estes  <aestes@apple.com>
3792
3793         [iOS] Try to unlock PDF documents before printing them
3794         https://bugs.webkit.org/show_bug.cgi?id=185084
3795         <rdar://problem/39356622>
3796
3797         Reviewed by Dan Bernstein.
3798
3799         * UIProcess/ios/WKPDFView.mm:
3800         (-[WKPDFView pdfHostViewController:documentDidUnlockWithPassword:]):
3801
3802         Stored the password that successfully unlocked the current PDF document.
3803
3804         (-[WKPDFView _wk_printedDocument]):
3805
3806         Used the stored password to unlock the CGPDFDocument we create for printing.
3807
3808 2018-04-28  Andy Estes  <aestes@apple.com>
3809
3810         [iOS] Present an action sheet when long-pressing on PDF links
3811         https://bugs.webkit.org/show_bug.cgi?id=185093
3812         <rdar://problem/39356651>
3813
3814         Reviewed by Dan Bernstein.
3815
3816         * UIProcess/ios/WKPDFView.mm:
3817         (-[WKPDFView dealloc]):
3818
3819         Called -[WKActionSheetAssistant cleanupSheet].
3820
3821         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
3822
3823         Created a WKActionSheetAssistant with the host view as the assistant view and
3824         ourselves as the delegate.
3825
3826         (-[WKPDFView _URLWithPageIndex:]):
3827
3828         Added. Creates a URL to the current page with a page number fragment appended.
3829
3830         (-[WKPDFView _goToURL:atLocation:]):
3831
3832         Added. Navigates to a URL with a synthetic mouse click at a location in host view
3833         coordinates.
3834
3835         (-[WKPDFView pdfHostViewController:goToURL:]):
3836         (-[WKPDFView pdfHostViewController:goToPageIndex:withViewFrustum:]):
3837
3838         Called -_goToURL:atLocation:. Used -_URLWithPageIndex: to construct an NSURL from
3839         a page index.
3840
3841         (-[WKPDFView _showActionSheetForURL:atLocation:]):
3842
3843         Added. Populates _positionInformation with a URL and location and calls
3844         -[WKActionSheetAssistant showLinkSheet].
3845
3846         (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:]):
3847         (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:]):
3848
3849         Called -_showActionSheetForURL:atLocation:. Used -_URLWithPageIndex: to construct
3850         an NSURL from a page index.
3851
3852         (-[WKPDFView positionInformationForActionSheetAssistant:]):
3853
3854         Returned _positionInformation.
3855
3856         (-[WKPDFView actionSheetAssistant:performAction:]):
3857
3858         Populated the pasteboard with plain text and URL representations of
3859         _positionInformation.url.
3860
3861         (-[WKPDFView actionSheetAssistant:openElementAtLocation:]):
3862
3863         Called -_goToURL:atLocation.
3864
3865         (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]):
3866
3867         Created a UIWKSelectionAssistant and called -showShareSheetFor:fromRect:.
3868
3869         (-[WKPDFView actionSheetAssistant:shouldIncludeAppLinkActionsForElement:]):
3870
3871         Returned API::UIClient::shouldIncludeAppLinkActionsForElement().
3872
3873         (-[WKPDFView actionSheetAssistant:decideActionsForElement:defaultActions:]):
3874
3875         Returned API::UIClient::actionsForElement()l
3876
3877 2018-04-28  Andy Estes  <aestes@apple.com>
3878
3879         [iOS] Allow com.apple.WebKit.Networking to look up com.apple.wifi.manager
3880         https://bugs.webkit.org/show_bug.cgi?id=185114
3881         <rdar://problem/39808763>
3882
3883         Reviewed by Wenson Hsieh.
3884
3885         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
3886
3887 2018-04-28  Brent Fulgham  <bfulgham@apple.com>
3888
3889         Revise sandboxes to allow additional IOKit property access
3890         https://bugs.webkit.org/show_bug.cgi?id=185095
3891         <rdar://problem/39809455>
3892
3893         Reviewed by Eric Carlson.
3894
3895         Update the WebContent and Plugin processes to allow additional IOKit property access.
3896
3897         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
3898         * WebProcess/com.apple.WebProcess.sb.in:
3899
3900 2018-04-28  Carlos Garcia Campos  <cgarcia@igalia.com>
3901
3902         [GTK] WebProcess from WebKitGtk+ 2.19.92 SIGSEVs in WebCore::TextureMapperGL::~TextureMapperGL
3903         https://bugs.webkit.org/show_bug.cgi?id=184040
3904
3905         Reviewed by Michael Catanzaro.
3906
3907         This can happen when using single shared process model or when the process limit is reached in multiple process
3908         model. In this case, all pages in the same web process with accelerated compositing enabled share the same
3909         compositing thread. Every page sets its GL context as current when rendering a frame, but not when invalidating
3910         the threaded compositor when the page is closed. So, if a hidden tab is closed, the threaded compositor is
3911         invalidated and the GL resources of the current context (the visible page) are destroyed. This is also causing
3912         the blank pages issue when closing a tab related to another one, the current one stops rendering anything because
3913         its GL context has been released. We should make the threaded compositor context current when invalidating it.
3914
3915         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3916         (WebKit::ThreadedCompositor::invalidate):
3917
3918 2018-04-27  Timothy Hatcher  <timothy@apple.com>
3919
3920         REGRESSION: Touch events fail to dispatch to the page in all cases.
3921
3922         https://bugs.webkit.org/show_bug.cgi?id=185097
3923         rdar://problem/39731995
3924
3925         Reviewed by Tim Horton.
3926
3927         * UIProcess/ios/WKContentViewInteraction.mm:
3928         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
3929         Consult internal gesture recognizers, otherwise NO might get returned.
3930
3931 2018-04-26  Ryosuke Niwa  <rniwa@webkit.org>
3932
3933         PSON: Triggering a navigation to an invalid URL creates a new WebContent process
3934         https://bugs.webkit.org/show_bug.cgi?id=185066
3935
3936         Reviewed by Youenn Fablet.
3937
3938         Don't create a new WebContent process when the target URL is invalid as well as when the source URL is invalid.
3939
3940         * UIProcess/WebProcessPool.cpp:
3941         (WebKit::WebProcessPool::processForNavigationInternal):
3942
3943 2018-04-27  Youenn Fablet  <youenn@apple.com>
3944
3945         Use NetworkLoadChecker for XHR/fetch loads
3946         https://bugs.webkit.org/show_bug.cgi?id=184741
3947
3948         Reviewed by Chris Dumez.
3949
3950         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
3951         (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
3952         Pass the preflight error as completion error if any.
3953         * NetworkProcess/NetworkLoad.cpp:
3954         (WebKit::NetworkLoad::willPerformHTTPRedirection):
3955         Set response source to Network so that checks relying on that are correct.
3956         * NetworkProcess/NetworkLoadChecker.cpp:
3957         (WebKit::NetworkLoadChecker::validateResponse):
3958         Adding Oppaqueredirect tainting.
3959         (NetworkLoadChecker::doesNotNeedCORSCheck):
3960         Adding a check to only activate CORS checks for CORS enabled schemes.
3961         Non CORS enabled schemes loads should have failed in WebProcess already.
3962         (WebKit::NetworkLoadChecker::checkCORSRedirectedRequest):
3963         Remove Authorization header as done by SubresourceLoader.
3964         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
3965         If error is cancellation, we still want to call the completion handler.
3966         * NetworkProcess/NetworkResourceLoader.cpp:
3967         Activate network load checker for all types of loads.
3968         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
3969         Handle manual redirection by directly calling didReceiveResponse.
3970
3971 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3972
3973         Add an experimental feature flag for viewport "min-device-width"
3974         https://bugs.webkit.org/show_bug.cgi?id=185050
3975         <rdar://problem/39624038>
3976
3977         Reviewed by Tim Horton.
3978
3979         Add MinDeviceWidthEnabled as a new experimental feature, on by default in extra zoom mode and off elsewhere.
3980
3981         * Shared/WebPreferences.yaml:
3982         * Shared/WebPreferencesDefaultValues.h:
3983
3984 2018-04-27  Daniel Bates  <dabates@apple.com>
3985
3986         UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance() is applicable to both Mac and iOS
3987         https://bugs.webkit.org/show_bug.cgi?id=185079
3988         <rdar://problem/39794960>
3989
3990         I inadvertently forgot to move the UIDelegate field webViewDidResignInputElementStrongPasswordAppearanceWithUserInfo
3991         outside the PLATFORM(MAC)-guard.
3992
3993         * UIProcess/Cocoa/UIDelegate.h:
3994
3995 2018-04-27  Daniel Bates  <dabates@apple.com>
3996
3997         UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance() is applicable to both Mac and iOS
3998         https://bugs.webkit.org/show_bug.cgi?id=185079
3999         <rdar://problem/39794960>
4000
4001         Reviewed by Andy Estes.
4002
4003         * UIProcess/Cocoa/UIDelegate.h:
4004         * UIProcess/Cocoa/UIDelegate.mm:
4005         (WebKit::UIDelegate::setDelegate):
4006         (WebKit::UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance):
4007
4008 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
4009
4010         Rename minimumLayoutSize to viewLayoutSize
4011         https://bugs.webkit.org/show_bug.cgi?id=185050
4012         <rdar://problem/39624038>
4013
4014         Reviewed by Tim Horton.
4015
4016         Renames minimumLayoutSize to viewLayoutSize, since the minimum layout size in ViewportConfiguration is now
4017         different from the minimum layout size that is currently pushed down from the UI process (e.g. WKWebView SPI) in
4018         the case where `min-device-width` is used to override the minimum layout size.
4019
4020         * Shared/WebPageCreationParameters.cpp:
4021         (WebKit::WebPageCreationParameters::encode const):
4022         (WebKit::WebPageCreationParameters::decode):
4023         * Shared/WebPageCreationParameters.h:
4024         * UIProcess/API/Cocoa/WKWebView.mm:
4025         (-[WKWebView _processDidExit]):
4026         (-[WKWebView activeViewLayoutSize:]):
4027         (-[WKWebView _dispatchSetViewLayoutSize:]):
4028         (-[WKWebView _frameOrBoundsChanged]):
4029         (-[WKWebView _minimumLayoutSizeOverride]):
4030         (-[WKWebView _setViewLayoutSizeOverride:]):
4031         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
4032         (-[WKWebView _endAnimatedResize]):
4033         (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:maximumUnobscuredSizeOverride:]):
4034         (-[WKWebView _clearOverrideLayoutParameters]):
4035         (-[WKWebView _minimumLayoutWidth]):
4036         (-[WKWebView _setMinimumLayoutWidth:]):
4037         (-[WKWebView activeMinimumLayoutSize:]): Deleted.
4038         (-[WKWebView _dispatchSetMinimumLayoutSize:]): Deleted.
4039         (-[WKWebView _setMinimumLayoutSizeOverride:]): Deleted.
4040         (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:minimumLayoutSizeForMinimalUI:maximumUnobscuredSizeOverride:]): Deleted.
4041
4042         Remove unused SPI that has been deprecated since iOS 9, has a simple drop-in replacement, and no longer has any
4043         internal clients.
4044
4045         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
4046         * UIProcess/Cocoa/WebViewImpl.mm:
4047         (WebKit::WebViewImpl::setMinimumSizeForAutoLayout):
4048         (WebKit::WebViewImpl::minimumSizeForAutoLayout const):
4049         (WebKit::WebViewImpl::setIntrinsicContentSize):
4050         * UIProcess/DrawingAreaProxy.h:
4051         (WebKit::DrawingAreaProxy::viewLayoutSizeDidChange):
4052         (WebKit::DrawingAreaProxy::minimumLayoutSizeDidChange): Deleted.
4053         * UIProcess/WebPageProxy.cpp:
4054         (WebKit::WebPageProxy::creationParameters):
4055         (WebKit::WebPageProxy::setViewLayoutSize):
4056         (WebKit::WebPageProxy::setMinimumLayoutSize): Deleted.
4057         * UIProcess/WebPageProxy.h:
4058         (WebKit::WebPageProxy::viewLayoutSize const):
4059         (WebKit::WebPageProxy::minimumLayoutSize const): Deleted.
4060         * UIProcess/ios/WebPageProxyIOS.mm:
4061         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
4062         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize):
4063         (WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize): Deleted.
4064         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
4065         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
4066         (WebKit::TiledCoreAnimationDrawingAreaProxy::viewLayoutSizeDidChange):
4067         (WebKit::TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry):
4068         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange):
4069         (WebKit::TiledCoreAnimationDrawingAreaProxy::willSendUpdateGeometry):
4070         (WebKit::TiledCoreAnimationDrawingAreaProxy::minimumLayoutSizeDidChange): Deleted.
4071         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
4072         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
4073         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
4074         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
4075         * WebProcess/WebPage/WebPage.cpp:
4076         (WebKit::m_credentialsMessenger):
4077         (WebKit::WebPage::setViewLayoutSize):
4078         (WebKit::WebPage::setMinimumLayoutSize): Deleted.
4079         * WebProcess/WebPage/WebPage.h:
4080         (WebKit::WebPage::viewLayoutSize const):