Use a Variant for FormDataElement
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-09-21  Alex Christensen  <achristensen@webkit.org>
2
3         Use a Variant for FormDataElement
4         https://bugs.webkit.org/show_bug.cgi?id=189777
5
6         Reviewed by Chris Dumez.
7
8         * NetworkProcess/NetworkResourceLoadParameters.cpp:
9         (WebKit::NetworkResourceLoadParameters::encode const):
10         * NetworkProcess/NetworkResourceLoader.cpp:
11         * Shared/SessionState.h:
12         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
13         (WebKit::toHTTPBody):
14
15 2018-09-21  Alex Christensen  <achristensen@webkit.org>
16
17         Simply authentication code even more!
18         https://bugs.webkit.org/show_bug.cgi?id=189719
19
20         Reviewed by Andy Estes.
21
22         Just when you thought it couldn't get simpler and more elegant, it can!
23
24         * NetworkProcess/Downloads/Download.cpp:
25         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
26         * NetworkProcess/NetworkLoad.cpp:
27         * NetworkProcess/PingLoad.cpp:
28         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
29         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
30         * Shared/Authentication/AuthenticationChallengeDisposition.h: Added.
31         * Shared/Authentication/AuthenticationManager.cpp:
32         (WebKit::AuthenticationManager::completeAuthenticationChallenge):
33         (WebKit::AuthenticationManager::useCredentialForChallenge): Deleted.
34         (WebKit::AuthenticationManager::useCredentialForSingleChallenge): Deleted.
35         (WebKit::AuthenticationManager::continueWithoutCredentialForChallenge): Deleted.
36         (WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge): Deleted.
37         (WebKit::AuthenticationManager::cancelChallenge): Deleted.
38         (WebKit::AuthenticationManager::cancelSingleChallenge): Deleted.
39         (WebKit::AuthenticationManager::performDefaultHandling): Deleted.
40         (WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge): Deleted.
41         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinue): Deleted.
42         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge): Deleted.
43         * Shared/Authentication/AuthenticationManager.h:
44         * Shared/Authentication/AuthenticationManager.messages.in:
45         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
46         (WebKit::AuthenticationManager::initializeConnection):
47         * UIProcess/API/C/WKAuthenticationDecisionListener.cpp:
48         (WKAuthenticationDecisionListenerUseCredential):
49         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm:
50         (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
51         * UIProcess/API/glib/WebKitAuthenticationRequest.cpp:
52         (webkit_authentication_request_authenticate):
53         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
54         (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
55         * UIProcess/Authentication/AuthenticationDecisionListener.cpp:
56         (WebKit::AuthenticationDecisionListener::AuthenticationDecisionListener):
57         (WebKit::AuthenticationDecisionListener::~AuthenticationDecisionListener):
58         (WebKit::AuthenticationDecisionListener::useCredential):
59         (WebKit::AuthenticationDecisionListener::cancel):
60         (WebKit::AuthenticationDecisionListener::performDefaultHandling):
61         (WebKit::AuthenticationDecisionListener::rejectProtectionSpaceAndContinue):
62         * UIProcess/Authentication/AuthenticationDecisionListener.h:
63         (WebKit::AuthenticationDecisionListener::create):
64         * UIProcess/Cocoa/DownloadClient.mm:
65         (WebKit::DownloadClient::didReceiveAuthenticationChallenge):
66         * UIProcess/Cocoa/NavigationState.mm:
67         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
68         * WebKit.xcodeproj/project.pbxproj:
69
70 2018-09-21  Chris Dumez  <cdumez@apple.com>
71
72         Regression(Mojave): Resuming a WK2 download crashes
73         https://bugs.webkit.org/show_bug.cgi?id=189838
74         <rdar://problem/44618538>
75
76         Reviewed by Alex Christensen.
77
78         Update our workaround to tweak the download resume data to include the actual download path so that
79         it works on macOS Mojave and up. Unfortunately, the resume data internal representation has changed,
80         causing our previous workaround to fail.
81
82         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
83         (WebKit::Download::resume):
84
85 2018-09-21  Youenn Fablet  <youenn@apple.com>
86
87         Whitelist two additional plugins
88         https://bugs.webkit.org/show_bug.cgi?id=189832
89         <rdar://problem/44628127>
90
91         Reviewed by Brent Fulgham.
92
93         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
94         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed):
95
96 2018-09-21  Woodrow Wang  <woodrow_wang@apple.com>
97
98         Clear persistent storage between tests for resourceLoadStatistics
99         https://bugs.webkit.org/show_bug.cgi?id=189684
100         <rdar://problem/44540099>
101
102         Reviewed by Chris Dumez.
103
104         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
105         (WKWebsiteDataStoreStatisticsResetToConsistentState):
106         * UIProcess/Network/NetworkProcessProxy.cpp:
107         (WebKit::NetworkProcessProxy::didClose):
108         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
109         * UIProcess/WebResourceLoadStatisticsStore.cpp:
110         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
111
112         Remove function only called in testing for resetting statistics to consistent
113         state. 
114
115         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory): Deleted.
116
117         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
118         (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor):
119         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
120
121 2018-09-20  Ryan Haddad  <ryanhaddad@apple.com>
122
123         Unreviewed, rolling out r236289.
124
125         Caused 8 TestWebKitAPI.ContentFiltering test failures.
126
127         Reverted changeset:
128
129         "InjectedBundle parameters often need initialization function
130         called before unarchiving"
131         https://bugs.webkit.org/show_bug.cgi?id=189709
132         https://trac.webkit.org/changeset/236289
133
134 2018-09-20  Youenn Fablet  <youenn@apple.com>
135
136         Allow additional plug-ins to run unsandboxed
137         https://bugs.webkit.org/show_bug.cgi?id=189791
138         <rdar://problem/44628127>
139
140         Reviewed by Brent Fulgham.
141
142         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
143         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed):
144
145 2018-09-20  Brent Fulgham  <bfulgham@apple.com>
146
147         InjectedBundle parameters often need initialization function called before unarchiving
148         https://bugs.webkit.org/show_bug.cgi?id=189709
149         <rdar://problem/44573653>
150
151         Reviewed by Chris Dumez.
152
153         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
154         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
155         after the bundle initialiation function runs, which gives the embedding program the opportunity to
156         register additional classes that are safe for serialization.
157         
158         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
159         This new method returns 'true' if the serialization was successful, otherwise it returns false.
160
161         Revise 'initialize' to call this new method and check the return value. If it fails, try decoding the
162         bundle parameters after the bundle's initialization function is called.
163
164         * WebProcess/InjectedBundle/InjectedBundle.h:
165         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
166         (WebKit::InjectedBundle::initialize): Use the new method.
167         (WebKit::InjectedBundle::decodeBundleParameters): Added.
168         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
169         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
170         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
171         NSDictionary object may itself hold other kinds of objects.
172
173 2018-09-20  Jer Noble  <jer.noble@apple.com>
174
175         Enable Modern EME by default
176         https://bugs.webkit.org/show_bug.cgi?id=189794
177
178         Reviewed by Jon Lee.
179
180         * Shared/WebPreferences.yaml:
181
182 2018-09-20  Thibault Saunier  <tsaunier@igalia.com>
183
184         [GTK][WPE] Make sure MediaDeviceEnabled and PeerConnectionEnabled are always synced with enable-media-stream
185         https://bugs.webkit.org/show_bug.cgi?id=188704
186
187         By default m_isMediaDevicesEnabled and m_isScreenCaptureEnabled are false but
188         m_isMediaStreamEnabled is true meaning that in the WPE minibrowser getUserMedia
189         was disabled even if we explicitly set `"enable-media-stream", TRUE`.
190
191         Reviewed by Michael Catanzaro.
192
193         * UIProcess/API/glib/WebKitSettings.cpp:
194         (webKitSettingsConstructed):
195
196 2018-09-20  Justin Michaud  <justin_michaud@apple.com>
197
198         Implement CSS Custom Properties and Values Skeleton
199         https://bugs.webkit.org/show_bug.cgi?id=189694
200
201         Reviewed by Simon Fraser.
202
203         Add feature flag for CSS custom properties and values api
204
205         * Shared/WebPreferences.yaml:
206         * WebProcess/InjectedBundle/InjectedBundle.cpp:
207         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
208
209 2018-09-19  Dean Jackson  <dino@apple.com>
210
211         Temporarily move fullscreen back to experimental features
212         https://bugs.webkit.org/show_bug.cgi?id=189770
213         <rdar://problem/44619282>
214
215         Revert this change now that there is a commit to cherry-pick.
216
217         * Shared/WebPreferences.yaml:
218
219 2018-09-20  Chris Dumez  <cdumez@apple.com>
220
221         Unreviewed crash fix after r236226.
222
223         We need to protect |this| in WebProcessProxy::requestTermination().
224
225         * UIProcess/WebProcessProxy.cpp:
226         (WebKit::WebProcessProxy::requestTermination):
227
228 2018-09-20  Antti Koivisto  <antti@apple.com>
229
230         REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on Mac
231         https://bugs.webkit.org/show_bug.cgi?id=189663
232         <rdar://problem/44184955>
233
234         Reviewed by Geoff Garen and Chris Dumez.
235
236         We need to keep the layer tree of the previous page alive and visible until we have something
237         to render on the new page. With PSON on Mac this means that we should keep displaying the
238         layer tree from the previus process.
239
240         This patch moves the management of 'attaching' the drawing area (Mac only concept) from web process
241         to UI process. This is when we parent the layer tree to the view root layer. It also ensures that
242         the layer tree is not deleted too early on process swap and that it still eventually gets deleted.
243
244         * UIProcess/DrawingAreaProxy.h:
245         (WebKit::DrawingAreaProxy::attachInWebProcess):
246         * UIProcess/SuspendedPageProxy.cpp:
247         (WebKit::messageNamesToIgnoreWhileSuspended):
248         (WebKit::SuspendedPageProxy::tearDownDrawingAreaInWebProcess):
249
250         We no longer tear down drawing area (layer tree) for suspended pages automatically. Send an explicit
251         message for it.
252
253         * UIProcess/SuspendedPageProxy.h:
254         * UIProcess/WebPageProxy.cpp:
255         (WebKit::WebPageProxy::didCompletePageTransition):
256
257         Attach the drawing area if appropriate.
258
259         (WebKit::WebPageProxy::resetStateAfterProcessExited):
260
261         Call PageClien::processWillSwap instead of processDidExit when appropriate.
262
263         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
264
265         This is called when we have switched to the new layer tree.
266         Tear down the drawing area in the previus process.
267
268         * UIProcess/WebPageProxy.h:
269         * UIProcess/WebPageProxy.messages.in:
270         * UIProcess/ios/PageClientImplIOS.h:
271         * UIProcess/ios/PageClientImplIOS.mm:
272         (WebKit::PageClientImpl::processWillSwap):
273
274         On iOS this just call processDidExit for now.
275
276         * UIProcess/mac/PageClientImplMac.h:
277         * UIProcess/mac/PageClientImplMac.mm:
278         (WebKit::PageClientImpl::processWillSwap):
279         (WebKit::PageClientImpl::processDidExit):
280
281         Add processWillSwap separately from processDidExit. They are currently the same
282         except processWillSwap doesn't clear the root layer.
283
284         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
285         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
286         (WebKit::TiledCoreAnimationDrawingAreaProxy::attachInWebProcess):
287
288         Send a message to the web process to attach the drawing area.
289
290         * WebProcess/WebPage/DrawingArea.h:
291         (WebKit::DrawingArea::attach):
292         (WebKit::DrawingArea::attachDrawingArea): Deleted.
293
294         Rename to be less redundant.
295
296         * WebProcess/WebPage/DrawingArea.messages.in:
297         * WebProcess/WebPage/WebPage.cpp:
298         (WebKit::WebPage::reinitializeWebPage):
299
300         Don't attach drawing area automatically. It will be done by a message from UI process.
301
302         (WebKit::WebPage::setLayerTreeStateIsFrozen):
303
304         Layer tree is always frozen in a suspended process (if it exists).
305
306         (WebKit::WebPage::didReceivePolicyDecision):
307
308         Suspend immediately when receiving policy decision to avoid flash on 'about:blank' loading.
309
310         (WebKit::WebPage::didStartPageTransition):
311         (WebKit::WebPage::didCompletePageTransition):
312
313         Notify UI process of transition completion.
314
315         (WebKit::WebPage::setIsSuspended):
316         (WebKit::WebPage::tearDownDrawingAreaForSuspend):
317         * WebProcess/WebPage/WebPage.h:
318         * WebProcess/WebPage/WebPage.messages.in:
319         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
320         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
321         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
322
323         Don't attach drawing area automatically. It will be done by a message from UI process.
324
325         (WebKit::TiledCoreAnimationDrawingArea::attach):
326         (WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Deleted.
327
328 2018-09-20  Tomas Popela  <tpopela@redhat.com>
329
330         [GTK] Always prints in portrait when landscape is requested
331         https://bugs.webkit.org/show_bug.cgi?id=189543
332
333         Reviewed by Michael Catanzaro.
334
335         We have to change the surface size based on the requested orientation.
336         Otherwise only portrait will be printed as it's hardcoded.
337
338         * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
339
340 2018-09-19  Dean Jackson  <dino@grorg.org>
341
342         Temporarily move fullscreen back to experimental features
343         https://bugs.webkit.org/show_bug.cgi?id=189770
344         <rdar://problem/44619282>
345
346         Reviewed by Simon Fraser.
347
348         Make fullscreen an experimental feature again.
349
350         * Shared/WebPreferences.yaml:
351
352 2018-09-19  Dawei Fenton  <realdawei@apple.com>
353
354         Unreviewed, rolling out r236229.
355
356         caused API timouts on mac and ios
357
358         Reverted changeset:
359
360         "Clear persistent storage between tests for
361         resourceLoadStatistics"
362         https://bugs.webkit.org/show_bug.cgi?id=189684
363         https://trac.webkit.org/changeset/236229
364
365 2018-09-19  Alex Christensen  <achristensen@webkit.org>
366
367         REGRESSION(236154) C API clients not using WKPageSetPageNavigationClient couldn't complete HTTPS requests
368         https://bugs.webkit.org/show_bug.cgi?id=189771
369
370         Reviewed by Tim Horton.
371
372         * UIProcess/API/APINavigationClient.h:
373         (API::NavigationClient::didReceiveAuthenticationChallenge):
374         Perform default behavior if there's an authentication challenge but we're using the default navigation client.
375         I wish we had infrastructure to test this but WebKitTestRunner uses WKPageSetNavigationClient
376         and we don't have the ability to do networking from API tests.  This is a growing problem I intend to solve.
377
378 2018-09-19  Woodrow Wang  <woodrow_wang@apple.com>
379
380         Clear persistent storage between tests for resourceLoadStatistics
381         https://bugs.webkit.org/show_bug.cgi?id=189684
382         <rdar://problem/44540099>
383
384         Reviewed by Chris Dumez.
385
386         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
387         (WKWebsiteDataStoreStatisticsResetToConsistentState):
388         * UIProcess/WebResourceLoadStatisticsStore.cpp:
389         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
390
391         Remove function only called in testing for resetting statistics to consistent
392         state. 
393         
394         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory): Deleted.
395
396 2018-09-19  Chris Dumez  <cdumez@apple.com>
397
398         Crash under WebPageProxy::decidePolicyForNavigationAction()
399         https://bugs.webkit.org/show_bug.cgi?id=189763
400         <rdar://problem/44597111>
401
402         Reviewed by Alex Christensen.
403
404         Update WebNavigationState::navigation() / WebNavigationState::takeNavigation()
405         to return a pointer instead of a reference as we have evidence that they can
406         return null. I kept the debug assertions to try and catch the cases where we
407         return null but at least we stop crashing in release builds.
408
409         * UIProcess/WebNavigationState.cpp:
410         (WebKit::WebNavigationState::navigation):
411         (WebKit::WebNavigationState::takeNavigation):
412         * UIProcess/WebNavigationState.h:
413         * UIProcess/WebPageProxy.cpp:
414         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
415         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
416         (WebKit::WebPageProxy::didCommitLoadForFrame):
417         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
418         (WebKit::WebPageProxy::didFinishLoadForFrame):
419         (WebKit::WebPageProxy::didFailLoadForFrame):
420         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
421         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
422         (WebKit::WebPageProxy::decidePolicyForResponse):
423
424 2018-09-19  Chris Dumez  <cdumez@apple.com>
425
426         Crash under WebProcessProxy::suspendedPageWasDestroyed(WebKit::SuspendedPageProxy&)
427         https://bugs.webkit.org/show_bug.cgi?id=189721
428         <rdar://problem/44359788>
429
430         Reviewed by Geoffrey Garen.
431
432         Fix crash when destroying a SuspendedPageProxy whose WebProcessProxy was already
433         destroyed.
434
435         * UIProcess/SuspendedPageProxy.cpp:
436         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
437         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
438         * UIProcess/SuspendedPageProxy.h:
439         (WebKit::SuspendedPageProxy::process const):
440         Update SuspendedPageProxy::m_process to be a RefPtr<> instead of a raw pointer, similarly
441         to what we do in WebPageProxy. Relying on the WebProcessProxy to not get destroyed is
442         risky as this crash demonstrates.
443
444         * UIProcess/WebProcessProxy.cpp:
445         (WebKit::WebProcessProxy::requestTermination):
446         When a WebProcessProxy is terminated (by client or WebKit due to memory / cpu usage), call
447         webProcessDidClose() on all SuspendedPages, similarly to what we do in case of a crash in
448         processDidTerminateOrFailedToLaunch(). Failing to do so means that the SuspendedPageProxy
449         may still have a pointer to this WebProcessProxy, even though WebProcessProxy::shutDown()
450         has been called (which may destroy the WebProcessProxy).
451
452 2018-09-19  John Wilander  <wilander@apple.com>
453
454         Resource Load Statistics: Add optional cap on partitioned cache max age
455         https://bugs.webkit.org/show_bug.cgi?id=189711
456         <rdar://problem/39246837>
457
458         Reviewed by Antti Koivisto and Chris Dumez.
459
460         These changes add the capability to set a max age cap for prevalent resources
461         and consults it when retrieving cache entries. If an entry is capped and found
462         to be too old, it will not be used but instead removed from the cache.
463
464         This functionality is off by default because no cap is set by default.
465
466         * NetworkProcess/NetworkProcess.cpp:
467         (WebKit::NetworkProcess::setCacheMaxAgeCapForPrevalentResources):
468         (WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources):
469             Infrastructure for testing.
470         * NetworkProcess/NetworkProcess.h:
471         * NetworkProcess/NetworkProcess.messages.in:
472         * NetworkProcess/NetworkResourceLoader.cpp:
473         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
474             Now sends in the session ID in the retrieve call.
475         * NetworkProcess/cache/NetworkCache.cpp:
476         (WebKit::NetworkCache::hasReachedPrevalentResourceAgeCap):
477             Static convenience function.
478         (WebKit::NetworkCache::makeUseDecision):
479             Now receives an optional maxAge parameter and checks
480             hasReachedPrevalentResourceAgeCap() first.
481         (WebKit::NetworkCache::Cache::retrieve):
482             Now takes a session ID.
483         * NetworkProcess/cache/NetworkCache.h:
484         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
485         (WebKit::NetworkCache::cachedEntryReuseFailureToDiagnosticKey):
486             Added UseDecision::NoDueToPrevalentResourceAgeCap which causes a
487             return of WebCore::DiagnosticLoggingKeys::otherKey().
488         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
489         (WKWebsiteDataStoreSetStatisticsCacheMaxAgeCap):
490         (WKWebsiteDataStoreStatisticsResetToConsistentState):
491             Infrastructure for testing.
492         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
493         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
494         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
495             Now supports a user default ResourceLoadStatisticsCacheMaxAgeCap.
496         * UIProcess/Network/NetworkProcessProxy.cpp:
497         (WebKit::NetworkProcessProxy::hasStorageAccessForFrame):
498         (WebKit::NetworkProcessProxy::grantStorageAccess):
499         (WebKit::NetworkProcessProxy::removeAllStorageAccess):
500         (WebKit::NetworkProcessProxy::getAllStorageAccessEntries):
501         (WebKit::NetworkProcessProxy::setCacheMaxAgeCapForPrevalentResources):
502         (WebKit::NetworkProcessProxy::didSetCacheMaxAgeCapForPrevalentResources):
503         (WebKit::NetworkProcessProxy::resetCacheMaxAgeCapForPrevalentResources):
504         (WebKit::NetworkProcessProxy::didResetCacheMaxAgeCapForPrevalentResources):
505         (WebKit::nextRequestStorageAccessContextId): Deleted.
506             Deleted this to make all code use the generic generateCallbackID().
507         * UIProcess/Network/NetworkProcessProxy.h:
508         * UIProcess/Network/NetworkProcessProxy.messages.in:
509             Used to transfer the setting from the UI process to the network process. 
510         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
511         (WebKit::ResourceLoadStatisticsMemoryStore::setCacheMaxAgeCap):
512         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
513         * UIProcess/WebResourceLoadStatisticsStore.cpp:
514         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
515         * UIProcess/WebResourceLoadStatisticsStore.h:
516         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
517         (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
518         (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources):
519         * UIProcess/WebsiteData/WebsiteDataStore.h:
520
521 2018-09-18  Brent Fulgham  <bfulgham@apple.com>
522
523         [iOS] Allow WebContent process to check the "Protocol Characteristics" of files to which it has access
524         https://bugs.webkit.org/show_bug.cgi?id=189712
525         <rdar://problem/44386429>
526
527         Reviewed by Alex Christensen.
528
529         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
530
531 2018-09-18  Chris Dumez  <cdumez@apple.com>
532
533         [iOS] Crash under WebPageProxy::navigationGestureSnapshotWasRemoved()
534         https://bugs.webkit.org/show_bug.cgi?id=189714
535         <rdar://problem/32839498>
536
537         Reviewed by Tim Horton.
538
539         The ViewGestureController::removeSwipeSnapshot() implementation for iOS calls
540         navigationGestureSnapshotWasRemoved() on m_webPageProxyForBackForwardListForCurrentSwipe.
541         m_webPageProxyForBackForwardListForCurrentSwipe can differ from m_webPageProxy, and
542         is a RefPtr<>. This means that this WebPageProxy's WKWebView might have been deallocated,
543         in which case we'll crash when trying to use the pageClient in
544         WebPageProxy::navigationGestureSnapshotWasRemoved(). To address the issue, we now return
545         early in WebPageProxy::navigationGestureSnapshotWasRemoved() if m_isClosed is true,
546         after resetting m_isShowingNavigationGestureSnapshot to false but *before* trying to use
547         the pageClient. When a WKWebView is deallocated, it calls WebPageProxy::close(), which
548         sets m_isClosed to true.
549
550         * UIProcess/WebPageProxy.cpp:
551         (WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved):
552
553 2018-09-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
554
555         [Curl] Limit capturing extra metrics for Web Inspector when not required.
556         https://bugs.webkit.org/show_bug.cgi?id=189520
557
558         Reviewed by Alex Christensen.
559
560         Respect the value of NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics() to reduce the process
561         time when they are not needed.
562
563         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
564         (WebKit::NetworkDataTaskCurl::createCurlRequest):
565
566 2018-09-18  Alex Christensen  <achristensen@webkit.org>
567
568         Make WebPageProxy always have a API::NavigationClient instead of always having a API::LoaderClient and API::PolicyClient
569         https://bugs.webkit.org/show_bug.cgi?id=189012
570
571         Reviewed by Andy Estes.
572
573         When WebKit2 was being developed, we initially made the C API WKPageSetPagePolicyClient and WKPageSetPageLoaderClient.
574         When we released WKWebView, it was using WKNavigationDelegate, equivalent to WKPageSetPageNavigationClient.
575         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
576         loader or policy client.  Since the loader and policy clients are now being minimally supported only until legacy
577         software migrates to the navigation client, we are adding new functionality to the navigation client.
578         Making the navigation client the default and using the loader or policy client only if they are present supports
579         the legacy software and makes us have fewer forgotten null checks when adding new functionality to the navigation client.
580
581         * UIProcess/API/C/WKPage.cpp:
582         (WKPageSetPageNavigationClient):
583         * UIProcess/Cocoa/NavigationState.h:
584         * UIProcess/Cocoa/NavigationState.mm:
585         (WebKit::NavigationState::createNavigationClient):
586         * UIProcess/WebPageProxy.cpp:
587         (WebKit::WebPageProxy::WebPageProxy):
588         (WebKit::WebPageProxy::setNavigationClient):
589         (WebKit::WebPageProxy::setLoaderClient):
590         (WebKit::WebPageProxy::setPolicyClient):
591         (WebKit::WebPageProxy::close):
592         (WebKit::WebPageProxy::didChangeBackForwardList):
593         (WebKit::WebPageProxy::willGoToBackForwardListItem):
594         (WebKit::WebPageProxy::findPlugin):
595         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
596         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
597         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
598         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
599         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
600         (WebKit::WebPageProxy::didCommitLoadForFrame):
601         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
602         (WebKit::WebPageProxy::didFinishLoadForFrame):
603         (WebKit::WebPageProxy::didFailLoadForFrame):
604         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
605         (WebKit::WebPageProxy::didReachLayoutMilestone):
606         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
607         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
608         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
609         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
610         (WebKit::WebPageProxy::decidePolicyForResponse):
611         (WebKit::WebPageProxy::contentRuleListNotification):
612         (WebKit::WebPageProxy::webGLPolicyForURL):
613         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
614         (WebKit::WebPageProxy::processDidBecomeUnresponsive):
615         (WebKit::WebPageProxy::processDidBecomeResponsive):
616         (WebKit::WebPageProxy::dispatchProcessDidTerminate):
617         (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
618         (WebKit::WebPageProxy::wrapCryptoKey):
619         (WebKit::WebPageProxy::unwrapCryptoKey):
620         (WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
621         (WebKit::WebPageProxy::navigationGestureDidBegin):
622         (WebKit::WebPageProxy::navigationGestureWillEnd):
623         (WebKit::WebPageProxy::navigationGestureDidEnd):
624         (WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved):
625         * UIProcess/WebPageProxy.h:
626
627 2018-09-18  Alex Christensen  <achristensen@webkit.org>
628
629         Clean up AuthenticationChallengeProxy
630         https://bugs.webkit.org/show_bug.cgi?id=189668
631
632         Reviewed by Youenn Fablet.
633
634         At its core, it's a CompletionHandler with some information.
635         Make it more elegant and simple with no change in behavior and reduce the complexity of this security-sensitive object.
636
637         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
638         (toNSURLSessionAuthChallengeDisposition):
639         * Shared/Authentication/AuthenticationManager.cpp:
640         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge):
641         * Shared/Authentication/AuthenticationManager.h:
642         * UIProcess/API/C/WKAuthenticationChallenge.cpp:
643         (WKAuthenticationChallengeGetDecisionListener):
644         (WKAuthenticationChallengeGetProtectionSpace):
645         (WKAuthenticationChallengeGetProposedCredential):
646         (WKAuthenticationChallengeGetPreviousFailureCount):
647         * UIProcess/API/C/WKPage.cpp:
648         (WKPageSetPageNavigationClient):
649         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm:
650         (-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]):
651         (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
652         (-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]):
653         (-[WKNSURLAuthenticationChallengeSender performDefaultHandlingForAuthenticationChallenge:]):
654         (-[WKNSURLAuthenticationChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]):
655         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
656         (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
657         (WebKit::AuthenticationChallengeProxy::~AuthenticationChallengeProxy): Deleted.
658         (WebKit::AuthenticationChallengeProxy::useCredential): Deleted.
659         (WebKit::AuthenticationChallengeProxy::cancel): Deleted.
660         (WebKit::AuthenticationChallengeProxy::performDefaultHandling): Deleted.
661         (WebKit::AuthenticationChallengeProxy::rejectProtectionSpaceAndContinue): Deleted.
662         (WebKit::AuthenticationChallengeProxy::proposedCredential const): Deleted.
663         (WebKit::AuthenticationChallengeProxy::protectionSpace const): Deleted.
664         (WebKit::AuthenticationChallengeProxy::setSecKeyProxyStore): Deleted.
665         * UIProcess/Authentication/AuthenticationChallengeProxy.h:
666         (WebKit::AuthenticationChallengeProxy::create):
667         (WebKit::AuthenticationChallengeProxy::listener const):
668         (WebKit::AuthenticationChallengeProxy::previousFailureCount const): Deleted.
669         * UIProcess/Authentication/AuthenticationDecisionListener.cpp:
670         (WebKit::AuthenticationDecisionListener::AuthenticationDecisionListener):
671         (WebKit::AuthenticationDecisionListener::~AuthenticationDecisionListener):
672         (WebKit::AuthenticationDecisionListener::useCredential):
673         (WebKit::AuthenticationDecisionListener::cancel):
674         (WebKit::AuthenticationDecisionListener::performDefaultHandling):
675         (WebKit::AuthenticationDecisionListener::rejectProtectionSpaceAndContinue):
676         (WebKit::AuthenticationDecisionListener::detachChallenge): Deleted.
677         * UIProcess/Authentication/AuthenticationDecisionListener.h:
678         (WebKit::AuthenticationDecisionListener::create):
679         * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:
680         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc):
681         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc const): Deleted.
682         * UIProcess/Cocoa/DownloadClient.mm:
683         (WebKit::DownloadClient::didReceiveAuthenticationChallenge):
684         * UIProcess/Cocoa/NavigationState.mm:
685         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
686         * UIProcess/Downloads/DownloadProxy.cpp:
687         (WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
688         * UIProcess/Network/NetworkProcessProxy.cpp:
689         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
690         * UIProcess/ServiceWorkerProcessProxy.cpp:
691         (WebKit::ServiceWorkerProcessProxy::didReceiveAuthenticationChallenge):
692         * UIProcess/WebPageProxy.cpp:
693         (WebKit::WebPageProxy::secKeyProxyStore):
694         (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
695         * UIProcess/WebPageProxy.h:
696
697 2018-09-18  Ben Richards  <benton_richards@apple.com>
698
699         Add script to generate WebContent service resource files and change XPC service main SPI to have it's own header
700         https://bugs.webkit.org/show_bug.cgi?id=188601
701
702         Reviewed by Dan Bernstein.
703
704         Added a script to the process entitlements build phase of the WebContent service that copies resource
705         files to WebKit.framework/PrivateHeaders/CustomWebContentResources. These resource files are to
706         be used by clients who would like to make a custom WebContent service.
707
708         * Scripts/copy-webcontent-resources-to-private-headers.sh: Added.
709         * WebKit.xcodeproj/project.pbxproj:
710         * WebProcess/API/Cocoa/WKWebProcess.h: Drive-by fix to make this header compileable alone.
711
712 2018-09-18  Ryan Haddad  <ryanhaddad@apple.com>
713
714         Unreviewed, rolling out r236138.
715
716         Caused API test and layout test failures on iOS.
717
718         Reverted changeset:
719
720         "REGRESSION (PSON): White or Black flash occurs when process
721         swapping on navigation on Mac"
722         https://bugs.webkit.org/show_bug.cgi?id=189663
723         https://trac.webkit.org/changeset/236138
724
725 2018-09-18  Eric Carlson  <eric.carlson@apple.com>
726
727         Always log when granting/revoking capture sandbox extensions
728         https://bugs.webkit.org/show_bug.cgi?id=189701
729         <rdar://problem/44564029>
730
731         Reviewed by Youenn Fablet.
732
733         * UIProcess/UserMediaProcessManager.cpp:
734         (WebKit::UserMediaProcessManager::willCreateMediaStream): Always log.
735         (WebKit::UserMediaProcessManager::endedCaptureSession): Ditto.
736
737         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
738         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Ditto.
739         (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): Ditto.
740
741 2018-09-18  Youenn Fablet  <youenn@apple.com>
742
743         Enable Unified Plan by default
744         https://bugs.webkit.org/show_bug.cgi?id=189675
745
746         Reviewed by Eric Carlson.
747
748         * Shared/WebPreferences.yaml:
749
750 2018-09-18  Antti Koivisto  <antti@apple.com>
751
752         REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on Mac
753         https://bugs.webkit.org/show_bug.cgi?id=189663
754         <rdar://problem/44184955>
755
756         Reviewed by Geoff Garen.
757
758         We need to keep the layer tree of the previous page alive and visible until we have something
759         to render on the new page. With PSON on Mac this means that we should keep displaying the
760         layer tree from the previus process.
761
762         This patch moves the management of 'attaching' the drawing area (Mac only concept) from web process
763         to UI process. This is when we parent the layer tree to the view root layer. It also ensures that
764         the layer tree is not deleted too early on process swap and that it still eventually gets deleted.
765
766         * UIProcess/DrawingAreaProxy.h:
767         (WebKit::DrawingAreaProxy::attachInWebProcess):
768         * UIProcess/SuspendedPageProxy.cpp:
769         (WebKit::messageNamesToIgnoreWhileSuspended):
770         (WebKit::SuspendedPageProxy::tearDownDrawingAreaInWebProcess):
771
772         We no longer tear down drawing area (layer tree) for suspended pages automatically. Send an explicit
773         message for it.
774
775         * UIProcess/SuspendedPageProxy.h:
776         * UIProcess/WebPageProxy.cpp:
777         (WebKit::WebPageProxy::reattachToWebProcess):
778
779         Only call didRelaunchProcess when process actually relaunched (not navigation process launch) to
780         match not calling processDidExit in resetStateAfterProcessExited.
781
782         (WebKit::WebPageProxy::didCompletePageTransition):
783
784         Attach the drawing area if appropriate.
785
786         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
787
788         Send suspend message to WebPage immediately instead waiting for the runloop callback. This is needed so we
789         can avoid flashing the initial empty document load when the new Page object is created.
790
791         (WebKit::WebPageProxy::resetStateAfterProcessExited):
792
793         Don't call processDidExit when suspending, not exiting the process (this function needs a new name or rafactoring).
794         This avoids clearing the drawing area and flashing to black.
795
796         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
797
798         This is called when we have switched to the new layer tree.
799         Tear down the drawing area in the previus process.
800
801         * UIProcess/WebPageProxy.h:
802         * UIProcess/WebPageProxy.messages.in:
803         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
804         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
805         (WebKit::TiledCoreAnimationDrawingAreaProxy::attachInWebProcess):
806
807         Send a message to the web process to attach the drawing area.
808
809         * WebProcess/WebPage/DrawingArea.h:
810         (WebKit::DrawingArea::attach):
811         (WebKit::DrawingArea::attachDrawingArea): Deleted.
812
813         Rename to be less redundant.
814
815         * WebProcess/WebPage/DrawingArea.messages.in:
816         * WebProcess/WebPage/WebPage.cpp:
817         (WebKit::WebPage::reinitializeWebPage):
818
819         Don't attach drawing area automatically. It will be done by a message from UI process.
820
821         (WebKit::WebPage::setLayerTreeStateIsFrozen):
822
823         Layer tree is always frozen in a suspended process (if it exists).
824
825         (WebKit::WebPage::didStartPageTransition):
826         (WebKit::WebPage::didCompletePageTransition):
827
828         Notify UI process of transition completion.
829
830         (WebKit::WebPage::setIsSuspended):
831         (WebKit::WebPage::tearDownDrawingAreaForSuspend):
832         * WebProcess/WebPage/WebPage.h:
833         * WebProcess/WebPage/WebPage.messages.in:
834         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
835         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
836         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
837
838         Don't attach drawing area automatically. It will be done by a message from UI process.
839
840         (WebKit::TiledCoreAnimationDrawingArea::attach):
841         (WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Deleted.
842
843 2018-09-18  Claudio Saavedra  <csaavedra@igalia.com>
844
845         [WPE] Implement mouse event modifiers
846         https://bugs.webkit.org/show_bug.cgi?id=189697
847
848         Reviewed by Carlos Garcia Campos.
849
850         Only "CapsLocks" is missing, as WPE doesn't support that modifier.
851         * Shared/wpe/WebEventFactory.cpp:
852         (WebKit::modifiersForEventModifiers):
853         (WebKit::WebEventFactory::createWebKeyboardEvent):
854         (WebKit::WebEventFactory::createWebMouseEvent):
855         (WebKit::modifiersForEvent): Deleted.
856
857 2018-09-17  Zan Dobersek  <zdobersek@igalia.com>
858
859         Unreviewed build fix after r236101.
860
861         * UIProcess/WebResourceLoadStatisticsStore.cpp:
862         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
863         Correct a BinarySemaphore::wait() call which now accepts no arguments.
864
865 2018-09-17  Yusuke Suzuki  <utatane.tea@gmail.com>
866
867         [WTF] Use Semaphore and BinarySemaphore instead of dispatch_semaphore_t
868         https://bugs.webkit.org/show_bug.cgi?id=185339
869
870         Reviewed by Mark Lam.
871
872         * Platform/IPC/Connection.cpp:
873         (IPC::Connection::SyncMessageState::wait):
874         * Shared/mac/SecItemShim.cpp:
875         (WebKit::sendSecItemRequest):
876         Use BinarySemaphore.
877
878         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
879         (WebKit::ResourceLoadStatisticsPersistentStorage::finishAllPendingWorkSynchronously):
880         * UIProcess/WebStorage/StorageManager.cpp:
881         (WebKit::StorageManager::applicationWillTerminate):
882         * UIProcess/ios/WKActionSheetAssistant.mm:
883         (appLinkForURL):
884         Use BinarySemaphore to wait for async completion handler. We also fix memory leak
885         since the old code does not call dispatch_release for the used semaphore.
886
887 2018-09-17  Simon Fraser  <simon.fraser@apple.com>
888
889         Many modern media control tests leak documents in testing
890         https://bugs.webkit.org/show_bug.cgi?id=189437
891
892         Reviewed by Darin Adler.
893
894         In order to accurately detect leaks in media controls tests which use lots of
895         SVGImages, we have to:
896         - Fire a zero-delay timer after the postTask, in order for ImagesLoader's m_derefElementTimer
897           to clear references to elements.
898         - Have releaseCriticalMemory() call CachedResourceLoader's garbageCollectDocumentResources()
899           to drop the last handle to the CachedResource for an SVGImage.
900         - Call WKBundleReleaseMemory() after the GC and timer, since we need garbageCollectDocumentResources()
901           to run again after that timer has fired.
902         
903         This should fix most of the spurious leak reports involving SVGImage documents.
904
905         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
906         (WKBundlePageCallAfterTasksAndTimers):
907         (WKBundlePagePostTask): Deleted.
908         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
909
910 2018-09-17  Dan Bernstein  <mitz@apple.com>
911
912         Try to fix Apple internal builds with the iOS 12.0 SDK.
913
914         * Configurations/WebKit.xcconfig: Disable framework header postprocessing for iOS 12.0.
915
916 2018-09-17  Ryan Haddad  <ryanhaddad@apple.com>
917
918         Unreviewed, rolling out r236092 because it breaks internal builds. Also,  remove stray '+' character from ChangeLog file.
919
920         * Scripts/copy-webcontent-resources-to-private-headers.sh: Removed.
921         * WebKit.xcodeproj/project.pbxproj:
922
923 2018-08-17  Ben Richards  <benton_richards@apple.com>
924
925         Add script to generate WebContent service resource files and change XPC service main SPI to have it's own header
926         https://bugs.webkit.org/show_bug.cgi?id=188601
927
928         Reviewed by Dan Bernstein.
929
930         Added a script to the process entitlements build phase of the WebContent service that copies resource
931         files to WebKit.framework/PrivateHeaders/CustomWebContentResources. These resource files are to
932         be used by clients who would like to make a custom WebContent service.
933
934         * Scripts/copy-webcontent-resources-to-private-headers.sh: Added.
935         * WebKit.xcodeproj/project.pbxproj:
936
937
938 2018-09-17  Simon Fraser  <simon.fraser@apple.com>
939
940         Add more Fullscreen logging
941         https://bugs.webkit.org/show_bug.cgi?id=189656
942
943         Reviewed by Jer Noble.
944
945         Add some fullscreen logging so I can tell whether WebFullScreenManager ever releases
946         the fullscreen element.
947
948         * WebProcess/FullScreen/WebFullScreenManager.cpp:
949         (WebKit::WebFullScreenManager::WebFullScreenManager):
950         (WebKit::WebFullScreenManager::videoControlsManagerDidChange):
951         (WebKit::WebFullScreenManager::setPIPStandbyElement):
952         (WebKit::WebFullScreenManager::enterFullScreenForElement):
953         (WebKit::WebFullScreenManager::exitFullScreenForElement):
954         (WebKit::WebFullScreenManager::willEnterFullScreen):
955         (WebKit::WebFullScreenManager::didEnterFullScreen):
956         (WebKit::WebFullScreenManager::willExitFullScreen):
957         (WebKit::WebFullScreenManager::didExitFullScreen):
958         (WebKit::WebFullScreenManager::close):
959         * WebProcess/FullScreen/WebFullScreenManager.h:
960
961 2018-09-17  Tim Horton  <timothy_horton@apple.com>
962
963         Swipe snapshot can get stuck if swiping is disabled while it is visible
964         https://bugs.webkit.org/show_bug.cgi?id=189667
965         <rdar://problem/40367780>
966
967         Reviewed by Simon Fraser.
968
969         If navigation gestures are disabled while a swipe snapshot is visible,
970         WKWebView will tear down the ViewGestureController, which means that
971         the SnapshotRemovalTracker will no longer be around to ever remove
972         the snapshot.
973
974         It's currently very hard to write a test for this because we have
975         yet to come up with a good mechanism for testing swiping on iOS.
976
977         * UIProcess/API/Cocoa/WKWebView.mm:
978         (-[WKWebView setAllowsBackForwardNavigationGestures:]):
979         Instead of tearing down the ViewGestureController when navigation
980         gestures are disabled, just set a bit on it that disables gestures.
981
982         * UIProcess/Cocoa/ViewGestureController.cpp:
983         (WebKit::ViewGestureController::canSwipeInDirection const):
984         * UIProcess/Cocoa/ViewGestureController.h:
985         (WebKit::ViewGestureController::setSwipeGestureEnabled):
986         (WebKit::ViewGestureController::isSwipeGestureEnabled):
987         Add a bit to ViewGestureController that makes starting new gestures
988         always fail, but allows e.g. snapshots from existing swipes to continue
989         their usual behavior.
990
991 2018-09-17  Alex Christensen  <achristensen@webkit.org>
992
993         Expose WKWebProcess.h as a private header
994         https://bugs.webkit.org/show_bug.cgi?id=189636
995
996         * WebKit.xcodeproj/project.pbxproj:
997
998 2018-09-17  Alex Christensen  <achristensen@webkit.org>
999
1000         Expose XPCServiceMain in a WebProcess header rather than WKProcessPool
1001         https://bugs.webkit.org/show_bug.cgi?id=189636
1002
1003         Reviewed by Dan Bernstein.
1004
1005         Fix a few build failures along the way.
1006
1007         * PluginProcess/mac/PluginControllerProxyMac.mm:
1008         (WebKit::PluginControllerProxy::windowAndViewFramesChanged):
1009         (WebKit::PluginControllerProxy::updateLayerHostingContext):
1010         * PluginProcess/mac/PluginProcessMac.mm:
1011         (WebKit::replacedNSWorkspace_launchApplicationAtURL_options_configuration_error):
1012         (WebKit::PluginProcess::platformInitializeProcess):
1013         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
1014         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
1015         (WebKit::XPCServiceMain):
1016         (main):
1017         * SourcesCocoa.txt:
1018         * UIProcess/API/Cocoa/WKProcessPool.mm:
1019         (+[WKProcessPool _webContentProcessXPCMain]): Deleted.
1020         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1021         * WebKit.xcodeproj/project.pbxproj:
1022         * WebProcess/API: Added.
1023         * WebProcess/API/Cocoa: Added.
1024         * WebProcess/API/Cocoa/WKWebProcess.cpp: Added.
1025         (WKWebProcessMain):
1026         * WebProcess/API/Cocoa/WKWebProcess.h: Added.
1027         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1028         (-[WKAccessibilityWebPageObject convertScreenPointToRootView:]):
1029         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
1030         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
1031
1032 2018-09-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1033
1034         [Curl] Respond with requested authentication scheme for authentication challenge.
1035         https://bugs.webkit.org/show_bug.cgi?id=189318
1036
1037         Reviewed by Alex Christensen.
1038
1039         Curl port depends on libcurl's authentication handling by enabling CURLAUTH_ANY. With this
1040         mode, the round-trip communication between the client and the server is handled by libcurl
1041         internally. That's okay for many cases. But when initial request has a credentials
1042         (i.e. XMLHttpRequest), there's no valid chance to store credential to the storage because
1043         the returned response is not 401.
1044
1045         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1046         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl):
1047         (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
1048         (WebKit::NetworkDataTaskCurl::tryHttpAuthentication):
1049         (WebKit::NetworkDataTaskCurl::tryProxyAuthentication):
1050         (WebKit::NetworkDataTaskCurl::restartWithCredential):
1051         * NetworkProcess/curl/NetworkDataTaskCurl.h:
1052
1053 2018-09-17  Woodrow Wang  <woodrow_wang@apple.com>
1054
1055         Clear pending resource load statistics' writes after tests
1056         https://bugs.webkit.org/show_bug.cgi?id=189632
1057         <rdar://problem/44469275>
1058
1059         Reviewed by Chris Dumez.
1060
1061         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1062         (WKWebsiteDataStoreStatisticsResetToConsistentState):
1063
1064 2018-09-17  Chris Dumez  <cdumez@apple.com>
1065
1066         PSON: window.open() with 'noopener' should only process-swap cross-site, not cross-origin
1067         https://bugs.webkit.org/show_bug.cgi?id=189602
1068         <rdar://problem/44430549>
1069
1070         Reviewed by Geoff Garen.
1071
1072         The following fixes were made to our process swap on navigation logic:
1073         - Browsing contexts opened via window.open() with 'noopener' option now only same if
1074           they are cross-site, instead of doing a stricter cross-origin check.
1075         - Support process swapping when opening a new window via <a target="_blank" rel="noopener">
1076           that is cross-site.
1077
1078         In order to support this, the following changes were made:
1079         - Stop passing a 'isCrossOriginWindowOpenNavigation' flag to the UIProcess when navigating because:
1080           - This is specific to window.open() and does not apply to other windows opened by DOM
1081           - This forces the origin check to happens on WebContent process side instead of relying on the
1082             one in WebProcessPool in the UIProcess
1083         - Pass the origin of the requester to the UIProcess when navigating, so that the WebProcessPool
1084           can use the requester's host for the cross-site check for the initial navigation in a new window
1085           created by DOM.
1086         - Add 2 flags to WebPageProxy which indicate if the page was created by the DOM and if any provisional
1087           loads have been committed. The WebProcessPool uses theses flags to recognize initial loads in
1088           new windows created by the DOM, so that it uses the requester's origin for the cross-site check.
1089
1090         * Shared/NavigationActionData.cpp:
1091         (WebKit::NavigationActionData::encode const):
1092         (WebKit::NavigationActionData::decode):
1093         * Shared/NavigationActionData.h:
1094         * UIProcess/API/APINavigation.h:
1095         (API::Navigation::setRequesterOrigin):
1096         (API::Navigation::requesterOrigin const):
1097         * UIProcess/WebPageProxy.cpp:
1098         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1099         (WebKit::WebPageProxy::didCommitLoadForFrame):
1100         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1101         (WebKit::WebPageProxy::createNewPage):
1102         * UIProcess/WebPageProxy.h:
1103         (WebKit::WebPageProxy::setOpenedByDOM):
1104         (WebKit::WebPageProxy::openedByDOM const):
1105         (WebKit::WebPageProxy::hasCommittedAnyProvisionalLoads const):
1106         * UIProcess/WebProcessPool.cpp:
1107         (WebKit::shouldUseSameProcessBasedOnURLs):
1108         (WebKit::WebProcessPool::processForNavigationInternal):
1109         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1110         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1111
1112 2018-09-17  Alexey Proskuryakov  <ap@apple.com>
1113
1114         Revert https://trac.webkit.org/r235910, because the new test times out.
1115         Crash under PlatformPopupMenuData::encode when interacting with a select menu that has variable fonts
1116         https://bugs.webkit.org/show_bug.cgi?id=188008
1117
1118         * Shared/cf/ArgumentCodersCF.cpp:
1119         (IPC::encode):
1120         (IPC::decode):
1121
1122 2018-09-17  Alex Christensen  <achristensen@webkit.org>
1123
1124         Refactoring related to Safe Browsing
1125         https://bugs.webkit.org/show_bug.cgi?id=189631
1126
1127         Reviewed by Tim Horton.
1128
1129         Make SafeBrowsingResult RefCounted.
1130         Move logic from an unnamed lambda to WebPageProxy::receivedNavigationPolicyDecision.
1131
1132         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1133         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
1134         (WebKit::WebPageProxy::contentFilterDidBlockLoadForFrame): Deleted.
1135         (WebKit::WebPageProxy::addPlatformLoadParameters): Deleted.
1136         (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): Deleted.
1137         (WebKit::WebPageProxy::startDrag): Deleted.
1138         (WebKit::WebPageProxy::setPromisedDataForImage): Deleted.
1139         (WebKit::WebPageProxy::setDragCaretRect): Deleted.
1140         (WebKit::WebPageProxy::platformRegisterAttachment): Deleted.
1141         (WebKit::WebPageProxy::platformCloneAttachment): Deleted.
1142         * UIProcess/SafeBrowsingResult.h:
1143         (WebKit::SafeBrowsingResult::create):
1144         * UIProcess/WebFramePolicyListenerProxy.cpp:
1145         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
1146         * UIProcess/WebFramePolicyListenerProxy.h:
1147         * UIProcess/WebFrameProxy.cpp:
1148         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
1149         * UIProcess/WebFrameProxy.h:
1150         * UIProcess/WebPageProxy.cpp:
1151         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1152         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1153         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1154         (WebKit::WebPageProxy::decidePolicyForResponse):
1155         * UIProcess/WebPageProxy.h:
1156
1157 2018-09-17  Darin Adler  <darin@apple.com>
1158
1159         Use OpaqueJSString rather than JSRetainPtr inside WebKit
1160         https://bugs.webkit.org/show_bug.cgi?id=189652
1161
1162         Reviewed by Saam Barati.
1163
1164         * Shared/API/c/WKString.cpp: Removed unneeded include of JSStringRef.h.
1165
1166         * WebProcess/Automation/WebAutomationSessionProxy.cpp: Removed unneeded
1167         include of JSRetainPtr.
1168         (WebKit::toJSString): Deleted.
1169         (WebKit::toJSValue): Use OpaqueJSString::create.
1170         (WebKit::callPropertyFunction): Ditto.
1171         (WebKit::evaluate): Use adoptRef.
1172         (WebKit::evaluateJavaScriptCallback): Ditto.
1173         (WebKit::WebAutomationSessionProxy::scriptObjectForFrame):
1174         Use OpaqueJSString::create.
1175         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Use
1176         String rather than JSStringRef.
1177
1178         * WebProcess/Plugins/PDF/PDFPlugin.mm: Removed unneeded includes.
1179         (WebKit::PDFPlugin::runScriptsInPDFDocument): Use OpaqueJSString::create.
1180
1181 2018-09-17  Michael Catanzaro  <mcatanzaro@igalia.com>
1182
1183         Unreviewed, fix incorrect WPE build fix made in r236009
1184
1185         This isn't the right place to add the typedef. I failed to notice that the WebKitWebView
1186         type is not actually used anywhere in this header. Actually, the problematic function is no
1187         longer declared or used anywhere and was just missed when WebKitScriptDialog was refactored,
1188         so remove it.
1189
1190         * UIProcess/API/wpe/WebKitScriptDialog.h:
1191         * UIProcess/API/wpe/WebKitScriptDialogWPE.cpp:
1192         (webkitScriptDialogRun): Deleted.
1193
1194 2018-09-17  Sihui Liu  <sihui_liu@apple.com>
1195
1196         Move IndexedDB to Network Process
1197         https://bugs.webkit.org/show_bug.cgi?id=189415
1198         <rdar://problem/44396973>
1199
1200         Reviewed by Chris Dumez.
1201
1202         We are going to eliminate storage process and move its functionality to network process. 
1203         The reasons why we want to do this:
1204         1. Lower resource usage of having an additional process for storage operations, especially
1205         memory. Single storage process takes about 5MB memory on macOS.
1206         2. Reduce latency of Service Workers. After enabling Service Workers, we've seen
1207         regression in app launch. The launch time of storage process is partly attributed to this:
1208         Service Workers delay page loading until receiving response from storage process.
1209         3. We choose network process because UI process may have broader access in file system
1210         that we don't want the storage operations to have.
1211
1212         This patch is the first piece towards the goal. It mainly moves indexedDB from storage process
1213         to corresponding components of network process. Moving of Service Worker and stopping to 
1214         launch storage process will be done in following patches.
1215
1216         We expect to see the higher cpu and memory usage of network process as it is taking more work,
1217         but the overall gain in memory and latency after we completely remove storage process should be 
1218         positive.
1219
1220         * CMakeLists.txt:
1221         * DerivedSources.make:
1222         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp.
1223         (WebKit::WebIDBConnectionToClient::create):
1224         (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient):
1225         (WebKit::WebIDBConnectionToClient::~WebIDBConnectionToClient):
1226         (WebKit::WebIDBConnectionToClient::disconnectedFromWebProcess):
1227         (WebKit::WebIDBConnectionToClient::messageSenderConnection):
1228         (WebKit::WebIDBConnectionToClient::connectionToClient):
1229         (WebKit::WebIDBConnectionToClient::didDeleteDatabase):
1230         (WebKit::WebIDBConnectionToClient::didOpenDatabase):
1231         (WebKit::WebIDBConnectionToClient::didAbortTransaction):
1232         (WebKit::WebIDBConnectionToClient::didCommitTransaction):
1233         (WebKit::WebIDBConnectionToClient::didCreateObjectStore):
1234         (WebKit::WebIDBConnectionToClient::didDeleteObjectStore):
1235         (WebKit::WebIDBConnectionToClient::didRenameObjectStore):
1236         (WebKit::WebIDBConnectionToClient::didClearObjectStore):
1237         (WebKit::WebIDBConnectionToClient::didCreateIndex):
1238         (WebKit::WebIDBConnectionToClient::didDeleteIndex):
1239         (WebKit::WebIDBConnectionToClient::didRenameIndex):
1240         (WebKit::WebIDBConnectionToClient::didPutOrAdd):
1241         (WebKit::WebIDBConnectionToClient::handleGetResult):
1242         (WebKit::WebIDBConnectionToClient::didGetRecord):
1243         (WebKit::WebIDBConnectionToClient::didGetAllRecords):
1244         (WebKit::WebIDBConnectionToClient::didGetCount):
1245         (WebKit::WebIDBConnectionToClient::didDeleteRecord):
1246         (WebKit::WebIDBConnectionToClient::didOpenCursor):
1247         (WebKit::WebIDBConnectionToClient::didIterateCursor):
1248         (WebKit::WebIDBConnectionToClient::fireVersionChangeEvent):
1249         (WebKit::WebIDBConnectionToClient::didStartTransaction):
1250         (WebKit::WebIDBConnectionToClient::didCloseFromServer):
1251         (WebKit::WebIDBConnectionToClient::notifyOpenDBRequestBlocked):
1252         (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNames):
1253         (WebKit::WebIDBConnectionToClient::deleteDatabase):
1254         (WebKit::WebIDBConnectionToClient::openDatabase):
1255         (WebKit::WebIDBConnectionToClient::abortTransaction):
1256         (WebKit::WebIDBConnectionToClient::commitTransaction):
1257         (WebKit::WebIDBConnectionToClient::didFinishHandlingVersionChangeTransaction):
1258         (WebKit::WebIDBConnectionToClient::createObjectStore):
1259         (WebKit::WebIDBConnectionToClient::deleteObjectStore):
1260         (WebKit::WebIDBConnectionToClient::renameObjectStore):
1261         (WebKit::WebIDBConnectionToClient::clearObjectStore):
1262         (WebKit::WebIDBConnectionToClient::createIndex):
1263         (WebKit::WebIDBConnectionToClient::deleteIndex):
1264         (WebKit::WebIDBConnectionToClient::renameIndex):
1265         (WebKit::WebIDBConnectionToClient::putOrAdd):
1266         (WebKit::WebIDBConnectionToClient::getRecord):
1267         (WebKit::WebIDBConnectionToClient::getAllRecords):
1268         (WebKit::WebIDBConnectionToClient::getCount):
1269         (WebKit::WebIDBConnectionToClient::deleteRecord):
1270         (WebKit::WebIDBConnectionToClient::openCursor):
1271         (WebKit::WebIDBConnectionToClient::iterateCursor):
1272         (WebKit::WebIDBConnectionToClient::establishTransaction):
1273         (WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose):
1274         (WebKit::WebIDBConnectionToClient::databaseConnectionClosed):
1275         (WebKit::WebIDBConnectionToClient::abortOpenAndUpgradeNeeded):
1276         (WebKit::WebIDBConnectionToClient::didFireVersionChangeEvent):
1277         (WebKit::WebIDBConnectionToClient::openDBRequestCancelled):
1278         (WebKit::WebIDBConnectionToClient::confirmDidCloseFromServer):
1279         (WebKit::WebIDBConnectionToClient::getAllDatabaseNames):
1280         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.h.
1281         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.messages.in: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.messages.in.
1282         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1283         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1284
1285         Code moved from StorageToWebProcessConnection::didReceiveMessage.
1286
1287         (WebKit::NetworkConnectionToWebProcess::didClose):
1288         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
1289
1290         Network process receives and stores sandbox extension of temporary files for later indexedDB
1291         use.
1292
1293         (WebKit::NetworkConnectionToWebProcess::didClose):
1294         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
1295         (WebKit::generateIDBConnectionToServerIdentifier):
1296         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
1297         (WebKit::NetworkConnectionToWebProcess::removeIDBConnectionToServer):
1298         * NetworkProcess/NetworkConnectionToWebProcess.h:
1299         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1300         * NetworkProcess/NetworkProcess.cpp:
1301         (WebKit::NetworkProcess::NetworkProcess):
1302         (WebKit::NetworkProcess::initializeNetworkProcess):
1303         (WebKit::NetworkProcess::addWebsiteDataStore):
1304         (WebKit::NetworkProcess::fetchWebsiteData):
1305         (WebKit::NetworkProcess::deleteWebsiteData):
1306         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1307         (WebKit::NetworkProcess::idbServer):
1308         (WebKit::NetworkProcess::ensurePathExists):
1309         (WebKit::NetworkProcess::postStorageTask):
1310         (WebKit::NetworkProcess::performNextStorageTask):
1311         (WebKit::NetworkProcess::prepareForAccessToTemporaryFile):
1312         (WebKit::NetworkProcess::accessToTemporaryFileComplete):
1313         (WebKit::NetworkProcess::indexedDatabaseOrigins):
1314         (WebKit::NetworkProcess::addIndexedDatabaseSession):
1315         (WebKit::NetworkProcess::getSandboxExtensionsForBlobFiles):
1316
1317         Instead of asking UI process to grant sandbox extension to storage process, now network 
1318         process just asks for sandbox extension fot itself.
1319
1320         (WebKit::NetworkProcess::didGetSandboxExtensionsForBlobFiles):
1321         (WebKit::NetworkProcess::updateTemporaryFileSandboxExtensions):
1322         (WebKit::NetworkProcess::grantSandboxExtensionsToStorageProcessForBlobs): Deleted.
1323         (WebKit::NetworkProcess::didGrantSandboxExtensionsToStorageProcessForBlobs): Deleted.
1324         * NetworkProcess/NetworkProcess.h:
1325         * NetworkProcess/NetworkProcess.messages.in:
1326         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1327         (WebKit::NetworkProcessCreationParameters::encode const):
1328         (WebKit::NetworkProcessCreationParameters::decode):
1329         * NetworkProcess/NetworkProcessCreationParameters.h:
1330         * Shared/Storage/StorageProcessCreationParameters.cpp:
1331         (WebKit::StorageProcessCreationParameters::encode const):
1332         (WebKit::StorageProcessCreationParameters::decode):
1333         * Shared/Storage/StorageProcessCreationParameters.h:
1334         * Shared/WebsiteDataStoreParameters.cpp:
1335         (WebKit::WebsiteDataStoreParameters::encode const):
1336         (WebKit::WebsiteDataStoreParameters::decode):
1337         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
1338         * Shared/WebsiteDataStoreParameters.h:
1339         * Sources.txt:
1340         * StorageProcess/StorageProcess.cpp:
1341         (WebKit::StorageProcess::initializeWebsiteDataStore):
1342         (WebKit::StorageProcess::fetchWebsiteData):
1343         (WebKit::StorageProcess::deleteWebsiteData):
1344         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
1345         (WebKit::StorageProcess::idbServer): Deleted.
1346         (WebKit::StorageProcess::grantSandboxExtensionsForBlobs): Deleted.
1347         (WebKit::StorageProcess::prepareForAccessToTemporaryFile): Deleted.
1348         (WebKit::StorageProcess::accessToTemporaryFileComplete): Deleted.
1349         (WebKit::StorageProcess::indexedDatabaseOrigins): Deleted.
1350         (WebKit::StorageProcess::getSandboxExtensionsForBlobFiles): Deleted.
1351         (WebKit::StorageProcess::didGetSandboxExtensionsForBlobFiles): Deleted.
1352         * StorageProcess/StorageProcess.h:
1353         (WebKit::StorageProcess::queue): Deleted.
1354         * StorageProcess/StorageProcess.messages.in:
1355         * StorageProcess/StorageToWebProcessConnection.cpp:
1356         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
1357         (WebKit::StorageToWebProcessConnection::didClose):
1358         (WebKit::generateIDBConnectionToServerIdentifier): Deleted.
1359         (WebKit::StorageToWebProcessConnection::establishIDBConnectionToServer): Deleted.
1360         (WebKit::StorageToWebProcessConnection::removeIDBConnectionToServer): Deleted.
1361         * StorageProcess/StorageToWebProcessConnection.h:
1362         * StorageProcess/StorageToWebProcessConnection.messages.in:
1363         * UIProcess/Network/NetworkProcessProxy.cpp:
1364         (WebKit::NetworkProcessProxy::getSandboxExtensionsForBlobFiles):
1365         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToStorageProcessForBlobs): Deleted.
1366         * UIProcess/Network/NetworkProcessProxy.h:
1367         * UIProcess/Network/NetworkProcessProxy.messages.in:
1368         * UIProcess/Storage/StorageProcessProxy.cpp:
1369         (WebKit::StorageProcessProxy::getSandboxExtensionsForBlobFiles): Deleted.
1370         * UIProcess/Storage/StorageProcessProxy.h:
1371         * UIProcess/Storage/StorageProcessProxy.messages.in:
1372         * UIProcess/WebProcessPool.cpp:
1373         (WebKit::WebProcessPool::ensureNetworkProcess):
1374         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
1375         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
1376         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1377         (WebKit::WebsiteDataStore::parameters):
1378         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1379         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
1380         (WebKit::WebsiteDataStore::fetchDataAndApply):
1381         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
1382         (WebKit::WebsiteDataStore::removeData):
1383         (WebKit::WebsiteDataStore::storageProcessParameters):
1384         (WebKit::WebsiteDataStore::parameters):
1385         * WebKit.xcodeproj/project.pbxproj:
1386         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1387         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
1388         (WebKit::WebIDBConnectionToServer::~WebIDBConnectionToServer):
1389         (WebKit::WebIDBConnectionToServer::messageSenderConnection):
1390         * WebProcess/Databases/WebDatabaseProvider.cpp:
1391         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
1392         * WebProcess/Network/NetworkProcessConnection.cpp:
1393         (WebKit::NetworkProcessConnection::didReceiveMessage):
1394         (WebKit::NetworkProcessConnection::didClose):
1395         (WebKit::NetworkProcessConnection::idbConnectionToServerForSession):
1396         * WebProcess/Network/NetworkProcessConnection.h:
1397         (WebKit::NetworkProcessConnection::existingIDBConnectionToServerForIdentifier const):
1398         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
1399         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
1400         (WebKit::WebToStorageProcessConnection::didClose):
1401         (WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession): Deleted.
1402         * WebProcess/Storage/WebToStorageProcessConnection.h:
1403         (WebKit::WebToStorageProcessConnection::existingIDBConnectionToServerForIdentifier): Deleted.
1404         * WebProcess/WebProcess.cpp:
1405         (WebKit::WebProcess::networkProcessConnectionClosed):
1406         (WebKit::WebProcess::webToStorageProcessConnectionClosed):
1407
1408 2018-09-08  Darin Adler  <darin@apple.com>
1409
1410         Streamline JSRetainPtr, fix leaks of JSString and JSGlobalContext
1411         https://bugs.webkit.org/show_bug.cgi?id=189455
1412
1413         Reviewed by Keith Miller.
1414
1415         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1416         (WebKit::toJSString): Use adopt function instead of adopt construuctor.
1417         (WebKit::evaluate): Ditto.
1418         (WebKit::evaluateJavaScriptCallback): Ditto.
1419         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Ditto.
1420
1421 2018-09-14  Matt Lewis  <jlewis3@apple.com>
1422
1423         Unreviewed, rolling out r236020.
1424
1425         This caused an api failure on High Sierra
1426
1427         Reverted changeset:
1428
1429         "Refactoring related to Safe Browsing"
1430         https://bugs.webkit.org/show_bug.cgi?id=189631
1431         https://trac.webkit.org/changeset/236020
1432
1433 2018-09-14  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1434
1435         [Curl] Bug fix on some inaccurate values in NetworkLoadMetrics.
1436         https://bugs.webkit.org/show_bug.cgi?id=189530
1437
1438         Reviewed by Alex Christensen.
1439
1440         Curl port uses the start time libcurl provided. But there's a lug between main thread and Curl thread.
1441         Record the start time of request instead of libcurl's start timing and use it to measure the metrics.
1442
1443         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1444         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl):
1445         (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
1446         (WebKit::NetworkDataTaskCurl::restartWithCredential):
1447         * NetworkProcess/curl/NetworkDataTaskCurl.h:
1448
1449 2018-09-14  Alex Christensen  <achristensen@webkit.org>
1450
1451         Refactoring related to Safe Browsing
1452         https://bugs.webkit.org/show_bug.cgi?id=189631
1453
1454         Reviewed by Tim Horton.
1455
1456         Make SafeBrowsingResult RefCounted.
1457         Move logic from an unnamed lambda to WebPageProxy::receivedNavigationPolicyDecision.
1458
1459         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1460         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
1461         (WebKit::WebPageProxy::contentFilterDidBlockLoadForFrame): Deleted.
1462         (WebKit::WebPageProxy::addPlatformLoadParameters): Deleted.
1463         (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): Deleted.
1464         (WebKit::WebPageProxy::startDrag): Deleted.
1465         (WebKit::WebPageProxy::setPromisedDataForImage): Deleted.
1466         (WebKit::WebPageProxy::setDragCaretRect): Deleted.
1467         (WebKit::WebPageProxy::platformRegisterAttachment): Deleted.
1468         (WebKit::WebPageProxy::platformCloneAttachment): Deleted.
1469         * UIProcess/SafeBrowsingResult.h:
1470         (WebKit::SafeBrowsingResult::create):
1471         * UIProcess/WebFramePolicyListenerProxy.cpp:
1472         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
1473         * UIProcess/WebFramePolicyListenerProxy.h:
1474         * UIProcess/WebFrameProxy.cpp:
1475         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
1476         * UIProcess/WebFrameProxy.h:
1477         * UIProcess/WebPageProxy.cpp:
1478         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1479         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1480         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1481         (WebKit::WebPageProxy::decidePolicyForResponse):
1482         * UIProcess/WebPageProxy.h:
1483
1484 2018-09-14  Geoffrey Garen  <ggaren@apple.com>
1485
1486         Clarify the configuration used by WKUIDelegate's createWebViewWithConfiguration
1487         https://bugs.webkit.org/show_bug.cgi?id=189634
1488
1489         Reviewed by Tim Horton.
1490
1491         * UIProcess/API/Cocoa/WKUIDelegate.h:
1492
1493 2018-09-11  Simon Fraser  <simon.fraser@apple.com>
1494
1495         Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings
1496         https://bugs.webkit.org/show_bug.cgi?id=189521
1497
1498         Reviewed by Tim Horton.
1499
1500         Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>.
1501         
1502         RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>.
1503         
1504         Added some helper functions to null out a RefPtr<GraphicsLayer> after removing from the tree,
1505         clearing the client. GraphicsLayer.m_client becomes a pointer, so it can be set to point to a singleton
1506         empty client when a GraphicsLayer gets detached from its owner. More explicit layer unparenting,
1507         and removed some unnecessary parent checks, and redundant unparenting.
1508         
1509         Other changes are just to adapt to the new ownership patterns.
1510         
1511         I verified that no GraphicsLayers were leaked or abandoned after this change.
1512
1513         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
1514         (WebKit::WebInspectorClient::~WebInspectorClient):
1515         (WebKit::WebInspectorClient::showPaintRect):
1516         (WebKit::WebInspectorClient::animationEndedForLayer):
1517         * WebProcess/WebCoreSupport/WebInspectorClient.h:
1518         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
1519         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
1520         (WebKit::RemoteLayerTreeContext::createGraphicsLayer):
1521         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
1522         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1523         (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers):
1524         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1525
1526 2018-09-14  Eric Carlson  <eric.carlson@apple.com>
1527
1528         Support arbitrary video resolution in getUserMedia API
1529         https://bugs.webkit.org/show_bug.cgi?id=178109
1530         <rdar://problem/35083128>
1531
1532         Reviewed by Youenn Fablet.
1533
1534         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
1535
1536 2018-09-14  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1537
1538         [Curl][WebKit] Bug fix for continuously retrying with empty credentials.
1539         https://bugs.webkit.org/show_bug.cgi?id=189601
1540
1541         Reviewed by Alex Christensen.
1542
1543         Added stop condition for empty credentials passed by client.
1544
1545         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1546         (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
1547         (WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse):
1548         (WebKit::NetworkDataTaskCurl::tryHttpAuthentication):
1549         (WebKit::NetworkDataTaskCurl::tryProxyAuthentication):
1550         * NetworkProcess/curl/NetworkDataTaskCurl.h:
1551
1552 2018-09-14  Jer Noble  <jer.noble@apple.com>
1553
1554         Turn SourceBufferChangeTypeEnabled on by default
1555         https://bugs.webkit.org/show_bug.cgi?id=189527
1556
1557         Reviewed by Eric Carlson.
1558
1559         * Shared/WebPreferences.yaml:
1560         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1561
1562 2018-09-14  Michael Catanzaro  <mcatanzaro@igalia.com>
1563
1564         Unreviewed, speculative WPE build fix after r236004
1565         https://bugs.webkit.org/show_bug.cgi?id=189545
1566
1567         * UIProcess/API/wpe/WebKitScriptDialog.h:
1568
1569 2018-09-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1570
1571         [GTK] Make script dialogs modal to the current web view only
1572         https://bugs.webkit.org/show_bug.cgi?id=189545
1573
1574         Reviewed by Michael Catanzaro.
1575
1576         Change the default implementation of script dialogs to use an embedded window, like the HTTP auth dialog,
1577         instead of a GtkMessageDialog. This patch adds a base class WebKitWebViewDialog shared by
1578         WebKitAuthenticationDialog and the new WebKitScriptDialogImpl.
1579
1580         * SourcesGTK.txt: Add new files to compilation.
1581         * UIProcess/API/glib/WebKitScriptDialogPrivate.h:
1582         * UIProcess/API/gtk/WebKitAuthenticationDialog.cpp:
1583         (webkitAuthenticationDialogInitialize): Do not use a frame and use a better styled title.
1584         (webkit_authentication_dialog_class_init): Remove implementation of vfuncs that are now implemented by the
1585         parent.
1586         * UIProcess/API/gtk/WebKitAuthenticationDialog.h:
1587         * UIProcess/API/gtk/WebKitScriptDialogGtk.cpp:
1588         (webkitScriptDialogAccept): Use WebKitScriptDialogImpl API.
1589         (webkitScriptDialogDismiss): Ditto.
1590         (webkitScriptDialogSetUserInput): Ditto.
1591         * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp: Added.
1592         (webkitScriptDialogImplClose):
1593         (webkitScriptDialogImplKeyPressEvent):
1594         (webkitScriptDialogImplMap):
1595         (webkitScriptDialogImplConstructed):
1596         (webkitScriptDialogImplDispose):
1597         (webkit_script_dialog_impl_class_init):
1598         (webkitScriptDialogImplAddButton):
1599         (webkitScriptDialogImplNew):
1600         (webkitScriptDialogImplCancel):
1601         (webkitScriptDialogImplConfirm):
1602         (webkitScriptDialogImplSetEntryText):
1603         * UIProcess/API/gtk/WebKitScriptDialogImpl.h: Added.
1604         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1605         (webkitWebViewChildIsInternalWidget): Rename authenticationDialog as just dialog.
1606         (webkitWebViewBaseAddDialog): Ditto.
1607         (webkitWebViewBaseContainerRemove): Ditto.
1608         (webkitWebViewBaseContainerForall): Ditto.
1609         (webkitWebViewBaseConstructed): Ditto.
1610         (webkitWebViewBaseSizeAllocate): Ditto.
1611         (webkitWebViewBaseKeyPressEvent): Ditto.
1612         (webkitWebViewBaseHandleMouseEvent): Ditto.
1613         (webkitWebViewBaseButtonPressEvent): Ditto.
1614         (webkitWebViewBaseButtonReleaseEvent): Ditto.
1615         (webkitWebViewBaseHandleWheelEvent): Ditto.
1616         (webkitWebViewBaseScrollEvent): Ditto.
1617         (webkitWebViewBaseMotionNotifyEvent): Ditto.
1618         (webkitWebViewBaseCrossingNotifyEvent): Ditto.
1619         (webkitWebViewBaseTouchEvent): Ditto.
1620         (webkitWebViewBaseFocus): Ditto.
1621         (webkitWebViewBaseDestroy): Ditto.
1622         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
1623         * UIProcess/API/gtk/WebKitWebViewDialog.cpp: Added.
1624         (webkitWebViewDialogDraw):
1625         (webkitWebViewDialogSizeAllocate):
1626         (webkitWebViewDialogConstructed):
1627         (webkit_web_view_dialog_class_init):
1628         * UIProcess/API/gtk/WebKitWebViewDialog.h: Added.
1629         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
1630         (webkitWebViewAuthenticate):
1631         (webkitWebViewScriptDialog):
1632
1633 2018-09-13  Ryan Haddad  <ryanhaddad@apple.com>
1634
1635         Unreviewed, rolling out r235954.
1636
1637         Breaks the watchOS build.
1638
1639         Reverted changeset:
1640
1641         "Move IndexedDB to Network Process"
1642         https://bugs.webkit.org/show_bug.cgi?id=189415
1643         https://trac.webkit.org/changeset/235954
1644
1645 2018-09-13  Chris Dumez  <cdumez@apple.com>
1646
1647         Regression(PSON): setting window.opener to null allows process swapping in cases that are not web-compatible
1648         https://bugs.webkit.org/show_bug.cgi?id=189590
1649         <rdar://problem/44422725>
1650
1651         Reviewed by Geoffrey Garen.
1652
1653         If script calls window.open() without 'noopener' and the newly navigated window gets navigated cross-site,
1654         we are currently unable to process-swap because the opener has a WindowProxy handle to this new Window and
1655         may interact with it (which we currently do not support cross-process). We were dealing with this by not
1656         process-swapping if window.opener is not null. This works most of the time but is not sufficient because the
1657         opener may get nulled out, while the opener still has a valid WindowProxy handle to its openee.
1658
1659         Therefore, we now also check for a flag indicating if the frame was opened via window.open() without
1660         'nooopener'. We still need to check if the browsing context has an opener for browsing context created
1661         via <a target="_blank"> for example (the opener does not have a handle to the new window but the openee
1662         has access to its opener).
1663
1664         * Shared/NavigationActionData.cpp:
1665         (WebKit::NavigationActionData::encode const):
1666         (WebKit::NavigationActionData::decode):
1667         * Shared/NavigationActionData.h:
1668         * UIProcess/API/APINavigation.h:
1669         (API::Navigation::openedViaWindowOpenWithOpener const):
1670         (API::Navigation::setOpenedViaWindowOpenWithOpener):
1671         * UIProcess/WebPageProxy.cpp:
1672         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1673         * UIProcess/WebProcessPool.cpp:
1674         (WebKit::WebProcessPool::processForNavigationInternal):
1675         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1676         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1677
1678 2018-09-13  Dean Jackson  <dino@grorg.org>
1679
1680         Generate warnings for Preferences files
1681         https://bugs.webkit.org/show_bug.cgi?id=189573
1682
1683         Reviewed by Sam Weinig.
1684
1685         Generate the "DO NOT EDIT" warnings, rather than have
1686         them in the template (which was confusing).
1687
1688         While here, simplify some of the templating generation code
1689         to avoid duplication.
1690
1691         * Scripts/GeneratePreferences.rb:
1692         * Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb:
1693         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
1694         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
1695         * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb:
1696         * Scripts/PreferencesTemplates/WebPreferencesKeys.cpp.erb:
1697         * Scripts/PreferencesTemplates/WebPreferencesKeys.h.erb:
1698         * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb:
1699
1700 2018-09-13  Keith Rollin  <krollin@apple.com>
1701
1702         WebPageProxy::reportPageLoadResult can crash on some code paths
1703         https://bugs.webkit.org/show_bug.cgi?id=189568
1704
1705         Reviewed by Chris Dumez.
1706
1707         WebPageProxy::reportPageLoadResult (which is called from
1708         WebPageProxy::didFinishLoadForFrame) can sometimes crash when
1709         accessing m_pageLoadStart (a std::optional) in its unloaded state.
1710         Normally, m_pageLoadStart is initialized in
1711         WebPageProxy::didStartProvisionalLoadForFrame, which one would expect
1712         would be called before WebPageProxy::didFinishLoadForFrame. But that
1713         turns out to not always be the case. It's not apparent under what
1714         conditions didStartProvisionalLoadForFrame will not be called, but
1715         it's happening in the wild, leading to crashes now that std::optional
1716         asserts in release builds on bad accesses (see
1717         https://bugs.webkit.org/show_bug.cgi?id=189568).
1718
1719         Fix this by checking m_pageLoadState on entry to reportPageLoadResult.
1720
1721         * UIProcess/WebPageProxy.cpp:
1722         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
1723         (WebKit::WebPageProxy::didFinishLoadForFrame):
1724         (WebKit::WebPageProxy::didFailLoadForFrame):
1725         (WebKit::WebPageProxy::reportPageLoadResult):
1726
1727 2018-09-13  Chris Dumez  <cdumez@apple.com>
1728
1729         ProcessSwap.BackWithoutSuspendedPage API test hits assertion under WebPageProxy::didCreateMainFrame()
1730         https://bugs.webkit.org/show_bug.cgi?id=189599
1731
1732         Reviewed by Geoffrey Garen.
1733
1734         The code in WebPageProxy::reattachToWebProcess() was re-initializing m_mainFrame unconditionally in case
1735         of a HistoryNavigation. The reason we need to initialize m_mainFrame in reattachToWebProcess() is if the
1736         process we're reattaching to already has a WebPage (with a main frame), in which case
1737         WebPageProxy::didCreateMainFrame() would not get called to initialize WebPageProxy::m_mainFrame.
1738
1739         The process we're reattaching to can be in such a state only if it comes from a SuspendedPageProxy (we
1740         detached the WebProcessProxy from the WebPageProxy but kept the WebPage in the "suspended" WebProcess).
1741         It is true that we're only reattaching to a SuspendedPageProxy's process in the event of history
1742         navigations. However, it is not true that all history navigations will use a SuspendedPageProxy's process.
1743         For example, no SuspendedPageProxy may be available for the history navigation because the history
1744         was restored to a new view from disk, or because the WebBackForwardListItem no longer has a
1745         SuspendedPageProxy (we currently only keep a single SuspendedPageProxy for the last HistoryItem).
1746
1747         Therefore, unconditionally initializating m_mainFrame in reattachToWebProcess() for history navigations
1748         is incorrect and we should instead check if we're reattaching to a SuspendedPage's process.
1749
1750         Change is covered by ProcessSwap.BackWithoutSuspendedPage API test which is no longer crashes and
1751         existing Back/Forward PSON API tests which are still passing.
1752
1753         * UIProcess/WebPageProxy.cpp:
1754         (WebKit::WebPageProxy::reattachToWebProcess):
1755         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1756         * UIProcess/WebPageProxy.h:
1757
1758 2018-09-13  Chris Dumez  <cdumez@apple.com>
1759
1760         Add release logging to help debug PSON issues
1761         https://bugs.webkit.org/show_bug.cgi?id=189562
1762
1763         Reviewed by Ryosuke Niwa.
1764
1765         Add release logging to help debug issues related to process swap on navigation.
1766
1767         * UIProcess/WebPageProxy.cpp:
1768         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1769         * UIProcess/WebProcessPool.cpp:
1770         (WebKit::WebProcessPool::processForNavigation):
1771         (WebKit::WebProcessPool::processForNavigationInternal):
1772         * UIProcess/WebProcessPool.h:
1773
1774 2018-09-13  Chris Dumez  <cdumez@apple.com>
1775
1776         Add null check for drawing area in WebPage::didCompletePageTransition() after r235867
1777         https://bugs.webkit.org/show_bug.cgi?id=189587
1778
1779         Reviewed by Geoffrey Garen.
1780
1781         Add null check for drawing area in WebPage::didCompletePageTransition() after r235867
1782         as this is causing crashes on the bots.
1783
1784         * WebProcess/WebPage/WebPage.cpp:
1785         (WebKit::WebPage::didCompletePageTransition):
1786
1787 2018-09-13  Ryan Haddad  <ryanhaddad@apple.com>
1788
1789         Unreviewed, rolling out r235953.
1790
1791         Caused layout test crashes under GuardMalloc.
1792
1793         Reverted changeset:
1794
1795         "Make GraphicsLayers ref-counted, so their tree can persist
1796         when disconnected from RenderLayerBackings"
1797         https://bugs.webkit.org/show_bug.cgi?id=189521
1798         https://trac.webkit.org/changeset/235953
1799
1800 2018-09-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1801
1802         [GTK][WPE] Allow to run script dialogs asynchronously in the UI process
1803         https://bugs.webkit.org/show_bug.cgi?id=189544
1804
1805         Reviewed by Michael Catanzaro.
1806
1807         Script dialogs are sync in the WebProcess, but we don't need to block the UI process while they are running. Our
1808         current API doesn't allow it, because it always expects the dialog to be closed in the signal handler. API
1809         changes are backwards compatible.
1810
1811         * UIProcess/API/glib/WebKitScriptDialog.cpp:
1812         (webkitScriptDialogCreate): Added to heap allocate a WebKitScriptDialog.
1813         (webkitScriptDialogIsRunning): Common implementation here, a script dialog is considered to be running if it has
1814         a competion handler pending.
1815         (webkit_script_dialog_ref): WebKitScriptDialog is now refcounted.
1816         (webkit_script_dialog_unref): Ditto.
1817         (webkit_script_dialog_close): New method to notify that we are done with the dialog.
1818         * UIProcess/API/glib/WebKitScriptDialogPrivate.h:
1819         (_WebKitScriptDialog::_WebKitScriptDialog): Use a single constructor and keep the completion handler.
1820         * UIProcess/API/glib/WebKitUIClient.cpp: Do not call the completion handler, pass it to the web view.
1821         * UIProcess/API/glib/WebKitWebView.cpp:
1822         (webkitWebViewDispose): Close the current script dialog if there's any.
1823         (webkit_web_view_class_init): Document how to handle dialogs asynchronously.
1824         (webkitWebViewRunJavaScriptAlert): Do not stack allocate the WebKitScriptDialog, create it with
1825         webkitScriptDialogCreate() passing the completion handler.
1826         (webkitWebViewRunJavaScriptConfirm): Ditto.
1827         (webkitWebViewRunJavaScriptPrompt): Ditto.
1828         (webkitWebViewRunJavaScriptBeforeUnloadConfirm): Ditto.
1829         * UIProcess/API/glib/WebKitWebViewPrivate.h:
1830         * UIProcess/API/gtk/WebKitScriptDialog.h:
1831         * UIProcess/API/gtk/WebKitScriptDialogGtk.cpp:
1832         (scriptDialogResponseCallback): Hnadle the response callback.
1833         (webkitScriptDialogRun): Do not use gtk_dialog_run(), connect to response signal and show the dialogs instead.
1834         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1835         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
1836         * UIProcess/API/wpe/WebKitScriptDialogWPE.cpp:
1837
1838 2018-09-12  Dan Bernstein  <mitz@apple.com>
1839
1840         Update availability annotations to match the macOS and iOS SDKs in the Xcode 10 GM seed
1841         https://bugs.webkit.org/show_bug.cgi?id=189561
1842
1843         Reviewed by Tim Horton.
1844
1845         Changed WK_MAC_TBA and WK_IOS_TBA to 10.14 and 12.0, respectively, in all declarations that
1846         appear in the GM seed SDKs.
1847
1848         * Shared/API/Cocoa/_WKRenderingProgressEvents.h:
1849         * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
1850         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1851         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1852         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1853         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1854         * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
1855         * UIProcess/API/Cocoa/WKViewPrivate.h:
1856         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1857         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1858         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
1859         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1860         * UIProcess/API/Cocoa/_WKAttachment.h:
1861         * UIProcess/API/Cocoa/_WKAutomationDelegate.h:
1862         * UIProcess/API/Cocoa/_WKAutomationSession.h:
1863         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
1864         * UIProcess/API/Cocoa/_WKFormInputSession.h:
1865         * UIProcess/API/Cocoa/_WKInputDelegate.h:
1866         * UIProcess/API/Cocoa/_WKLinkIconParameters.h:
1867         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1868         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
1869         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h:
1870         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.h:
1871         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h:
1872         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
1873
1874 2018-09-12  Dan Bernstein  <mitz@apple.com>
1875
1876         [Cocoa] Complete support for Paste as Quotation
1877         https://bugs.webkit.org/show_bug.cgi?id=189504
1878
1879         Reviewed by Wenson Hsieh.
1880
1881         * UIProcess/API/Cocoa/WKWebView.mm:
1882         (-[WKWebView canPerformAction:withSender:]): Handle _pasteAsQuotation:. It’s not included
1883           in FOR_EACH_WKCONTENTVIEW_ACTION, because it’s declared and implemented in the WKPrivate
1884           category. If we add more actions in the category, it could make sense to fold them into
1885           a new FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION.
1886         (-[WKWebView targetForAction:withSender:]): Handle _pasteAsQuotation:.
1887         (-[WKWebView _pasteAsQuotation:]): Send to the WebViewImpl or the WKContentView.
1888         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declared a new _pasteAsQuotation: action.
1889
1890         * UIProcess/Cocoa/WebViewImpl.mm:
1891         (WebKit::selectorExceptionMap): Added a custom mapping from the new selector to the
1892           PasteAsQuotation command.
1893
1894         * UIProcess/ios/WKContentViewInteraction.h: Declare methods for the new action.
1895         * UIProcess/ios/WKContentViewInteraction.mm:
1896           Forward _pasteAsQuotation: to the WKWebView so that clients get a chance to override its
1897           behavior.
1898         (-[WKContentView _pasteAsQuotationForWebView:]): Send the command to the page.
1899
1900 2018-09-12  Sihui Liu  <sihui_liu@apple.com>
1901
1902         Move IndexedDB to Network Process
1903         https://bugs.webkit.org/show_bug.cgi?id=189415
1904
1905         Reviewed by Geoffrey Garen.
1906
1907         We are going to eliminate storage process and move its functionality to network process. 
1908         The reasons why we want to do this:
1909         1. Lower resource usage of having an additional process for storage operations, especially
1910         memory. Single storage process takes about 5MB memory on macOS.
1911         2. Reduce latency of Service Workers. After enabling Service Workers, we've seen
1912         regression in app launch. The launch time of storage process is partly attributed to this:
1913         Service Workers delay page loading until receiving response from storage process.
1914         3. We choose network process because UI process may have broader access in file system
1915         that we don't want the storage operations to have.
1916
1917         This patch is the first piece towards the goal. It mainly moves indexedDB from storage process
1918         to corresponding components of network process. Moving of Service Worker and stopping to 
1919         launch storage process will be done in following patches.
1920
1921         We expect to see the higher cpu and memory usage of network process as it is taking more work,
1922         but the overall gain in memory and latency after we completely remove storage process should be 
1923         positive.
1924
1925
1926         * CMakeLists.txt:
1927         * DerivedSources.make:
1928
1929         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp.
1930         (WebKit::WebIDBConnectionToClient::create):
1931         (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient):
1932         (WebKit::WebIDBConnectionToClient::~WebIDBConnectionToClient):
1933         (WebKit::WebIDBConnectionToClient::disconnectedFromWebProcess):
1934         (WebKit::WebIDBConnectionToClient::messageSenderConnection):
1935         (WebKit::WebIDBConnectionToClient::connectionToClient):
1936         (WebKit::WebIDBConnectionToClient::didDeleteDatabase):
1937         (WebKit::WebIDBConnectionToClient::didOpenDatabase):
1938         (WebKit::WebIDBConnectionToClient::didAbortTransaction):
1939         (WebKit::WebIDBConnectionToClient::didCommitTransaction):
1940         (WebKit::WebIDBConnectionToClient::didCreateObjectStore):
1941         (WebKit::WebIDBConnectionToClient::didDeleteObjectStore):
1942         (WebKit::WebIDBConnectionToClient::didRenameObjectStore):
1943         (WebKit::WebIDBConnectionToClient::didClearObjectStore):
1944         (WebKit::WebIDBConnectionToClient::didCreateIndex):
1945         (WebKit::WebIDBConnectionToClient::didDeleteIndex):
1946         (WebKit::WebIDBConnectionToClient::didRenameIndex):
1947         (WebKit::WebIDBConnectionToClient::didPutOrAdd):
1948         (WebKit::WebIDBConnectionToClient::handleGetResult):
1949         (WebKit::WebIDBConnectionToClient::didGetRecord):
1950         (WebKit::WebIDBConnectionToClient::didGetAllRecords):
1951         (WebKit::WebIDBConnectionToClient::didGetCount):
1952         (WebKit::WebIDBConnectionToClient::didDeleteRecord):
1953         (WebKit::WebIDBConnectionToClient::didOpenCursor):
1954         (WebKit::WebIDBConnectionToClient::didIterateCursor):
1955         (WebKit::WebIDBConnectionToClient::fireVersionChangeEvent):
1956         (WebKit::WebIDBConnectionToClient::didStartTransaction):
1957         (WebKit::WebIDBConnectionToClient::didCloseFromServer):
1958         (WebKit::WebIDBConnectionToClient::notifyOpenDBRequestBlocked):
1959         (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNames):
1960         (WebKit::WebIDBConnectionToClient::deleteDatabase):
1961         (WebKit::WebIDBConnectionToClient::openDatabase):
1962         (WebKit::WebIDBConnectionToClient::abortTransaction):
1963         (WebKit::WebIDBConnectionToClient::commitTransaction):
1964         (WebKit::WebIDBConnectionToClient::didFinishHandlingVersionChangeTransaction):
1965         (WebKit::WebIDBConnectionToClient::createObjectStore):
1966         (WebKit::WebIDBConnectionToClient::deleteObjectStore):
1967         (WebKit::WebIDBConnectionToClient::renameObjectStore):
1968         (WebKit::WebIDBConnectionToClient::clearObjectStore):
1969         (WebKit::WebIDBConnectionToClient::createIndex):
1970         (WebKit::WebIDBConnectionToClient::deleteIndex):
1971         (WebKit::WebIDBConnectionToClient::renameIndex):
1972         (WebKit::WebIDBConnectionToClient::putOrAdd):
1973         (WebKit::WebIDBConnectionToClient::getRecord):
1974         (WebKit::WebIDBConnectionToClient::getAllRecords):
1975         (WebKit::WebIDBConnectionToClient::getCount):
1976         (WebKit::WebIDBConnectionToClient::deleteRecord):
1977         (WebKit::WebIDBConnectionToClient::openCursor):
1978         (WebKit::WebIDBConnectionToClient::iterateCursor):
1979         (WebKit::WebIDBConnectionToClient::establishTransaction):
1980         (WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose):
1981         (WebKit::WebIDBConnectionToClient::databaseConnectionClosed):
1982         (WebKit::WebIDBConnectionToClient::abortOpenAndUpgradeNeeded):
1983         (WebKit::WebIDBConnectionToClient::didFireVersionChangeEvent):
1984         (WebKit::WebIDBConnectionToClient::openDBRequestCancelled):
1985         (WebKit::WebIDBConnectionToClient::confirmDidCloseFromServer):
1986         (WebKit::WebIDBConnectionToClient::getAllDatabaseNames):
1987         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.h.
1988         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.messages.in: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.messages.in.
1989         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1990         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1991
1992         Code moved from StorageToWebProcessConnection::didReceiveMessage.
1993
1994         (WebKit::NetworkConnectionToWebProcess::didClose):
1995         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
1996
1997         Network process receives and stores sandbox extension of temporary files for later indexedDB
1998         use.
1999
2000         (WebKit::generateIDBConnectionToServerIdentifier):
2001         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
2002         (WebKit::NetworkConnectionToWebProcess::removeIDBConnectionToServer):
2003         * NetworkProcess/NetworkConnectionToWebProcess.h:
2004         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2005         * NetworkProcess/NetworkProcess.cpp:
2006         (WebKit::NetworkProcess::NetworkProcess):
2007         (WebKit::NetworkProcess::initializeNetworkProcess):
2008         (WebKit::NetworkProcess::addWebsiteDataStore):
2009         (WebKit::NetworkProcess::fetchWebsiteData):
2010         (WebKit::NetworkProcess::deleteWebsiteData):
2011         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2012         (WebKit::NetworkProcess::idbServer):
2013         (WebKit::NetworkProcess::ensurePathExists):
2014         (WebKit::NetworkProcess::postStorageTask):
2015         (WebKit::NetworkProcess::performNextStorageTask):
2016         (WebKit::NetworkProcess::prepareForAccessToTemporaryFile):
2017         (WebKit::NetworkProcess::accessToTemporaryFileComplete):
2018         (WebKit::NetworkProcess::indexedDatabaseOrigins):
2019         (WebKit::NetworkProcess::addIndexedDatabaseSession):
2020         (WebKit::NetworkProcess::getSandboxExtensionsForBlobFiles):
2021
2022         Instead of asking UI process to grant sandbox extension to storage process, now network 
2023         process just asks for sandbox extension fot itself.
2024
2025         (WebKit::NetworkProcess::didGetSandboxExtensionsForBlobFiles):
2026         (WebKit::NetworkProcess::updateTemporaryFileSandboxExtensions):
2027         (WebKit::NetworkProcess::grantSandboxExtensionsToStorageProcessForBlobs): Deleted.
2028         (WebKit::NetworkProcess::didGrantSandboxExtensionsToStorageProcessForBlobs): Deleted.
2029         * NetworkProcess/NetworkProcess.h:
2030         (WebKit::NetworkProcess::queue):
2031         * NetworkProcess/NetworkProcess.messages.in:
2032         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2033         (WebKit::NetworkProcessCreationParameters::encode const):
2034         (WebKit::NetworkProcessCreationParameters::decode):
2035         * NetworkProcess/NetworkProcessCreationParameters.h:
2036         * Shared/Storage/StorageProcessCreationParameters.cpp:
2037         (WebKit::StorageProcessCreationParameters::encode const):
2038         (WebKit::StorageProcessCreationParameters::decode):
2039         * Shared/Storage/StorageProcessCreationParameters.h:
2040         * Shared/WebsiteDataStoreParameters.cpp:
2041         (WebKit::WebsiteDataStoreParameters::encode const):
2042         (WebKit::WebsiteDataStoreParameters::decode):
2043         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
2044         * Shared/WebsiteDataStoreParameters.h:
2045         * Sources.txt:
2046         * StorageProcess/StorageProcess.cpp:
2047         (WebKit::StorageProcess::initializeWebsiteDataStore):
2048         (WebKit::StorageProcess::fetchWebsiteData):
2049         (WebKit::StorageProcess::deleteWebsiteData):
2050         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
2051         (WebKit::StorageProcess::idbServer): Deleted.
2052         (WebKit::StorageProcess::grantSandboxExtensionsForBlobs): Deleted.
2053         (WebKit::StorageProcess::prepareForAccessToTemporaryFile): Deleted.
2054         (WebKit::StorageProcess::accessToTemporaryFileComplete): Deleted.
2055         (WebKit::StorageProcess::indexedDatabaseOrigins): Deleted.
2056         (WebKit::StorageProcess::getSandboxExtensionsForBlobFiles): Deleted.
2057         (WebKit::StorageProcess::didGetSandboxExtensionsForBlobFiles): Deleted.
2058         * StorageProcess/StorageProcess.h:
2059         (WebKit::StorageProcess::queue): Deleted.
2060         * StorageProcess/StorageProcess.messages.in:
2061         * StorageProcess/StorageToWebProcessConnection.cpp:
2062         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
2063         (WebKit::StorageToWebProcessConnection::didClose):
2064         (WebKit::generateIDBConnectionToServerIdentifier): Deleted.
2065         (WebKit::StorageToWebProcessConnection::establishIDBConnectionToServer): Deleted.
2066         (WebKit::StorageToWebProcessConnection::removeIDBConnectionToServer): Deleted.
2067         * StorageProcess/StorageToWebProcessConnection.h:
2068         * StorageProcess/StorageToWebProcessConnection.messages.in:
2069         * UIProcess/Network/NetworkProcessProxy.cpp:
2070         (WebKit::NetworkProcessProxy::getSandboxExtensionsForBlobFiles):
2071         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToStorageProcessForBlobs): Deleted.
2072         * UIProcess/Network/NetworkProcessProxy.h:
2073         * UIProcess/Network/NetworkProcessProxy.messages.in:
2074         * UIProcess/Storage/StorageProcessProxy.cpp:
2075         (WebKit::StorageProcessProxy::getSandboxExtensionsForBlobFiles): Deleted.
2076         * UIProcess/Storage/StorageProcessProxy.h:
2077         * UIProcess/Storage/StorageProcessProxy.messages.in:
2078         * UIProcess/WebProcessPool.cpp:
2079         (WebKit::WebProcessPool::ensureNetworkProcess):
2080         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
2081         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
2082         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2083         (WebKit::WebsiteDataStore::parameters):
2084         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2085         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
2086         (WebKit::WebsiteDataStore::fetchDataAndApply):
2087         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
2088         (WebKit::WebsiteDataStore::removeData):
2089         (WebKit::WebsiteDataStore::storageProcessParameters):
2090         (WebKit::WebsiteDataStore::parameters):
2091         * WebKit.xcodeproj/project.pbxproj:
2092         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
2093         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
2094         (WebKit::WebIDBConnectionToServer::~WebIDBConnectionToServer):
2095         (WebKit::WebIDBConnectionToServer::messageSenderConnection):
2096         * WebProcess/Databases/WebDatabaseProvider.cpp:
2097         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
2098         * WebProcess/Network/NetworkProcessConnection.cpp:
2099         (WebKit::NetworkProcessConnection::didReceiveMessage):
2100         (WebKit::NetworkProcessConnection::didClose):
2101         (WebKit::NetworkProcessConnection::idbConnectionToServerForSession):
2102         * WebProcess/Network/NetworkProcessConnection.h:
2103         (WebKit::NetworkProcessConnection::existingIDBConnectionToServerForIdentifier):
2104         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
2105         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
2106
2107         Code moved from WebToStorageProcessConnection::didReceiveMessage.
2108
2109         (WebKit::WebToStorageProcessConnection::didClose):
2110         (WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession): Deleted.
2111         * WebProcess/Storage/WebToStorageProcessConnection.h:
2112         (WebKit::WebToStorageProcessConnection::existingIDBConnectionToServerForIdentifier): Deleted.
2113         * WebProcess/WebProcess.cpp:
2114         (WebKit::WebProcess::networkProcessConnectionClosed):
2115         (WebKit::WebProcess::webToStorageProcessConnectionClosed):
2116
2117 2018-09-11  Simon Fraser  <simon.fraser@apple.com>
2118
2119         Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings
2120         https://bugs.webkit.org/show_bug.cgi?id=189521
2121
2122         Reviewed by Tim Horton.
2123
2124         Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>.
2125         
2126         RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>.
2127         
2128         All the other changes are just to adapt to the new ownership patterns.
2129         
2130         I verified that no GraphicsLayers were leaked or abandoned after this change.
2131
2132         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
2133         (WebKit::WebInspectorClient::~WebInspectorClient):
2134         (WebKit::WebInspectorClient::showPaintRect):
2135         (WebKit::WebInspectorClient::animationEndedForLayer):
2136         * WebProcess/WebCoreSupport/WebInspectorClient.h:
2137         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
2138         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
2139         (WebKit::RemoteLayerTreeContext::createGraphicsLayer):
2140         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
2141         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2142         (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers):
2143         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2144
2145 2018-09-12  Chris Dumez  <cdumez@apple.com>
2146
2147         PSON: No process swap on back navigation after URL bar navigation
2148         https://bugs.webkit.org/show_bug.cgi?id=189557
2149         <rdar://problem/44353108>
2150
2151         Reviewed by Alex Christensen.
2152
2153         Our logic in WebProcessPool::processForNavigationInternal() was wrongly using
2154         WebBackForwardList::currentItem() as source item of the navigation, instead of
2155         using Navigation::fromItem(). In case of back navigation, by the time
2156         processForNavigation() is called, the WebBackForwardList's currentItem has already
2157         been updated to be the target item, via a Sync IPC from the WebProcess. As a result,
2158         the source and target items would be the same in the following check:
2159         ` if (currentItem->itemID().processIdentifier == backForwardListItem->itemID().processIdentifier)`
2160
2161         This would cause us to reuse the same process incorrectly. Our existing API test coverage
2162         did not catch this because our target HistoryItem usually has a SuspendedPage and we decide
2163         to use the SuspendedPage's process a few lines above in WebProcessPool::processForNavigationInternal().
2164
2165         * UIProcess/WebProcessPool.cpp:
2166         (WebKit::WebProcessPool::processForNavigationInternal):
2167
2168 2018-09-12  Alex Christensen  <achristensen@webkit.org>
2169
2170         Make IPC::SharedBufferDataReference a type that decodes into but does not inherit from IPC::DataReference
2171         https://bugs.webkit.org/show_bug.cgi?id=189519
2172
2173         Reviewed by Chris Dumez.
2174
2175         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2176         * NetworkProcess/NetworkResourceLoader.cpp:
2177         (WebKit::NetworkResourceLoader::bufferingTimerFired):
2178         (WebKit::NetworkResourceLoader::sendBuffer):
2179         * Platform/IPC/DataReference.cpp:
2180         (IPC::SharedBufferDataReference::encode const): Deleted.
2181         * Platform/IPC/DataReference.h:
2182         (IPC::SharedBufferDataReference::SharedBufferDataReference): Deleted.
2183         * Platform/IPC/HandleMessage.h:
2184         * Platform/IPC/SharedBufferDataReference.h: Added.
2185         (IPC::SharedBufferDataReference::SharedBufferDataReference):
2186         (IPC::SharedBufferDataReference::encode const):
2187         * Scripts/webkit/messages.py:
2188         * Shared/API/APIData.h:
2189         * StorageProcess/StorageProcess.messages.in:
2190         * UIProcess/WebPageProxy.messages.in:
2191         * UIProcess/WebURLSchemeTask.cpp:
2192         (WebKit::WebURLSchemeTask::didReceiveData):
2193         * WebKit.xcodeproj/project.pbxproj:
2194         * WebProcess/Network/WebLoaderStrategy.cpp:
2195         (WebKit::WebLoaderStrategy::storeDerivedDataToCache):
2196         * WebProcess/Network/WebResourceLoader.messages.in:
2197         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
2198         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
2199         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveBlobChunk):
2200         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
2201         (WebKit::WebEditorClient::registerAttachmentIdentifier):
2202         * WebProcess/WebPage/WebPage.cpp:
2203         (WebKit::WebPage::getContentsAsMHTMLData):
2204         (WebKit::WebPage::getSelectionAsWebArchiveData):
2205         (WebKit::WebPage::getMainResourceDataOfFrame):
2206         (WebKit::WebPage::getResourceDataFromFrame):
2207         (WebKit::WebPage::getWebArchiveOfFrame):
2208         (WebKit::WebPage::drawPagesToPDF):
2209         * WebProcess/WebPage/WebPage.messages.in:
2210
2211 2018-09-11  Dean Jackson  <dino@apple.com>
2212
2213         Header parsing for experimental and internal debug features
2214         https://bugs.webkit.org/show_bug.cgi?id=189486
2215         <rdar://problem/44320618>
2216
2217         Reviewed by Tim Horton.
2218
2219         Provide key-based (string) access to experimental and internal features.
2220
2221         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
2222         * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb:
2223         * UIProcess/API/C/WKPreferences.cpp:
2224         (WKPreferencesSetExperimentalFeatureForKey):
2225         (WKPreferencesResetAllInternalDebugFeatures):
2226         (WKPreferencesSetInternalDebugFeatureForKey):
2227         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2228         * UIProcess/WebPreferences.h:
2229
2230 2018-09-10  Matt Rajca  <mrajca@apple.com>
2231
2232         Expose a few WebPlaybackControlsManager-driven PIP APIs to clients
2233         https://bugs.webkit.org/show_bug.cgi?id=189478
2234         <rdar://problem/44312650>
2235
2236         Reviewed by Eric Carlson.
2237
2238         This patch exposes APIs necessary to toggle PIP and query its status from clients of WKWebView.
2239         The existing PIP test has been updated to use the new APIs instead of simulating mouse clicks.
2240         I also increased the size of the video element in the test page so it gets picked up by the
2241         main content heuristics.
2242
2243         * UIProcess/API/Cocoa/WKWebView.mm:
2244         (-[WKWebView _updateMediaPlaybackControlsManager]): Create a media playback controls manager if necessary.
2245         (-[WKWebView _isPictureInPictureActive]): Return true if the "active" media element is in PIP.
2246         (-[WKWebView _togglePictureInPicture]): Toggle PIP on the "active" media element.
2247         (-[WKWebView _canTogglePictureInPicture]): Renamed from...
2248         (-[WKWebView _canTogglePictureInPictureForTesting]):
2249         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2250         * UIProcess/Cocoa/WebViewImpl.h:
2251         * UIProcess/Cocoa/WebViewImpl.mm:
2252         (WebKit::WebViewImpl::isPictureInPictureActive): Return true if the "active" media element is in PIP.
2253         (WebKit::WebViewImpl::togglePictureInPicture): Toggle PIP on the "active" media element.
2254         (WebKit::WebViewImpl::updateMediaPlaybackControlsManager): Let clients create a playback
2255          controls manager even when there is no Touch Bar present.
2256         (WebKit::WebViewImpl::updateMediaTouchBar): Extract some code into a helper method.
2257         (WebKit::WebViewImpl::canTogglePictureInPicture): Renamed from...
2258         (WebKit::WebViewImpl::canTogglePictureInPictureForTesting):
2259
2260 2018-09-12  Fujii Hironori  <Hironori.Fujii@sony.com>
2261
2262         [Win][Clang] error: non-constant-expression cannot be narrowed from type 'int' to 'SHORT'
2263         https://bugs.webkit.org/show_bug.cgi?id=189542
2264
2265         Reviewed by Alex Christensen.
2266
2267         * UIProcess/win/WebInspectorProxyWin.cpp:
2268         (WebKit::WebInspectorProxy::platformCreateFrontendPage): Narrowed initialWindowWidth and initialWindowHeight by using static_cast.
2269
2270 2018-09-12  Chris Dumez  <cdumez@apple.com>
2271
2272         Clean up SuspendedPageProxy
2273         https://bugs.webkit.org/show_bug.cgi?id=189517
2274
2275         Reviewed by Alex Christensen.
2276
2277         Clean up SuspendedPageProxy:
2278         1. SuspendedPageProxy does not need to be RefCounted. It is even dangerous given that WebPageProxy
2279            owns the SuspendedPageProxy and SuspendedPageProxy has a WebPageProxy& data member. We definitely
2280            do not want it to outlive its WebPageProxy.
2281         2. The SuspendedPageProxy destructor does not need to be virtual.
2282         3. Have WebBackForwardListItem keep a WeakPtr<SuspendedPageProxy> instead of a SuspendedPageProxy*.
2283            This is safer and avoid having to explicitly clear the pointer.
2284         4. m_finishedSuspending data member does not need a getter and is only needed if !LOG_DISABLED.
2285
2286         * Shared/WebBackForwardListItem.cpp:
2287         (WebKit::WebBackForwardListItem::setSuspendedPage):
2288         * Shared/WebBackForwardListItem.h:
2289         (WebKit::WebBackForwardListItem::suspendedPage const):
2290         * UIProcess/SuspendedPageProxy.cpp:
2291         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
2292         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
2293         (WebKit::SuspendedPageProxy::webProcessDidClose):
2294         (WebKit::SuspendedPageProxy::didFinishLoad):
2295         * UIProcess/SuspendedPageProxy.h:
2296         (WebKit::SuspendedPageProxy::process const):
2297         * UIProcess/WebPageProxy.cpp:
2298         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
2299         (WebKit::WebPageProxy::reattachToWebProcess):
2300         * UIProcess/WebPageProxy.h:
2301
2302 2018-09-12  Guillaume Emont  <guijemont@igalia.com>
2303
2304         Add IGNORE_WARNING_.* macros
2305         https://bugs.webkit.org/show_bug.cgi?id=188996
2306
2307         Reviewed by Michael Catanzaro.
2308
2309         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2310         (WebKit::NetworkDataTaskCocoa::statelessCookieStorage):
2311         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2312         (WebKit::NetworkProcess::platformSyncAllCookies):
2313         * PluginProcess/mac/PluginProcessMac.mm:
2314         (WebKit::beginModal):
2315         * PluginProcess/mac/PluginProcessShim.mm:
2316         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
2317         (WebKit::NetscapePluginModule::tryLoad):
2318         * Shared/ios/ChildProcessIOS.mm:
2319         (WebKit::ChildProcess::initializeSandbox):
2320         * Shared/mac/ChildProcessMac.mm:
2321         (WebKit::compileAndApplySandboxSlowCase):
2322         * Shared/mac/ColorSpaceData.mm:
2323         (WebKit::ColorSpaceData::decode):
2324         * Shared/mac/SandboxExtensionMac.mm:
2325         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
2326         * UIProcess/API/Cocoa/WKWebView.mm:
2327         (-[WKWebView _web_superAccessibilityAttributeValue:]):
2328         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2329         * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm:
2330         * UIProcess/API/glib/WebKitWebView.cpp:
2331         (webkitWebViewRunAsModal):
2332         * UIProcess/API/mac/WKView.mm:
2333         (-[WKView _web_superAccessibilityAttributeValue:]):
2334         * UIProcess/Cocoa/DownloadClient.mm:
2335         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
2336         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
2337         (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
2338         * UIProcess/Cocoa/NavigationState.mm:
2339         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2340         * UIProcess/Cocoa/UIDelegate.mm:
2341         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
2342         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2343         (WebKit::WebProcessPool::platformInitializeWebProcess):
2344         * UIProcess/Cocoa/WebViewImpl.mm:
2345         (-[WKTextListTouchBarViewController initWithWebViewImpl:]):
2346         (WebKit::WebViewImpl::updateWindowAndViewFrames):
2347         (WebKit::WebViewImpl::sendDragEndToPage):
2348         (WebKit::WebViewImpl::startDrag):
2349         (WebKit::WebViewImpl::characterIndexForPoint):
2350         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
2351         (WebKit::PluginProcessProxy::getPluginProcessSerialNumber):
2352         (WebKit::PluginProcessProxy::makePluginProcessTheFrontProcess):
2353         (WebKit::PluginProcessProxy::makeUIProcessTheFrontProcess):
2354         (WebKit::PluginProcessProxy::exitFullscreen):
2355         * UIProcess/ios/SmartMagnificationController.mm:
2356         * UIProcess/ios/WKGeolocationProviderIOS.mm:
2357         * UIProcess/ios/WKLegacyPDFView.mm:
2358         * UIProcess/ios/WKPDFPageNumberIndicator.mm:
2359         (-[WKPDFPageNumberIndicator _makeRoundedCorners]):
2360         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
2361         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2362         (-[WKFileUploadPanel _presentPopoverWithContentViewController:animated:]):
2363         * UIProcess/ios/forms/WKFormColorControl.mm:
2364         (-[WKColorPopover initWithView:]):
2365         * UIProcess/ios/forms/WKFormInputControl.mm:
2366         (-[WKDateTimePopover initWithView:datePickerMode:]):
2367         * UIProcess/ios/forms/WKFormPopover.h:
2368         * UIProcess/ios/forms/WKFormPopover.mm:
2369         * UIProcess/ios/forms/WKFormSelectPopover.mm:
2370         (-[WKSelectPopover initWithView:hasGroups:]):
2371         * UIProcess/mac/PageClientImplMac.mm:
2372         (WebKit::PageClientImpl::screenToRootView):
2373         (WebKit::PageClientImpl::rootViewToScreen):
2374         * UIProcess/mac/WKFullScreenWindowController.mm:
2375         (-[WKFullScreenWindowController enterFullScreen:]):
2376         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
2377         (-[WKFullScreenWindowController exitFullScreen]):
2378         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
2379         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
2380         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
2381         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
2382         (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):
2383         * UIProcess/mac/WKPrintingView.mm:
2384         (-[WKPrintingView _setAutodisplay:]):
2385         (-[WKPrintingView _drawPDFDocument:page:atPoint:]):
2386         (-[WKPrintingView _drawPreview:]):
2387         (-[WKPrintingView drawRect:]):
2388         * UIProcess/mac/WKTextInputWindowController.mm:
2389         (-[WKTextInputPanel _interpretKeyEvent:usingLegacyCocoaTextInput:string:]):
2390         (-[WKTextInputPanel _hasMarkedText]):
2391         * UIProcess/mac/WebPopupMenuProxyMac.mm:
2392         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
2393         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
2394         (WebKit::initializeEventRecord):
2395         (WebKit::NetscapePlugin::sendComplexTextInput):
2396         (WebKit::makeCGLPresentLayerOpaque):
2397         (WebKit::NetscapePlugin::nullEventTimerFired):
2398         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2399         (-[WKPDFPluginAccessibilityObject accessibilityFocusedUIElement]):
2400         (-[WKPDFLayerControllerDelegate writeItemsToPasteboard:withTypes:]):
2401         (WebKit::PDFPlugin::handleEditingCommand):
2402         (WebKit::PDFPlugin::setActiveAnnotation):
2403         (WebKit:: const):
2404         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.h:
2405         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
2406         (WebKit::PDFPluginChoiceAnnotation::createAnnotationElement):
2407         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h:
2408         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
2409         (WebKit::PDFPluginTextAnnotation::createAnnotationElement):
2410         * WebProcess/WebCoreSupport/WebAlternativeTextClient.h:
2411         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
2412         (WebKit::convertImageToBitmap):
2413         (WebKit::WebDragClient::declareAndWriteDragImage):
2414         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
2415         * WebProcess/WebPage/mac/WebPageMac.mm:
2416         (WebKit::drawPDFPage):
2417
2418 2018-09-11  Olivia Barnett  <obarnett@apple.com>
2419
2420         Implement the Web Share API for mac
2421         https://bugs.webkit.org/show_bug.cgi?id=189443
2422
2423         Reviewed by Tim Horton.
2424
2425         * Shared/WebPreferencesDefaultValues.h:
2426         * UIProcess/API/Cocoa/WKWebView.mm:
2427         (-[WKWebView shareSheetDidDismiss:]):
2428         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2429         * UIProcess/API/mac/WKView.mm:
2430         (-[WKView shareSheetDidDismiss:]):
2431         * UIProcess/Cocoa/WebViewImpl.h:
2432         * UIProcess/Cocoa/WebViewImpl.mm:
2433         (WebKit::WebViewImpl::showShareSheet):
2434         (WebKit::WebViewImpl::shareSheetDidDismiss):
2435         Implemented function for WKShareSheetDelegate.
2436
2437         * UIProcess/Cocoa/WKShareSheet.h:
2438         * UIProcess/Cocoa/WKShareSheet.mm:
2439         (-[WKShareSheet initWithView:initWithView:]):
2440         (-[WKShareSheet presentWithParameters:completionHandler:]):
2441         (-[WKShareSheet sharingServicePicker:didChooseSharingService:]):
2442         (-[WKShareSheet _cancel]):
2443         (-[WKShareSheet dismiss]):
2444         (-[WKShareSheet _dismissDisplayAnimated:]):
2445         (-[WKShareSheet invokeShareSheetWithResolution:]):
2446         (-[WKShareSheet initWithView:]): Deleted.
2447         Added mac platform checks and share sheet functionality.
2448
2449         * UIProcess/mac/PageClientImplMac.h:
2450         * UIProcess/mac/PageClientImplMac.mm:
2451         (WebKit::PageClientImpl::showShareSheet):
2452         Allows macos to invoke the system share sheet.
2453
2454 2018-09-07  Dean Jackson  <dino@apple.com>
2455
2456         Add and expose Internal features from WebKit
2457         https://bugs.webkit.org/show_bug.cgi?id=189442
2458         <rdar://problem/44243404>
2459
2460         Reviewed by Simon Fraser.
2461
2462         Experimental features have become a mess. People are using them for
2463         anything that they want to be easily toggled from a host app (e.g.
2464         Safari), which means the user-facing menu has become large and
2465         confusing.
2466
2467         Introduce the idea of Internal features, that will be exposed in a way
2468         that end-users are not expected to ever see (unless they really want
2469         to).
2470
2471         * CMakeLists.txt: Add new files.
2472         * Sources.txt:
2473         * SourcesCocoa.txt:
2474         * WebKit.xcodeproj/project.pbxproj:
2475
2476         * DerivedSources.make: Add new generated files.
2477         * Scripts/GeneratePreferences.rb: Generate the preferences stuff for Internal Debug features.
2478         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
2479         * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb: Added.
2480
2481         * Shared/API/APIObject.h: New API object for InternalDebugFeature.
2482         * Shared/Cocoa/APIObject.mm:
2483         (API::Object::newObject):
2484
2485         * Shared/WebPreferences.yaml: Change some of the existing experimental features to "internal".
2486
2487         * UIProcess/API/APIInternalDebugFeature.cpp: New API type - just like APIExperimentalFeature.
2488         (API::InternalDebugFeature::create):
2489         (API::InternalDebugFeature::InternalDebugFeature):
2490         (API::InternalDebugFeature::~InternalDebugFeature):
2491         * UIProcess/API/APIInternalDebugFeature.h:
2492         * UIProcess/API/C/WKAPICast.h:
2493
2494         * UIProcess/API/Cocoa/WKPreferences.mm: Change the naming of the experimental feature API so that it
2495         won't clash with internal debug features. We can remove the old API once Safari has adopted.
2496         (+[WKPreferences _internalDebugFeatures]):
2497         (-[WKPreferences _isEnabledForInternalDebugFeature:]):
2498         (-[WKPreferences _setEnabled:forInternalDebugFeature:]):
2499         (-[WKPreferences _isEnabledForFeature:]):
2500         (-[WKPreferences _setEnabled:forFeature:]):
2501         (-[WKPreferences _isEnabledForExperimentalFeature:]):
2502         (-[WKPreferences _setEnabled:forExperimentalFeature:]):
2503         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2504
2505         * UIProcess/API/Cocoa/_WKInternalDebugFeature.h: New object - same as _WKExperimentalFeature.
2506         * UIProcess/API/Cocoa/_WKInternalDebugFeature.mm:
2507         (-[_WKInternalDebugFeature dealloc]):
2508         (-[_WKInternalDebugFeature description]):
2509         (-[_WKInternalDebugFeature name]):
2510         (-[_WKInternalDebugFeature key]):
2511         (-[_WKInternalDebugFeature details]):
2512         (-[_WKInternalDebugFeature defaultValue]):
2513         (-[_WKInternalDebugFeature isHidden]):
2514         (-[_WKInternalDebugFeature _apiObject]):
2515         * UIProcess/API/Cocoa/_WKInternalDebugFeatureInternal.h:
2516
2517         * UIProcess/WebPreferences.cpp: Add support for Internal Debug features.
2518         (WebKit::WebPreferences::updateBoolValueForInternalDebugFeatureKey):
2519         (WebKit::WebPreferences::updateBoolValueForExperimentalFeatureKey):
2520         * UIProcess/WebPreferences.h:
2521
2522         * UIProcess/WebProcessPool.cpp: Change a comment now that it is an internal feature.
2523         (WebKit::WebProcessPool::createWebPage):
2524
2525 2018-09-11  Eric Carlson  <eric.carlson@apple.com>
2526
2527         WebPage::close should clear UserMediaPermissionRequestManager
2528         https://bugs.webkit.org/show_bug.cgi?id=189369
2529         <rdar://problem/44196724>
2530
2531         Reviewed by Youenn Fablet.
2532
2533         * WebProcess/WebPage/WebPage.cpp:
2534         (WebKit::WebPage::close): Clear m_userMediaPermissionRequestManager.
2535
2536 2018-09-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2537
2538         [macOS] [WK2] Support changing foreground colors via color panel
2539         https://bugs.webkit.org/show_bug.cgi?id=189382
2540         <rdar://problem/44227311>
2541
2542         Reviewed by Ryosuke Niwa.
2543
2544         Adds support for changing font color in a richly editable element in WebKit2 via NSColorPanel. See below for
2545         more detail, as well as the WebCore ChangeLog.
2546
2547         * UIProcess/API/Cocoa/WKWebView.mm:
2548         (-[WKWebView changeColor:]):
2549
2550         Implement this selector; AppKit calls into this when changing font color using NSColorPanel.
2551
2552         * UIProcess/Cocoa/WebViewImpl.h:
2553         * UIProcess/Cocoa/WebViewImpl.mm:
2554         (WebKit::WebViewImpl::changeFontColorFromSender):
2555
2556         Creates and populates new FontAttributeChanges, with only the foreground color determined by asking the sender
2557         object for its -color.
2558
2559         * WebProcess/WebPage/mac/WebPageMac.mm:
2560
2561         Use the relevant EditAction for the incoming FontAttributeChanges, instead of always specifying
2562         EditAction::ChangeAttributes.
2563
2564         (WebKit::WebPage::changeFontAttributes):
2565
2566 2018-09-11  Myles C. Maxfield  <mmaxfield@apple.com>
2567
2568         Crash under PlatformPopupMenuData::encode when interacting with a select menu that has variable fonts
2569         https://bugs.webkit.org/show_bug.cgi?id=188008
2570
2571         Reviewed by Alex Christensen.
2572
2573         This patch is a follow-up to https://bugs.webkit.org/show_bug.cgi?id=180307.
2574         Variable fonts have CFDictionaries with non-string keys. We need to support that in our IPC code.
2575
2576         * Shared/cf/ArgumentCodersCF.cpp:
2577         (IPC::encode):
2578         (IPC::decode):
2579
2580 2018-09-11  Adrian Perez de Castro  <aperez@igalia.com>
2581
2582         [WPE][GTK] API documentation is unclear about how to modify requests before sending them
2583         https://bugs.webkit.org/show_bug.cgi?id=189505
2584
2585         Reviewed by Michael Catanzaro.
2586
2587         Add notes to the API documentation to make explicit where modification
2588         of WebKitURIRequest instances affects the request data sent over the
2589         network.
2590
2591         * UIProcess/API/glib/WebKitNavigationAction.cpp: Clarify that
2592         modifications to the associated WebKitURIRequest do not affect the
2593         actual request. Point to WebKitPage::send-request instead.
2594         * UIProcess/API/glib/WebKitResponsePolicyDecision.cpp: Ditto.
2595         * UIProcess/API/glib/WebKitWebView.cpp:
2596         (webkit_web_view_class_init): Ditto for the description of the
2597         WebKitWebView::decide-policy signal. Also fix the syntax of example.
2598         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
2599         (webkit_web_page_class_init): Indicate that modifications to the
2600         WebKitURIRequest will change the actual network request data.
2601
2602 2018-09-11  Michael Catanzaro  <mcatanzaro@igalia.com>
2603
2604         Unreviewed, attempt to fix Apple builds after r235903
2605         https://bugs.webkit.org/show_bug.cgi?id=188872
2606
2607         If it really needs to be inlined, it will need to move to the header....
2608
2609         * UIProcess/WebPageProxy.cpp:
2610         (WebKit::WebPageProxy::pageClient const):
2611
2612 2018-09-11  Michael Catanzaro  <mcatanzaro@igalia.com>
2613
2614         Unreviewed, fix build after r235903
2615         https://bugs.webkit.org/show_bug.cgi?id=188872
2616
2617         This broke all ports except GTK. Need to add a missing header.
2618
2619         * UIProcess/PageClient.h:
2620
2621 2018-09-11  Pablo Saavedra  <psaavedra@igalia.com>
2622
2623         Add missing #if ENABLE(VIDEO) WebProcess/FullScreen/WebFullScreenManager.cpp
2624         https://bugs.webkit.org/show_bug.cgi?id=189506
2625
2626         Reviewed by Tim Horton.
2627
2628         m_pipStandbyElement is only defined in
2629         WebKit/WebProcess/FullScreen/WebFullScreenManager.h
2630         only when ENABLE(VIDEO) (see
2631         https://bugs.webkit.org/show_bug.cgi?id=181338)
2632
2633         * WebProcess/FullScreen/WebFullScreenManager.cpp:
2634         (WebKit::WebFullScreenManager::setPIPStandbyElement):
2635
2636 2018-09-11  Michael Catanzaro  <mcatanzaro@igalia.com>
2637
2638         WebPageProxy should hold a WeakPtr to its PageClient
2639         https://bugs.webkit.org/show_bug.cgi?id=188872
2640
2641         Reviewed by Ryosuke Niwa.
2642
2643         This ensures the PageClient reference is always valid when used.
2644
2645         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2646         (WebKit::WebPageProxy::startDrag):
2647         (WebKit::WebPageProxy::setDragCaretRect):
2648         * UIProcess/PageClient.h:
2649         * UIProcess/WebPageProxy.cpp:
2650         (WebKit::PageClientProtector::PageClientProtector):
2651         (WebKit::PageClientProtector::~PageClientProtector):
2652         (WebKit::WebPageProxy::WebPageProxy):
2653         (WebKit::m_resetRecentCrashCountTimer):
2654         (WebKit::WebPageProxy::pageClient const):
2655         (WebKit::WebPageProxy::reattachToWebProcess):
2656         (WebKit::WebPageProxy::initializeWebPage):
2657         (WebKit::WebPageProxy::close):
2658         (WebKit::WebPageProxy::didChangeBackForwardList):
2659         (WebKit::WebPageProxy::willGoToBackForwardListItem):
2660         (WebKit::WebPageProxy::shouldKeepCurrentBackForwardListItemInList):
2661         (WebKit::WebPageProxy::setViewNeedsDisplay):
2662         (WebKit::WebPageProxy::requestScroll):
2663         (WebKit::WebPageProxy::viewScrollPosition const):
2664         (WebKit::WebPageProxy::updateActivityState):
2665         (WebKit::WebPageProxy::activityStateDidChange):
2666         (WebKit::WebPageProxy::viewDidEnterWindow):
2667         (WebKit::WebPageProxy::dispatchActivityStateChange):
2668         (WebKit::WebPageProxy::layerHostingModeDidChange):
2669         (WebKit::WebPageProxy::viewSize const):
2670         (WebKit::WebPageProxy::startDrag):
2671         (WebKit::WebPageProxy::didPerformDragOperation):
2672         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
2673         (WebKit::WebPageProxy::findPlugin):
2674         (WebKit::WebPageProxy::handleTouchEventSynchronously):
2675         (WebKit::WebPageProxy::handleTouchEvent):
2676         (WebKit::WebPageProxy::preferencesDidChange):
2677         (WebKit::WebPageProxy::didCreateMainFrame):
2678         (WebKit::WebPageProxy::didCreateSubframe):
2679         (WebKit::WebPageProxy::didStartProgress):
2680         (WebKit::WebPageProxy::didChangeProgress):
2681         (WebKit::WebPageProxy::didFinishProgress):
2682         (WebKit::WebPageProxy::didDestroyNavigation):
2683         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
2684         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
2685         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
2686         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
2687         (WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
2688         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
2689         (WebKit::WebPageProxy::didCommitLoadForFrame):
2690         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
2691         (WebKit::WebPageProxy::didFinishLoadForFrame):
2692         (WebKit::WebPageProxy::didFailLoadForFrame):
2693         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
2694         (WebKit::WebPageProxy::didReceiveTitleForFrame):
2695         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
2696         (WebKit::WebPageProxy::didReachLayoutMilestone):
2697         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
2698         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
2699         (WebKit::WebPageProxy::frameDidBecomeFrameSet):
2700         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2701         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2702         (WebKit::WebPageProxy::decidePolicyForResponse):
2703         (WebKit::WebPageProxy::unableToImplementPolicy):
2704         (WebKit::WebPageProxy::didNavigateWithNavigationData):
2705         (WebKit::WebPageProxy::didPerformClientRedirect):
2706         (WebKit::WebPageProxy::didPerformServerRedirect):
2707         (WebKit::WebPageProxy::didUpdateHistoryTitle):
2708         (WebKit::WebPageProxy::closePage):
2709         (WebKit::WebPageProxy::setWindowFrame):
2710         (WebKit::WebPageProxy::getWindowFrame):
2711         (WebKit::WebPageProxy::getWindowFrameWithCallback):
2712         (WebKit::WebPageProxy::screenToRootView):
2713         (WebKit::WebPageProxy::rootViewToScreen):
2714         (WebKit::WebPageProxy::syncRootViewToScreen):
2715         (WebKit::WebPageProxy::accessibilityScreenToRootView):
2716         (WebKit::WebPageProxy::rootViewToAccessibilityScreen):
2717         (WebKit::WebPageProxy::didChangeViewportProperties):
2718         (WebKit::WebPageProxy::runOpenPanel):
2719         (WebKit::WebPageProxy::showShareSheet):
2720         (WebKit::WebPageProxy::handleDownloadRequest):
2721         (WebKit::WebPageProxy::didChangeContentSize):
2722         (WebKit::WebPageProxy::showColorPicker):
2723         (WebKit::WebPageProxy::showDataListSuggestions):
2724         (WebKit::WebPageProxy::compositionWasCanceled):
2725         (WebKit::WebPageProxy::registerInsertionUndoGrouping):
2726         (WebKit::WebPageProxy::canUndoRedo):
2727         (WebKit::WebPageProxy::executeUndoRedo):
2728         (WebKit::WebPageProxy::clearAllEditCommands):
2729         (WebKit::WebPageProxy::setTextIndicator):
2730         (WebKit::WebPageProxy::clearTextIndicator):
2731         (WebKit::WebPageProxy::setTextIndicatorAnimationProgress):
2732         (WebKit::WebPageProxy::showPopupMenu):
2733         (WebKit::WebPageProxy::showContextMenu):
2734         (WebKit::WebPageProxy::registerEditCommand):
2735         (WebKit::WebPageProxy::canUndo):
2736         (WebKit::WebPageProxy::canRedo):
2737         (WebKit::WebPageProxy::setToolTip):
2738         (WebKit::WebPageProxy::setCursor):
2739         (WebKit::WebPageProxy::setCursorHiddenUntilMouseMoves):
2740         (WebKit::WebPageProxy::didReceiveEvent):
2741         (WebKit::WebPageProxy::resetState):
2742         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2743         (WebKit::WebPageProxy::creationParameters):
2744         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
2745         (WebKit::WebPageProxy::exitAcceleratedCompositingMode):
2746         (WebKit::WebPageProxy::updateAcceleratedCompositingMode):
2747         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
2748         (WebKit::WebPageProxy::recommendedScrollbarStyleDidChange):
2749         (WebKit::WebPageProxy::didChangeScrollOffsetPinningForMainFrame):
2750         (WebKit::WebPageProxy::didFinishLoadingDataForCustomContentProvider):
2751         (WebKit::WebPageProxy::updateBackingStoreDiscardableState):
2752         (WebKit::WebPageProxy::showCorrectionPanel):
2753         (WebKit::WebPageProxy::dismissCorrectionPanel):
2754         (WebKit::WebPageProxy::dismissCorrectionPanelSoon):
2755         (WebKit::WebPageProxy::recordAutocorrectionResponse):
2756         (WebKit::WebPageProxy::useDarkAppearance const):
2757         (WebKit::WebPageProxy::showDictationAlternativeUI):
2758         (WebKit::WebPageProxy::removeDictationAlternatives):
2759         (WebKit::WebPageProxy::dictationAlternatives):
2760         (WebKit::WebPageProxy::setEditableElementIsFocused):
2761         (WebKit::WebPageProxy::takeViewSnapshot):
2762         (WebKit::WebPageProxy::wrapCryptoKey):
2763         (WebKit::WebPageProxy::unwrapCryptoKey):
2764         (WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
2765         (WebKit::WebPageProxy::navigationGestureDidBegin):
2766         (WebKit::WebPageProxy::navigationGestureWillEnd):
2767         (WebKit::WebPageProxy::navigationGestureDidEnd):
2768         (WebKit::WebPageProxy::willRecordNavigationSnapshot):
2769         (WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved):
2770         (WebKit::WebPageProxy::isPlayingMediaDidChange):
2771         (WebKit::WebPageProxy::videoControlsManagerDidChange):
2772         (WebKit::WebPageProxy::handleControlledElementIDResponse const):
2773         (WebKit::WebPageProxy::didPerformImmediateActionHitTest):
2774         (WebKit::WebPageProxy::immediateActionAnimationControllerForHitTestResult):
2775         (WebKit::WebPageProxy::didHandleAcceptedCandidate):
2776         (WebKit::WebPageProxy::addPlaybackTargetPickerClient):
2777         (WebKit::WebPageProxy::removePlaybackTargetPickerClient):
2778         (WebKit::WebPageProxy::showPlaybackTargetPicker):
2779         (WebKit::WebPageProxy::playbackTargetPickerClientStateDidChange):
2780         (WebKit::WebPageProxy::setMockMediaPlaybackTargetPickerEnabled):
2781         (WebKit::WebPageProxy::setMockMediaPlaybackTargetPickerState):
2782         (WebKit::WebPageProxy::didChangeBackgroundColor):
2783         (WebKit::WebPageProxy::didRestoreScrollPosition):
2784         (WebKit::WebPageProxy::userInterfaceLayoutDirection):
2785         (WebKit::WebPageProxy::didInsertAttachment):
2786         (WebKit::WebPageProxy::didRemoveAttachment):
2787         * UIProcess/WebPageProxy.h:
2788         * UIProcess/gstreamer/WebPageProxyGStreamer.cpp:
2789         (WebKit::WebPageProxy::requestInstallMissingMediaPlugins):
2790         * UIProcess/gtk/WebPageProxyGtk.cpp:
2791         (WebKit::WebPageProxy::viewWidget):
2792         (WebKit::WebPageProxy::editorStateChanged):
2793         * UIProcess/ios/WebPageProxyIOS.mm:
2794         (WebKit::WebPageProxy::computeCustomFixedPositionRect const):
2795         (WebKit::WebPageProxy::overflowScrollViewWillStartPanGesture):
2796         (WebKit::WebPageProxy::overflowScrollViewDidScroll):
2797         (WebKit::WebPageProxy::overflowScrollWillStartScroll):
2798         (WebKit::WebPageProxy::overflowScrollDidEndScroll):
2799         (WebKit::WebPageProxy::didCommitLayerTree):
2800         (WebKit::WebPageProxy::layerTreeCommitComplete):
2801         (WebKit::WebPageProxy::didReceivePositionInformation):
2802         (WebKit::WebPageProxy::saveImageToLibrary):
2803         (WebKit::WebPageProxy::interpretKeyEvent):
2804         (WebKit::WebPageProxy::registerWebProcessAccessibilityToken):
2805         (WebKit::WebPageProxy::couldNotRestorePageState):
2806         (WebKit::WebPageProxy::restorePageState):
2807         (WebKit::WebPageProxy::restorePageCenterAndScale):
2808         (WebKit::WebPageProxy::didGetTapHighlightGeometries):
2809         (WebKit::WebPageProxy::startAssistingNode):
2810         (WebKit::WebPageProxy::stopAssistingNode):
2811         (WebKit::WebPageProxy::showInspectorHighlight):
2812         (WebKit::WebPageProxy::hideInspectorHighlight):
2813         (WebKit::WebPageProxy::showInspectorIndication):
2814         (WebKit::WebPageProxy::hideInspectorIndication):
2815         (WebKit::WebPageProxy::enableInspectorNodeSearch):
2816         (WebKit::WebPageProxy::disableInspectorNodeSearch):
2817         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
2818         (WebKit::WebPageProxy::showPlaybackTargetPicker):
2819         (WebKit::WebPageProxy::commitPotentialTapFailed):
2820         (WebKit::WebPageProxy::didNotHandleTapAsClick):
2821         (WebKit::WebPageProxy::didCompleteSyntheticClick):
2822         (WebKit::WebPageProxy::disableDoubleTapGesturesDuringTapIfNecessary):
2823         (WebKit::WebPageProxy::editorStateChanged):
2824         (WebKit::WebPageProxy::showValidationMessage):
2825         (WebKit::WebPageProxy::didHandleStartDataInteractionRequest):
2826         (WebKit::WebPageProxy::didHandleAdditionalDragItemsRequest):
2827         (WebKit::WebPageProxy::didConcludeEditDataInteraction):
2828         (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame):
2829         * UIProcess/mac/WebPageProxyMac.mm:
2830         (WebKit::WebPageProxy::windowAndViewFramesChanged):
2831         (WebKit::WebPageProxy::insertDictatedTextAsync):
2832         (WebKit::WebPageProxy::setPromisedDataForImage):
2833         (WebKit::WebPageProxy::didPerformDictionaryLookup):
2834         (WebKit::WebPageProxy::registerWebProcessAccessibilityToken):
2835         (WebKit::WebPageProxy::makeFirstResponder):
2836         (WebKit::WebPageProxy::assistiveTechnologyMakeFirstResponder):
2837         (WebKit::WebPageProxy::colorSpace):
2838         (WebKit::WebPageProxy::pluginFocusOrWindowFocusChanged):
2839         (WebKit::WebPageProxy::setPluginComplexTextInputState):
2840         (WebKit::WebPageProxy::executeSavedCommandBySelector):
2841         (WebKit::WebPageProxy::intrinsicContentSizeDidChange):
2842         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
2843         (WebKit::WebPageProxy::acceleratedCompositingRootLayer const):
2844         (WebKit::WebPageProxy::showPDFContextMenu):
2845         (WebKit::WebPageProxy::showTelephoneNumberMenu):
2846         (WebKit::WebPageProxy::boundsOfLayerInLayerBackedWindowCoordinates const):
2847         (WebKit::WebPageProxy::editorStateChanged):
2848         (WebKit::WebPageProxy::startWindowDrag):
2849         (WebKit::WebPageProxy::platformWindow):
2850         (WebKit::WebPageProxy::rootViewToWindow):
2851         (WebKit::WebPageProxy::showValidationMessage):
2852         (WebKit::WebPageProxy::inspectorAttachmentView):
2853         (WebKit::WebPageProxy::remoteObjectRegistry):
2854         * UIProcess/win/WebPageProxyWin.cpp:
2855         (WebKit::WebPageProxy::viewWidget):
2856         * UIProcess/wpe/WebPageProxyWPE.cpp:
2857         (WebKit::WebPageProxy::viewBackend):
2858
2859 2018-09-11  Chris Dumez  <cdumez@apple.com>
2860
2861         Regression(PSON): "Swipe back" snapshot is missing when navigating back cross-process
2862         https://bugs.webkit.org/show_bug.cgi?id=189482
2863         <rdar://problem/44317222>
2864
2865         Reviewed by Geoffrey Garen.
2866
2867         The issue was that when we swap process on navigation, we:
2868         1. Call processDidTerminate() which calls resetState() and clears the displayed content
2869         2. Reattach the WebPageProxy to a new WebProcess
2870         3. Trigger the navigation
2871         4. Take the navigation snapshot
2872
2873         When the navigation snapshot occurs at step 4, the view is already blank in the case of
2874         process swap. To avoid the issue, we take the navigation snapshot earlier, before calling
2875         processDidTerminate() and we suppress the next navigation snapshot as it would be blank.
2876
2877         At some point, we will likely want to display the previous' WebProcess content longer,
2878         until the new WebProcess has something interesting to display. Once this is implemented,
2879         we'll likely be able to drop the early snapshotting logic.
2880
2881         * UIProcess/WebPageProxy.cpp:
2882         (WebKit::WebPageProxy::recordAutomaticNavigationSnapshot):
2883         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2884         (WebKit::WebPageProxy::restoreFromSessionState):
2885         (WebKit::WebPageProxy::didCommitLoadForFrame):
2886         * UIProcess/WebPageProxy.h:
2887         (WebKit::WebPageProxy::suppressNextAutomaticNavigationSnapshot):
2888
2889 2018-09-11  Woodrow Wang  <woodrow_wang@apple.com>
2890
2891         Add Web API Statistics Collection
2892         https://bugs.webkit.org/show_bug.cgi?id=187773
2893         <rdar://problem/44155162>
2894
2895         Reviewed by Brent Fulgham.
2896
2897         * Shared/WebCoreArgumentCoders.cpp:
2898         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
2899         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
2900         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
2901
2902 == Rolled over to ChangeLog-2018-09-11 ==