[WebAuthN] Import a JS CBOR coder
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-10-01  Jiewen Tan  <jiewen_tan@apple.com>
2
3         [WebAuthN] Import a JS CBOR coder
4         https://bugs.webkit.org/show_bug.cgi?id=189877
5         <rdar://problem/44701124>
6
7         Reviewed by Chris Dumez.
8
9         Update MockWebAuthenticationConfiguration to have userCertificateBase64 and intermediateCACertificateBase64
10         as Local's memeber such that tests can pass those certificates to MockLocalConnection instead of letting it
11         holds some static ones.
12
13         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
14         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
15         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
16         (WebKit::MockLocalConnection::getAttestation const):
17         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
18
19 2018-10-01  Chris Dumez  <cdumez@apple.com>
20
21         Regression(r236512): http/tests/navigation/keyboard-events-during-provisional-navigation.html is flaky
22         https://bugs.webkit.org/show_bug.cgi?id=190052
23
24         Reviewed by Ryosuke Niwa.
25
26         * Platform/IPC/Connection.cpp:
27         (IPC::Connection::sendMessage):
28         * Platform/IPC/Connection.h:
29         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
30         (WKBundlePagePostMessageIgnoringFullySynchronousMode):
31         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
32         * WebProcess/WebPage/WebPage.cpp:
33         (WebKit::WebPage::postMessageIgnoringFullySynchronousMode):
34         * WebProcess/WebPage/WebPage.h:
35
36 2018-10-01  Daniel Bates  <dabates@apple.com>
37
38         [iOS] Special keys are misidentified in DOM keyboard events
39         https://bugs.webkit.org/show_bug.cgi?id=189974
40
41         Reviewed by Wenson Hsieh.
42
43         Take the key code of WebEvent to be the key code for the new WebKeyboardEvent verbatim
44         now that we normalize the character strings of the WebEvent to account for the special
45         UIKit input strings.
46
47         * Shared/ios/WebIOSEventFactory.mm:
48         (WebIOSEventFactory::createWebKeyboardEvent):
49
50 2018-10-01  Alex Christensen  <achristensen@webkit.org>
51
52         Fix an internal build after r236665
53         https://bugs.webkit.org/show_bug.cgi?id=189850
54
55         * WebKit.xcodeproj/project.pbxproj:
56         Make WKNSURLAuthenticationChallenge.h a private header.
57
58 2018-10-01  Alex Christensen  <achristensen@webkit.org>
59
60         URL should not use TextEncoding internally
61         https://bugs.webkit.org/show_bug.cgi?id=190111
62
63         Reviewed by Andy Estes.
64
65         * UIProcess/WebInspectorProxy.cpp:
66
67 2018-10-01  Jeremy Jones  <jeremyj@apple.com>
68
69         Unify implementation in VideoFullscreenInterfaceAVKit
70         https://bugs.webkit.org/show_bug.cgi?id=190091
71         rdar://problem/44734523
72
73         Reviewed by Jer Noble.
74
75         Unified code in VideoFullscreenInterfaceAVKit now that new code path is proven and include
76         any changes that had been made in the old path.
77
78         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
79         * WebProcess/cocoa/VideoFullscreenManager.mm:
80         (WebKit::VideoFullscreenManager::supportsVideoFullscreenStandby const):
81         (WebKit::VideoFullscreenManager::didSetupFullscreen):
82         (WebKit::VideoFullscreenManager::didExitFullscreen):
83
84 2018-10-01  Daniel Bates  <dabates@apple.com>
85
86         [iOS] Wrong key event may be sent to UIKit
87         https://bugs.webkit.org/show_bug.cgi?id=189992
88
89         Reviewed by Simon Fraser.
90
91         Retain a clone of a received UIEvent if it is for a hardware key event so as to ensure that we
92         notify the UIKit keyboard code of the correct keyboard event.
93
94         Currently the UIProcess retains the UIEvent associated with a keyboard event so as to defer
95         notifying the UIKit keyboard code (via -_handleKeyUIEvent) about a received keyboard event until
96         after the WebProcess has processed the raw key event. If this UIEvent is for a hardware keyboard
97         event then it is not sufficient to retain it to preserve its value because UIKit uses a singleton
98         UIEvent for all hardware keyboard events ;=> its value will be clobbered as each hardware keyboard
99         event is received. Instead we need to explicitly clone a UIEvent for a hardware key event before
100         retaining it.
101
102         * Platform/spi/ios/UIKitSPI.h: Forward declare SPI.
103         * UIProcess/ios/WKContentViewInteraction.mm:
104         (-[WKContentView handleKeyEvent:]): Clone the UIEvent if it is for a hardware key event.
105
106 2018-10-01  Alex Christensen  <achristensen@webkit.org>
107
108         Deprecate ObjC SPI in Deprecated Xcode group
109         https://bugs.webkit.org/show_bug.cgi?id=189850
110
111         Reviewed by Andy Estes.
112
113         * Shared/Cocoa/APIObject.mm:
114         (API::Object::newObject):
115         * Shared/mac/ObjCObjectGraph.mm:
116         (WebKit::typeFromObject):
117         (WebKit::ObjCObjectGraph::encode):
118         (WebKit::ObjCObjectGraph::decode):
119         * UIProcess/API/Cocoa/WKBrowsingContextController.h:
120         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
121         (didStartProvisionalNavigation):
122         (didReceiveServerRedirectForProvisionalNavigation):
123         (didFailProvisionalNavigation):
124         (didCommitNavigation):
125         (didFinishNavigation):
126         (didFailNavigation):
127         (canAuthenticateAgainstProtectionSpace):
128         (didReceiveAuthenticationChallenge):
129         (processDidCrash):
130         (setUpPagePolicyClient):
131         * UIProcess/API/Cocoa/WKBrowsingContextGroup.h:
132         * UIProcess/API/Cocoa/WKBrowsingContextGroupInternal.h:
133         * UIProcess/API/Cocoa/WKBrowsingContextHistoryDelegate.h:
134         * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegate.h:
135         * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h:
136         * UIProcess/API/Cocoa/WKBrowsingContextPolicyDelegate.h:
137         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h:
138         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm:
139         (-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]):
140         (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
141         (-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]):
142         (-[WKNSURLAuthenticationChallengeSender performDefaultHandlingForAuthenticationChallenge:]):
143         (-[WKNSURLAuthenticationChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]):
144         * UIProcess/API/Cocoa/WKNavigationData.h:
145         * UIProcess/API/Cocoa/WKNavigationDataInternal.h:
146         * UIProcess/API/Cocoa/WKProcessGroup.h:
147         * UIProcess/API/Cocoa/WKProcessGroup.mm:
148         (didCreateConnection):
149         (getInjectedBundleInitializationUserData):
150         (didNavigateWithNavigationData):
151         (didPerformClientRedirect):
152         (didPerformServerRedirect):
153         (didUpdateHistoryTitle):
154         * UIProcess/API/Cocoa/WKTypeRefWrapper.h:
155         * UIProcess/API/Cocoa/WKView.h:
156         (WK_CLASS_DEPRECATED_WITH_REPLACEMENT):
157         * UIProcess/API/Cocoa/_WKThumbnailView.h:
158         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
159         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
160         (WebKit::WebProcessProxy::transformHandlesToObjects):
161         (WebKit::WebProcessProxy::transformObjectsToHandles):
162         * UIProcess/Cocoa/WebViewImpl.h:
163         * UIProcess/Cocoa/WebViewImpl.mm:
164         * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm:
165         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
166         * UIProcess/ios/WKContentView.h:
167         * UIProcess/mac/WebInspectorProxyMac.mm:
168         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
169         * WebProcess/cocoa/WebProcessCocoa.mm:
170         (WebKit::WebProcess::transformHandlesToObjects):
171         (WebKit::WebProcess::transformObjectsToHandles):
172
173 2018-10-01  Youenn Fablet  <youenn@apple.com>
174
175         [macOS Sierra] Layout Test http/wpt/cache-storage/cache-put-keys.https.any.worker.html is a flaky failure
176         https://bugs.webkit.org/show_bug.cgi?id=184204
177
178         Reviewed by Chris Dumez.
179
180         NetworkCache::Storage by default limits the length to read to 1500 milliseconds.
181         This is good for the HTTP cache since networking might be faster.
182         It does not work for DOM cache which needs to get these resources even if it takes a long time.
183
184         Since this is disabled by a Mode::Testing option, use it for DOMCache after renaming it to Mode::AvoidRandomness.
185
186         Add a bunch of release logging to help debugging error cases.
187
188         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
189         (WebKit::CacheStorage::Caches::retrieveOriginFromDirectory):
190         (WebKit::CacheStorage::Caches::initialize):
191         (WebKit::CacheStorage::Caches::writeCachesToDisk):
192         (WebKit::CacheStorage::Caches::readRecord):
193         * NetworkProcess/cache/NetworkCache.cpp:
194         (WebKit::NetworkCache::Cache::open):
195         * NetworkProcess/cache/NetworkCacheStorage.cpp:
196         (WebKit::NetworkCache::Storage::dispatchReadOperation):
197         (WebKit::NetworkCache::Storage::shrinkIfNeeded):
198         * NetworkProcess/cache/NetworkCacheStorage.h:
199
200 2018-10-01  Olivier Blin  <olivier.blin@softathome.com>
201
202         [WPE] Remove WebKit2InspectorGResourceBundle.xml
203         https://bugs.webkit.org/show_bug.cgi?id=190132
204
205         Reviewed by Michael Catanzaro.
206
207         * UIProcess/API/wpe/WebKit2InspectorGResourceBundle.xml: Removed.
208         This is unused since legacy INSPECTOR_SERVER implementation has
209         been removed in r217924.
210
211 2018-09-30  Eric Carlson  <eric.carlson@apple.com>
212
213         [MediaStream] Clean up RealtimeMediaSource settings change handling
214         https://bugs.webkit.org/show_bug.cgi?id=189998
215         <rdar://problem/44797884>
216
217         Reviewed by Youenn Fablet.
218
219         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
220         (WebKit::UserMediaCaptureManager::Source::setSettings):
221
222 2018-09-30  Eric Carlson  <eric.carlson@apple.com>
223
224         [MediaStream] Use display-specific capture factories
225         https://bugs.webkit.org/show_bug.cgi?id=190043
226         <rdar://problem/44834412>
227
228         Reviewed by Youenn Fablet.
229
230         * WebProcess/cocoa/UserMediaCaptureManager.h:
231
232 2018-09-29  Commit Queue  <commit-queue@webkit.org>
233
234         Unreviewed, rolling out r236631.
235         https://bugs.webkit.org/show_bug.cgi?id=190112
236
237         Caused various eventSender tests, including fast/css/pseudo-
238         active-style-sharing*, to fail (Requested by smfr on #webkit).
239
240         Reverted changeset:
241
242         "Regression(r236512): http/tests/navigation/keyboard-events-
243         during-provisional-navigation.html is flaky"
244         https://bugs.webkit.org/show_bug.cgi?id=190052
245         https://trac.webkit.org/changeset/236631
246
247 2018-09-29  Chris Dumez  <cdumez@apple.com>
248
249         [PSON] Deal with the drawing area potentially being null in WebFrameLoaderClient::transitionToCommittedForNewPage()
250         https://bugs.webkit.org/show_bug.cgi?id=190084
251         <rdar://problem/44844561>
252
253         Reviewed by Antti Koivisto.
254
255         Deal with the drawing area potentially being null in WebFrameLoaderClient::transitionToCommittedForNewPage(), as a
256         result of calling WebPage::tearDownDrawingAreaForSuspend().
257
258         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
259         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
260
261 2018-09-28  Wenson Hsieh  <wenson_hsieh@apple.com>
262
263         No DOM API to instantiate an attachment for an img element
264         https://bugs.webkit.org/show_bug.cgi?id=189934
265         <rdar://problem/44743222>
266
267         Reviewed by Ryosuke Niwa.
268
269         Makes some adjustments to support using _WKAttachment's file wrapper to change the contents of any image element
270         hosting the attachment in its shadow root. To do this, we add some plumbing to allow the UI process to update an
271         attachment element's enclosing image with data from its file wrapper.
272
273         * UIProcess/API/APIAttachment.cpp:
274         (API::Attachment::isEmpty const):
275         (API::Attachment::enclosingImageData const):
276
277         Helper method that creates a SharedBuffer representing image data for the attachment. Only returns a non-null
278         value for attachment elements that are enclosed within an image.
279
280         * UIProcess/API/APIAttachment.h:
281         * UIProcess/API/Cocoa/APIAttachmentCocoa.mm:
282         (API::Attachment::enclosingImageData const):
283         (API::Attachment::isEmpty const):
284         * UIProcess/API/Cocoa/WKWebView.mm:
285         (-[WKWebView _attachmentForIdentifier:]):
286
287         Add new SPI to request a _WKAttachment for a given unique identifier. Currently, this is only used for testing.
288
289         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
290         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
291         (WebKit::WebPageProxy::platformRegisterAttachment):
292         * UIProcess/WebPageProxy.cpp:
293         (WebKit::WebPageProxy::updateAttachmentAttributes):
294         (WebKit::WebPageProxy::registerAttachmentIdentifier):
295         (WebKit::WebPageProxy::didInsertAttachmentWithIdentifier):
296
297         Plumb whether or not the attachment is enclosed by an image from the web process to the UI process.
298
299         (WebKit::WebPageProxy::didRemoveAttachmentWithIdentifier):
300         (WebKit::WebPageProxy::didInsertAttachment): Deleted.
301         (WebKit::WebPageProxy::didRemoveAttachment):
302         * UIProcess/WebPageProxy.h:
303         * UIProcess/WebPageProxy.messages.in:
304         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
305         (WebKit::WebEditorClient::registerAttachmentIdentifier):
306         (WebKit::WebEditorClient::didInsertAttachmentWithIdentifier):
307
308         Update attachment attributes after inserting an attachment. This ensures that an attachment that was created and
309         later inserted via script into the document will be synced with state in the UI process, if the client has
310         changed the contents of the attachment.
311
312         * WebProcess/WebCoreSupport/WebEditorClient.h:
313         * WebProcess/WebPage/WebPage.cpp:
314         (WebKit::WebPage::updateAttachmentAttributes):
315
316         Plumb attachment data from the UI process to the web process.
317
318         * WebProcess/WebPage/WebPage.h:
319         * WebProcess/WebPage/WebPage.messages.in:
320
321 2018-09-28  Chris Dumez  <cdumez@apple.com>
322
323         Regression(r236512): http/tests/navigation/keyboard-events-during-provisional-navigation.html is flaky
324         https://bugs.webkit.org/show_bug.cgi?id=190052
325
326         Reviewed by Ryosuke Niwa.
327
328         Introduce a new IPC::SendOption indicating that the IPC should always be sent asynchronously,
329         even if the connection is in fully synchronous mode. This is used by WebKitTestRunner for
330         all text outputting (e.g. console.log) is asynchronous, and thus in order.
331
332         * Platform/IPC/Connection.cpp:
333         (IPC::Connection::sendMessage):
334         * Platform/IPC/Connection.h:
335         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
336         (WKBundlePagePostMessageIgnoringFullySynchronousMode):
337         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
338         * WebProcess/WebPage/WebPage.cpp:
339         (WebKit::WebPage::postMessageIgnoringFullySynchronousMode):
340         * WebProcess/WebPage/WebPage.h:
341
342 2018-09-28  John Wilander  <wilander@apple.com>
343
344         Skip debug assertion in ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain()
345         https://bugs.webkit.org/show_bug.cgi?id=190097
346         <rdar://problem/44877080>
347
348         Reviewed by Chris Dumez.
349
350         The change in https://bugs.webkit.org/show_bug.cgi?id=190055 causes a
351         re-classification that may trigger a debug assertion in
352         ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain().
353         We should skip the assertion for statistics model version 14 to avoid
354         this.
355
356         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
357         (WebKit::ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain const):
358
359 2018-09-28  Devin Rousso  <drousso@apple.com>
360
361         Web Inspector: crash in InspectorNetworkAgent::didReceiveResponse when loading denied x-frame resources
362         https://bugs.webkit.org/show_bug.cgi?id=190046
363
364         Reviewed by Joseph Pecoraro.
365
366         * NetworkProcess/NetworkResourceLoader.cpp:
367         (WebKit::NetworkResourceLoader::didReceiveResponse):
368         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
369         Send the sanitized `ResourceResponse` with the message so WebInspector is able to access it.
370
371         * WebProcess/Network/WebResourceLoader.h:
372         * WebProcess/Network/WebResourceLoader.cpp:
373         * WebProcess/Network/WebResourceLoader.messages.in:
374         (WebKit::WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied):
375
376 2018-09-28  Jiewen Tan  <jiewen_tan@apple.com>
377
378         [WebAuthN] Polish WebAuthN auto-test environment
379         https://bugs.webkit.org/show_bug.cgi?id=189283
380         <rdar://problem/44117828>
381
382         Reviewed by Chris Dumez.
383
384         This patch changes MockWebAuthenticationConfiguration.local to optional such that tests can express
385         absence of local authenticators.
386
387         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
388         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
389         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
390         (WebKit::MockLocalConnection::getUserConsent const):
391         (WebKit::MockLocalConnection::getAttestation const):
392         * UIProcess/WebAuthentication/Mock/MockLocalService.cpp:
393         (WebKit::MockLocalService::platformStartDiscovery const):
394         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
395
396 2018-09-28  Jer Noble  <jer.noble@apple.com>
397
398         Refactoring: eliminate raw pointer usage in Fullscreen code
399         https://bugs.webkit.org/show_bug.cgi?id=188747
400         <rdar://problem/43541164>
401
402         Reviewed by Alex Christensen.
403
404         Adopt those Ref and WeakPtr changes made in WebCore.
405
406         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
407         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
408         (WebKit::PlaybackSessionModelContext::addClient):
409         (WebKit::PlaybackSessionModelContext::removeClient):
410         (WebKit::PlaybackSessionModelContext::durationChanged):
411         (WebKit::PlaybackSessionModelContext::currentTimeChanged):
412         (WebKit::PlaybackSessionModelContext::bufferedTimeChanged):
413         (WebKit::PlaybackSessionModelContext::rateChanged):
414         (WebKit::PlaybackSessionModelContext::seekableRangesChanged):
415         (WebKit::PlaybackSessionModelContext::canPlayFastReverseChanged):
416         (WebKit::PlaybackSessionModelContext::audioMediaSelectionOptionsChanged):
417         (WebKit::PlaybackSessionModelContext::legibleMediaSelectionOptionsChanged):
418         (WebKit::PlaybackSessionModelContext::audioMediaSelectionIndexChanged):
419         (WebKit::PlaybackSessionModelContext::legibleMediaSelectionIndexChanged):
420         (WebKit::PlaybackSessionModelContext::externalPlaybackChanged):
421         (WebKit::PlaybackSessionModelContext::wirelessVideoPlaybackDisabledChanged):
422         (WebKit::PlaybackSessionModelContext::mutedChanged):
423         (WebKit::PlaybackSessionModelContext::volumeChanged):
424         (WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged):
425         (WebKit::PlaybackSessionManagerProxy::invalidate):
426         (WebKit::PlaybackSessionManagerProxy::createModelAndInterface):
427         (WebKit::PlaybackSessionManagerProxy::removeClientForContext):
428         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
429         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
430         (WebKit::VideoFullscreenModelContext::create):
431         (WebKit::VideoFullscreenModelContext::VideoFullscreenModelContext):
432         (WebKit::VideoFullscreenModelContext::addClient):
433         (WebKit::VideoFullscreenModelContext::removeClient):
434         (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture):
435         (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture):
436         (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture):
437         (WebKit::VideoFullscreenModelContext::willExitPictureInPicture):
438         (WebKit::VideoFullscreenModelContext::didExitPictureInPicture):
439         (WebKit::VideoFullscreenManagerProxy::invalidate):
440         (WebKit::VideoFullscreenManagerProxy::createModelAndInterface):
441         (WebKit::VideoFullscreenManagerProxy::removeClientForContext):
442         (WebKit::VideoFullscreenModelContext::~VideoFullscreenModelContext): Deleted.
443         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
444         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
445         (WKFullScreenViewControllerVideoFullscreenModelClient::setInterface):
446         (-[WKFullScreenViewController videoControlsManagerDidChange]):
447         (-[WKFullScreenViewController _togglePiPAction:]):
448         * UIProcess/mac/WKFullScreenWindowController.mm:
449         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface):
450         * WebProcess/cocoa/PlaybackSessionManager.h:
451         * WebProcess/cocoa/PlaybackSessionManager.mm:
452         (WebKit::PlaybackSessionInterfaceContext::PlaybackSessionInterfaceContext):
453         (WebKit::PlaybackSessionManager::~PlaybackSessionManager):
454         (WebKit::PlaybackSessionManager::createModelAndInterface):
455         (WebKit::PlaybackSessionManager::removeContext):
456         (WebKit::PlaybackSessionInterfaceContext::~PlaybackSessionInterfaceContext): Deleted.
457         * WebProcess/cocoa/VideoFullscreenManager.h:
458         (WebKit::VideoFullscreenInterfaceContext::create):
459         (WebKit::VideoFullscreenInterfaceContext::createWeakPtr):
460         * WebProcess/cocoa/VideoFullscreenManager.mm:
461         (WebKit::VideoFullscreenInterfaceContext::VideoFullscreenInterfaceContext):
462         (WebKit::VideoFullscreenManager::~VideoFullscreenManager):
463         (WebKit::VideoFullscreenManager::createModelAndInterface):
464         (WebKit::VideoFullscreenManager::removeContext):
465
466 2018-09-28  Chris Dumez  <cdumez@apple.com>
467
468         Drop support for cross-origin-window-policy header
469         https://bugs.webkit.org/show_bug.cgi?id=190081
470
471         Reviewed by Ryosuke Niwa.
472
473         * Shared/WebPreferences.yaml:
474         * UIProcess/API/C/WKPreferences.cpp:
475         * UIProcess/API/C/WKPreferencesRef.h:
476         * WebProcess/WebPage/WebPage.cpp:
477         (WebKit::WebPage::frameBecameRemote):
478
479 2018-09-28  Chris Dumez  <cdumez@apple.com>
480
481         Do not do automatic process prewarming while under memory pressure
482         https://bugs.webkit.org/show_bug.cgi?id=190082
483         <rdar://problem/39771424>
484
485         Reviewed by Geoffrey Garen.
486
487         Do not do automatic process prewarming while under memory pressure and
488         also terminate any prewarmed process when receiving a memory warning.
489
490         * UIProcess/WebProcessPool.cpp:
491         (WebKit::WebProcessPool::prewarmProcess):
492         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
493         (WebKit::WebProcessPool::handleMemoryPressureWarning):
494         * UIProcess/WebProcessPool.h:
495         * UIProcess/ios/WebMemoryPressureHandlerIOS.mm:
496         (WebKit::installMemoryPressureHandler):
497
498 2018-09-28  Daniel Bates  <dabates@apple.com>
499
500         [iOS] Allow programmatic focus when hardware keyboard is attached
501         https://bugs.webkit.org/show_bug.cgi?id=190017
502         <rdar://problem/42270463>
503
504         Reviewed by Wenson Hsieh.
505
506         Make the experience of using iOS with a hardware keyboard more desktop-like by allowing
507         programmatic focusing of editable elements.
508
509         * Platform/spi/ios/UIKitSPI.h: Forward declare SPI.
510         * Shared/NativeWebKeyboardEvent.h:
511         * Shared/ios/NativeWebKeyboardEventIOS.mm:
512         (WebKit::isInHardwareKeyboardMode): Returns whether we are in hardware keyboard mode. In DumpRenderTree
513         and WebKitTestRunner this function always returns false to keep test results deterministic.
514         * UIProcess/ios/WKContentViewInteraction.mm:
515         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
516         Allow starting an input session if we are in hardware keyboard mode.
517         * WebProcess/WebPage/ios/WebPageIOS.mm:
518         (WebKit::WebPage::platformEditorState const): Send the full editor state if we are in hardware
519         keyboard mode regardless of whether layout has been performed so that UIProcess can update UI,
520         including the position of the caret, immediately.
521
522 2018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
523
524         Rename createMarkup to serializePreservingVisualAppearance
525         https://bugs.webkit.org/show_bug.cgi?id=190086
526
527         Reviewed by Wenson Hsieh.
528
529         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
530         (WebKit::WebEditorClient::updateGlobalSelection):
531
532 2018-09-28  Commit Queue  <commit-queue@webkit.org>
533
534         Unreviewed, rolling out r236605.
535         https://bugs.webkit.org/show_bug.cgi?id=190087
536
537         caused three API test timeouts (Requested by jernoble on
538         #webkit).
539
540         Reverted changeset:
541
542         "Refactoring: eliminate raw pointer usage in Fullscreen code"
543         https://bugs.webkit.org/show_bug.cgi?id=188747
544         https://trac.webkit.org/changeset/236605
545
546 2018-09-28  Jer Noble  <jer.noble@apple.com>
547
548         Refactoring: eliminate raw pointer usage in Fullscreen code
549         https://bugs.webkit.org/show_bug.cgi?id=188747
550         <rdar://problem/43541164>
551
552         Reviewed by Alex Christensen.
553
554         Adopt those Ref and WeakPtr changes made in WebCore.
555
556         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
557         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
558         (WebKit::PlaybackSessionModelContext::addClient):
559         (WebKit::PlaybackSessionModelContext::removeClient):
560         (WebKit::PlaybackSessionModelContext::durationChanged):
561         (WebKit::PlaybackSessionModelContext::currentTimeChanged):
562         (WebKit::PlaybackSessionModelContext::bufferedTimeChanged):
563         (WebKit::PlaybackSessionModelContext::rateChanged):
564         (WebKit::PlaybackSessionModelContext::seekableRangesChanged):
565         (WebKit::PlaybackSessionModelContext::canPlayFastReverseChanged):
566         (WebKit::PlaybackSessionModelContext::audioMediaSelectionOptionsChanged):
567         (WebKit::PlaybackSessionModelContext::legibleMediaSelectionOptionsChanged):
568         (WebKit::PlaybackSessionModelContext::audioMediaSelectionIndexChanged):
569         (WebKit::PlaybackSessionModelContext::legibleMediaSelectionIndexChanged):
570         (WebKit::PlaybackSessionModelContext::externalPlaybackChanged):
571         (WebKit::PlaybackSessionModelContext::wirelessVideoPlaybackDisabledChanged):
572         (WebKit::PlaybackSessionModelContext::mutedChanged):
573         (WebKit::PlaybackSessionModelContext::volumeChanged):
574         (WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged):
575         (WebKit::PlaybackSessionManagerProxy::invalidate):
576         (WebKit::PlaybackSessionManagerProxy::createModelAndInterface):
577         (WebKit::PlaybackSessionManagerProxy::removeClientForContext):
578         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
579         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
580         (WebKit::VideoFullscreenModelContext::create):
581         (WebKit::VideoFullscreenModelContext::VideoFullscreenModelContext):
582         (WebKit::VideoFullscreenModelContext::addClient):
583         (WebKit::VideoFullscreenModelContext::removeClient):
584         (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture):
585         (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture):
586         (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture):
587         (WebKit::VideoFullscreenModelContext::willExitPictureInPicture):
588         (WebKit::VideoFullscreenModelContext::didExitPictureInPicture):
589         (WebKit::VideoFullscreenManagerProxy::invalidate):
590         (WebKit::VideoFullscreenManagerProxy::createModelAndInterface):
591         (WebKit::VideoFullscreenManagerProxy::removeClientForContext):
592         (WebKit::VideoFullscreenModelContext::~VideoFullscreenModelContext): Deleted.
593         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
594         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
595         (WKFullScreenViewControllerVideoFullscreenModelClient::setInterface):
596         (-[WKFullScreenViewController videoControlsManagerDidChange]):
597         (-[WKFullScreenViewController _togglePiPAction:]):
598         * UIProcess/mac/WKFullScreenWindowController.mm:
599         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface):
600         * WebProcess/cocoa/PlaybackSessionManager.h:
601         * WebProcess/cocoa/PlaybackSessionManager.mm:
602         (WebKit::PlaybackSessionInterfaceContext::PlaybackSessionInterfaceContext):
603         (WebKit::PlaybackSessionManager::~PlaybackSessionManager):
604         (WebKit::PlaybackSessionManager::createModelAndInterface):
605         (WebKit::PlaybackSessionManager::removeContext):
606         (WebKit::PlaybackSessionInterfaceContext::~PlaybackSessionInterfaceContext): Deleted.
607         * WebProcess/cocoa/VideoFullscreenManager.h:
608         (WebKit::VideoFullscreenInterfaceContext::create):
609         (WebKit::VideoFullscreenInterfaceContext::createWeakPtr):
610         * WebProcess/cocoa/VideoFullscreenManager.mm:
611         (WebKit::VideoFullscreenInterfaceContext::VideoFullscreenInterfaceContext):
612         (WebKit::VideoFullscreenManager::~VideoFullscreenManager):
613         (WebKit::VideoFullscreenManager::createModelAndInterface):
614         (WebKit::VideoFullscreenManager::removeContext):
615
616 2018-09-28  Fujii Hironori  <Hironori.Fujii@sony.com>
617
618         [WinCairo] error C2027: use of undefined type 'WTF::EnumTraits<E>' while compiling AuthenticationChallengeProxy.cpp
619         https://bugs.webkit.org/show_bug.cgi?id=190071
620
621         Unreviewed build fix for WinCairo port.
622
623         AuthenticationChallengeDisposition was not defined in this file.
624
625         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: Include "AuthenticationChallengeDisposition.h".
626
627 2018-09-26  Ryosuke Niwa  <rniwa@webkit.org>
628
629         Use enum class in createMarkup arguments
630         https://bugs.webkit.org/show_bug.cgi?id=190028
631
632         Reviewed by Wenson Hsieh.
633
634         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
635         (WebKit::WebEditorClient::updateGlobalSelection):
636
637 2018-09-27  John Wilander  <wilander@apple.com>
638
639         Resource Load Statistics: Non-redirected top frame navigation should not get captured in statistics
640         https://bugs.webkit.org/show_bug.cgi?id=190055
641         <rdar://problem/44843460>
642
643         Reviewed by Chris Dumez.
644
645         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
646             Bumped the statisticsModelVersion to 14 to be able to
647             correct legacy statistics.
648         (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
649             Now skips capture if it's the main frame.
650
651 2018-09-27  Brent Fulgham  <bfulgham@apple.com>
652
653         [iOS] Allow access to VoiceServices features needed for accessibility
654         https://bugs.webkit.org/show_bug.cgi?id=190019
655         <rdar://problem/43621111>
656
657         Reviewed by Chris Fleizach.
658
659         Revise the sandbox to allow access to relevant WebSpeech features.
660
661         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
662
663 2018-09-27  Sihui Liu  <sihui_liu@apple.com>
664
665         Fix IOSMAC build
666         https://bugs.webkit.org/show_bug.cgi?id=190021
667
668         Reviewed by Alex Christensen.
669
670         * NetworkProcess/mac/NetworkProcessMac.mm:
671         (WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const):
672
673 2018-09-27  John Wilander  <wilander@apple.com>
674
675         Resource Load Statistics: Remove temporary compatibility fix for auto-dismiss popups
676         https://bugs.webkit.org/show_bug.cgi?id=189980
677         <rdar://problem/44780645>
678
679         Reviewed by Alex Christensen.
680
681         The change in https://bugs.webkit.org/show_bug.cgi?id=183620 was a temporary
682         compatibility fix as explained in:
683         https://webkit.org/blog/8311/intelligent-tracking-prevention-2-0/. We should
684         remove it.
685
686         These changes remove the parameter isTriggeredByUserGesture since it's no longer needed.
687
688         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
689         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
690         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
691         * UIProcess/WebResourceLoadStatisticsStore.cpp:
692         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
693         * UIProcess/WebResourceLoadStatisticsStore.h:
694         * UIProcess/WebResourceLoadStatisticsStore.messages.in:
695         * WebProcess/WebProcess.cpp:
696         (WebKit::WebProcess::WebProcess):
697
698 2018-09-27  Ryan Haddad  <ryanhaddad@apple.com>
699
700         Unreviewed, rolling out r236557.
701
702         Really roll out r236557 this time because it breaks internal
703         builds.
704
705         Reverted changeset:
706
707         "Add VP8 support to WebRTC"
708         https://bugs.webkit.org/show_bug.cgi?id=189976
709         https://trac.webkit.org/changeset/236557
710
711 2018-09-27  Youenn Fablet  <youenn@apple.com>
712
713         Add VP8 support to WebRTC
714         https://bugs.webkit.org/show_bug.cgi?id=189976
715
716         Reviewed by Eric Carlson.
717
718         * Shared/WebPreferences.yaml:
719
720 2018-09-27  Chris Dumez  <cdumez@apple.com>
721
722         The WebContent process should not process incoming IPC while waiting for a sync IPC reply
723         https://bugs.webkit.org/show_bug.cgi?id=184183
724         <rdar://problem/36800576>
725
726         Reviewed by Ryosuke Niwa.
727
728         In recent years, we have experienced re-entrancy bugs/crashes in WebCore due to the WebContent process
729         processing unrelated incoming synchronous IPC when waiting for a reply to one of its synchronous IPC
730         to another process. In order to deal with this, we introduced a DoNotProcessIncomingMessagesWhenWaitingForSyncReply
731         IPC::SendOption which we used on sendSync() calls where we knew re-entering would be unsafe. However,
732         it turns out to be needed for a lot of the WebProcess's sync IPC and it is error-prone. In order to
733         address the issue, we've decided to update the WebContent process behavior so that it processes all its
734         IPC in order (not matter if synchronous or not) and thus so that we never dispatch unrelated synchronous
735         IPC while waiting for a synchronous IPC reply, expect in cases where it would cause a deadlock.
736
737         As a result, this patch also drops support for the DoNotProcessIncomingMessagesWhenWaitingForSyncReply
738         IPC::SendOption which is no longer needed and has some code complexity.
739
740         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
741         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
742         * Platform/IPC/Connection.cpp:
743         (IPC::Connection::sendSyncMessage):
744         (IPC::Connection::waitForSyncReply):
745         * Platform/IPC/Connection.h:
746         (IPC::Connection::sendSync):
747         * PluginProcess/WebProcessConnection.cpp:
748         (WebKit::WebProcessConnection::WebProcessConnection):
749         * StorageProcess/StorageToWebProcessConnection.cpp:
750         (WebKit::StorageToWebProcessConnection::StorageToWebProcessConnection):
751         * UIProcess/WebProcessProxy.cpp:
752         (WebKit::WebProcessProxy::connectionWillOpen):
753         * UIProcess/WebProcessProxy.h:
754         * UIProcess/WebProcessProxy.messages.in:
755         * WebProcess/InjectedBundle/InjectedBundle.cpp:
756         (WebKit::InjectedBundle::postSynchronousMessage):
757         * WebProcess/Network/WebLoaderStrategy.cpp:
758         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
759         (WebKit::WebLoaderStrategy::responseFromResourceLoadIdentifier):
760         (WebKit::WebLoaderStrategy::intermediateLoadInformationFromResourceLoadIdentifier):
761         (WebKit::WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier):
762         * WebProcess/Plugins/PluginProxy.cpp:
763         (WebKit::PluginProxy::destroy):
764         (WebKit::PluginProxy::supportsSnapshotting const):
765         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
766         (WebKit::WebPluginInfoProvider::populatePluginCache):
767         * WebProcess/Storage/WebSWClientConnection.cpp:
768         (WebKit::WebSWClientConnection::WebSWClientConnection):
769         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
770         * WebProcess/WebCoreSupport/WebChromeClient.h:
771         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
772         (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame):
773         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
774         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
775         * WebProcess/WebPage/WebPage.cpp:
776         (WebKit::WebPage::rootViewToScreen):
777         * WebProcess/WebProcess.cpp:
778         (WebKit::getNetworkProcessConnection):
779         * WebProcess/WebProcess.h:
780         * WebProcess/WebProcess.messages.in:
781
782 2018-09-27  Antoine Quint  <graouts@apple.com>
783
784         [Web Animations] Turn Web Animations with CSS integration on
785         https://bugs.webkit.org/show_bug.cgi?id=184819
786         <rdar://problem/39597337>
787
788         Reviewed by Dean Jackson.
789
790         * Shared/WebPreferences.yaml:
791
792 2018-09-26  James Savage  <james.savage@apple.com>
793
794         Allow override of viewport configuration.
795         https://bugs.webkit.org/show_bug.cgi?id=188772.
796         <rdar://problem/43538892>.
797
798         Reviewed by Simon Fraser.
799
800         * Shared/WebPreferences.yaml:
801         * UIProcess/API/Cocoa/WKPreferences.mm:
802         (-[WKPreferences _setShouldIgnoreMetaViewport:]):
803         (-[WKPreferences _shouldIgnoreMetaViewport]):
804         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
805         * WebProcess/WebPage/WebPage.cpp:
806         (WebKit::WebPage::viewportPropertiesDidChange): If we are ignoring the
807         <meta> viewport, short circuit calling setViewportArguments() and do not
808         do any updates.
809         (WebKit::WebPage::didCommitLoad): Ditto.
810         * WebProcess/WebPage/ios/WebPageIOS.mm:
811         (WebKit::WebPage::resetViewportDefaultConfiguration): Select the default
812         configuration based on UIProcess setting.
813
814 2018-09-26  Chris Dumez  <cdumez@apple.com>
815
816         Regression(r236512): WKWebViewCandidateTests.SoftSpaceReplacementAfterCandidateInsertionWithoutReplacement API test is failing
817         https://bugs.webkit.org/show_bug.cgi?id=190007
818
819         Reviewed by Alex Christensen.
820
821         Drop DispatchMessageEvenWhenWaitingForSyncReply SendOption from EditorStateChanged IPC calls to restore
822         pre-r236512 behavior. Before r236512, this option had no effect on IPC from the WebContent to the UIProcess
823         because the m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage flag was set
824         on that IPC::Connection. However, after r236512, m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage
825         is no longer set on the connection, and the DispatchMessageEvenWhenWaitingForSyncReply SendOption was
826         causing this message to get processed out of order with regards to other async IPC, thus causing the
827         API test failure.
828
829         * WebProcess/WebPage/WebPage.cpp:
830         (WebKit::WebPage::sendEditorStateUpdate):
831         (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate):
832
833 2018-09-26  Alex Christensen  <achristensen@webkit.org>
834
835         Fix UAF after r236463
836         https://bugs.webkit.org/show_bug.cgi?id=190011
837
838         Reviewed by Chris Dumez.
839
840         I had removed an early return in NetworkResourceLoader::continueDidReceiveResponse.
841         Reading the (probably) null m_responseCompletionHandler was reading after the object had been destroyed.
842
843         * NetworkProcess/NetworkResourceLoader.cpp:
844         (WebKit::NetworkResourceLoader::continueDidReceiveResponse):
845
846 2018-09-26  Ryosuke Niwa  <rniwa@webkit.org>
847
848         Selection should work across shadow boundary when initiated by a mouse drag
849         https://bugs.webkit.org/show_bug.cgi?id=151380
850         <rdar://problem/24363872>
851
852         Reviewed by Antti Koivisto.
853
854         Added SelectionAcrossShadowBoundariesEnabled as an internal debug feature,
855         and moved CSSCustomPropertiesAndValuesEnabled to where other experimental features are located.
856
857         * Shared/WebPreferences.yaml:
858
859 2018-09-26  Chris Dumez  <cdumez@apple.com>
860
861         Unreviewed, apply post-landing review comments after r236512.
862
863         * UIProcess/WebPageProxy.cpp:
864         (WebKit::WebPageProxy::didCreateMainFrame):
865         (WebKit::WebPageProxy::didCreateSubframe):
866
867 2018-09-26  Chris Dumez  <cdumez@apple.com>
868
869         UIProcess should process incoming sync IPC from WebProcess when waiting for a sync IPC reply from it
870         https://bugs.webkit.org/show_bug.cgi?id=189927
871
872         Reviewed by Geoffrey Garen.
873
874         UIProcess should process incoming sync IPC from WebProcess when waiting for a sync IPC reply from it
875         in order to avoid deadlocks. This is not an issue currently because the WebProcess does process
876         incoming sync IPC when waiting for a sync IPC reply. However, we plan to change this in the future
877         in order to avoid bugs caused by re-entering WebCore at unsafe times.
878
879         The reason the UIProcess previously did not do out of order sync IPC process was to avoid processing
880         a synchronous policy decision IPC for a frameID it did not know about yet, due to the DidCreateMainFrame /
881         DidCreateSubframe IPC messages being asynchronous. To address this issue, the decidePolicyForNavigationActionSync
882         IPC handler now calls didCreateMainFrame() / didCreateSubframe() as needed if it does not know about
883         the frame yet. Note that synchronous policy decisions are rare and are currently only needed by initial
884         about:blank and fragment navigations.
885
886         * UIProcess/WebPageProxy.cpp:
887         (WebKit::WebPageProxy::didCreateMainFrame):
888         (WebKit::WebPageProxy::didCreateSubframe):
889         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
890         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
891         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
892         * UIProcess/WebPageProxy.h:
893         * UIProcess/WebPageProxy.messages.in:
894         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
895         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
896
897         * WebProcess/WebPage/WebFrame.cpp:
898         (WebKit::WebFrame::createWithCoreMainFrame):
899         (WebKit::WebFrame::createSubframe):
900         Drop DispatchMessageEvenWhenWaitingForSyncReply SendOption when sending the
901         DidCreateMainFrame / DidCreateSubframe IPC. Previously, this SendOption has
902         no effect because the IPC::Connection would have the
903         m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage
904         flag set to true. However, now that we stop setting this flag on the IPC
905         connection from the WebProcess to the UIProcess, it would lead to those
906         IPC messages getting processed out of order with regards to the
907         DecidePolicyForNavigationAsync asynchronous IPC. DidCreateMainFrame would
908         sometimes get processed *after* the DecidePolicyForNavigationAsync IPC
909         and we would not know about the frameID yet.
910
911         * WebProcess/WebProcess.cpp:
912         (WebKit::WebProcess::initializeConnection):
913
914 2018-09-26  Antti Koivisto  <antti@apple.com>
915
916         REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on iOS
917         https://bugs.webkit.org/show_bug.cgi?id=189695
918         <rdar://problem/44551146>
919
920         Reviewed by Simon Fraser.
921
922         Freeze the layers on UI process side during process swap.
923
924         * UIProcess/API/Cocoa/WKWebView.mm:
925         (-[WKWebView _processWillChange]):
926
927         Shared work of _processWillSwap and _processDidExit.
928
929         (-[WKWebView _processWillSwap]):
930         (-[WKWebView _processDidExit]):
931
932         Split into two functions. Don't reset scroll position and similar when doing navigation swap.
933
934         * UIProcess/API/Cocoa/WKWebViewInternal.h:
935         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
936         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
937         (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
938         (WebKit::RemoteLayerTreeDrawingAreaProxy::detachRemoteLayerTreeHost):
939
940         Add to way to detach RemoteLayerTreeHost from the drawing area. Inert RemoteLayerTreeHost will host
941         the frozen layers.
942
943         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
944         (WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator):
945         (WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilPendingUpdate):
946         (WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilAnyUpdate):
947         (WebKit::RemoteLayerTreeDrawingAreaProxy::prepareForAppSuspension):
948         (WebKit::RemoteLayerTreeDrawingAreaProxy::hasVisibleContent const):
949         (WebKit::RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting const):
950         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
951         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
952         (WebKit::RemoteLayerTreeHost::RemoteLayerTreeHost):
953         (WebKit::RemoteLayerTreeHost::updateLayerTree):
954         (WebKit::RemoteLayerTreeHost::animationDidStart):
955         (WebKit::RemoteLayerTreeHost::animationDidEnd):
956         (WebKit::RemoteLayerTreeHost::detachFromDrawingArea):
957
958         Clear the DrawingArea backpointer.
959
960         * UIProcess/WebPageProxy.cpp:
961         (WebKit::WebPageProxy::continueNavigationInNewProcess):
962         (WebKit::WebPageProxy::resetState):
963
964         Detach and save the current RemoteLayerTreeHost on navigation swap.
965
966         * UIProcess/WebPageProxy.h:
967         * UIProcess/ios/PageClientImplIOS.mm:
968         (WebKit::PageClientImpl::processWillSwap):
969
970         Avoid reseting the scroll position.
971
972         * UIProcess/ios/WebPageProxyIOS.mm:
973         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
974
975         Drop the frozen layers after setting the new root layer.
976
977         * UIProcess/mac/WebPageProxyMac.mm:
978         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
979
980         For completeness do this also on Mac (where remote layers are currently not used).
981
982 2018-09-25  Ryosuke Niwa  <rniwa@webkit.org>
983
984         Make frame flattening an internal debug feature
985         https://bugs.webkit.org/show_bug.cgi?id=189984
986
987         Reviewed by Simon Fraser.
988
989         Made frame flattening a runtime switchable from internal debug menu.
990
991         To avoid having to enumerate three distinct values in the settings, made it a boolean flag in WKPreference.
992         That's what's exposd as an API anyway.
993
994         * Shared/WebPreferences.yaml:
995         * Shared/WebPreferencesDefaultValues.h:
996         * UIProcess/API/C/WKPreferences.cpp:
997         (WKPreferencesSetFrameFlatteningEnabled):
998         (WKPreferencesGetFrameFlatteningEnabled):
999         * UIProcess/API/glib/WebKitSettings.cpp:
1000         (webkit_settings_get_enable_frame_flattening):
1001         (webkit_settings_set_enable_frame_flattening):
1002         * WebProcess/WebPage/WebPage.cpp:
1003         (WebKit::WebPage::updatePreferences):
1004
1005 2018-09-25  Eric Carlson  <eric.carlson@apple.com>
1006
1007         [MediaStream] Add Mac window capture source
1008         https://bugs.webkit.org/show_bug.cgi?id=189958
1009         <rdar://problem/44767616>
1010
1011         Reviewed by Youenn Fablet.
1012
1013         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1014         * UIProcess/WebPageProxy.cpp:
1015         (WebKit::WebPageProxy::beginMonitoringCaptureDevices): Sync with webcore prefs before listening
1016         to device changes so we listen on the correct devices.
1017
1018 2018-09-25  Chris Dumez  <cdumez@apple.com>
1019
1020         Unreviewed, rolling out r236471 and r236480.
1021
1022         Seems to be causing some flaky crashes
1023
1024         Reverted changesets:
1025
1026         "UIProcess should process incoming sync IPC from WebProcess
1027         when waiting for a sync IPC reply from it"
1028         https://bugs.webkit.org/show_bug.cgi?id=189927
1029         https://trac.webkit.org/changeset/236471
1030
1031         "Revert some of the changes in r236471"
1032         https://bugs.webkit.org/show_bug.cgi?id=189973
1033         https://trac.webkit.org/changeset/236480
1034
1035 2018-09-25  Conrad Shultz  <conrad_shultz@apple.com>
1036
1037         Enable customization of the file upload panel
1038         https://bugs.webkit.org/show_bug.cgi?id=189970
1039
1040         Reviewed by Wenson Hsieh.
1041
1042         With this change, platform implementations can override, or implement in a category,
1043         +[WKContentView _fileUploadPanelClass] as needed.
1044
1045         * UIProcess/ios/WKContentViewInteraction.h:
1046         * UIProcess/ios/WKContentViewInteraction.mm:
1047         (-[WKContentView _showRunOpenPanel:resultListener:]):
1048
1049 2018-09-25  Chris Dumez  <cdumez@apple.com>
1050
1051         Unreviewed, rolling out r236420 and r236458.
1052
1053         This change is not fully correct
1054
1055         Reverted changesets:
1056
1057         "Do not do early processing of incoming sync IPC unless we're
1058         waiting for a sync IPC reply"
1059         https://bugs.webkit.org/show_bug.cgi?id=186941
1060         https://trac.webkit.org/changeset/236420
1061
1062         "Unreviewed, update bug number of http/tests/misc/blob-
1063         size.html crash on Windows"
1064         https://trac.webkit.org/changeset/236458
1065
1066 2018-09-25  Jiewen Tan  <jiewen_tan@apple.com>
1067
1068         Unreviewed, a quick fix after r236481.
1069
1070         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1071         (WebKit::WebsiteDataStore::setMockWebAuthenticationConfiguration):
1072         Add an early return, so we don't end up with setting MockWebAuthenticationConfiguration twice.
1073
1074 2018-09-25  John Wilander  <wilander@apple.com>
1075
1076         Change from HAVE(CFNETWORK_STORAGE_PARTITIONING) to ENABLE(RESOURCE_LOAD_STATISTICS)
1077         https://bugs.webkit.org/show_bug.cgi?id=189959
1078         <rdar://problem/44767642>
1079
1080         Reviewed by Chris Dumez.
1081
1082         We no longer make use of CFNetwork's cookie partitioning so we should
1083         change the compile-time flag to something that makes sense. This should
1084         also make it easier/cleaner for other ports.
1085
1086         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1087         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
1088         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
1089         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
1090         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage):
1091         * NetworkProcess/NetworkProcess.cpp:
1092         (WebKit::NetworkProcess::initializeNetworkProcess):
1093         * NetworkProcess/NetworkProcess.h:
1094         * NetworkProcess/NetworkProcess.messages.in:
1095         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1096         (WebKit::NetworkProcessCreationParameters::encode const):
1097         (WebKit::NetworkProcessCreationParameters::decode):
1098         * NetworkProcess/NetworkProcessCreationParameters.h:
1099         * NetworkProcess/NetworkResourceLoader.cpp:
1100         (WebKit::NetworkResourceLoader::didFinishLoading):
1101         (WebKit::NetworkResourceLoader::sendResultForCacheEntry):
1102         * NetworkProcess/NetworkResourceLoader.h:
1103         * NetworkProcess/cache/NetworkCache.cpp:
1104         (WebKit::NetworkCache::Cache::retrieve):
1105         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1106         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1107         (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy):
1108         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1109         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
1110         * Shared/WebProcessCreationParameters.cpp:
1111         (WebKit::WebProcessCreationParameters::encode const):
1112         (WebKit::WebProcessCreationParameters::decode):
1113         * Shared/WebProcessCreationParameters.h:
1114         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1115         (WebKit::WebProcessPool::platformInitializeWebProcess):
1116         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1117         * UIProcess/Network/NetworkProcessProxy.cpp:
1118         * UIProcess/Network/NetworkProcessProxy.h:
1119         * UIProcess/Network/NetworkProcessProxy.messages.in:
1120         * UIProcess/WebPageProxy.cpp:
1121         * UIProcess/WebPageProxy.h:
1122         * UIProcess/WebPageProxy.messages.in:
1123         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1124         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
1125         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
1126         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
1127         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
1128         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
1129         (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler):
1130         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1131         (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
1132         (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources):
1133         (WebKit::WebsiteDataStore::networkProcessDidCrash):
1134         * UIProcess/WebsiteData/WebsiteDataStore.h:
1135         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1136         * WebProcess/WebCoreSupport/WebChromeClient.h:
1137         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1138         (WebKit::WebFrameLoaderClient::detachedFromParent2):
1139         (WebKit::WebFrameLoaderClient::dispatchWillChangeDocument):
1140         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1141         * WebProcess/WebPage/WebPage.cpp:
1142         * WebProcess/WebPage/WebPage.h:
1143         * WebProcess/WebPage/WebPage.messages.in:
1144         * WebProcess/WebProcess.cpp:
1145         (WebKit::WebProcess::initializeWebProcess):
1146
1147 2018-09-25  Philippe Normand  <pnormand@igalia.com>
1148
1149         [WPE] Export jsc_ symbols
1150         https://bugs.webkit.org/show_bug.cgi?id=189964
1151
1152         Reviewed by Michael Catanzaro.
1153
1154         * webkitglib-symbols.map: Keep jsc_* symbols as visible so they
1155         can be used by applications depending on WPE.
1156
1157 2018-09-25  Jiewen Tan  <jiewen_tan@apple.com>
1158
1159         [WebAuthN] Make AuthenticatorManager
1160         https://bugs.webkit.org/show_bug.cgi?id=189279
1161         <rdar://problem/44116792>
1162
1163         Reviewed by Chris Dumez.
1164
1165         This patch introduces AuthenticatorManager which is the central of WebAuthentication that 1) handles
1166         web requests, 2) discovers authenticators, 3) manages authetnicators and 4) in the future interacts with UI.
1167         The lifetime of the AuthenticatorManager is managed by WebsiteDataStore such that it is almost a singleton
1168         per UI Process.
1169
1170         1) Requests come from WebAuthenticatorCoordinatorProxy and then cached in AuthenticatorManager which will
1171         then distribute requests whenever a new authenticator is discovered.
1172
1173         2) An ABC AuthenticatorTransportService is provided as an interface for AuthenticatorManager to invoke
1174         startDiscovery. Actual work will be done in corresponding derived classes, say, LocalService. LocalService
1175         is the one that discover attached platform authenticators, for example, TouchID or FaceID.
1176
1177         Eache service is unique per AuthetnicatorManager, which means we will have at most 4 services, Local, USB,
1178         NFC, and BLE. The latter three will be implemented soon. Also, AuthenticatorManager serves as an observer to
1179         *Service, so the latter can inform the former whenever an authenticator is added or removed.
1180
1181         When a new authenticator is discovered, the corresponding service will create an Authetnicator object that
1182         binds to the physical authenticator device through a *Connection object. There is no ABC for connection for
1183         now as I forsee every *Connection will be quite different. The *Connection object is the one that send/receive
1184         messages from the physicla device. So far, a LocalConnection is provided even though normally local authenticators
1185         are attached. This class is provided solely for separating UI and network traffic from LocalAuthenticator's
1186         request handling process. So we can override them in a mock test environment. I will talk about this in the
1187         next section.
1188
1189         3) An ABC Authenticator is provided as an interface for AuthenticatorManager to distribute requests on. Requests
1190         will then be handled by the derived classes, say, LocalAuthenticator. Each authenticator object is a FSM that
1191         works asynchronously.
1192
1193         For LocalAuthenticator, it has 4 states for MakeCredential: Init => RequestReceived => UserConsented => Attested => End,
1194         and 3 states for GetAssertion: Init => RequestReceived => UserConsented => End. In the transit from RequestReceived to
1195         UserConsented, it will invoke LocalConnection to talk to LocalAuthentication.framework that prompt users for TouchID
1196         or FaceID. And then the transit from UserConsented => Attested, it will invoke LocalConnection to talk to
1197         DeviceIdentity.framework that does Apple attestation. Most of the work are from the original LocalAuthenticator
1198         implementation, and this patch converts it to a FSM and simplify the callback and threading model.
1199
1200         When a respond is ready, each authenticator will notify their observer which is the AuthenticatorManager.
1201         AuthenticatorManager will only reply to Web Process whenever there is a valid respond or a terminating error. Otherwise,
1202         the request will time out. I will explore the time out mechanism in a more detailed manner in Bug 189642.
1203
1204         The above is a briefing of the AuthetnicatorManager architecture in functional. The asynchronous model is explained here:
1205         1) Since most discovery and request handling processes are asynchronous, I enforced them to be executed asyncrhonous in
1206         the interface of the ABC.
1207         2) There is no dedicated secondary threads here. However, underlying framework might decide to perform works on a dedicated
1208         thread and then execute the provided callback. Whenever such situation happens, the policy here is to wrap the actual callback
1209         into a callback that will post the actual callback back to the main thread and pass the wrapping callback to the APIs. Hence,
1210         weak pointers in the actual callback are guaranteed to work.
1211         3) Callbacks are used only if it is one way, and they are CompletionHandlers.
1212         4) Potential multi ways asynchronous operations are encapsulated in regarding Observer interfaces.
1213
1214         Finally, let me explain how the mock test works:
1215         1) Mock testing is done in WebKitTestRunner instead of Internals because a considerable large portion of work is in UIProcess
1216         instead of WebProcess, says, the AuthenticatorManager.
1217         2) The basic idea is to override functionality of *Connection classes and then make them thin such that we can get the best
1218         possible coverage in auto tests.
1219         3) In order to enable layout tests to configure the Mock*Connection classes, a MockWebAuthenticationConfiguration struct is
1220         provided. A corresponding JS dictionary will be created by each test and passed from the TestRunner to the connection object.
1221         4) To bridge the above tunnel, a MockAuthenticatorManager is constructed. It is instrumented to return every error.
1222         5) Also, Mock*Service classes are made to mock the discovery process as well.
1223         6) Noted, every mock overrided methods are made thin.
1224
1225         * CMakeLists.txt:
1226         * Configurations/WebKit.xcconfig:
1227         * Platform/spi/Cocoa/DeviceIdentitySPI.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
1228         * SourcesCocoa.txt:
1229         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1230         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
1231         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1232         * UIProcess/WebAuthentication/Authenticator.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1233         (WebKit::Authenticator::handleRequest):
1234         (WebKit::Authenticator::receiveRespond const):
1235         * UIProcess/WebAuthentication/Authenticator.h: Renamed from Source/WebCore/Modules/webauthn/cocoa/LocalAuthenticator.h.
1236         (WebKit::Authenticator::setObserver):
1237         (WebKit::Authenticator::observer const):
1238         (WebKit::Authenticator::requestData const):
1239         * UIProcess/WebAuthentication/AuthenticatorManager.cpp: Added.
1240         (WebKit::AuthenticatorManagerInternal::collectTransports):
1241         (WebKit::AuthenticatorManager::makeCredential):
1242         (WebKit::AuthenticatorManager::getAssertion):
1243         (WebKit::AuthenticatorManager::clearState):
1244         (WebKit::AuthenticatorManager::authenticatorAdded):
1245         (WebKit::AuthenticatorManager::respondReceived):
1246         (WebKit::AuthenticatorManager::createService const):
1247         (WebKit::AuthenticatorManager::respondReceivedInternal):
1248         (WebKit::AuthenticatorManager::startDiscovery):
1249         * UIProcess/WebAuthentication/AuthenticatorManager.h: Added.
1250         (WebKit::AuthenticatorManager::pendingCompletionHandler):
1251         * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
1252         (WebKit::AuthenticatorTransportService::create):
1253         (WebKit::AuthenticatorTransportService::createMock):
1254         (WebKit::AuthenticatorTransportService::AuthenticatorTransportService):
1255         (WebKit::AuthenticatorTransportService::startDiscovery const):
1256         * UIProcess/WebAuthentication/AuthenticatorTransportService.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
1257         (WebKit::AuthenticatorTransportService::observer const):
1258         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1259         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
1260         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: Added.
1261         (WebKit::LocalAuthenticatorInternal::buildAuthData):
1262         (WebKit::LocalAuthenticatorInternal::transportsContain):
1263         (WebKit::LocalAuthenticatorInternal::produceHashSet):
1264         (WebKit::LocalAuthenticatorInternal::toVector):
1265         (WebKit::LocalAuthenticator::LocalAuthenticator):
1266         (WebKit::LocalAuthenticator::makeCredential):
1267         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented):
1268         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
1269         (WebKit::LocalAuthenticator::getAssertion):
1270         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
1271         * UIProcess/WebAuthentication/Cocoa/LocalConnection.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
1272         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: Added.
1273         (WebKit::LocalConnection::getUserConsent const):
1274         (WebKit::LocalConnection::getAttestation const):
1275         * UIProcess/WebAuthentication/Cocoa/LocalService.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1276         * UIProcess/WebAuthentication/Cocoa/LocalService.mm: Renamed from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
1277         (WebKit::LocalService::LocalService):
1278         (WebKit::LocalService::isAvailable):
1279         (WebKit::LocalService::startDiscoveryInternal const):
1280         (WebKit::LocalService::platformStartDiscovery const):
1281         (WebKit::LocalService::createLocalConnection const):
1282         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1283         (WebKit::MockAuthenticatorManager::MockAuthenticatorManager):
1284         (WebKit::MockAuthenticatorManager::createService const):
1285         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
1286         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1287         * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1288         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: Added.
1289         (WebKit::MockLocalConnection::MockLocalConnection):
1290         (WebKit::MockLocalConnection::getUserConsent const):
1291         (WebKit::MockLocalConnection::getAttestation const):
1292         * UIProcess/WebAuthentication/Mock/MockLocalService.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1293         (WebKit::MockLocalService::MockLocalService):
1294         (WebKit::MockLocalService::platformStartDiscovery const):
1295         (WebKit::MockLocalService::createLocalConnection const):
1296         * UIProcess/WebAuthentication/Mock/MockLocalService.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1297         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1298         * UIProcess/WebAuthentication/WebAuthenticationRequestData.h: Renamed from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1299         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
1300         (WebKit::WebAuthenticatorCoordinatorProxy::WebAuthenticatorCoordinatorProxy):
1301         (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
1302         (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
1303         (WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable):
1304         (WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailableReply): Deleted.
1305         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
1306         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1307         (WebKit::WebsiteDataStore::WebsiteDataStore):
1308         (WebKit::WebsiteDataStore::setMockWebAuthenticationConfiguration):
1309         * UIProcess/WebsiteData/WebsiteDataStore.h:
1310         (WebKit::WebsiteDataStore::authenticatorManager):
1311         * WebKit.xcodeproj/project.pbxproj:
1312
1313 2018-09-25  Chris Dumez  <cdumez@apple.com>
1314
1315         Revert some of the changes in r236471
1316         https://bugs.webkit.org/show_bug.cgi?id=189973
1317
1318         Reviewed by Alex Christensen.
1319
1320         Revert some of the changes in r236471 as they should not be needed. In particular,
1321         it should not be possible for the DecidePolicyForNavigationActionSync IPC to get
1322         processed *before* the DidCreateMainFrame / DidCreateSubframe ones because those
1323         use IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply. They are thus
1324         processed early when necessary, the same way as synchronous IPC messages.
1325
1326         * UIProcess/WebPageProxy.cpp:
1327         (WebKit::WebPageProxy::didCreateMainFrame):
1328         (WebKit::WebPageProxy::didCreateSubframe):
1329         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
1330         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1331         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
1332         * UIProcess/WebPageProxy.h:
1333         * UIProcess/WebPageProxy.messages.in:
1334         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1335         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1336         * WebProcess/WebPage/WebFrame.cpp:
1337         (WebKit::WebFrame::createWithCoreMainFrame):
1338         (WebKit::WebFrame::createSubframe):
1339
1340 2018-09-25  Sihui Liu  <sihui_liu@apple.com>
1341
1342         Move Service Worker Management from Storage Process to Network Process
1343         https://bugs.webkit.org/show_bug.cgi?id=189422
1344
1345         Reviewed by Youenn Fablet.
1346
1347         After r236035, this is another piece to move functionality of storage process to network process. When 
1348         we enable Service Workers, network process instead of storage process will be launched. 
1349         This patch will not change the behavior of Service Worker.
1350
1351         * CMakeLists.txt:
1352         * DerivedSources.make:
1353         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1354         (WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess):
1355         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1356         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage):
1357         (WebKit::NetworkConnectionToWebProcess::didClose):
1358         (WebKit::NetworkConnectionToWebProcess::unregisterSWConnections):
1359         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
1360         * NetworkProcess/NetworkConnectionToWebProcess.h:
1361         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1362         * NetworkProcess/NetworkProcess.cpp:
1363         (WebKit::NetworkProcess::didReceiveMessage):
1364         (WebKit::NetworkProcess::initializeNetworkProcess):
1365         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
1366         (WebKit::NetworkProcess::addWebsiteDataStore):
1367         (WebKit::NetworkProcess::destroySession):
1368         (WebKit::NetworkProcess::fetchWebsiteData):
1369         (WebKit::NetworkProcess::deleteWebsiteData):
1370         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1371         (WebKit::NetworkProcess::connectionToContextProcessFromIPCConnection):
1372         (WebKit::NetworkProcess::connectionToContextProcessWasClosed):
1373         (WebKit::NetworkProcess::needsServerToContextConnectionForOrigin const):
1374         (WebKit::NetworkProcess::swServerForSession):
1375         (WebKit::NetworkProcess::swOriginStoreForSession):
1376         (WebKit::NetworkProcess::existingSWOriginStoreForSession const):
1377         (WebKit::NetworkProcess::serverToContextConnectionForOrigin):
1378         (WebKit::NetworkProcess::createServerToContextConnection):
1379         (WebKit::NetworkProcess::didFailFetch):
1380         (WebKit::NetworkProcess::didNotHandleFetch):
1381         (WebKit::NetworkProcess::didReceiveFetchResponse):
1382         (WebKit::NetworkProcess::didReceiveFetchData):
1383         (WebKit::NetworkProcess::didReceiveFetchFormData):
1384         (WebKit::NetworkProcess::didFinishFetch):
1385         (WebKit::NetworkProcess::postMessageToServiceWorkerClient):
1386         (WebKit::NetworkProcess::postMessageToServiceWorker):
1387         (WebKit::NetworkProcess::registerSWServerConnection):
1388         (WebKit::NetworkProcess::unregisterSWServerConnection):
1389         (WebKit::NetworkProcess::swContextConnectionMayNoLongerBeNeeded):
1390         (WebKit::NetworkProcess::disableServiceWorkerProcessTerminationDelay):
1391         (WebKit::NetworkProcess::addServiceWorkerSession):
1392         * NetworkProcess/NetworkProcess.h:
1393         (WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const):
1394         * NetworkProcess/NetworkProcess.messages.in:
1395         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1396         (WebKit::NetworkProcessCreationParameters::encode const):
1397         (WebKit::NetworkProcessCreationParameters::decode):
1398         * NetworkProcess/NetworkProcessCreationParameters.h:
1399         * NetworkProcess/ServiceWorker/WebSWOriginStore.cpp: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWOriginStore.cpp.
1400         (WebKit::WebSWOriginStore::WebSWOriginStore):
1401         (WebKit::WebSWOriginStore::addToStore):
1402         (WebKit::WebSWOriginStore::removeFromStore):
1403         (WebKit::WebSWOriginStore::clearStore):
1404         (WebKit::WebSWOriginStore::importComplete):
1405         (WebKit::WebSWOriginStore::registerSWServerConnection):
1406         (WebKit::WebSWOriginStore::unregisterSWServerConnection):
1407         (WebKit::WebSWOriginStore::sendStoreHandle):
1408         (WebKit::WebSWOriginStore::didInvalidateSharedMemory):
1409         * NetworkProcess/ServiceWorker/WebSWOriginStore.h: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWOriginStore.h.
1410         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp.
1411         (WebKit::WebSWServerConnection::WebSWServerConnection):
1412         (WebKit::WebSWServerConnection::~WebSWServerConnection):
1413         (WebKit::WebSWServerConnection::rejectJobInClient):
1414         (WebKit::WebSWServerConnection::resolveRegistrationJobInClient):
1415         (WebKit::WebSWServerConnection::resolveUnregistrationJobInClient):
1416         (WebKit::WebSWServerConnection::startScriptFetchInClient):
1417         (WebKit::WebSWServerConnection::updateRegistrationStateInClient):
1418         (WebKit::WebSWServerConnection::fireUpdateFoundEvent):
1419         (WebKit::WebSWServerConnection::setRegistrationLastUpdateTime):
1420         (WebKit::WebSWServerConnection::setRegistrationUpdateViaCache):
1421         (WebKit::WebSWServerConnection::notifyClientsOfControllerChange):
1422         (WebKit::WebSWServerConnection::updateWorkerStateInClient):
1423         (WebKit::WebSWServerConnection::cancelFetch):
1424         (WebKit::WebSWServerConnection::startFetch):
1425         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
1426         (WebKit::WebSWServerConnection::scheduleJobInServer):
1427         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
1428         (WebKit::WebSWServerConnection::didReceiveFetchData):
1429         (WebKit::WebSWServerConnection::didReceiveFetchFormData):
1430         (WebKit::WebSWServerConnection::didFinishFetch):
1431         (WebKit::WebSWServerConnection::didFailFetch):
1432         (WebKit::WebSWServerConnection::didNotHandleFetch):
1433         (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
1434         (WebKit::WebSWServerConnection::matchRegistration):
1435         (WebKit::WebSWServerConnection::registrationReady):
1436         (WebKit::WebSWServerConnection::getRegistrations):
1437         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
1438         (WebKit::WebSWServerConnection::unregisterServiceWorkerClient):
1439         (WebKit::WebSWServerConnection::sendToContextProcess):
1440         * NetworkProcess/ServiceWorker/WebSWServerConnection.h: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h.
1441         (WebKit::WebSWServerConnection::ipcConnection const):
1442         (WebKit::WebSWServerConnection::sessionID const):
1443         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in.
1444         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp.
1445         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
1446         (WebKit::WebSWServerToContextConnection::messageSenderConnection):
1447         (WebKit::WebSWServerToContextConnection::messageSenderDestinationID):
1448         (WebKit::WebSWServerToContextConnection::connectionClosed):
1449         (WebKit::WebSWServerToContextConnection::installServiceWorkerContext):
1450         (WebKit::WebSWServerToContextConnection::fireInstallEvent):
1451         (WebKit::WebSWServerToContextConnection::fireActivateEvent):
1452         (WebKit::WebSWServerToContextConnection::terminateWorker):
1453         (WebKit::WebSWServerToContextConnection::syncTerminateWorker):
1454         (WebKit::WebSWServerToContextConnection::findClientByIdentifierCompleted):
1455         (WebKit::WebSWServerToContextConnection::matchAllCompleted):
1456         (WebKit::WebSWServerToContextConnection::claimCompleted):
1457         (WebKit::WebSWServerToContextConnection::didFinishSkipWaiting):
1458         (WebKit::WebSWServerToContextConnection::connectionMayNoLongerBeNeeded):
1459         (WebKit::WebSWServerToContextConnection::terminate):
1460         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.h.
1461         (WebKit::WebSWServerToContextConnection::create):
1462         (WebKit::WebSWServerToContextConnection::ipcConnection const):
1463         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in.
1464         * NetworkProcess/ios/NetworkProcessIOS.mm:
1465         (WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const):
1466         * Shared/Storage/StorageProcessCreationParameters.cpp:
1467         (WebKit::StorageProcessCreationParameters::encode const):
1468         (WebKit::StorageProcessCreationParameters::decode):
1469         * Shared/Storage/StorageProcessCreationParameters.h:
1470         (): Deleted.
1471         * Shared/WebsiteDataStoreParameters.cpp:
1472         (WebKit::WebsiteDataStoreParameters::encode const):
1473         (WebKit::WebsiteDataStoreParameters::decode):
1474         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
1475         * Shared/WebsiteDataStoreParameters.h:
1476         * Sources.txt:
1477         * StorageProcess/StorageProcess.cpp:
1478         (WebKit::StorageProcess::didReceiveMessage):
1479         (WebKit::StorageProcess::initializeWebsiteDataStore):
1480         (WebKit::StorageProcess::createStorageToWebProcessConnection):
1481         (WebKit::StorageProcess::destroySession):
1482         (WebKit::StorageProcess::fetchWebsiteData):
1483         (WebKit::StorageProcess::deleteWebsiteData):
1484         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
1485         (WebKit::StorageProcess::connectionToContextProcessFromIPCConnection): Deleted.
1486         (WebKit::StorageProcess::connectionToContextProcessWasClosed): Deleted.
1487         (WebKit::StorageProcess::needsServerToContextConnectionForOrigin const): Deleted.
1488         (WebKit::StorageProcess::swServerForSession): Deleted.
1489         (WebKit::StorageProcess::swOriginStoreForSession): Deleted.
1490         (WebKit::StorageProcess::existingSWOriginStoreForSession const): Deleted.
1491         (WebKit::StorageProcess::serverToContextConnectionForOrigin): Deleted.
1492         (WebKit::StorageProcess::createServerToContextConnection): Deleted.
1493         (WebKit::StorageProcess::didFailFetch): Deleted.
1494         (WebKit::StorageProcess::didNotHandleFetch): Deleted.
1495         (WebKit::StorageProcess::didReceiveFetchResponse): Deleted.
1496         (WebKit::StorageProcess::didReceiveFetchData): Deleted.
1497         (WebKit::StorageProcess::didReceiveFetchFormData): Deleted.
1498         (WebKit::StorageProcess::didFinishFetch): Deleted.
1499         (WebKit::StorageProcess::postMessageToServiceWorkerClient): Deleted.
1500         (WebKit::StorageProcess::postMessageToServiceWorker): Deleted.
1501         (WebKit::StorageProcess::registerSWServerConnection): Deleted.
1502         (WebKit::StorageProcess::unregisterSWServerConnection): Deleted.
1503         (WebKit::StorageProcess::swContextConnectionMayNoLongerBeNeeded): Deleted.
1504         (WebKit::StorageProcess::disableServiceWorkerProcessTerminationDelay): Deleted.
1505         * StorageProcess/StorageProcess.h:
1506         (WebKit::StorageProcess::parentProcessHasServiceWorkerEntitlement const): Deleted.
1507         (): Deleted.
1508         * StorageProcess/StorageProcess.messages.in:
1509         * StorageProcess/StorageToWebProcessConnection.cpp:
1510         (WebKit::StorageToWebProcessConnection::~StorageToWebProcessConnection):
1511         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
1512         (WebKit::StorageToWebProcessConnection::didReceiveSyncMessage):
1513         (WebKit::StorageToWebProcessConnection::didClose):
1514         (WebKit::StorageToWebProcessConnection::unregisterSWConnections): Deleted.
1515         (WebKit::StorageToWebProcessConnection::establishSWServerConnection): Deleted.
1516         * StorageProcess/StorageToWebProcessConnection.h:
1517         * StorageProcess/StorageToWebProcessConnection.messages.in:
1518         * StorageProcess/ios/StorageProcessIOS.mm:
1519         (WebKit::StorageProcess::parentProcessHasServiceWorkerEntitlement const): Deleted.
1520         * UIProcess/Network/NetworkProcessProxy.cpp:
1521         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
1522         (WebKit::NetworkProcessProxy::networkProcessCrashed):
1523         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
1524         (WebKit::NetworkProcessProxy::didFinishLaunching):
1525         (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess):
1526         (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcessForExplicitSession):
1527         * UIProcess/Network/NetworkProcessProxy.h:
1528         * UIProcess/Network/NetworkProcessProxy.messages.in:
1529         * UIProcess/ServiceWorkerProcessProxy.cpp:
1530         (WebKit::ServiceWorkerProcessProxy::start):
1531         * UIProcess/Storage/StorageProcessProxy.cpp:
1532         (WebKit::StorageProcessProxy::getStorageProcessConnection):
1533         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcess): Deleted.
1534         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcessForExplicitSession): Deleted.
1535         * UIProcess/Storage/StorageProcessProxy.h:
1536         * UIProcess/Storage/StorageProcessProxy.messages.in:
1537         * UIProcess/WebProcessPool.cpp:
1538         (WebKit::WebProcessPool::ensureNetworkProcess):
1539         (WebKit::WebProcessPool::networkProcessCrashed):
1540         (WebKit::WebProcessPool::getNetworkProcessConnection):
1541         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
1542         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
1543         (WebKit::WebProcessPool::disableServiceWorkerProcessTerminationDelay):
1544         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
1545         (WebKit::WebProcessPool::registerURLSchemeServiceWorkersCanHandle):
1546         (WebKit::WebProcessPool::postMessageToServiceWorkerClient):
1547         (WebKit::WebProcessPool::postMessageToServiceWorker):
1548         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess): Deleted.
1549         * UIProcess/WebProcessPool.h:
1550         * UIProcess/WebProcessProxy.cpp:
1551         (WebKit::WebProcessProxy::getNetworkProcessConnection):
1552         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1553         (WebKit::WebsiteDataStore::parameters):
1554         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1555         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
1556         (WebKit::WebsiteDataStore::fetchDataAndApply):
1557         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
1558         (WebKit::WebsiteDataStore::removeData):
1559         (WebKit::WebsiteDataStore::storageProcessParameters):
1560         (WebKit::WebsiteDataStore::parameters):
1561         * WebKit.xcodeproj/project.pbxproj:
1562         * WebProcess/Network/NetworkProcessConnection.cpp:
1563         (WebKit::NetworkProcessConnection::didReceiveMessage):
1564         (WebKit::NetworkProcessConnection::didReceiveSyncMessage):
1565         (WebKit::NetworkProcessConnection::didClose):
1566         (WebKit::NetworkProcessConnection::serviceWorkerConnectionForSession):
1567         * WebProcess/Network/NetworkProcessConnection.h:
1568         (WebKit::NetworkProcessConnection::existingServiceWorkerConnectionForSession):
1569         * WebProcess/Storage/WebSWClientConnection.cpp:
1570         (WebKit::WebSWClientConnection::WebSWClientConnection):
1571         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1572         (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
1573         (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
1574         (WebKit::WebSWContextManagerConnection::startFetch):
1575         (WebKit::WebSWContextManagerConnection::didFinishInstall):
1576         (WebKit::WebSWContextManagerConnection::didFinishActivation):
1577         (WebKit::WebSWContextManagerConnection::setServiceWorkerHasPendingEvents):
1578         (WebKit::WebSWContextManagerConnection::skipWaiting):
1579         (WebKit::WebSWContextManagerConnection::setScriptResource):
1580         (WebKit::WebSWContextManagerConnection::workerTerminated):
1581         (WebKit::WebSWContextManagerConnection::findClientByIdentifier):
1582         (WebKit::WebSWContextManagerConnection::matchAll):
1583         (WebKit::WebSWContextManagerConnection::claim):
1584         * WebProcess/Storage/WebSWContextManagerConnection.h:
1585         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
1586         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
1587         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
1588         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish):
1589         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveBlobChunk):
1590         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
1591         (WebKit::WebServiceWorkerFetchTaskClient::didFinish):
1592         (WebKit::WebServiceWorkerFetchTaskClient::didNotHandle):
1593         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
1594         (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
1595         (WebKit::WebServiceWorkerProvider::existingServiceWorkerConnectionForSession):
1596         (WebKit::WebServiceWorkerProvider::handleFetch):
1597         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
1598         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
1599         (WebKit::WebToStorageProcessConnection::didReceiveSyncMessage):
1600         (WebKit::WebToStorageProcessConnection::didClose):
1601         (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession): Deleted.
1602         * WebProcess/Storage/WebToStorageProcessConnection.h:
1603         (WebKit::WebToStorageProcessConnection::existingServiceWorkerConnectionForSession): Deleted.
1604         * WebProcess/WebProcess.cpp:
1605         (WebKit::WebProcess::networkProcessConnectionClosed):
1606         (WebKit::WebProcess::webToStorageProcessConnectionClosed):
1607         (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess):
1608         (WebKit::WebProcess::establishWorkerContextConnectionToStorageProcess): Deleted.
1609         * WebProcess/WebProcess.h:
1610         (WebKit::WebProcess::existingNetworkProcessConnection):
1611         (WebKit::WebProcess::existingWebToStorageProcessConnection): Deleted.
1612         * WebProcess/WebProcess.messages.in:
1613
1614 2018-09-25  Chris Dumez  <cdumez@apple.com>
1615
1616         UIProcess should process incoming sync IPC from WebProcess when waiting for a sync IPC reply from it
1617         https://bugs.webkit.org/show_bug.cgi?id=189927
1618
1619         Reviewed by Alex Christensen.
1620
1621         UIProcess should process incoming sync IPC from WebProcess when waiting for a sync IPC reply from it
1622         in order to avoid deadlocks. This is not an issue currently because the WebProcess does process
1623         incoming sync IPC when waiting for a sync IPC reply. However, we plan to change this in the future
1624         in order to avoid bugs caused by re-entering WebCore at unsafe times.
1625
1626         The reason the UIProcess previously did not do out of order sync IPC process was to avoid processing
1627         a synchronous policy decision IPC for a frameID it did not know about yet, due to the DidCreateMainFrame /
1628         DidCreateSubframe IPC messages being asynchronous. To address this issue, the decidePolicyForNavigationActionSync
1629         IPC handler now calls didCreateMainFrame() / didCreateSubframe() as needed if it does not know about
1630         the frame yet. Note that synchronous policy decisions are rare and are currently only needed by initial
1631         about:blank and fragment navigations.
1632
1633         * UIProcess/WebPageProxy.cpp:
1634         (WebKit::WebPageProxy::didCreateMainFrame):
1635         (WebKit::WebPageProxy::didCreateSubframe):
1636         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
1637         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1638         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
1639         * UIProcess/WebPageProxy.h:
1640         * UIProcess/WebPageProxy.messages.in:
1641         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1642         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1643         * WebProcess/WebProcess.cpp:
1644         (WebKit::WebProcess::initializeConnection):
1645
1646 2018-09-25  Chris Dumez  <cdumez@apple.com>
1647
1648         Extending the lifetime of a NetworkProcessProxy / StorageProcessProxy may cause it to have a stale WebProcessPool pointer
1649         https://bugs.webkit.org/show_bug.cgi?id=189851
1650         <rdar://problem/44696263>
1651
1652         Reviewed by Alex Christensen.
1653
1654         Extending the lifetime of a NetworkProcessProxy / StorageProcessProxy may cause it to have a stale WebProcessPool pointer:
1655         - NetworkProcessProxy::m_processPool
1656         - StorageProcessProxy::m_processPool
1657
1658         Those data members are C++ references because it is expected that the WebProcessPool owns the NetworkProcessProxy and
1659         StorageProcessProxy. However, since NetworkProcessProxy / StorageProcessProxy are refcounted, it has happened that code
1660         extends the lifetime of those past their process pool, leading to stale prrocess pool usage. The fix for these crashes
1661         so far as been to ref the WebProcessPool instead of the NetworkProcessProxy / StorageProcessProxy. However, it is very
1662         tempting for people to simply ref the NetworkProcessProxy / StorageProcessProxy given that they are refcounted.
1663         For this reason, this patch updates NetworkProcessProxy / StorageProcessProxy so that they are no longer RefCounted
1664         and so that the WebProcessPool truly owns them via std::unique_ptr<>.
1665
1666         * UIProcess/ChildProcessProxy.h:
1667         * UIProcess/Network/NetworkProcessProxy.cpp:
1668         (WebKit::NetworkProcessProxy::networkProcessCrashed):
1669         (WebKit::NetworkProcessProxy::didClose):
1670         (WebKit::NetworkProcessProxy::create): Deleted.
1671         * UIProcess/Network/NetworkProcessProxy.h:
1672         (WebKit::NetworkProcessProxy::throttler): Deleted.
1673         (WebKit::NetworkProcessProxy::processPool): Deleted.
1674         * UIProcess/Plugins/PluginProcessProxy.h:
1675         (WebKit::PluginProcessProxy::pluginProcessAttributes const): Deleted.
1676         (WebKit::PluginProcessProxy::pluginProcessToken const): Deleted.
1677         (WebKit::PluginProcessProxy::isValid const): Deleted.
1678         * UIProcess/Storage/StorageProcessProxy.cpp:
1679         (WebKit::StorageProcessProxy::create): Deleted.
1680         * UIProcess/Storage/StorageProcessProxy.h:
1681         * UIProcess/WebProcessPool.cpp:
1682         (WebKit::WebProcessPool::ensureNetworkProcess):
1683         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
1684         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
1685         * UIProcess/WebProcessPool.h:
1686         * UIProcess/WebProcessProxy.h:
1687
1688 2018-09-25  Alex Christensen  <achristensen@webkit.org>
1689
1690         NetworkLoad::didReceiveResponse should pass its completion handler to its client
1691         https://bugs.webkit.org/show_bug.cgi?id=188701
1692
1693         Reviewed by Michael Catanzaro.
1694
1695         Right now we have a confusing enum ShouldContinueDidReceiveResponse and a complicated flow
1696         that involves many objects and implicitly using NetworkLoad's destructor as part of the
1697         loading flow.  This makes the responsibilities of the objects clear.
1698
1699         * NetworkProcess/Downloads/PendingDownload.cpp:
1700         (WebKit::PendingDownload::didReceiveResponse):
1701         * NetworkProcess/Downloads/PendingDownload.h:
1702         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
1703         (WebKit::NetworkCORSPreflightChecker::didReceiveResponse):
1704         (WebKit::NetworkCORSPreflightChecker::didReceiveResponseNetworkSession): Deleted.
1705         * NetworkProcess/NetworkCORSPreflightChecker.h:
1706         * NetworkProcess/NetworkDataTask.cpp:
1707         (WebKit::NetworkDataTask::didReceiveResponse):
1708         * NetworkProcess/NetworkDataTask.h:
1709         * NetworkProcess/NetworkLoad.cpp:
1710         (WebKit::NetworkLoad::~NetworkLoad):
1711         (WebKit::NetworkLoad::convertTaskToDownload):
1712         (WebKit::NetworkLoad::didReceiveResponse):
1713         (WebKit::NetworkLoad::notifyDidReceiveResponse):
1714         (WebKit::NetworkLoad::continueDidReceiveResponse): Deleted.
1715         (WebKit::NetworkLoad::didReceiveResponseNetworkSession): Deleted.
1716         * NetworkProcess/NetworkLoad.h:
1717         * NetworkProcess/NetworkLoadClient.h:
1718         * NetworkProcess/NetworkResourceLoader.cpp:
1719         (WebKit::NetworkResourceLoader::~NetworkResourceLoader):
1720         (WebKit::NetworkResourceLoader::didReceiveResponse):
1721         (WebKit::NetworkResourceLoader::didFinishWithRedirectResponse):
1722         (WebKit::NetworkResourceLoader::continueDidReceiveResponse):
1723         * NetworkProcess/NetworkResourceLoader.h:
1724         * NetworkProcess/PingLoad.cpp:
1725         (WebKit::PingLoad::didReceiveResponse):
1726         (WebKit::PingLoad::didReceiveResponseNetworkSession): Deleted.
1727         * NetworkProcess/PingLoad.h:
1728         * NetworkProcess/PreconnectTask.cpp:
1729         (WebKit::PreconnectTask::didReceiveResponse):
1730         * NetworkProcess/PreconnectTask.h:
1731         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1732         (WebKit::NetworkCache::SpeculativeLoad::didReceiveResponse):
1733         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
1734         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
1735         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
1736
1737 2018-09-24  Alex Christensen  <achristensen@webkit.org>
1738
1739         Build fix.
1740         https://bugs.webkit.org/show_bug.cgi?id=189929
1741
1742         * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h:
1743
1744 2018-09-24  Alex Christensen  <achristensen@webkit.org>
1745
1746         Prepare to replace WKBundleFileHandleCreateWithPath with a version that takes a WKBundlePageRef
1747         https://bugs.webkit.org/show_bug.cgi?id=189929
1748
1749         Reviewed by Andy Estes.
1750
1751         This will be needed for rdar://problem/24576194
1752
1753         * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.cpp:
1754         (WKBundleFileHandleCreateWithPathForPage):
1755         * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h:
1756
1757 2018-09-24  Alex Christensen  <achristensen@webkit.org>
1758
1759         Begin deprecating C API
1760         https://bugs.webkit.org/show_bug.cgi?id=189810
1761
1762         Reviewed by Andy Estes.
1763
1764         * Shared/API/c/WKDeprecated.h: Added.
1765         * UIProcess/API/C/WKPage.h:
1766         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
1767         (setUpPagePolicyClient):
1768         (-[WKBrowsingContextController setPolicyDelegate:]):
1769         * WebKit.xcodeproj/project.pbxproj:
1770
1771 2018-09-24  Chris Dumez  <cdumez@apple.com>
1772
1773         Unreviewed, rolling out r236368.
1774
1775         Caused WebKit.NetworkProcessCrashWithPendingConnection API
1776         test to crash (Bug 189926)
1777
1778         Reverted changeset:
1779
1780         "Extending the lifetime of a NetworkProcessProxy /
1781         StorageProcessProxy may cause it to have a stale
1782         WebProcessPool pointer"
1783         https://bugs.webkit.org/show_bug.cgi?id=189851
1784         https://trac.webkit.org/changeset/236368
1785
1786 2018-09-21  Simon Fraser  <simon.fraser@apple.com>
1787
1788         Remove the old "AcceleratedCompositingForOverflowScroll" code
1789         https://bugs.webkit.org/show_bug.cgi?id=189870
1790
1791         Reviewed by Zalan Bujtas.
1792
1793         The "AcceleratedCompositingForOverflowScroll" code was added to allow overflow:scroll to use
1794         composited scrolling if an overflow:scroll could be made a stacking context without affecting
1795         z-order. We need overflow:scroll to be accelerated always, so a different approach is needed.
1796         Remove this old code (unused by any platform?) to make working on new code easier.
1797
1798         * Shared/WebPreferences.yaml:
1799         * UIProcess/API/C/WKPreferences.cpp:
1800         (WKPreferencesSetAcceleratedCompositingForOverflowScrollEnabled): Deleted.
1801         (WKPreferencesGetAcceleratedCompositingForOverflowScrollEnabled): Deleted.
1802         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1803
1804 2018-09-24  Chris Dumez  <cdumez@apple.com>
1805
1806         Do not do early processing of incoming sync IPC unless we're waiting for a sync IPC reply
1807         https://bugs.webkit.org/show_bug.cgi?id=186941
1808
1809         Reviewed by Alex Christensen.
1810
1811         The comment was claiming we were processing incoming sync messages while waiting for a
1812         sync IPC reply to prevent deadlocks. However, the code was failing to check if we were
1813         waiting for a sync IPC reply. As a result, incoming sync IPC messages would get processed
1814         early no matter what, jumping the line. This was the source of the flakiness in the blob
1815         tests since the IPC to register the blob in the network process was async and the follow-up
1816         IPC to ask the network process for the blob size was sync. The sync message to get the blob
1817         size would jump the line and get processed before the async message to register the blob.
1818         As a result, the network process would not know about the blob yet and return size 0. Of
1819         course, this could happen if the network process was sending sync IPC at the time. However,
1820         the network process never sends any sync IPC and therefore, should never process incoming
1821         IPC messages out of order.
1822
1823         * Platform/IPC/Connection.cpp:
1824         (IPC::Connection::processIncomingMessage):
1825
1826 2018-09-24  Daniel Bates  <dabates@apple.com>
1827
1828         [iOS] Key code is 0 for many hardware keyboard keys
1829         https://bugs.webkit.org/show_bug.cgi?id=189604
1830
1831         Reviewed by Wenson Hsieh.
1832
1833         For a hardware keyboard-generated event (an event with a non-nill event._hidEvent) pass
1834         the key code for the event. Otherwise, do what we do now and pass 0 as the event is likely
1835         a software keyboard-generated event.
1836
1837         * Platform/spi/ios/UIKitSPI.h: Add some more SPI.
1838         * UIProcess/ios/WKContentViewInteraction.mm:
1839         (-[WKContentView handleKeyEvent:]):
1840
1841 2018-09-24  Brian Burg  <bburg@apple.com>
1842
1843         Web Inspector: topContentInset is not accounted for when inspecting a WKWebView and docked to side
1844         https://bugs.webkit.org/show_bug.cgi?id=189859
1845
1846         Reviewed by Joseph Pecoraro.
1847
1848         * UIProcess/mac/WebInspectorProxyMac.mm:
1849         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
1850         Add special cases for inspecting a WKWebView. We already special-case for WKView.
1851
1852 2018-09-24  Miguel Gomez  <magomez@igalia.com>
1853
1854         [GTK][WPE] Compositing indicators are not working
1855         https://bugs.webkit.org/show_bug.cgi?id=189915
1856
1857         Reviewed by Žan Doberšek.
1858
1859         Pass the debugBorder and repaintCount parameters to the TextureMapperLayer when required.
1860
1861         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1862         (WebKit::CoordinatedGraphicsScene::updateSceneState):
1863
1864 2018-09-21  Dean Jackson  <dino@apple.com>
1865
1866         Add PointerEvent, plus feature flag, plus Web Platform Tests
1867         https://bugs.webkit.org/show_bug.cgi?id=189867
1868         <rdar://problem/44697384>
1869
1870         Reviewed by Simon Fraser.
1871
1872         Add PointerEvents as an experimental feature.
1873
1874         * Shared/WebPreferences.yaml:
1875
1876 2018-09-21  Brian Burg  <bburg@apple.com>
1877
1878         Web Inspector: dock buttons disappear if Web Inspector goes fullscreen
1879         https://bugs.webkit.org/show_bug.cgi?id=189865
1880         <rdar://problem/42600534>
1881
1882         Reviewed by Matt Baker.
1883
1884         When a fullscreen Safari tab has a docked Inspector, and the "detach" button
1885         is clicked, Inspector goes into its own fullscreen window. In that window,
1886         there are no buttons for docking to side or bottom.
1887
1888         It turns out that we always send setDockingUnavailable(true) if the inspector
1889         window is fullscreen. This eventually causes the inspector to reflect that
1890         by hiding the docking-related buttons.
1891
1892         * UIProcess/mac/WebInspectorProxyMac.mm:
1893         (WebKit::WebInspectorProxy::platformCanAttach):
1894         This early exit does not seem to serve any purpose, so remove it.
1895
1896 2018-09-21  Chris Dumez  <cdumez@apple.com>
1897
1898         Extending the lifetime of a NetworkProcessProxy / StorageProcessProxy may cause it to have a stale WebProcessPool pointer
1899         https://bugs.webkit.org/show_bug.cgi?id=189851
1900
1901         Reviewed by Alex Christensen.
1902
1903         Extending the lifetime of a NetworkProcessProxy / StorageProcessProxy may cause it to have a stale WebProcessPool pointer:
1904         - NetworkProcessProxy::m_processPool
1905         - StorageProcessProxy::m_processPool
1906
1907         Those data members are C++ references because it is expected that the WebProcessPool owns the NetworkProcessProxy and
1908         StorageProcessProxy. However, since NetworkProcessProxy / StorageProcessProxy are refcounted, it has happened that code
1909         extends the lifetime of those past their process pool, leading to stale prrocess pool usage. The fix for these crashes
1910         so far as been to ref the WebProcessPool instead of the NetworkProcessProxy / StorageProcessProxy. However, given how
1911         error-prone this is, this patch updates NetworkProcessProxy / StorageProcessProxy so that they forward their refcounting
1912         to the WebProcessPool.
1913
1914         * UIProcess/ChildProcessProxy.h:
1915         * UIProcess/Network/NetworkProcessProxy.cpp:
1916         (WebKit::NetworkProcessProxy::ref):
1917         (WebKit::NetworkProcessProxy::deref):
1918         (WebKit::NetworkProcessProxy::didClose):
1919         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
1920         (WebKit::NetworkProcessProxy::create): Deleted.
1921         * UIProcess/Network/NetworkProcessProxy.h:
1922         * UIProcess/Plugins/PluginProcessProxy.h:
1923         * UIProcess/Storage/StorageProcessProxy.cpp:
1924         (WebKit::StorageProcessProxy::ref):
1925         (WebKit::StorageProcessProxy::deref):
1926         (WebKit::StorageProcessProxy::create): Deleted.
1927         * UIProcess/Storage/StorageProcessProxy.h:
1928         * UIProcess/WebProcessPool.cpp:
1929         (WebKit::WebProcessPool::ensureNetworkProcess):
1930         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
1931         * UIProcess/WebProcessPool.h:
1932         * UIProcess/WebProcessProxy.h:
1933
1934 2018-09-21  Alex Christensen  <achristensen@webkit.org>
1935
1936         Use a Variant for FormDataElement
1937         https://bugs.webkit.org/show_bug.cgi?id=189777
1938
1939         Reviewed by Chris Dumez.
1940
1941         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1942         (WebKit::NetworkResourceLoadParameters::encode const):
1943         * NetworkProcess/NetworkResourceLoader.cpp:
1944         * Shared/SessionState.h:
1945         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
1946         (WebKit::toHTTPBody):
1947
1948 2018-09-21  Alex Christensen  <achristensen@webkit.org>
1949
1950         Simply authentication code even more!
1951         https://bugs.webkit.org/show_bug.cgi?id=189719
1952
1953         Reviewed by Andy Estes.
1954
1955         Just when you thought it couldn't get simpler and more elegant, it can!
1956
1957         * NetworkProcess/Downloads/Download.cpp:
1958         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
1959         * NetworkProcess/NetworkLoad.cpp:
1960         * NetworkProcess/PingLoad.cpp:
1961         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1962         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1963         * Shared/Authentication/AuthenticationChallengeDisposition.h: Added.
1964         * Shared/Authentication/AuthenticationManager.cpp:
1965         (WebKit::AuthenticationManager::completeAuthenticationChallenge):
1966         (WebKit::AuthenticationManager::useCredentialForChallenge): Deleted.
1967         (WebKit::AuthenticationManager::useCredentialForSingleChallenge): Deleted.
1968         (WebKit::AuthenticationManager::continueWithoutCredentialForChallenge): Deleted.
1969         (WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge): Deleted.
1970         (WebKit::AuthenticationManager::cancelChallenge): Deleted.
1971         (WebKit::AuthenticationManager::cancelSingleChallenge): Deleted.
1972         (WebKit::AuthenticationManager::performDefaultHandling): Deleted.
1973         (WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge): Deleted.
1974         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinue): Deleted.
1975         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge): Deleted.
1976         * Shared/Authentication/AuthenticationManager.h:
1977         * Shared/Authentication/AuthenticationManager.messages.in:
1978         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
1979         (WebKit::AuthenticationManager::initializeConnection):
1980         * UIProcess/API/C/WKAuthenticationDecisionListener.cpp:
1981         (WKAuthenticationDecisionListenerUseCredential):
1982         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm:
1983         (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
1984         * UIProcess/API/glib/WebKitAuthenticationRequest.cpp:
1985         (webkit_authentication_request_authenticate):
1986         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
1987         (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
1988         * UIProcess/Authentication/AuthenticationDecisionListener.cpp:
1989         (WebKit::AuthenticationDecisionListener::AuthenticationDecisionListener):
1990         (WebKit::AuthenticationDecisionListener::~AuthenticationDecisionListener):
1991         (WebKit::AuthenticationDecisionListener::useCredential):
1992         (WebKit::AuthenticationDecisionListener::cancel):
1993         (WebKit::AuthenticationDecisionListener::performDefaultHandling):
1994         (WebKit::AuthenticationDecisionListener::rejectProtectionSpaceAndContinue):
1995         * UIProcess/Authentication/AuthenticationDecisionListener.h:
1996         (WebKit::AuthenticationDecisionListener::create):
1997         * UIProcess/Cocoa/DownloadClient.mm:
1998         (WebKit::DownloadClient::didReceiveAuthenticationChallenge):
1999         * UIProcess/Cocoa/NavigationState.mm:
2000         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
2001         * WebKit.xcodeproj/project.pbxproj:
2002
2003 2018-09-21  Chris Dumez  <cdumez@apple.com>
2004
2005         Regression(Mojave): Resuming a WK2 download crashes
2006         https://bugs.webkit.org/show_bug.cgi?id=189838
2007         <rdar://problem/44618538>
2008
2009         Reviewed by Alex Christensen.
2010
2011         Update our workaround to tweak the download resume data to include the actual download path so that
2012         it works on macOS Mojave and up. Unfortunately, the resume data internal representation has changed,
2013         causing our previous workaround to fail.
2014
2015         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
2016         (WebKit::Download::resume):
2017
2018 2018-09-21  Youenn Fablet  <youenn@apple.com>
2019
2020         Whitelist two additional plugins
2021         https://bugs.webkit.org/show_bug.cgi?id=189832
2022         <rdar://problem/44628127>
2023
2024         Reviewed by Brent Fulgham.
2025
2026         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
2027         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed):
2028
2029 2018-09-21  Woodrow Wang  <woodrow_wang@apple.com>
2030
2031         Clear persistent storage between tests for resourceLoadStatistics
2032         https://bugs.webkit.org/show_bug.cgi?id=189684
2033         <rdar://problem/44540099>
2034
2035         Reviewed by Chris Dumez.
2036
2037         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2038         (WKWebsiteDataStoreStatisticsResetToConsistentState):
2039         * UIProcess/Network/NetworkProcessProxy.cpp:
2040         (WebKit::NetworkProcessProxy::didClose):
2041         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
2042         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2043         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
2044
2045         Remove function only called in testing for resetting statistics to consistent
2046         state. 
2047
2048         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory): Deleted.
2049
2050         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2051         (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor):
2052         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
2053
2054 2018-09-20  Ryan Haddad  <ryanhaddad@apple.com>
2055
2056         Unreviewed, rolling out r236289.
2057
2058         Caused 8 TestWebKitAPI.ContentFiltering test failures.
2059
2060         Reverted changeset:
2061
2062         "InjectedBundle parameters often need initialization function
2063         called before unarchiving"
2064         https://bugs.webkit.org/show_bug.cgi?id=189709
2065         https://trac.webkit.org/changeset/236289
2066
2067 2018-09-20  Youenn Fablet  <youenn@apple.com>
2068
2069         Allow additional plug-ins to run unsandboxed
2070         https://bugs.webkit.org/show_bug.cgi?id=189791
2071         <rdar://problem/44628127>
2072
2073         Reviewed by Brent Fulgham.
2074
2075         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
2076         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed):
2077
2078 2018-09-20  Brent Fulgham  <bfulgham@apple.com>
2079
2080         InjectedBundle parameters often need initialization function called before unarchiving
2081         https://bugs.webkit.org/show_bug.cgi?id=189709
2082         <rdar://problem/44573653>
2083
2084         Reviewed by Chris Dumez.
2085
2086         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
2087         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
2088         after the bundle initialiation function runs, which gives the embedding program the opportunity to
2089         register additional classes that are safe for serialization.
2090         
2091         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
2092         This new method returns 'true' if the serialization was successful, otherwise it returns false.
2093
2094         Revise 'initialize' to call this new method and check the return value. If it fails, try decoding the
2095         bundle parameters after the bundle's initialization function is called.
2096
2097         * WebProcess/InjectedBundle/InjectedBundle.h:
2098         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
2099         (WebKit::InjectedBundle::initialize): Use the new method.
2100         (WebKit::InjectedBundle::decodeBundleParameters): Added.
2101         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
2102         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
2103         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
2104         NSDictionary object may itself hold other kinds of objects.
2105
2106 2018-09-20  Jer Noble  <jer.noble@apple.com>
2107
2108         Enable Modern EME by default
2109         https://bugs.webkit.org/show_bug.cgi?id=189794
2110
2111         Reviewed by Jon Lee.
2112
2113         * Shared/WebPreferences.yaml:
2114
2115 2018-09-20  Thibault Saunier  <tsaunier@igalia.com>
2116
2117         [GTK][WPE] Make sure MediaDeviceEnabled and PeerConnectionEnabled are always synced with enable-media-stream
2118         https://bugs.webkit.org/show_bug.cgi?id=188704
2119
2120         By default m_isMediaDevicesEnabled and m_isScreenCaptureEnabled are false but
2121         m_isMediaStreamEnabled is true meaning that in the WPE minibrowser getUserMedia
2122         was disabled even if we explicitly set `"enable-media-stream", TRUE`.
2123
2124         Reviewed by Michael Catanzaro.
2125
2126         * UIProcess/API/glib/WebKitSettings.cpp:
2127         (webKitSettingsConstructed):
2128
2129 2018-09-20  Justin Michaud  <justin_michaud@apple.com>
2130
2131         Implement CSS Custom Properties and Values Skeleton
2132         https://bugs.webkit.org/show_bug.cgi?id=189694
2133
2134         Reviewed by Simon Fraser.
2135
2136         Add feature flag for CSS custom properties and values api
2137
2138         * Shared/WebPreferences.yaml:
2139         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2140         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2141
2142 2018-09-19  Dean Jackson  <dino@apple.com>
2143
2144         Temporarily move fullscreen back to experimental features
2145         https://bugs.webkit.org/show_bug.cgi?id=189770
2146         <rdar://problem/44619282>
2147
2148         Revert this change now that there is a commit to cherry-pick.
2149
2150         * Shared/WebPreferences.yaml:
2151
2152 2018-09-20  Chris Dumez  <cdumez@apple.com>
2153
2154         Unreviewed crash fix after r236226.
2155
2156         We need to protect |this| in WebProcessProxy::requestTermination().
2157
2158         * UIProcess/WebProcessProxy.cpp:
2159         (WebKit::WebProcessProxy::requestTermination):
2160
2161 2018-09-20  Antti Koivisto  <antti@apple.com>
2162
2163         REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on Mac
2164         https://bugs.webkit.org/show_bug.cgi?id=189663
2165         <rdar://problem/44184955>
2166
2167         Reviewed by Geoff Garen and Chris Dumez.
2168
2169         We need to keep the layer tree of the previous page alive and visible until we have something
2170         to render on the new page. With PSON on Mac this means that we should keep displaying the
2171         layer tree from the previus process.
2172
2173         This patch moves the management of 'attaching' the drawing area (Mac only concept) from web process
2174         to UI process. This is when we parent the layer tree to the view root layer. It also ensures that
2175         the layer tree is not deleted too early on process swap and that it still eventually gets deleted.
2176
2177         * UIProcess/DrawingAreaProxy.h:
2178         (WebKit::DrawingAreaProxy::attachInWebProcess):
2179         * UIProcess/SuspendedPageProxy.cpp:
2180         (WebKit::messageNamesToIgnoreWhileSuspended):
2181         (WebKit::SuspendedPageProxy::tearDownDrawingAreaInWebProcess):
2182
2183         We no longer tear down drawing area (layer tree) for suspended pages automatically. Send an explicit
2184         message for it.
2185
2186         * UIProcess/SuspendedPageProxy.h:
2187         * UIProcess/WebPageProxy.cpp:
2188         (WebKit::WebPageProxy::didCompletePageTransition):
2189
2190         Attach the drawing area if appropriate.
2191
2192         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2193
2194         Call PageClien::processWillSwap instead of processDidExit when appropriate.
2195
2196         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
2197
2198         This is called when we have switched to the new layer tree.
2199         Tear down the drawing area in the previus process.
2200
2201         * UIProcess/WebPageProxy.h:
2202         * UIProcess/WebPageProxy.messages.in:
2203         * UIProcess/ios/PageClientImplIOS.h:
2204         * UIProcess/ios/PageClientImplIOS.mm:
2205         (WebKit::PageClientImpl::processWillSwap):
2206
2207         On iOS this just call processDidExit for now.
2208
2209         * UIProcess/mac/PageClientImplMac.h:
2210         * UIProcess/mac/PageClientImplMac.mm:
2211         (WebKit::PageClientImpl::processWillSwap):
2212         (WebKit::PageClientImpl::processDidExit):
2213
2214         Add processWillSwap separately from processDidExit. They are currently the same
2215         except processWillSwap doesn't clear the root layer.
2216
2217         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
2218         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2219         (WebKit::TiledCoreAnimationDrawingAreaProxy::attachInWebProcess):
2220
2221         Send a message to the web process to attach the drawing area.
2222
2223         * WebProcess/WebPage/DrawingArea.h:
2224         (WebKit::DrawingArea::attach):
2225         (WebKit::DrawingArea::attachDrawingArea): Deleted.
2226
2227         Rename to be less redundant.
2228
2229         * WebProcess/WebPage/DrawingArea.messages.in:
2230         * WebProcess/WebPage/WebPage.cpp:
2231         (WebKit::WebPage::reinitializeWebPage):
2232
2233         Don't attach drawing area automatically. It will be done by a message from UI process.
2234
2235         (WebKit::WebPage::setLayerTreeStateIsFrozen):
2236
2237         Layer tree is always frozen in a suspended process (if it exists).
2238
2239         (WebKit::WebPage::didReceivePolicyDecision):
2240
2241         Suspend immediately when receiving policy decision to avoid flash on 'about:blank' loading.
2242
2243         (WebKit::WebPage::didStartPageTransition):
2244         (WebKit::WebPage::didCompletePageTransition):
2245
2246         Notify UI process of transition completion.
2247
2248         (WebKit::WebPage::setIsSuspended):
2249         (WebKit::WebPage::tearDownDrawingAreaForSuspend):
2250         * WebProcess/WebPage/WebPage.h:
2251         * WebProcess/WebPage/WebPage.messages.in:
2252         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2253         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2254         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
2255
2256         Don't attach drawing area automatically. It will be done by a message from UI process.
2257
2258         (WebKit::TiledCoreAnimationDrawingArea::attach):
2259         (WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Deleted.
2260
2261 2018-09-20  Tomas Popela  <tpopela@redhat.com>
2262
2263         [GTK] Always prints in portrait when landscape is requested
2264         https://bugs.webkit.org/show_bug.cgi?id=189543
2265
2266         Reviewed by Michael Catanzaro.
2267
2268         We have to change the surface size based on the requested orientation.
2269         Otherwise only portrait will be printed as it's hardcoded.
2270
2271         * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
2272
2273 2018-09-19  Dean Jackson  <dino@grorg.org>
2274
2275         Temporarily move fullscreen back to experimental features
2276         https://bugs.webkit.org/show_bug.cgi?id=189770
2277         <rdar://problem/44619282>
2278
2279         Reviewed by Simon Fraser.
2280
2281         Make fullscreen an experimental feature again.
2282
2283         * Shared/WebPreferences.yaml:
2284
2285 2018-09-19  Dawei Fenton  <realdawei@apple.com>
2286
2287         Unreviewed, rolling out r236229.
2288
2289         caused API timouts on mac and ios
2290
2291         Reverted changeset:
2292
2293         "Clear persistent storage between tests for
2294         resourceLoadStatistics"
2295         https://bugs.webkit.org/show_bug.cgi?id=189684
2296         https://trac.webkit.org/changeset/236229
2297
2298 2018-09-19  Alex Christensen  <achristensen@webkit.org>
2299
2300         REGRESSION(236154) C API clients not using WKPageSetPageNavigationClient couldn't complete HTTPS requests
2301         https://bugs.webkit.org/show_bug.cgi?id=189771
2302
2303         Reviewed by Tim Horton.
2304
2305         * UIProcess/API/APINavigationClient.h:
2306         (API::NavigationClient::didReceiveAuthenticationChallenge):
2307         Perform default behavior if there's an authentication challenge but we're using the default navigation client.
2308         I wish we had infrastructure to test this but WebKitTestRunner uses WKPageSetNavigationClient
2309         and we don't have the ability to do networking from API tests.  This is a growing problem I intend to solve.
2310
2311 2018-09-19  Woodrow Wang  <woodrow_wang@apple.com>
2312
2313         Clear persistent storage between tests for resourceLoadStatistics
2314         https://bugs.webkit.org/show_bug.cgi?id=189684
2315         <rdar://problem/44540099>
2316
2317         Reviewed by Chris Dumez.
2318
2319         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2320         (WKWebsiteDataStoreStatisticsResetToConsistentState):
2321         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2322         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
2323
2324         Remove function only called in testing for resetting statistics to consistent
2325         state. 
2326         
2327         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory): Deleted.
2328
2329 2018-09-19  Chris Dumez  <cdumez@apple.com>
2330
2331         Crash under WebPageProxy::decidePolicyForNavigationAction()
2332         https://bugs.webkit.org/show_bug.cgi?id=189763
2333         <rdar://problem/44597111>
2334
2335         Reviewed by Alex Christensen.
2336
2337         Update WebNavigationState::navigation() / WebNavigationState::takeNavigation()
2338         to return a pointer instead of a reference as we have evidence that they can
2339         return null. I kept the debug assertions to try and catch the cases where we
2340         return null but at least we stop crashing in release builds.
2341
2342         * UIProcess/WebNavigationState.cpp:
2343         (WebKit::WebNavigationState::navigation):
2344         (WebKit::WebNavigationState::takeNavigation):
2345         * UIProcess/WebNavigationState.h:
2346         * UIProcess/WebPageProxy.cpp:
2347         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
2348         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
2349         (WebKit::WebPageProxy::didCommitLoadForFrame):
2350         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
2351         (WebKit::WebPageProxy::didFinishLoadForFrame):
2352         (WebKit::WebPageProxy::didFailLoadForFrame):
2353         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
2354         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2355         (WebKit::WebPageProxy::decidePolicyForResponse):
2356
2357 2018-09-19  Chris Dumez  <cdumez@apple.com>
2358
2359         Crash under WebProcessProxy::suspendedPageWasDestroyed(WebKit::SuspendedPageProxy&)
2360         https://bugs.webkit.org/show_bug.cgi?id=189721
2361         <rdar://problem/44359788>
2362
2363         Reviewed by Geoffrey Garen.
2364
2365         Fix crash when destroying a SuspendedPageProxy whose WebProcessProxy was already
2366         destroyed.
2367
2368         * UIProcess/SuspendedPageProxy.cpp:
2369         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
2370         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
2371         * UIProcess/SuspendedPageProxy.h:
2372         (WebKit::SuspendedPageProxy::process const):
2373         Update SuspendedPageProxy::m_process to be a RefPtr<> instead of a raw pointer, similarly
2374         to what we do in WebPageProxy. Relying on the WebProcessProxy to not get destroyed is
2375         risky as this crash demonstrates.
2376
2377         * UIProcess/WebProcessProxy.cpp:
2378         (WebKit::WebProcessProxy::requestTermination):
2379         When a WebProcessProxy is terminated (by client or WebKit due to memory / cpu usage), call
2380         webProcessDidClose() on all SuspendedPages, similarly to what we do in case of a crash in
2381         processDidTerminateOrFailedToLaunch(). Failing to do so means that the SuspendedPageProxy
2382         may still have a pointer to this WebProcessProxy, even though WebProcessProxy::shutDown()
2383         has been called (which may destroy the WebProcessProxy).
2384
2385 2018-09-19  John Wilander  <wilander@apple.com>
2386
2387         Resource Load Statistics: Add optional cap on partitioned cache max age
2388         https://bugs.webkit.org/show_bug.cgi?id=189711
2389         <rdar://problem/39246837>
2390
2391         Reviewed by Antti Koivisto and Chris Dumez.
2392
2393         These changes add the capability to set a max age cap for prevalent resources
2394         and consults it when retrieving cache entries. If an entry is capped and found
2395         to be too old, it will not be used but instead removed from the cache.
2396
2397         This functionality is off by default because no cap is set by default.
2398
2399         * NetworkProcess/NetworkProcess.cpp:
2400         (WebKit::NetworkProcess::setCacheMaxAgeCapForPrevalentResources):
2401         (WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources):
2402             Infrastructure for testing.
2403         * NetworkProcess/NetworkProcess.h:
2404         * NetworkProcess/NetworkProcess.messages.in:
2405         * NetworkProcess/NetworkResourceLoader.cpp:
2406         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2407             Now sends in the session ID in the retrieve call.
2408         * NetworkProcess/cache/NetworkCache.cpp:
2409         (WebKit::NetworkCache::hasReachedPrevalentResourceAgeCap):
2410             Static convenience function.
2411         (WebKit::NetworkCache::makeUseDecision):
2412             Now receives an optional maxAge parameter and checks
2413             hasReachedPrevalentResourceAgeCap() first.
2414         (WebKit::NetworkCache::Cache::retrieve):
2415             Now takes a session ID.
2416         * NetworkProcess/cache/NetworkCache.h:
2417         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
2418         (WebKit::NetworkCache::cachedEntryReuseFailureToDiagnosticKey):
2419             Added UseDecision::NoDueToPrevalentResourceAgeCap which causes a
2420             return of WebCore::DiagnosticLoggingKeys::otherKey().
2421         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2422         (WKWebsiteDataStoreSetStatisticsCacheMaxAgeCap):
2423         (WKWebsiteDataStoreStatisticsResetToConsistentState):
2424             Infrastructure for testing.
2425         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2426         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
2427         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
2428             Now supports a user default ResourceLoadStatisticsCacheMaxAgeCap.
2429         * UIProcess/Network/NetworkProcessProxy.cpp:
2430         (WebKit::NetworkProcessProxy::hasStorageAccessForFrame):
2431         (WebKit::NetworkProcessProxy::grantStorageAccess):
2432         (WebKit::NetworkProcessProxy::removeAllStorageAccess):
2433         (WebKit::NetworkProcessProxy::getAllStorageAccessEntries):
2434         (WebKit::NetworkProcessProxy::setCacheMaxAgeCapForPrevalentResources):
2435         (WebKit::NetworkProcessProxy::didSetCacheMaxAgeCapForPrevalentResources):
2436         (WebKit::NetworkProcessProxy::resetCacheMaxAgeCapForPrevalentResources):
2437         (WebKit::NetworkProcessProxy::didResetCacheMaxAgeCapForPrevalentResources):
2438         (WebKit::nextRequestStorageAccessContextId): Deleted.
2439             Deleted this to make all code use the generic generateCallbackID().
2440         * UIProcess/Network/NetworkProcessProxy.h:
2441         * UIProcess/Network/NetworkProcessProxy.messages.in:
2442             Used to transfer the setting from the UI process to the network process. 
2443         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
2444         (WebKit::ResourceLoadStatisticsMemoryStore::setCacheMaxAgeCap):
2445         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
2446         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2447         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
2448         * UIProcess/WebResourceLoadStatisticsStore.h:
2449         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2450         (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
2451         (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources):
2452         * UIProcess/WebsiteData/WebsiteDataStore.h:
2453
2454 2018-09-18  Brent Fulgham  <bfulgham@apple.com>
2455
2456         [iOS] Allow WebContent process to check the "Protocol Characteristics" of files to which it has access
2457         https://bugs.webkit.org/show_bug.cgi?id=189712
2458         <rdar://problem/44386429>
2459
2460         Reviewed by Alex Christensen.
2461
2462         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2463
2464 2018-09-18  Chris Dumez  <cdumez@apple.com>
2465
2466         [iOS] Crash under WebPageProxy::navigationGestureSnapshotWasRemoved()
2467         https://bugs.webkit.org/show_bug.cgi?id=189714
2468         <rdar://problem/32839498>
2469
2470         Reviewed by Tim Horton.
2471
2472         The ViewGestureController::removeSwipeSnapshot() implementation for iOS calls
2473         navigationGestureSnapshotWasRemoved() on m_webPageProxyForBackForwardListForCurrentSwipe.
2474         m_webPageProxyForBackForwardListForCurrentSwipe can differ from m_webPageProxy, and
2475         is a RefPtr<>. This means that this WebPageProxy's WKWebView might have been deallocated,
2476         in which case we'll crash when trying to use the pageClient in
2477         WebPageProxy::navigationGestureSnapshotWasRemoved(). To address the issue, we now return
2478         early in WebPageProxy::navigationGestureSnapshotWasRemoved() if m_isClosed is true,
2479         after resetting m_isShowingNavigationGestureSnapshot to false but *before* trying to use
2480         the pageClient. When a WKWebView is deallocated, it calls WebPageProxy::close(), which
2481         sets m_isClosed to true.
2482
2483         * UIProcess/WebPageProxy.cpp:
2484         (WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved):
2485
2486 2018-09-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2487
2488         [Curl] Limit capturing extra metrics for Web Inspector when not required.
2489         https://bugs.webkit.org/show_bug.cgi?id=189520
2490
2491         Reviewed by Alex Christensen.
2492
2493         Respect the value of NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics() to reduce the process
2494         time when they are not needed.
2495
2496         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2497         (WebKit::NetworkDataTaskCurl::createCurlRequest):
2498
2499 2018-09-18  Alex Christensen  <achristensen@webkit.org>
2500
2501         Make WebPageProxy always have a API::NavigationClient instead of always having a API::LoaderClient and API::PolicyClient
2502         https://bugs.webkit.org/show_bug.cgi?id=189012
2503
2504         Reviewed by Andy Estes.
2505
2506         When WebKit2 was being developed, we initially made the C API WKPageSetPagePolicyClient and WKPageSetPageLoaderClient.
2507         When we released WKWebView, it was using WKNavigationDelegate, equivalent to WKPageSetPageNavigationClient.
2508         To support one or the other, we would use the navigation client if it was present, but if not we would fall back to the
2509         loader or policy client.  Since the loader and policy clients are now being minimally supported only until legacy
2510         software migrates to the navigation client, we are adding new functionality to the navigation client.
2511         Making the navigation client the default and using the loader or policy client only if they are present supports
2512         the legacy software and makes us have fewer forgotten null checks when adding new functionality to the navigation client.
2513
2514         * UIProcess/API/C/WKPage.cpp:
2515         (WKPageSetPageNavigationClient):
2516         * UIProcess/Cocoa/NavigationState.h:
2517         * UIProcess/Cocoa/NavigationState.mm:
2518         (WebKit::NavigationState::createNavigationClient):
2519         * UIProcess/WebPageProxy.cpp:
2520         (WebKit::WebPageProxy::WebPageProxy):
2521         (WebKit::WebPageProxy::setNavigationClient):
2522         (WebKit::WebPageProxy::setLoaderClient):
2523         (WebKit::WebPageProxy::setPolicyClient):
2524         (WebKit::WebPageProxy::close):
2525         (WebKit::WebPageProxy::didChangeBackForwardList):
2526         (WebKit::WebPageProxy::willGoToBackForwardListItem):
2527         (WebKit::WebPageProxy::findPlugin):
2528         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
2529         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
2530         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
2531         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
2532         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
2533         (WebKit::WebPageProxy::didCommitLoadForFrame):
2534         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
2535         (WebKit::WebPageProxy::didFinishLoadForFrame):
2536         (WebKit::WebPageProxy::didFailLoadForFrame):
2537         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
2538         (WebKit::WebPageProxy::didReachLayoutMilestone):
2539         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
2540         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
2541         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2542         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2543         (WebKit::WebPageProxy::decidePolicyForResponse):
2544         (WebKit::WebPageProxy::contentRuleListNotification):
2545         (WebKit::WebPageProxy::webGLPolicyForURL):
2546         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
2547         (WebKit::WebPageProxy::processDidBecomeUnresponsive):
2548         (WebKit::WebPageProxy::processDidBecomeResponsive):
2549         (WebKit::WebPageProxy::dispatchProcessDidTerminate):
2550         (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
2551         (WebKit::WebPageProxy::wrapCryptoKey):
2552         (WebKit::WebPageProxy::unwrapCryptoKey):
2553         (WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
2554         (WebKit::WebPageProxy::navigationGestureDidBegin):
2555         (WebKit::WebPageProxy::navigationGestureWillEnd):
2556         (WebKit::WebPageProxy::navigationGestureDidEnd):
2557         (WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved):
2558         * UIProcess/WebPageProxy.h:
2559
2560 2018-09-18  Alex Christensen  <achristensen@webkit.org>
2561
2562         Clean up AuthenticationChallengeProxy
2563         https://bugs.webkit.org/show_bug.cgi?id=189668
2564
2565         Reviewed by Youenn Fablet.
2566
2567         At its core, it's a CompletionHandler with some information.
2568         Make it more elegant and simple with no change in behavior and reduce the complexity of this security-sensitive object.
2569
2570         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2571         (toNSURLSessionAuthChallengeDisposition):
2572         * Shared/Authentication/AuthenticationManager.cpp:
2573         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge):
2574         * Shared/Authentication/AuthenticationManager.h:
2575         * UIProcess/API/C/WKAuthenticationChallenge.cpp:
2576         (WKAuthenticationChallengeGetDecisionListener):
2577         (WKAuthenticationChallengeGetProtectionSpace):
2578         (WKAuthenticationChallengeGetProposedCredential):
2579         (WKAuthenticationChallengeGetPreviousFailureCount):
2580         * UIProcess/API/C/WKPage.cpp:
2581         (WKPageSetPageNavigationClient):
2582         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm:
2583         (-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]):
2584         (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
2585         (-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]):
2586         (-[WKNSURLAuthenticationChallengeSender performDefaultHandlingForAuthenticationChallenge:]):
2587         (-[WKNSURLAuthenticationChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]):
2588         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
2589         (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
2590         (WebKit::AuthenticationChallengeProxy::~AuthenticationChallengeProxy): Deleted.
2591         (WebKit::AuthenticationChallengeProxy::useCredential): Deleted.
2592         (WebKit::AuthenticationChallengeProxy::cancel): Deleted.
2593         (WebKit::AuthenticationChallengeProxy::performDefaultHandling): Deleted.
2594         (WebKit::AuthenticationChallengeProxy::rejectProtectionSpaceAndContinue): Deleted.
2595         (WebKit::AuthenticationChallengeProxy::proposedCredential const): Deleted.
2596         (WebKit::AuthenticationChallengeProxy::protectionSpace const): Deleted.
2597         (WebKit::AuthenticationChallengeProxy::setSecKeyProxyStore): Deleted.
2598         * UIProcess/Authentication/AuthenticationChallengeProxy.h:
2599         (WebKit::AuthenticationChallengeProxy::create):
2600         (WebKit::AuthenticationChallengeProxy::listener const):
2601         (WebKit::AuthenticationChallengeProxy::previousFailureCount const): Deleted.
2602         * UIProcess/Authentication/AuthenticationDecisionListener.cpp:
2603         (WebKit::AuthenticationDecisionListener::AuthenticationDecisionListener):
2604         (WebKit::AuthenticationDecisionListener::~AuthenticationDecisionListener):
2605         (WebKit::AuthenticationDecisionListener::useCredential):
2606         (WebKit::AuthenticationDecisionListener::cancel):
2607         (WebKit::AuthenticationDecisionListener::performDefaultHandling):
2608         (WebKit::AuthenticationDecisionListener::rejectProtectionSpaceAndContinue):
2609         (WebKit::AuthenticationDecisionListener::detachChallenge): Deleted.
2610         * UIProcess/Authentication/AuthenticationDecisionListener.h:
2611         (WebKit::AuthenticationDecisionListener::create):
2612         * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:
2613         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc):
2614         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc const): Deleted.
2615         * UIProcess/Cocoa/DownloadClient.mm:
2616         (WebKit::DownloadClient::didReceiveAuthenticationChallenge):
2617         * UIProcess/Cocoa/NavigationState.mm:
2618         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
2619         * UIProcess/Downloads/DownloadProxy.cpp:
2620         (WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
2621         * UIProcess/Network/NetworkProcessProxy.cpp:
2622         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
2623         * UIProcess/ServiceWorkerProcessProxy.cpp:
2624         (WebKit::ServiceWorkerProcessProxy::didReceiveAuthenticationChallenge):
2625         * UIProcess/WebPageProxy.cpp:
2626         (WebKit::WebPageProxy::secKeyProxyStore):
2627         (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
2628         * UIProcess/WebPageProxy.h:
2629
2630 2018-09-18  Ben Richards  <benton_richards@apple.com>
2631
2632         Add script to generate WebContent service resource files and change XPC service main SPI to have it's own header
2633         https://bugs.webkit.org/show_bug.cgi?id=188601
2634
2635         Reviewed by Dan Bernstein.
2636
2637         Added a script to the process entitlements build phase of the WebContent service that copies resource
2638         files to WebKit.framework/PrivateHeaders/CustomWebContentResources. These resource files are to
2639         be used by clients who would like to make a custom WebContent service.
2640
2641         * Scripts/copy-webcontent-resources-to-private-headers.sh: Added.
2642         * WebKit.xcodeproj/project.pbxproj:
2643         * WebProcess/API/Cocoa/WKWebProcess.h: Drive-by fix to make this header compileable alone.
2644
2645 2018-09-18  Ryan Haddad  <ryanhaddad@apple.com>
2646
2647         Unreviewed, rolling out r236138.
2648
2649         Caused API test and layout test failures on iOS.
2650
2651         Reverted changeset:
2652
2653         "REGRESSION (PSON): White or Black flash occurs when process
2654         swapping on navigation on Mac"
2655         https://bugs.webkit.org/show_bug.cgi?id=189663
2656         https://trac.webkit.org/changeset/236138
2657
2658 2018-09-18  Eric Carlson  <eric.carlson@apple.com>
2659
2660         Always log when granting/revoking capture sandbox extensions
2661         https://bugs.webkit.org/show_bug.cgi?id=189701
2662         <rdar://problem/44564029>
2663
2664         Reviewed by Youenn Fablet.
2665
2666         * UIProcess/UserMediaProcessManager.cpp:
2667         (WebKit::UserMediaProcessManager::willCreateMediaStream): Always log.
2668         (WebKit::UserMediaProcessManager::endedCaptureSession): Ditto.
2669
2670         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2671         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Ditto.
2672         (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): Ditto.
2673
2674 2018-09-18  Youenn Fablet  <youenn@apple.com>
2675
2676         Enable Unified Plan by default
2677         https://bugs.webkit.org/show_bug.cgi?id=189675
2678
2679         Reviewed by Eric Carlson.
2680
2681         * Shared/WebPreferences.yaml:
2682
2683 2018-09-18  Antti Koivisto  <antti@apple.com>
2684
2685         REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on Mac
2686         https://bugs.webkit.org/show_bug.cgi?id=189663
2687         <rdar://problem/44184955>
2688
2689         Reviewed by Geoff Garen.
2690
2691         We need to keep the layer tree of the previous page alive and visible until we have something
2692         to render on the new page. With PSON on Mac this means that we should keep displaying the
2693         layer tree from the previus process.
2694
2695         This patch moves the management of 'attaching' the drawing area (Mac only concept) from web process
2696         to UI process. This is when we parent the layer tree to the view root layer. It also ensures that
2697         the layer tree is not deleted too early on process swap and that it still eventually gets deleted.
2698
2699         * UIProcess/DrawingAreaProxy.h:
2700         (WebKit::DrawingAreaProxy::attachInWebProcess):
2701         * UIProcess/SuspendedPageProxy.cpp:
2702         (WebKit::messageNamesToIgnoreWhileSuspended):
2703         (WebKit::SuspendedPageProxy::tearDownDrawingAreaInWebProcess):
2704
2705         We no longer tear down drawing area (layer tree) for suspended pages automatically. Send an explicit
2706         message for it.
2707
2708         * UIProcess/SuspendedPageProxy.h:
2709         * UIProcess/WebPageProxy.cpp:
2710         (WebKit::WebPageProxy::reattachToWebProcess):
2711
2712         Only call didRelaunchProcess when process actually relaunched (not navigation process launch) to
2713         match not calling processDidExit in resetStateAfterProcessExited.
2714
2715         (WebKit::WebPageProxy::didCompletePageTransition):
2716
2717         Attach the drawing area if appropriate.
2718
2719         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2720
2721         Send suspend message to WebPage immediately instead waiting for the runloop callback. This is needed so we
2722         can avoid flashing the initial empty document load when the new Page object is created.
2723
2724         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2725
2726         Don't call processDidExit when suspending, not exiting the process (this function needs a new name or rafactoring).
2727         This avoids clearing the drawing area and flashing to black.
2728
2729         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
2730
2731         This is called when we have switched to the new layer tree.
2732         Tear down the drawing area in the previus process.
2733
2734         * UIProcess/WebPageProxy.h:
2735         * UIProcess/WebPageProxy.messages.in:
2736         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
2737         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2738         (WebKit::TiledCoreAnimationDrawingAreaProxy::attachInWebProcess):
2739
2740         Send a message to the web process to attach the drawing area.
2741
2742         * WebProcess/WebPage/DrawingArea.h:
2743         (WebKit::DrawingArea::attach):
2744         (WebKit::DrawingArea::attachDrawingArea): Deleted.
2745
2746         Rename to be less redundant.
2747
2748         * WebProcess/WebPage/DrawingArea.messages.in:
2749         * WebProcess/WebPage/WebPage.cpp:
2750         (WebKit::WebPage::reinitializeWebPage):
2751
2752         Don't attach drawing area automatically. It will be done by a message from UI process.
2753
2754         (WebKit::WebPage::setLayerTreeStateIsFrozen):
2755
2756         Layer tree is always frozen in a suspended process (if it exists).
2757
2758         (WebKit::WebPage::didStartPageTransition):
2759         (WebKit::WebPage::didCompletePageTransition):
2760
2761         Notify UI process of transition completion.
2762
2763         (WebKit::WebPage::setIsSuspended):
2764         (WebKit::WebPage::tearDownDrawingAreaForSuspend):
2765         * WebProcess/WebPage/WebPage.h:
2766         * WebProcess/WebPage/WebPage.messages.in:
2767         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2768         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2769         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
2770
2771         Don't attach drawing area automatically. It will be done by a message from UI process.
2772
2773         (WebKit::TiledCoreAnimationDrawingArea::attach):
2774         (WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Deleted.
2775
2776 2018-09-18  Claudio Saavedra  <csaavedra@igalia.com>
2777
2778         [WPE] Implement mouse event modifiers
2779         https://bugs.webkit.org/show_bug.cgi?id=189697
2780
2781         Reviewed by Carlos Garcia Campos.
2782
2783         Only "CapsLocks" is missing, as WPE doesn't support that modifier.
2784         * Shared/wpe/WebEventFactory.cpp:
2785         (WebKit::modifiersForEventModifiers):
2786         (WebKit::WebEventFactory::createWebKeyboardEvent):
2787         (WebKit::WebEventFactory::createWebMouseEvent):
2788         (WebKit::modifiersForEvent): Deleted.
2789
2790 2018-09-17  Zan Dobersek  <zdobersek@igalia.com>
2791
2792         Unreviewed build fix after r236101.
2793
2794         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2795         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
2796         Correct a BinarySemaphore::wait() call which now accepts no arguments.
2797
2798 2018-09-17  Yusuke Suzuki  <utatane.tea@gmail.com>
2799
2800         [WTF] Use Semaphore and BinarySemaphore instead of dispatch_semaphore_t
2801         https://bugs.webkit.org/show_bug.cgi?id=185339
2802
2803         Reviewed by Mark Lam.
2804
2805         * Platform/IPC/Connection.cpp:
2806         (IPC::Connection::SyncMessageState::wait):
2807         * Shared/mac/SecItemShim.cpp:
2808         (WebKit::sendSecItemRequest):
2809         Use BinarySemaphore.
2810
2811         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
2812         (WebKit::ResourceLoadStatisticsPersistentStorage::finishAllPendingWorkSynchronously):
2813         * UIProcess/WebStorage/StorageManager.cpp:
2814         (WebKit::StorageManager::applicationWillTerminate):
2815         * UIProcess/ios/WKActionSheetAssistant.mm:
2816         (appLinkForURL):
2817         Use BinarySemaphore to wait for async completion handler. We also fix memory leak
2818         since the old code does not call dispatch_release for the used semaphore.
2819
2820 2018-09-17  Simon Fraser  <simon.fraser@apple.com>
2821
2822         Many modern media control tests leak documents in testing
2823         https://bugs.webkit.org/show_bug.cgi?id=189437
2824
2825         Reviewed by Darin Adler.
2826
2827         In order to accurately detect leaks in media controls tests which use lots of
2828         SVGImages, we have to:
2829         - Fire a zero-delay timer after the postTask, in order for ImagesLoader's m_derefElementTimer
2830           to clear references to elements.
2831         - Have releaseCriticalMemory() call CachedResourceLoader's garbageCollectDocumentResources()
2832           to drop the last handle to the CachedResource for an SVGImage.
2833         - Call WKBundleReleaseMemory() after the GC and timer, since we need garbageCollectDocumentResources()
2834           to run again after that timer has fired.
2835         
2836         This should fix most of the spurious leak reports involving SVGImage documents.
2837
2838         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
2839         (WKBundlePageCallAfterTasksAndTimers):
2840         (WKBundlePagePostTask): Deleted.
2841         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
2842
2843 2018-09-17  Dan Bernstein  <mitz@apple.com>
2844
2845         Try to fix Apple internal builds with the iOS 12.0 SDK.
2846
2847         * Configurations/WebKit.xcconfig: Disable framework header postprocessing for iOS 12.0.
2848
2849 2018-09-17  Ryan Haddad  <ryanhaddad@apple.com>
2850
2851         Unreviewed, rolling out r236092 because it breaks internal builds. Also,  remove stray '+' character from ChangeLog file.
2852
2853         * Scripts/copy-webcontent-resources-to-private-headers.sh: Removed.
2854         * WebKit.xcodeproj/project.pbxproj:
2855
2856 2018-08-17  Ben Richards  <benton_richards@apple.com>
2857
2858         Add script to generate WebContent service resource files and change XPC service main SPI to have it's own header
2859         https://bugs.webkit.org/show_bug.cgi?id=188601
2860
2861         Reviewed by Dan Bernstein.
2862
2863         Added a script to the process entitlements build phase of the WebContent service that copies resource
2864         files to WebKit.framework/PrivateHeaders/CustomWebContentResources. These resource files are to
2865         be used by clients who would like to make a custom WebContent service.
2866
2867         * Scripts/copy-webcontent-resources-to-private-headers.sh: Added.
2868         * WebKit.xcodeproj/project.pbxproj:
2869
2870
2871 2018-09-17  Simon Fraser  <simon.fraser@apple.com>
2872
2873         Add more Fullscreen logging
2874         https://bugs.webkit.org/show_bug.cgi?id=189656
2875
2876         Reviewed by Jer Noble.
2877
2878         Add some fullscreen logging so I can tell whether WebFullScreenManager ever releases
2879         the fullscreen element.
2880
2881         * WebProcess/FullScreen/WebFullScreenManager.cpp:
2882         (WebKit::WebFullScreenManager::WebFullScreenManager):
2883         (WebKit::WebFullScreenManager::videoControlsManagerDidChange):
2884         (WebKit::WebFullScreenManager::setPIPStandbyElement):
2885         (WebKit::WebFullScreenManager::enterFullScreenForElement):
2886         (WebKit::WebFullScreenManager::exitFullScreenForElement):
2887         (WebKit::WebFullScreenManager::willEnterFullScreen):
2888         (WebKit::WebFullScreenManager::didEnterFullScreen):
2889         (WebKit::WebFullScreenManager::willExitFullScreen):
2890         (WebKit::WebFullScreenManager::didExitFullScreen):
2891         (WebKit::WebFullScreenManager::close):
2892         * WebProcess/FullScreen/WebFullScreenManager.h:
2893
2894 2018-09-17  Tim Horton  <timothy_horton@apple.com>
2895
2896         Swipe snapshot can get stuck if swiping is disabled while it is visible
2897         https://bugs.webkit.org/show_bug.cgi?id=189667
2898         <rdar://problem/40367780>
2899
2900         Reviewed by Simon Fraser.
2901
2902         If navigation gestures are disabled while a swipe snapshot is visible,
2903         WKWebView will tear down the ViewGestureController, which means that
2904         the SnapshotRemovalTracker will no longer be around to ever remove
2905         the snapshot.
2906
2907         It's currently very hard to write a test for this because we have
2908         yet to come up with a good mechanism for testing swiping on iOS.
2909
2910         * UIProcess/API/Cocoa/WKWebView.mm:
2911         (-[WKWebView setAllowsBackForwardNavigationGestures:]):
2912         Instead of tearing down the ViewGestureController when navigation
2913         gestures are disabled, just set a bit on it that disables gestures.
2914
2915         * UIProcess/Cocoa/ViewGestureController.cpp:
2916         (WebKit::ViewGestureController::canSwipeInDirection const):
2917         * UIProcess/Cocoa/ViewGestureController.h:
2918         (WebKit::ViewGestureController::setSwipeGestureEnabled):
2919         (WebKit::ViewGestureController::isSwipeGestureEnabled):
2920         Add a bit to ViewGestureController that makes starting new gestures
2921         always fail, but allows e.g. snapshots from existing swipes to continue
2922         their usual behavior.
2923
2924 2018-09-17  Alex Christensen  <achristensen@webkit.org>
2925
2926         Expose WKWebProcess.h as a private header
2927         https://bugs.webkit.org/show_bug.cgi?id=189636
2928
2929         * WebKit.xcodeproj/project.pbxproj:
2930
2931 2018-09-17  Alex Christensen  <achristensen@webkit.org>
2932
2933         Expose XPCServiceMain in a WebProcess header rather than WKProcessPool
2934         https://bugs.webkit.org/show_bug.cgi?id=189636
2935
2936         Reviewed by Dan Bernstein.
2937
2938         Fix a few build failures along the way.
2939
2940         * PluginProcess/mac/PluginControllerProxyMac.mm:
2941         (WebKit::PluginControllerProxy::windowAndViewFramesChanged):
2942         (WebKit::PluginControllerProxy::updateLayerHostingContext):
2943         * PluginProcess/mac/PluginProcessMac.mm:
2944         (WebKit::replacedNSWorkspace_launchApplicationAtURL_options_configuration_error):
2945         (WebKit::PluginProcess::platformInitializeProcess):
2946         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
2947         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
2948         (WebKit::XPCServiceMain):
2949         (main):
2950         * SourcesCocoa.txt:
2951         * UIProcess/API/Cocoa/WKProcessPool.mm:
2952         (+[WKProcessPool _webContentProcessXPCMain]): Deleted.
2953         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2954         * WebKit.xcodeproj/project.pbxproj:
2955         * WebProcess/API: Added.
2956         * WebProcess/API/Cocoa: Added.
2957         * WebProcess/API/Cocoa/WKWebProcess.cpp: Added.
2958         (WKWebProcessMain):
2959         * WebProcess/API/Cocoa/WKWebProcess.h: Added.
2960         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
2961         (-[WKAccessibilityWebPageObject convertScreenPointToRootView:]):
2962         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
2963         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
2964
2965 2018-09-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2966
2967         [Curl] Respond with requested authentication scheme for authentication challenge.
2968         https://bugs.webkit.org/show_bug.cgi?id=189318
2969
2970         Reviewed by Alex Christensen.
2971
2972         Curl port depends on libcurl's authentication handling by enabling CURLAUTH_ANY. With this
2973         mode, the round-trip communication between the client and the server is handled by libcurl
2974         internally. That's okay for many cases. But when initial request has a credentials
2975         (i.e. XMLHttpRequest), there's no valid chance to store credential to the storage because
2976         the returned response is not 401.
2977
2978         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2979         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl):
2980         (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
2981         (WebKit::NetworkDataTaskCurl::tryHttpAuthentication):
2982         (WebKit::NetworkDataTaskCurl::tryProxyAuthentication):
2983         (WebKit::NetworkDataTaskCurl::restartWithCredential):
2984         * NetworkProcess/curl/NetworkDataTaskCurl.h:
2985
2986 2018-09-17  Woodrow Wang  <woodrow_wang@apple.com>
2987
2988         Clear pending resource load statistics' writes after tests
2989         https://bugs.webkit.org/show_bug.cgi?id=189632
2990         <rdar://problem/44469275>
2991
2992         Reviewed by Chris Dumez.
2993
2994         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2995         (WKWebsiteDataStoreStatisticsResetToConsistentState):
2996
2997 2018-09-17  Chris Dumez  <cdumez@apple.com>
2998
2999         PSON: window.open() with 'noopener' should only process-swap cross-site, not cross-origin
3000         https://bugs.webkit.org/show_bug.cgi?id=189602
3001         <rdar://problem/44430549>
3002
3003         Reviewed by Geoff Garen.
3004
3005         The following fixes were made to our process swap on navigation logic:
3006         - Browsing contexts opened via window.open() with 'noopener' option now only same if
3007           they are cross-site, instead of doing a stricter cross-origin check.
3008         - Support process swapping when opening a new window via <a target="_blank" rel="noopener">
3009           that is cross-site.
3010
3011         In order to support this, the following changes were made:
3012         - Stop passing a 'isCrossOriginWindowOpenNavigation' flag to the UIProcess when navigating because:
3013           - This is specific to window.open() and does not apply to other windows opened by DOM
3014           - This forces the origin check to happens on WebContent process side instead of relying on the
3015             one in WebProcessPool in the UIProcess
3016         - Pass the origin of the requester to the UIProcess when navigating, so that the WebProcessPool
3017           can use the requester's host for the cross-site check for the initial navigation in a new window
3018           created by DOM.
3019         - Add 2 flags to WebPageProxy which indicate if the page was created by the DOM and if any provisional
3020           loads have been committed. The WebProcessPool uses theses flags to recognize initial loads in
3021           new windows created by the DOM, so that it uses the requester's origin for the cross-site check.
3022
3023         * Shared/NavigationActionData.cpp:
3024         (WebKit::NavigationActionData::encode const):
3025         (WebKit::NavigationActionData::decode):
3026         * Shared/NavigationActionData.h:
3027         * UIProcess/API/APINavigation.h:
3028         (API::Navigation::setRequesterOrigin):
3029         (API::Navigation::requesterOrigin const):
3030         * UIProcess/WebPageProxy.cpp:
3031         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3032         (WebKit::WebPageProxy::didCommitLoadForFrame):
3033         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3034         (WebKit::WebPageProxy::createNewPage):
3035         * UIProcess/WebPageProxy.h:
3036         (WebKit::WebPageProxy::setOpenedByDOM):
3037         (WebKit::WebPageProxy::openedByDOM const):
3038         (WebKit::WebPageProxy::hasCommittedAnyProvisionalLoads const):
3039         * UIProcess/WebProcessPool.cpp:
3040         (WebKit::shouldUseSameProcessBasedOnURLs):
3041         (WebKit::WebProcessPool::processForNavigationInternal):
3042         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3043         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3044
3045 2018-09-17  Alexey Proskuryakov  <ap@apple.com>
3046
3047         Revert https://trac.webkit.org/r235910, because the new test times out.
3048         Crash under PlatformPopupMenuData::encode when interacting with a select menu that has variable fonts
3049         https://bugs.webkit.org/show_bug.cgi?id=188008
3050
3051         * Shared/cf/ArgumentCodersCF.cpp:
3052         (IPC::encode):
3053         (IPC::decode):
3054
3055 2018-09-17  Alex Christensen  <achristensen@webkit.org>
3056
3057         Refactoring related to Safe Browsing
3058         https://bugs.webkit.org/show_bug.cgi?id=189631
3059
3060         Reviewed by Tim Horton.
3061
3062         Make SafeBrowsingResult RefCounted.
3063         Move logic from an unnamed lambda to WebPageProxy::receivedNavigationPolicyDecision.
3064
3065         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3066         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
3067         (WebKit::WebPageProxy::contentFilterDidBlockLoadForFrame): Deleted.
3068         (WebKit::WebPageProxy::addPlatformLoadParameters): Deleted.
3069         (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): Deleted.
3070         (WebKit::WebPageProxy::startDrag): Deleted.
3071         (WebKit::WebPageProxy::setPromisedDataForImage): Deleted.
3072         (WebKit::WebPageProxy::setDragCaretRect): Deleted.
3073         (WebKit::WebPageProxy::platformRegisterAttachment): Deleted.
3074         (WebKit::WebPageProxy::platformCloneAttachment): Deleted.
3075         * UIProcess/SafeBrowsingResult.h:
3076         (WebKit::SafeBrowsingResult::create):
3077         * UIProcess/WebFramePolicyListenerProxy.cpp:
3078         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
3079         * UIProcess/WebFramePolicyListenerProxy.h:
3080         * UIProcess/WebFrameProxy.cpp:
3081         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
3082         * UIProcess/WebFrameProxy.h:
3083         * UIProcess/WebPageProxy.cpp:
3084         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3085         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3086         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
3087         (WebKit::WebPageProxy::decidePolicyForResponse):
3088         * UIProcess/WebPageProxy.h:
3089
3090 2018-09-17  Darin Adler  <darin@apple.com>
3091
3092         Use OpaqueJSString rather than JSRetainPtr inside WebKit
3093         https://bugs.webkit.org/show_bug.cgi?id=189652
3094
3095         Reviewed by Saam Barati.
3096
3097         * Shared/API/c/WKString.cpp: Removed unneeded include of JSStringRef.h.
3098
3099         * WebProcess/Automation/WebAutomationSessionProxy.cpp: Removed unneeded
3100         include of JSRetainPtr.
3101         (WebKit::toJSString): Deleted.
3102         (WebKit::toJSValue): Use OpaqueJSString::create.
3103         (WebKit::callPropertyFunction): Ditto.
3104         (WebKit::evaluate): Use adoptRef.
3105         (WebKit::evaluateJavaScriptCallback): Ditto.
3106         (WebKit::WebAutomationSessionProxy::scriptObjectForFrame):
3107         Use OpaqueJSString::create.
3108         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Use
3109         String rather than JSStringRef.
3110
3111         * WebProcess/Plugins/PDF/PDFPlugin.mm: Removed unneeded includes.
3112         (WebKit::PDFPlugin::runScriptsInPDFDocument): Use OpaqueJSString::create.
3113
3114 2018-09-17  Michael Catanzaro  <mcatanzaro@igalia.com>
3115
3116         Unreviewed, fix incorrect WPE build fix made in r236009
3117
3118         This isn't the right place to add the typedef. I failed to notice that the WebKitWebView
3119         type is not actually used anywhere in this header. Actually, the problematic function is no
3120         longer declared or used anywhere and was just missed when WebKitScriptDialog was refactored,
3121         so remove it.
3122
3123         * UIProcess/API/wpe/WebKitScriptDialog.h:
3124         * UIProcess/API/wpe/WebKitScriptDialogWPE.cpp:
3125         (webkitScriptDialogRun): Deleted.
3126
3127 2018-09-17  Sihui Liu  <sihui_liu@apple.com>
3128
3129         Move IndexedDB to Network Process
3130         https://bugs.webkit.org/show_bug.cgi?id=189415
3131         <rdar://problem/44396973>
3132
3133         Reviewed by Chris Dumez.
3134
3135         We are going to eliminate storage process and move its functionality to network process. 
3136         The reasons why we want to do this:
3137         1. Lower resource usage of having an additional process for storage operations, especially
3138         memory. Single storage process takes about 5MB memory on macOS.
3139         2. Reduce latency of Service Workers. After enabling Service Workers, we've seen
3140         regression in app launch. The launch time of storage process is partly attributed to this:
3141         Service Workers delay page loading until receiving response from storage process.
3142         3. We choose network process because UI process may have broader access in file system
3143         that we don't want the storage operations to have.
3144
3145         This patch is the first piece towards the goal. It mainly moves indexedDB from storage process
3146         to corresponding components of network process. Moving of Service Worker and stopping to 
3147         launch storage process will be done in following patches.
3148
3149         We expect to see the higher cpu and memory usage of network process as it is taking more work,
3150         but the overall gain in memory and latency after we completely remove storage process should be 
3151         positive.
3152
3153         * CMakeLists.txt:
3154         * DerivedSources.make:
3155         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp.
3156         (WebKit::WebIDBConnectionToClient::create):
3157         (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient):
3158         (WebKit::WebIDBConnectionToClient::~WebIDBConnectionToClient):
3159         (WebKit::WebIDBConnectionToClient::disconnectedFromWebProcess):
3160         (WebKit::WebIDBConnectionToClient::messageSenderConnection):
3161         (WebKit::WebIDBConnectionToClient::connectionToClient):
3162         (WebKit::WebIDBConnectionToClient::didDeleteDatabase):
3163         (WebKit::WebIDBConnectionToClient::didOpenDatabase):
3164         (WebKit::WebIDBConnectionToClient::didAbortTransaction):
3165         (WebKit::WebIDBConnectionToClient::didCommitTransaction):
3166         (WebKit::WebIDBConnectionToClient::didCreateObjectStore):
3167         (WebKit::WebIDBConnectionToClient::didDeleteObjectStore):
3168         (WebKit::WebIDBConnectionToClient::didRenameObjectStore):
3169         (WebKit::WebIDBConnectionToClient::didClearObjectStore):
3170         (WebKit::WebIDBConnectionToClient::didCreateIndex):
3171         (WebKit::WebIDBConnectionToClient::didDeleteIndex):
3172         (WebKit::WebIDBConnectionToClient::didRenameIndex):
3173         (WebKit::WebIDBConnectionToClient::didPutOrAdd):
3174         (WebKit::WebIDBConnectionToClient::handleGetResult):
3175         (WebKit::WebIDBConnectionToClient::didGetRecord):
3176         (WebKit::WebIDBConnectionToClient::didGetAllRecords):
3177         (WebKit::WebIDBConnectionToClient::didGetCount):
3178         (WebKit::WebIDBConnectionToClient::didDeleteRecord):
3179         (WebKit::WebIDBConnectionToClient::didOpenCursor):
3180         (WebKit::WebIDBConnectionToClient::didIterateCursor):
3181         (WebKit::WebIDBConnectionToClient::fireVersionChangeEvent):
3182         (WebKit::WebIDBConnectionToClient::didStartTransaction):
3183         (WebKit::WebIDBConnectionToClient::didCloseFromServer):
3184         (WebKit::WebIDBConnectionToClient::notifyOpenDBRequestBlocked):
3185         (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNames):
3186         (WebKit::WebIDBConnectionToClient::deleteDatabase):
3187         (WebKit::WebIDBConnectionToClient::openDatabase):
3188         (WebKit::WebIDBConnectionToClient::abortTransaction):
3189         (WebKit::WebIDBConnectionToClient::commitTransaction):
3190         (WebKit::WebIDBConnectionToClient::didFinishHandlingVersionChangeTransaction):
3191         (WebKit::WebIDBConnectionToClient::createObjectStore):
3192         (WebKit::WebIDBConnectionToClient::deleteObjectStore):
3193         (WebKit::WebIDBConnectionToClient::renameObjectStore):
3194         (WebKit::WebIDBConnectionToClient::clearObjectStore):
3195         (WebKit::WebIDBConnectionToClient::createIndex):
3196         (WebKit::WebIDBConnectionToClient::deleteIndex):
3197         (WebKit::WebIDBConnectionToClient::renameIndex):
3198         (WebKit::WebIDBConnectionToClient::putOrAdd):
3199         (WebKit::WebIDBConnectionToClient::getRecord):
3200         (WebKit::WebIDBConnectionToClient::getAllRecords):
3201         (WebKit::WebIDBConnectionToClient::getCount):
3202         (WebKit::WebIDBConnectionToClient::deleteRecord):
3203         (WebKit::WebIDBConnectionToClient::openCursor):
3204         (WebKit::WebIDBConnectionToClient::iterateCursor):
3205         (WebKit::WebIDBConnectionToClient::establishTransaction):
3206         (WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose):
3207         (WebKit::WebIDBConnectionToClient::databaseConnectionClosed):
3208         (WebKit::WebIDBConnectionToClient::abortOpenAndUpgradeNeeded):
3209         (WebKit::WebIDBConnectionToClient::didFireVersionChangeEvent):
3210         (WebKit::WebIDBConnectionToClient::openDBRequestCancelled):
3211         (WebKit::WebIDBConnectionToClient::confirmDidCloseFromServer):
3212         (WebKit::WebIDBConnectionToClient::getAllDatabaseNames):
3213         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.h.
3214         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.messages.in: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.messages.in.
3215         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3216         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
3217
3218         Code moved from StorageToWebProcessConnection::didReceiveMessage.
3219
3220         (WebKit::NetworkConnectionToWebProcess::didClose):
3221         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
3222
3223         Network process receives and stores sandbox extension of temporary files for later indexedDB
3224         use.
3225
3226         (WebKit::NetworkConnectionToWebProcess::didClose):
3227         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
3228         (WebKit::generateIDBConnectionToServerIdentifier):
3229         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
3230         (WebKit::NetworkConnectionToWebProcess::removeIDBConnectionToServer):
3231         * NetworkProcess/NetworkConnectionToWebProcess.h:
3232         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3233         * NetworkProcess/NetworkProcess.cpp:
3234         (WebKit::NetworkProcess::NetworkProcess):
3235         (WebKit::NetworkProcess::initializeNetworkProcess):
3236         (WebKit::NetworkProcess::addWebsiteDataStore):
3237         (WebKit::NetworkProcess::fetchWebsiteData):
3238         (WebKit::NetworkProcess::deleteWebsiteData):
3239         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
3240         (WebKit::NetworkProcess::idbServer):
3241         (WebKit::NetworkProcess::ensurePathExists):
3242         (WebKit::NetworkProcess::postStorageTask):
3243         (WebKit::NetworkProcess::performNextStorageTask):
3244         (WebKit::NetworkProcess::prepareForAccessToTemporaryFile):
3245         (WebKit::NetworkProcess::accessToTemporaryFileComplete):
3246         (WebKit::NetworkProcess::indexedDatabaseOrigins):
3247         (WebKit::NetworkProcess::addIndexedDatabaseSession):
3248         (WebKit::NetworkProcess::getSandboxExtensionsForBlobFiles):
3249
3250         Instead of asking UI process to grant sandbox extension to storage process, now network 
3251         process just asks for sandbox extension fot itself.
3252
3253         (WebKit::NetworkProcess::didGetSandboxExtensionsForBlobFiles):
3254         (WebKit::NetworkProcess::updateTemporaryFileSandboxExtensions):
3255         (WebKit::NetworkProcess::grantSandboxExtensionsToStorageProcessForBlobs): Deleted.
3256         (WebKit::NetworkProcess::didGrantSandboxExtensionsToStorageProcessForBlobs): Deleted.
3257         * NetworkProcess/NetworkProcess.h:
3258         * NetworkProcess/NetworkProcess.messages.in:
3259         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3260         (WebKit::NetworkProcessCreationParameters::encode const):
3261         (WebKit::NetworkProcessCreationParameters::decode):
3262         * NetworkProcess/NetworkProcessCreationParameters.h:
3263         * Shared/Storage/StorageProcessCreationParameters.cpp:
3264         (WebKit::StorageProcessCreationParameters::encode const):
3265         (WebKit::StorageProcessCreationParameters::decode):
3266         * Shared/Storage/StorageProcessCreationParameters.h:
3267         * Shared/WebsiteDataStoreParameters.cpp:
3268         (WebKit::WebsiteDataStoreParameters::encode const):
3269         (WebKit::WebsiteDataStoreParameters::decode):
3270         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
3271         * Shared/WebsiteDataStoreParameters.h:
3272         * Sources.txt:
3273         * StorageProcess/StorageProcess.cpp:
3274         (WebKit::StorageProcess::initializeWebsiteDataStore):
3275         (WebKit::StorageProcess::fetchWebsiteData):
3276         (WebKit::StorageProcess::deleteWebsiteData):
3277         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
3278         (WebKit::StorageProcess::idbServer): Deleted.
3279         (WebKit::StorageProcess::grantSandboxExtensionsForBlobs): Deleted.
3280         (WebKit::StorageProcess::prepareForAccessToTemporaryFile): Deleted.
3281         (WebKit::StorageProcess::accessToTemporaryFileComplete): Deleted.
3282         (WebKit::StorageProcess::indexedDatabaseOrigins): Deleted.
3283         (WebKit::StorageProcess::getSandboxExtensionsForBlobFiles): Deleted.
3284         (WebKit::StorageProcess::didGetSandboxExtensionsForBlobFiles): Deleted.
3285         * StorageProcess/StorageProcess.h:
3286         (WebKit::StorageProcess::queue): Deleted.
3287         * StorageProcess/StorageProcess.messages.in:
3288         * StorageProcess/StorageToWebProcessConnection.cpp:
3289         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
3290         (WebKit::StorageToWebProcessConnection::didClose):
3291         (WebKit::generateIDBConnectionToServerIdentifier): Deleted.
3292         (WebKit::StorageToWebProcessConnection::establishIDBConnectionToServer): Deleted.
3293         (WebKit::StorageToWebProcessConnection::removeIDBConnectionToServer): Deleted.
3294         * StorageProcess/StorageToWebProcessConnection.h:
3295         * StorageProcess/StorageToWebProcessConnection.messages.in:
3296         * UIProcess/Network/NetworkProcessProxy.cpp:
3297         (WebKit::NetworkProcessProxy::getSandboxExtensionsForBlobFiles):
3298         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToStorageProcessForBlobs): Deleted.
3299         * UIProcess/Network/NetworkProcessProxy.h:
3300         * UIProcess/Network/NetworkProcessProxy.messages.in:
3301         * UIProcess/Storage/StorageProcessProxy.cpp:
3302         (WebKit::StorageProcessProxy::getSandboxExtensionsForBlobFiles): Deleted.
3303         * UIProcess/Storage/StorageProcessProxy.h:
3304         * UIProcess/Storage/StorageProcessProxy.messages.in:
3305         * UIProcess/WebProcessPool.cpp:
3306         (WebKit::WebProcessPool::ensureNetworkProcess):
3307         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
3308         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
3309         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3310         (WebKit::WebsiteDataStore::parameters):
3311         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3312         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
3313         (WebKit::WebsiteDataStore::fetchDataAndApply):
3314         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
3315         (WebKit::WebsiteDataStore::removeData):
3316         (WebKit::WebsiteDataStore::storageProcessParameters):
3317         (WebKit::WebsiteDataStore::parameters):
3318         * WebKit.xcodeproj/project.pbxproj:
3319         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
3320         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
3321         (WebKit::WebIDBConnectionToServer::~WebIDBConnectionToServer):
3322         (WebKit::WebIDBConnectionToServer::messageSenderConnection):
3323         * WebProcess/Databases/WebDatabaseProvider.cpp:
3324         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
3325         * WebProcess/Network/NetworkProcessConnection.cpp:
3326         (WebKit::NetworkProcessConnection::didReceiveMessage):
3327         (WebKit::NetworkProcessConnection::didClose):
3328         (WebKit::NetworkProcessConnection::idbConnectionToServerForSession):
3329         * WebProcess/Network/NetworkProcessConnection.h:
3330         (WebKit::NetworkProcessConnection::existingIDBConnectionToServerForIdentifier const):
3331         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
3332         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
3333         (WebKit::WebToStorageProcessConnection::didClose):
3334         (WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession): Deleted.
3335         * WebProcess/Storage/WebToStorageProcessConnection.h:
3336         (WebKit::WebToStorageProcessConnection::existingIDBConnectionToServerForIdentifier): Deleted.
3337         * WebProcess/WebProcess.cpp:
3338         (WebKit::WebProcess::networkProcessConnectionClosed):
3339         (WebKit::WebProcess::webToStorageProcessConnectionClosed):
3340
3341 2018-09-08  Darin Adler  <darin@apple.com>
3342
3343         Streamline JSRetainPtr, fix leaks of JSString and JSGlobalContext
3344         https://bugs.webkit.org/show_bug.cgi?id=189455
3345
3346         Reviewed by Keith Miller.
3347
3348         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3349         (WebKit::toJSString): Use adopt function instead of adopt construuctor.
3350         (WebKit::evaluate): Ditto.
3351         (WebKit::evaluateJavaScriptCallback): Ditto.
3352         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Ditto.
3353
3354 2018-09-14  Matt Lewis  <jlewis3@apple.com>
3355
3356         Unreviewed, rolling out r236020.
3357
3358         This caused an api failure on High Sierra
3359
3360         Reverted changeset:
3361
3362         "Refactoring related to Safe Browsing"
3363         https://bugs.webkit.org/show_bug.cgi?id=189631
3364         https://trac.webkit.org/changeset/236020
3365
3366 2018-09-14  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3367
3368         [Curl] Bug fix on some inaccurate values in NetworkLoadMetrics.
3369         https://bugs.webkit.org/show_bug.cgi?id=189530
3370
3371         Reviewed by Alex Christensen.
3372
3373         Curl port uses the start time libcurl provided. But there's a lug between main thread and Curl thread.
3374         Record the start time of request instead of libcurl's start timing and use it to measure the metrics.
3375
3376         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3377         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl):
3378         (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
3379         (WebKit::NetworkDataTaskCurl::restartWithCredential):
3380         * NetworkProcess/curl/NetworkDataTaskCurl.h:
3381
3382 2018-09-14  Alex Christensen  <achristensen@webkit.org>
3383
3384         Refactoring related to Safe Browsing
3385         https://bugs.webkit.org/show_bug.cgi?id=189631
3386
3387         Reviewed by Tim Horton.
3388
3389         Make SafeBrowsingResult RefCounted.
3390         Move logic from an unnamed lambda to WebPageProxy::receivedNavigationPolicyDecision.
3391
3392