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