Add more Fullscreen logging
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-09-17  Simon Fraser  <simon.fraser@apple.com>
2
3         Add more Fullscreen logging
4         https://bugs.webkit.org/show_bug.cgi?id=189656
5
6         Reviewed by Jer Noble.
7
8         Add some fullscreen logging so I can tell whether WebFullScreenManager ever releases
9         the fullscreen element.
10
11         * WebProcess/FullScreen/WebFullScreenManager.cpp:
12         (WebKit::WebFullScreenManager::WebFullScreenManager):
13         (WebKit::WebFullScreenManager::videoControlsManagerDidChange):
14         (WebKit::WebFullScreenManager::setPIPStandbyElement):
15         (WebKit::WebFullScreenManager::enterFullScreenForElement):
16         (WebKit::WebFullScreenManager::exitFullScreenForElement):
17         (WebKit::WebFullScreenManager::willEnterFullScreen):
18         (WebKit::WebFullScreenManager::didEnterFullScreen):
19         (WebKit::WebFullScreenManager::willExitFullScreen):
20         (WebKit::WebFullScreenManager::didExitFullScreen):
21         (WebKit::WebFullScreenManager::close):
22         * WebProcess/FullScreen/WebFullScreenManager.h:
23
24 2018-09-17  Tim Horton  <timothy_horton@apple.com>
25
26         Swipe snapshot can get stuck if swiping is disabled while it is visible
27         https://bugs.webkit.org/show_bug.cgi?id=189667
28         <rdar://problem/40367780>
29
30         Reviewed by Simon Fraser.
31
32         If navigation gestures are disabled while a swipe snapshot is visible,
33         WKWebView will tear down the ViewGestureController, which means that
34         the SnapshotRemovalTracker will no longer be around to ever remove
35         the snapshot.
36
37         It's currently very hard to write a test for this because we have
38         yet to come up with a good mechanism for testing swiping on iOS.
39
40         * UIProcess/API/Cocoa/WKWebView.mm:
41         (-[WKWebView setAllowsBackForwardNavigationGestures:]):
42         Instead of tearing down the ViewGestureController when navigation
43         gestures are disabled, just set a bit on it that disables gestures.
44
45         * UIProcess/Cocoa/ViewGestureController.cpp:
46         (WebKit::ViewGestureController::canSwipeInDirection const):
47         * UIProcess/Cocoa/ViewGestureController.h:
48         (WebKit::ViewGestureController::setSwipeGestureEnabled):
49         (WebKit::ViewGestureController::isSwipeGestureEnabled):
50         Add a bit to ViewGestureController that makes starting new gestures
51         always fail, but allows e.g. snapshots from existing swipes to continue
52         their usual behavior.
53
54 2018-09-17  Alex Christensen  <achristensen@webkit.org>
55
56         Expose WKWebProcess.h as a private header
57         https://bugs.webkit.org/show_bug.cgi?id=189636
58
59         * WebKit.xcodeproj/project.pbxproj:
60
61 2018-09-17  Alex Christensen  <achristensen@webkit.org>
62
63         Expose XPCServiceMain in a WebProcess header rather than WKProcessPool
64         https://bugs.webkit.org/show_bug.cgi?id=189636
65
66         Reviewed by Dan Bernstein.
67
68         Fix a few build failures along the way.
69
70         * PluginProcess/mac/PluginControllerProxyMac.mm:
71         (WebKit::PluginControllerProxy::windowAndViewFramesChanged):
72         (WebKit::PluginControllerProxy::updateLayerHostingContext):
73         * PluginProcess/mac/PluginProcessMac.mm:
74         (WebKit::replacedNSWorkspace_launchApplicationAtURL_options_configuration_error):
75         (WebKit::PluginProcess::platformInitializeProcess):
76         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
77         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
78         (WebKit::XPCServiceMain):
79         (main):
80         * SourcesCocoa.txt:
81         * UIProcess/API/Cocoa/WKProcessPool.mm:
82         (+[WKProcessPool _webContentProcessXPCMain]): Deleted.
83         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
84         * WebKit.xcodeproj/project.pbxproj:
85         * WebProcess/API: Added.
86         * WebProcess/API/Cocoa: Added.
87         * WebProcess/API/Cocoa/WKWebProcess.cpp: Added.
88         (WKWebProcessMain):
89         * WebProcess/API/Cocoa/WKWebProcess.h: Added.
90         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
91         (-[WKAccessibilityWebPageObject convertScreenPointToRootView:]):
92         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
93         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
94
95 2018-09-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
96
97         [Curl] Respond with requested authentication scheme for authentication challenge.
98         https://bugs.webkit.org/show_bug.cgi?id=189318
99
100         Reviewed by Alex Christensen.
101
102         Curl port depends on libcurl's authentication handling by enabling CURLAUTH_ANY. With this
103         mode, the round-trip communication between the client and the server is handled by libcurl
104         internally. That's okay for many cases. But when initial request has a credentials
105         (i.e. XMLHttpRequest), there's no valid chance to store credential to the storage because
106         the returned response is not 401.
107
108         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
109         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl):
110         (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
111         (WebKit::NetworkDataTaskCurl::tryHttpAuthentication):
112         (WebKit::NetworkDataTaskCurl::tryProxyAuthentication):
113         (WebKit::NetworkDataTaskCurl::restartWithCredential):
114         * NetworkProcess/curl/NetworkDataTaskCurl.h:
115
116 2018-09-17  Woodrow Wang  <woodrow_wang@apple.com>
117
118         Clear pending resource load statistics' writes after tests
119         https://bugs.webkit.org/show_bug.cgi?id=189632
120         <rdar://problem/44469275>
121
122         Reviewed by Chris Dumez.
123
124         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
125         (WKWebsiteDataStoreStatisticsResetToConsistentState):
126
127 2018-09-17  Chris Dumez  <cdumez@apple.com>
128
129         PSON: window.open() with 'noopener' should only process-swap cross-site, not cross-origin
130         https://bugs.webkit.org/show_bug.cgi?id=189602
131         <rdar://problem/44430549>
132
133         Reviewed by Geoff Garen.
134
135         The following fixes were made to our process swap on navigation logic:
136         - Browsing contexts opened via window.open() with 'noopener' option now only same if
137           they are cross-site, instead of doing a stricter cross-origin check.
138         - Support process swapping when opening a new window via <a target="_blank" rel="noopener">
139           that is cross-site.
140
141         In order to support this, the following changes were made:
142         - Stop passing a 'isCrossOriginWindowOpenNavigation' flag to the UIProcess when navigating because:
143           - This is specific to window.open() and does not apply to other windows opened by DOM
144           - This forces the origin check to happens on WebContent process side instead of relying on the
145             one in WebProcessPool in the UIProcess
146         - Pass the origin of the requester to the UIProcess when navigating, so that the WebProcessPool
147           can use the requester's host for the cross-site check for the initial navigation in a new window
148           created by DOM.
149         - Add 2 flags to WebPageProxy which indicate if the page was created by the DOM and if any provisional
150           loads have been committed. The WebProcessPool uses theses flags to recognize initial loads in
151           new windows created by the DOM, so that it uses the requester's origin for the cross-site check.
152
153         * Shared/NavigationActionData.cpp:
154         (WebKit::NavigationActionData::encode const):
155         (WebKit::NavigationActionData::decode):
156         * Shared/NavigationActionData.h:
157         * UIProcess/API/APINavigation.h:
158         (API::Navigation::setRequesterOrigin):
159         (API::Navigation::requesterOrigin const):
160         * UIProcess/WebPageProxy.cpp:
161         (WebKit::WebPageProxy::continueNavigationInNewProcess):
162         (WebKit::WebPageProxy::didCommitLoadForFrame):
163         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
164         (WebKit::WebPageProxy::createNewPage):
165         * UIProcess/WebPageProxy.h:
166         (WebKit::WebPageProxy::setOpenedByDOM):
167         (WebKit::WebPageProxy::openedByDOM const):
168         (WebKit::WebPageProxy::hasCommittedAnyProvisionalLoads const):
169         * UIProcess/WebProcessPool.cpp:
170         (WebKit::shouldUseSameProcessBasedOnURLs):
171         (WebKit::WebProcessPool::processForNavigationInternal):
172         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
173         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
174
175 2018-09-17  Alexey Proskuryakov  <ap@apple.com>
176
177         Revert https://trac.webkit.org/r235910, because the new test times out.
178         Crash under PlatformPopupMenuData::encode when interacting with a select menu that has variable fonts
179         https://bugs.webkit.org/show_bug.cgi?id=188008
180
181         * Shared/cf/ArgumentCodersCF.cpp:
182         (IPC::encode):
183         (IPC::decode):
184
185 2018-09-17  Alex Christensen  <achristensen@webkit.org>
186
187         Refactoring related to Safe Browsing
188         https://bugs.webkit.org/show_bug.cgi?id=189631
189
190         Reviewed by Tim Horton.
191
192         Make SafeBrowsingResult RefCounted.
193         Move logic from an unnamed lambda to WebPageProxy::receivedNavigationPolicyDecision.
194
195         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
196         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
197         (WebKit::WebPageProxy::contentFilterDidBlockLoadForFrame): Deleted.
198         (WebKit::WebPageProxy::addPlatformLoadParameters): Deleted.
199         (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): Deleted.
200         (WebKit::WebPageProxy::startDrag): Deleted.
201         (WebKit::WebPageProxy::setPromisedDataForImage): Deleted.
202         (WebKit::WebPageProxy::setDragCaretRect): Deleted.
203         (WebKit::WebPageProxy::platformRegisterAttachment): Deleted.
204         (WebKit::WebPageProxy::platformCloneAttachment): Deleted.
205         * UIProcess/SafeBrowsingResult.h:
206         (WebKit::SafeBrowsingResult::create):
207         * UIProcess/WebFramePolicyListenerProxy.cpp:
208         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
209         * UIProcess/WebFramePolicyListenerProxy.h:
210         * UIProcess/WebFrameProxy.cpp:
211         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
212         * UIProcess/WebFrameProxy.h:
213         * UIProcess/WebPageProxy.cpp:
214         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
215         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
216         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
217         (WebKit::WebPageProxy::decidePolicyForResponse):
218         * UIProcess/WebPageProxy.h:
219
220 2018-09-17  Darin Adler  <darin@apple.com>
221
222         Use OpaqueJSString rather than JSRetainPtr inside WebKit
223         https://bugs.webkit.org/show_bug.cgi?id=189652
224
225         Reviewed by Saam Barati.
226
227         * Shared/API/c/WKString.cpp: Removed unneeded include of JSStringRef.h.
228
229         * WebProcess/Automation/WebAutomationSessionProxy.cpp: Removed unneeded
230         include of JSRetainPtr.
231         (WebKit::toJSString): Deleted.
232         (WebKit::toJSValue): Use OpaqueJSString::create.
233         (WebKit::callPropertyFunction): Ditto.
234         (WebKit::evaluate): Use adoptRef.
235         (WebKit::evaluateJavaScriptCallback): Ditto.
236         (WebKit::WebAutomationSessionProxy::scriptObjectForFrame):
237         Use OpaqueJSString::create.
238         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Use
239         String rather than JSStringRef.
240
241         * WebProcess/Plugins/PDF/PDFPlugin.mm: Removed unneeded includes.
242         (WebKit::PDFPlugin::runScriptsInPDFDocument): Use OpaqueJSString::create.
243
244 2018-09-17  Michael Catanzaro  <mcatanzaro@igalia.com>
245
246         Unreviewed, fix incorrect WPE build fix made in r236009
247
248         This isn't the right place to add the typedef. I failed to notice that the WebKitWebView
249         type is not actually used anywhere in this header. Actually, the problematic function is no
250         longer declared or used anywhere and was just missed when WebKitScriptDialog was refactored,
251         so remove it.
252
253         * UIProcess/API/wpe/WebKitScriptDialog.h:
254         * UIProcess/API/wpe/WebKitScriptDialogWPE.cpp:
255         (webkitScriptDialogRun): Deleted.
256
257 2018-09-17  Sihui Liu  <sihui_liu@apple.com>
258
259         Move IndexedDB to Network Process
260         https://bugs.webkit.org/show_bug.cgi?id=189415
261         <rdar://problem/44396973>
262
263         Reviewed by Chris Dumez.
264
265         We are going to eliminate storage process and move its functionality to network process. 
266         The reasons why we want to do this:
267         1. Lower resource usage of having an additional process for storage operations, especially
268         memory. Single storage process takes about 5MB memory on macOS.
269         2. Reduce latency of Service Workers. After enabling Service Workers, we've seen
270         regression in app launch. The launch time of storage process is partly attributed to this:
271         Service Workers delay page loading until receiving response from storage process.
272         3. We choose network process because UI process may have broader access in file system
273         that we don't want the storage operations to have.
274
275         This patch is the first piece towards the goal. It mainly moves indexedDB from storage process
276         to corresponding components of network process. Moving of Service Worker and stopping to 
277         launch storage process will be done in following patches.
278
279         We expect to see the higher cpu and memory usage of network process as it is taking more work,
280         but the overall gain in memory and latency after we completely remove storage process should be 
281         positive.
282
283         * CMakeLists.txt:
284         * DerivedSources.make:
285         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp.
286         (WebKit::WebIDBConnectionToClient::create):
287         (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient):
288         (WebKit::WebIDBConnectionToClient::~WebIDBConnectionToClient):
289         (WebKit::WebIDBConnectionToClient::disconnectedFromWebProcess):
290         (WebKit::WebIDBConnectionToClient::messageSenderConnection):
291         (WebKit::WebIDBConnectionToClient::connectionToClient):
292         (WebKit::WebIDBConnectionToClient::didDeleteDatabase):
293         (WebKit::WebIDBConnectionToClient::didOpenDatabase):
294         (WebKit::WebIDBConnectionToClient::didAbortTransaction):
295         (WebKit::WebIDBConnectionToClient::didCommitTransaction):
296         (WebKit::WebIDBConnectionToClient::didCreateObjectStore):
297         (WebKit::WebIDBConnectionToClient::didDeleteObjectStore):
298         (WebKit::WebIDBConnectionToClient::didRenameObjectStore):
299         (WebKit::WebIDBConnectionToClient::didClearObjectStore):
300         (WebKit::WebIDBConnectionToClient::didCreateIndex):
301         (WebKit::WebIDBConnectionToClient::didDeleteIndex):
302         (WebKit::WebIDBConnectionToClient::didRenameIndex):
303         (WebKit::WebIDBConnectionToClient::didPutOrAdd):
304         (WebKit::WebIDBConnectionToClient::handleGetResult):
305         (WebKit::WebIDBConnectionToClient::didGetRecord):
306         (WebKit::WebIDBConnectionToClient::didGetAllRecords):
307         (WebKit::WebIDBConnectionToClient::didGetCount):
308         (WebKit::WebIDBConnectionToClient::didDeleteRecord):
309         (WebKit::WebIDBConnectionToClient::didOpenCursor):
310         (WebKit::WebIDBConnectionToClient::didIterateCursor):
311         (WebKit::WebIDBConnectionToClient::fireVersionChangeEvent):
312         (WebKit::WebIDBConnectionToClient::didStartTransaction):
313         (WebKit::WebIDBConnectionToClient::didCloseFromServer):
314         (WebKit::WebIDBConnectionToClient::notifyOpenDBRequestBlocked):
315         (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNames):
316         (WebKit::WebIDBConnectionToClient::deleteDatabase):
317         (WebKit::WebIDBConnectionToClient::openDatabase):
318         (WebKit::WebIDBConnectionToClient::abortTransaction):
319         (WebKit::WebIDBConnectionToClient::commitTransaction):
320         (WebKit::WebIDBConnectionToClient::didFinishHandlingVersionChangeTransaction):
321         (WebKit::WebIDBConnectionToClient::createObjectStore):
322         (WebKit::WebIDBConnectionToClient::deleteObjectStore):
323         (WebKit::WebIDBConnectionToClient::renameObjectStore):
324         (WebKit::WebIDBConnectionToClient::clearObjectStore):
325         (WebKit::WebIDBConnectionToClient::createIndex):
326         (WebKit::WebIDBConnectionToClient::deleteIndex):
327         (WebKit::WebIDBConnectionToClient::renameIndex):
328         (WebKit::WebIDBConnectionToClient::putOrAdd):
329         (WebKit::WebIDBConnectionToClient::getRecord):
330         (WebKit::WebIDBConnectionToClient::getAllRecords):
331         (WebKit::WebIDBConnectionToClient::getCount):
332         (WebKit::WebIDBConnectionToClient::deleteRecord):
333         (WebKit::WebIDBConnectionToClient::openCursor):
334         (WebKit::WebIDBConnectionToClient::iterateCursor):
335         (WebKit::WebIDBConnectionToClient::establishTransaction):
336         (WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose):
337         (WebKit::WebIDBConnectionToClient::databaseConnectionClosed):
338         (WebKit::WebIDBConnectionToClient::abortOpenAndUpgradeNeeded):
339         (WebKit::WebIDBConnectionToClient::didFireVersionChangeEvent):
340         (WebKit::WebIDBConnectionToClient::openDBRequestCancelled):
341         (WebKit::WebIDBConnectionToClient::confirmDidCloseFromServer):
342         (WebKit::WebIDBConnectionToClient::getAllDatabaseNames):
343         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.h.
344         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.messages.in: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.messages.in.
345         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
346         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
347
348         Code moved from StorageToWebProcessConnection::didReceiveMessage.
349
350         (WebKit::NetworkConnectionToWebProcess::didClose):
351         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
352
353         Network process receives and stores sandbox extension of temporary files for later indexedDB
354         use.
355
356         (WebKit::NetworkConnectionToWebProcess::didClose):
357         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
358         (WebKit::generateIDBConnectionToServerIdentifier):
359         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
360         (WebKit::NetworkConnectionToWebProcess::removeIDBConnectionToServer):
361         * NetworkProcess/NetworkConnectionToWebProcess.h:
362         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
363         * NetworkProcess/NetworkProcess.cpp:
364         (WebKit::NetworkProcess::NetworkProcess):
365         (WebKit::NetworkProcess::initializeNetworkProcess):
366         (WebKit::NetworkProcess::addWebsiteDataStore):
367         (WebKit::NetworkProcess::fetchWebsiteData):
368         (WebKit::NetworkProcess::deleteWebsiteData):
369         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
370         (WebKit::NetworkProcess::idbServer):
371         (WebKit::NetworkProcess::ensurePathExists):
372         (WebKit::NetworkProcess::postStorageTask):
373         (WebKit::NetworkProcess::performNextStorageTask):
374         (WebKit::NetworkProcess::prepareForAccessToTemporaryFile):
375         (WebKit::NetworkProcess::accessToTemporaryFileComplete):
376         (WebKit::NetworkProcess::indexedDatabaseOrigins):
377         (WebKit::NetworkProcess::addIndexedDatabaseSession):
378         (WebKit::NetworkProcess::getSandboxExtensionsForBlobFiles):
379
380         Instead of asking UI process to grant sandbox extension to storage process, now network 
381         process just asks for sandbox extension fot itself.
382
383         (WebKit::NetworkProcess::didGetSandboxExtensionsForBlobFiles):
384         (WebKit::NetworkProcess::updateTemporaryFileSandboxExtensions):
385         (WebKit::NetworkProcess::grantSandboxExtensionsToStorageProcessForBlobs): Deleted.
386         (WebKit::NetworkProcess::didGrantSandboxExtensionsToStorageProcessForBlobs): Deleted.
387         * NetworkProcess/NetworkProcess.h:
388         * NetworkProcess/NetworkProcess.messages.in:
389         * NetworkProcess/NetworkProcessCreationParameters.cpp:
390         (WebKit::NetworkProcessCreationParameters::encode const):
391         (WebKit::NetworkProcessCreationParameters::decode):
392         * NetworkProcess/NetworkProcessCreationParameters.h:
393         * Shared/Storage/StorageProcessCreationParameters.cpp:
394         (WebKit::StorageProcessCreationParameters::encode const):
395         (WebKit::StorageProcessCreationParameters::decode):
396         * Shared/Storage/StorageProcessCreationParameters.h:
397         * Shared/WebsiteDataStoreParameters.cpp:
398         (WebKit::WebsiteDataStoreParameters::encode const):
399         (WebKit::WebsiteDataStoreParameters::decode):
400         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
401         * Shared/WebsiteDataStoreParameters.h:
402         * Sources.txt:
403         * StorageProcess/StorageProcess.cpp:
404         (WebKit::StorageProcess::initializeWebsiteDataStore):
405         (WebKit::StorageProcess::fetchWebsiteData):
406         (WebKit::StorageProcess::deleteWebsiteData):
407         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
408         (WebKit::StorageProcess::idbServer): Deleted.
409         (WebKit::StorageProcess::grantSandboxExtensionsForBlobs): Deleted.
410         (WebKit::StorageProcess::prepareForAccessToTemporaryFile): Deleted.
411         (WebKit::StorageProcess::accessToTemporaryFileComplete): Deleted.
412         (WebKit::StorageProcess::indexedDatabaseOrigins): Deleted.
413         (WebKit::StorageProcess::getSandboxExtensionsForBlobFiles): Deleted.
414         (WebKit::StorageProcess::didGetSandboxExtensionsForBlobFiles): Deleted.
415         * StorageProcess/StorageProcess.h:
416         (WebKit::StorageProcess::queue): Deleted.
417         * StorageProcess/StorageProcess.messages.in:
418         * StorageProcess/StorageToWebProcessConnection.cpp:
419         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
420         (WebKit::StorageToWebProcessConnection::didClose):
421         (WebKit::generateIDBConnectionToServerIdentifier): Deleted.
422         (WebKit::StorageToWebProcessConnection::establishIDBConnectionToServer): Deleted.
423         (WebKit::StorageToWebProcessConnection::removeIDBConnectionToServer): Deleted.
424         * StorageProcess/StorageToWebProcessConnection.h:
425         * StorageProcess/StorageToWebProcessConnection.messages.in:
426         * UIProcess/Network/NetworkProcessProxy.cpp:
427         (WebKit::NetworkProcessProxy::getSandboxExtensionsForBlobFiles):
428         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToStorageProcessForBlobs): Deleted.
429         * UIProcess/Network/NetworkProcessProxy.h:
430         * UIProcess/Network/NetworkProcessProxy.messages.in:
431         * UIProcess/Storage/StorageProcessProxy.cpp:
432         (WebKit::StorageProcessProxy::getSandboxExtensionsForBlobFiles): Deleted.
433         * UIProcess/Storage/StorageProcessProxy.h:
434         * UIProcess/Storage/StorageProcessProxy.messages.in:
435         * UIProcess/WebProcessPool.cpp:
436         (WebKit::WebProcessPool::ensureNetworkProcess):
437         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
438         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
439         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
440         (WebKit::WebsiteDataStore::parameters):
441         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
442         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
443         (WebKit::WebsiteDataStore::fetchDataAndApply):
444         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
445         (WebKit::WebsiteDataStore::removeData):
446         (WebKit::WebsiteDataStore::storageProcessParameters):
447         (WebKit::WebsiteDataStore::parameters):
448         * WebKit.xcodeproj/project.pbxproj:
449         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
450         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
451         (WebKit::WebIDBConnectionToServer::~WebIDBConnectionToServer):
452         (WebKit::WebIDBConnectionToServer::messageSenderConnection):
453         * WebProcess/Databases/WebDatabaseProvider.cpp:
454         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
455         * WebProcess/Network/NetworkProcessConnection.cpp:
456         (WebKit::NetworkProcessConnection::didReceiveMessage):
457         (WebKit::NetworkProcessConnection::didClose):
458         (WebKit::NetworkProcessConnection::idbConnectionToServerForSession):
459         * WebProcess/Network/NetworkProcessConnection.h:
460         (WebKit::NetworkProcessConnection::existingIDBConnectionToServerForIdentifier const):
461         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
462         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
463         (WebKit::WebToStorageProcessConnection::didClose):
464         (WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession): Deleted.
465         * WebProcess/Storage/WebToStorageProcessConnection.h:
466         (WebKit::WebToStorageProcessConnection::existingIDBConnectionToServerForIdentifier): Deleted.
467         * WebProcess/WebProcess.cpp:
468         (WebKit::WebProcess::networkProcessConnectionClosed):
469         (WebKit::WebProcess::webToStorageProcessConnectionClosed):
470
471 2018-09-08  Darin Adler  <darin@apple.com>
472
473         Streamline JSRetainPtr, fix leaks of JSString and JSGlobalContext
474         https://bugs.webkit.org/show_bug.cgi?id=189455
475
476         Reviewed by Keith Miller.
477
478         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
479         (WebKit::toJSString): Use adopt function instead of adopt construuctor.
480         (WebKit::evaluate): Ditto.
481         (WebKit::evaluateJavaScriptCallback): Ditto.
482         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Ditto.
483
484 2018-09-14  Matt Lewis  <jlewis3@apple.com>
485
486         Unreviewed, rolling out r236020.
487
488         This caused an api failure on High Sierra
489
490         Reverted changeset:
491
492         "Refactoring related to Safe Browsing"
493         https://bugs.webkit.org/show_bug.cgi?id=189631
494         https://trac.webkit.org/changeset/236020
495
496 2018-09-14  Basuke Suzuki  <Basuke.Suzuki@sony.com>
497
498         [Curl] Bug fix on some inaccurate values in NetworkLoadMetrics.
499         https://bugs.webkit.org/show_bug.cgi?id=189530
500
501         Reviewed by Alex Christensen.
502
503         Curl port uses the start time libcurl provided. But there's a lug between main thread and Curl thread.
504         Record the start time of request instead of libcurl's start timing and use it to measure the metrics.
505
506         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
507         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl):
508         (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
509         (WebKit::NetworkDataTaskCurl::restartWithCredential):
510         * NetworkProcess/curl/NetworkDataTaskCurl.h:
511
512 2018-09-14  Alex Christensen  <achristensen@webkit.org>
513
514         Refactoring related to Safe Browsing
515         https://bugs.webkit.org/show_bug.cgi?id=189631
516
517         Reviewed by Tim Horton.
518
519         Make SafeBrowsingResult RefCounted.
520         Move logic from an unnamed lambda to WebPageProxy::receivedNavigationPolicyDecision.
521
522         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
523         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
524         (WebKit::WebPageProxy::contentFilterDidBlockLoadForFrame): Deleted.
525         (WebKit::WebPageProxy::addPlatformLoadParameters): Deleted.
526         (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): Deleted.
527         (WebKit::WebPageProxy::startDrag): Deleted.
528         (WebKit::WebPageProxy::setPromisedDataForImage): Deleted.
529         (WebKit::WebPageProxy::setDragCaretRect): Deleted.
530         (WebKit::WebPageProxy::platformRegisterAttachment): Deleted.
531         (WebKit::WebPageProxy::platformCloneAttachment): Deleted.
532         * UIProcess/SafeBrowsingResult.h:
533         (WebKit::SafeBrowsingResult::create):
534         * UIProcess/WebFramePolicyListenerProxy.cpp:
535         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
536         * UIProcess/WebFramePolicyListenerProxy.h:
537         * UIProcess/WebFrameProxy.cpp:
538         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
539         * UIProcess/WebFrameProxy.h:
540         * UIProcess/WebPageProxy.cpp:
541         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
542         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
543         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
544         (WebKit::WebPageProxy::decidePolicyForResponse):
545         * UIProcess/WebPageProxy.h:
546
547 2018-09-14  Geoffrey Garen  <ggaren@apple.com>
548
549         Clarify the configuration used by WKUIDelegate's createWebViewWithConfiguration
550         https://bugs.webkit.org/show_bug.cgi?id=189634
551
552         Reviewed by Tim Horton.
553
554         * UIProcess/API/Cocoa/WKUIDelegate.h:
555
556 2018-09-11  Simon Fraser  <simon.fraser@apple.com>
557
558         Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings
559         https://bugs.webkit.org/show_bug.cgi?id=189521
560
561         Reviewed by Tim Horton.
562
563         Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>.
564         
565         RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>.
566         
567         Added some helper functions to null out a RefPtr<GraphicsLayer> after removing from the tree,
568         clearing the client. GraphicsLayer.m_client becomes a pointer, so it can be set to point to a singleton
569         empty client when a GraphicsLayer gets detached from its owner. More explicit layer unparenting,
570         and removed some unnecessary parent checks, and redundant unparenting.
571         
572         Other changes are just to adapt to the new ownership patterns.
573         
574         I verified that no GraphicsLayers were leaked or abandoned after this change.
575
576         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
577         (WebKit::WebInspectorClient::~WebInspectorClient):
578         (WebKit::WebInspectorClient::showPaintRect):
579         (WebKit::WebInspectorClient::animationEndedForLayer):
580         * WebProcess/WebCoreSupport/WebInspectorClient.h:
581         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
582         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
583         (WebKit::RemoteLayerTreeContext::createGraphicsLayer):
584         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
585         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
586         (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers):
587         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
588
589 2018-09-14  Eric Carlson  <eric.carlson@apple.com>
590
591         Support arbitrary video resolution in getUserMedia API
592         https://bugs.webkit.org/show_bug.cgi?id=178109
593         <rdar://problem/35083128>
594
595         Reviewed by Youenn Fablet.
596
597         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
598
599 2018-09-14  Basuke Suzuki  <Basuke.Suzuki@sony.com>
600
601         [Curl][WebKit] Bug fix for continuously retrying with empty credentials.
602         https://bugs.webkit.org/show_bug.cgi?id=189601
603
604         Reviewed by Alex Christensen.
605
606         Added stop condition for empty credentials passed by client.
607
608         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
609         (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
610         (WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse):
611         (WebKit::NetworkDataTaskCurl::tryHttpAuthentication):
612         (WebKit::NetworkDataTaskCurl::tryProxyAuthentication):
613         * NetworkProcess/curl/NetworkDataTaskCurl.h:
614
615 2018-09-14  Jer Noble  <jer.noble@apple.com>
616
617         Turn SourceBufferChangeTypeEnabled on by default
618         https://bugs.webkit.org/show_bug.cgi?id=189527
619
620         Reviewed by Eric Carlson.
621
622         * Shared/WebPreferences.yaml:
623         * UIProcess/API/C/WKPreferencesRefPrivate.h:
624
625 2018-09-14  Michael Catanzaro  <mcatanzaro@igalia.com>
626
627         Unreviewed, speculative WPE build fix after r236004
628         https://bugs.webkit.org/show_bug.cgi?id=189545
629
630         * UIProcess/API/wpe/WebKitScriptDialog.h:
631
632 2018-09-14  Carlos Garcia Campos  <cgarcia@igalia.com>
633
634         [GTK] Make script dialogs modal to the current web view only
635         https://bugs.webkit.org/show_bug.cgi?id=189545
636
637         Reviewed by Michael Catanzaro.
638
639         Change the default implementation of script dialogs to use an embedded window, like the HTTP auth dialog,
640         instead of a GtkMessageDialog. This patch adds a base class WebKitWebViewDialog shared by
641         WebKitAuthenticationDialog and the new WebKitScriptDialogImpl.
642
643         * SourcesGTK.txt: Add new files to compilation.
644         * UIProcess/API/glib/WebKitScriptDialogPrivate.h:
645         * UIProcess/API/gtk/WebKitAuthenticationDialog.cpp:
646         (webkitAuthenticationDialogInitialize): Do not use a frame and use a better styled title.
647         (webkit_authentication_dialog_class_init): Remove implementation of vfuncs that are now implemented by the
648         parent.
649         * UIProcess/API/gtk/WebKitAuthenticationDialog.h:
650         * UIProcess/API/gtk/WebKitScriptDialogGtk.cpp:
651         (webkitScriptDialogAccept): Use WebKitScriptDialogImpl API.
652         (webkitScriptDialogDismiss): Ditto.
653         (webkitScriptDialogSetUserInput): Ditto.
654         * UIProcess/API/gtk/WebKitScriptDialogImpl.cpp: Added.
655         (webkitScriptDialogImplClose):
656         (webkitScriptDialogImplKeyPressEvent):
657         (webkitScriptDialogImplMap):
658         (webkitScriptDialogImplConstructed):
659         (webkitScriptDialogImplDispose):
660         (webkit_script_dialog_impl_class_init):
661         (webkitScriptDialogImplAddButton):
662         (webkitScriptDialogImplNew):
663         (webkitScriptDialogImplCancel):
664         (webkitScriptDialogImplConfirm):
665         (webkitScriptDialogImplSetEntryText):
666         * UIProcess/API/gtk/WebKitScriptDialogImpl.h: Added.
667         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
668         (webkitWebViewChildIsInternalWidget): Rename authenticationDialog as just dialog.
669         (webkitWebViewBaseAddDialog): Ditto.
670         (webkitWebViewBaseContainerRemove): Ditto.
671         (webkitWebViewBaseContainerForall): Ditto.
672         (webkitWebViewBaseConstructed): Ditto.
673         (webkitWebViewBaseSizeAllocate): Ditto.
674         (webkitWebViewBaseKeyPressEvent): Ditto.
675         (webkitWebViewBaseHandleMouseEvent): Ditto.
676         (webkitWebViewBaseButtonPressEvent): Ditto.
677         (webkitWebViewBaseButtonReleaseEvent): Ditto.
678         (webkitWebViewBaseHandleWheelEvent): Ditto.
679         (webkitWebViewBaseScrollEvent): Ditto.
680         (webkitWebViewBaseMotionNotifyEvent): Ditto.
681         (webkitWebViewBaseCrossingNotifyEvent): Ditto.
682         (webkitWebViewBaseTouchEvent): Ditto.
683         (webkitWebViewBaseFocus): Ditto.
684         (webkitWebViewBaseDestroy): Ditto.
685         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
686         * UIProcess/API/gtk/WebKitWebViewDialog.cpp: Added.
687         (webkitWebViewDialogDraw):
688         (webkitWebViewDialogSizeAllocate):
689         (webkitWebViewDialogConstructed):
690         (webkit_web_view_dialog_class_init):
691         * UIProcess/API/gtk/WebKitWebViewDialog.h: Added.
692         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
693         (webkitWebViewAuthenticate):
694         (webkitWebViewScriptDialog):
695
696 2018-09-13  Ryan Haddad  <ryanhaddad@apple.com>
697
698         Unreviewed, rolling out r235954.
699
700         Breaks the watchOS build.
701
702         Reverted changeset:
703
704         "Move IndexedDB to Network Process"
705         https://bugs.webkit.org/show_bug.cgi?id=189415
706         https://trac.webkit.org/changeset/235954
707
708 2018-09-13  Chris Dumez  <cdumez@apple.com>
709
710         Regression(PSON): setting window.opener to null allows process swapping in cases that are not web-compatible
711         https://bugs.webkit.org/show_bug.cgi?id=189590
712         <rdar://problem/44422725>
713
714         Reviewed by Geoffrey Garen.
715
716         If script calls window.open() without 'noopener' and the newly navigated window gets navigated cross-site,
717         we are currently unable to process-swap because the opener has a WindowProxy handle to this new Window and
718         may interact with it (which we currently do not support cross-process). We were dealing with this by not
719         process-swapping if window.opener is not null. This works most of the time but is not sufficient because the
720         opener may get nulled out, while the opener still has a valid WindowProxy handle to its openee.
721
722         Therefore, we now also check for a flag indicating if the frame was opened via window.open() without
723         'nooopener'. We still need to check if the browsing context has an opener for browsing context created
724         via <a target="_blank"> for example (the opener does not have a handle to the new window but the openee
725         has access to its opener).
726
727         * Shared/NavigationActionData.cpp:
728         (WebKit::NavigationActionData::encode const):
729         (WebKit::NavigationActionData::decode):
730         * Shared/NavigationActionData.h:
731         * UIProcess/API/APINavigation.h:
732         (API::Navigation::openedViaWindowOpenWithOpener const):
733         (API::Navigation::setOpenedViaWindowOpenWithOpener):
734         * UIProcess/WebPageProxy.cpp:
735         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
736         * UIProcess/WebProcessPool.cpp:
737         (WebKit::WebProcessPool::processForNavigationInternal):
738         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
739         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
740
741 2018-09-13  Dean Jackson  <dino@grorg.org>
742
743         Generate warnings for Preferences files
744         https://bugs.webkit.org/show_bug.cgi?id=189573
745
746         Reviewed by Sam Weinig.
747
748         Generate the "DO NOT EDIT" warnings, rather than have
749         them in the template (which was confusing).
750
751         While here, simplify some of the templating generation code
752         to avoid duplication.
753
754         * Scripts/GeneratePreferences.rb:
755         * Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb:
756         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
757         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
758         * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb:
759         * Scripts/PreferencesTemplates/WebPreferencesKeys.cpp.erb:
760         * Scripts/PreferencesTemplates/WebPreferencesKeys.h.erb:
761         * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb:
762
763 2018-09-13  Keith Rollin  <krollin@apple.com>
764
765         WebPageProxy::reportPageLoadResult can crash on some code paths
766         https://bugs.webkit.org/show_bug.cgi?id=189568
767
768         Reviewed by Chris Dumez.
769
770         WebPageProxy::reportPageLoadResult (which is called from
771         WebPageProxy::didFinishLoadForFrame) can sometimes crash when
772         accessing m_pageLoadStart (a std::optional) in its unloaded state.
773         Normally, m_pageLoadStart is initialized in
774         WebPageProxy::didStartProvisionalLoadForFrame, which one would expect
775         would be called before WebPageProxy::didFinishLoadForFrame. But that
776         turns out to not always be the case. It's not apparent under what
777         conditions didStartProvisionalLoadForFrame will not be called, but
778         it's happening in the wild, leading to crashes now that std::optional
779         asserts in release builds on bad accesses (see
780         https://bugs.webkit.org/show_bug.cgi?id=189568).
781
782         Fix this by checking m_pageLoadState on entry to reportPageLoadResult.
783
784         * UIProcess/WebPageProxy.cpp:
785         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
786         (WebKit::WebPageProxy::didFinishLoadForFrame):
787         (WebKit::WebPageProxy::didFailLoadForFrame):
788         (WebKit::WebPageProxy::reportPageLoadResult):
789
790 2018-09-13  Chris Dumez  <cdumez@apple.com>
791
792         ProcessSwap.BackWithoutSuspendedPage API test hits assertion under WebPageProxy::didCreateMainFrame()
793         https://bugs.webkit.org/show_bug.cgi?id=189599
794
795         Reviewed by Geoffrey Garen.
796
797         The code in WebPageProxy::reattachToWebProcess() was re-initializing m_mainFrame unconditionally in case
798         of a HistoryNavigation. The reason we need to initialize m_mainFrame in reattachToWebProcess() is if the
799         process we're reattaching to already has a WebPage (with a main frame), in which case
800         WebPageProxy::didCreateMainFrame() would not get called to initialize WebPageProxy::m_mainFrame.
801
802         The process we're reattaching to can be in such a state only if it comes from a SuspendedPageProxy (we
803         detached the WebProcessProxy from the WebPageProxy but kept the WebPage in the "suspended" WebProcess).
804         It is true that we're only reattaching to a SuspendedPageProxy's process in the event of history
805         navigations. However, it is not true that all history navigations will use a SuspendedPageProxy's process.
806         For example, no SuspendedPageProxy may be available for the history navigation because the history
807         was restored to a new view from disk, or because the WebBackForwardListItem no longer has a
808         SuspendedPageProxy (we currently only keep a single SuspendedPageProxy for the last HistoryItem).
809
810         Therefore, unconditionally initializating m_mainFrame in reattachToWebProcess() for history navigations
811         is incorrect and we should instead check if we're reattaching to a SuspendedPage's process.
812
813         Change is covered by ProcessSwap.BackWithoutSuspendedPage API test which is no longer crashes and
814         existing Back/Forward PSON API tests which are still passing.
815
816         * UIProcess/WebPageProxy.cpp:
817         (WebKit::WebPageProxy::reattachToWebProcess):
818         (WebKit::WebPageProxy::continueNavigationInNewProcess):
819         * UIProcess/WebPageProxy.h:
820
821 2018-09-13  Chris Dumez  <cdumez@apple.com>
822
823         Add release logging to help debug PSON issues
824         https://bugs.webkit.org/show_bug.cgi?id=189562
825
826         Reviewed by Ryosuke Niwa.
827
828         Add release logging to help debug issues related to process swap on navigation.
829
830         * UIProcess/WebPageProxy.cpp:
831         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
832         * UIProcess/WebProcessPool.cpp:
833         (WebKit::WebProcessPool::processForNavigation):
834         (WebKit::WebProcessPool::processForNavigationInternal):
835         * UIProcess/WebProcessPool.h:
836
837 2018-09-13  Chris Dumez  <cdumez@apple.com>
838
839         Add null check for drawing area in WebPage::didCompletePageTransition() after r235867
840         https://bugs.webkit.org/show_bug.cgi?id=189587
841
842         Reviewed by Geoffrey Garen.
843
844         Add null check for drawing area in WebPage::didCompletePageTransition() after r235867
845         as this is causing crashes on the bots.
846
847         * WebProcess/WebPage/WebPage.cpp:
848         (WebKit::WebPage::didCompletePageTransition):
849
850 2018-09-13  Ryan Haddad  <ryanhaddad@apple.com>
851
852         Unreviewed, rolling out r235953.
853
854         Caused layout test crashes under GuardMalloc.
855
856         Reverted changeset:
857
858         "Make GraphicsLayers ref-counted, so their tree can persist
859         when disconnected from RenderLayerBackings"
860         https://bugs.webkit.org/show_bug.cgi?id=189521
861         https://trac.webkit.org/changeset/235953
862
863 2018-09-13  Carlos Garcia Campos  <cgarcia@igalia.com>
864
865         [GTK][WPE] Allow to run script dialogs asynchronously in the UI process
866         https://bugs.webkit.org/show_bug.cgi?id=189544
867
868         Reviewed by Michael Catanzaro.
869
870         Script dialogs are sync in the WebProcess, but we don't need to block the UI process while they are running. Our
871         current API doesn't allow it, because it always expects the dialog to be closed in the signal handler. API
872         changes are backwards compatible.
873
874         * UIProcess/API/glib/WebKitScriptDialog.cpp:
875         (webkitScriptDialogCreate): Added to heap allocate a WebKitScriptDialog.
876         (webkitScriptDialogIsRunning): Common implementation here, a script dialog is considered to be running if it has
877         a competion handler pending.
878         (webkit_script_dialog_ref): WebKitScriptDialog is now refcounted.
879         (webkit_script_dialog_unref): Ditto.
880         (webkit_script_dialog_close): New method to notify that we are done with the dialog.
881         * UIProcess/API/glib/WebKitScriptDialogPrivate.h:
882         (_WebKitScriptDialog::_WebKitScriptDialog): Use a single constructor and keep the completion handler.
883         * UIProcess/API/glib/WebKitUIClient.cpp: Do not call the completion handler, pass it to the web view.
884         * UIProcess/API/glib/WebKitWebView.cpp:
885         (webkitWebViewDispose): Close the current script dialog if there's any.
886         (webkit_web_view_class_init): Document how to handle dialogs asynchronously.
887         (webkitWebViewRunJavaScriptAlert): Do not stack allocate the WebKitScriptDialog, create it with
888         webkitScriptDialogCreate() passing the completion handler.
889         (webkitWebViewRunJavaScriptConfirm): Ditto.
890         (webkitWebViewRunJavaScriptPrompt): Ditto.
891         (webkitWebViewRunJavaScriptBeforeUnloadConfirm): Ditto.
892         * UIProcess/API/glib/WebKitWebViewPrivate.h:
893         * UIProcess/API/gtk/WebKitScriptDialog.h:
894         * UIProcess/API/gtk/WebKitScriptDialogGtk.cpp:
895         (scriptDialogResponseCallback): Hnadle the response callback.
896         (webkitScriptDialogRun): Do not use gtk_dialog_run(), connect to response signal and show the dialogs instead.
897         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
898         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
899         * UIProcess/API/wpe/WebKitScriptDialogWPE.cpp:
900
901 2018-09-12  Dan Bernstein  <mitz@apple.com>
902
903         Update availability annotations to match the macOS and iOS SDKs in the Xcode 10 GM seed
904         https://bugs.webkit.org/show_bug.cgi?id=189561
905
906         Reviewed by Tim Horton.
907
908         Changed WK_MAC_TBA and WK_IOS_TBA to 10.14 and 12.0, respectively, in all declarations that
909         appear in the GM seed SDKs.
910
911         * Shared/API/Cocoa/_WKRenderingProgressEvents.h:
912         * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
913         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
914         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
915         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
916         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
917         * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
918         * UIProcess/API/Cocoa/WKViewPrivate.h:
919         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
920         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
921         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
922         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
923         * UIProcess/API/Cocoa/_WKAttachment.h:
924         * UIProcess/API/Cocoa/_WKAutomationDelegate.h:
925         * UIProcess/API/Cocoa/_WKAutomationSession.h:
926         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
927         * UIProcess/API/Cocoa/_WKFormInputSession.h:
928         * UIProcess/API/Cocoa/_WKInputDelegate.h:
929         * UIProcess/API/Cocoa/_WKLinkIconParameters.h:
930         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
931         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
932         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h:
933         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.h:
934         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h:
935         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
936
937 2018-09-12  Dan Bernstein  <mitz@apple.com>
938
939         [Cocoa] Complete support for Paste as Quotation
940         https://bugs.webkit.org/show_bug.cgi?id=189504
941
942         Reviewed by Wenson Hsieh.
943
944         * UIProcess/API/Cocoa/WKWebView.mm:
945         (-[WKWebView canPerformAction:withSender:]): Handle _pasteAsQuotation:. It’s not included
946           in FOR_EACH_WKCONTENTVIEW_ACTION, because it’s declared and implemented in the WKPrivate
947           category. If we add more actions in the category, it could make sense to fold them into
948           a new FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION.
949         (-[WKWebView targetForAction:withSender:]): Handle _pasteAsQuotation:.
950         (-[WKWebView _pasteAsQuotation:]): Send to the WebViewImpl or the WKContentView.
951         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declared a new _pasteAsQuotation: action.
952
953         * UIProcess/Cocoa/WebViewImpl.mm:
954         (WebKit::selectorExceptionMap): Added a custom mapping from the new selector to the
955           PasteAsQuotation command.
956
957         * UIProcess/ios/WKContentViewInteraction.h: Declare methods for the new action.
958         * UIProcess/ios/WKContentViewInteraction.mm:
959           Forward _pasteAsQuotation: to the WKWebView so that clients get a chance to override its
960           behavior.
961         (-[WKContentView _pasteAsQuotationForWebView:]): Send the command to the page.
962
963 2018-09-12  Sihui Liu  <sihui_liu@apple.com>
964
965         Move IndexedDB to Network Process
966         https://bugs.webkit.org/show_bug.cgi?id=189415
967
968         Reviewed by Geoffrey Garen.
969
970         We are going to eliminate storage process and move its functionality to network process. 
971         The reasons why we want to do this:
972         1. Lower resource usage of having an additional process for storage operations, especially
973         memory. Single storage process takes about 5MB memory on macOS.
974         2. Reduce latency of Service Workers. After enabling Service Workers, we've seen
975         regression in app launch. The launch time of storage process is partly attributed to this:
976         Service Workers delay page loading until receiving response from storage process.
977         3. We choose network process because UI process may have broader access in file system
978         that we don't want the storage operations to have.
979
980         This patch is the first piece towards the goal. It mainly moves indexedDB from storage process
981         to corresponding components of network process. Moving of Service Worker and stopping to 
982         launch storage process will be done in following patches.
983
984         We expect to see the higher cpu and memory usage of network process as it is taking more work,
985         but the overall gain in memory and latency after we completely remove storage process should be 
986         positive.
987
988
989         * CMakeLists.txt:
990         * DerivedSources.make:
991
992         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp.
993         (WebKit::WebIDBConnectionToClient::create):
994         (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient):
995         (WebKit::WebIDBConnectionToClient::~WebIDBConnectionToClient):
996         (WebKit::WebIDBConnectionToClient::disconnectedFromWebProcess):
997         (WebKit::WebIDBConnectionToClient::messageSenderConnection):
998         (WebKit::WebIDBConnectionToClient::connectionToClient):
999         (WebKit::WebIDBConnectionToClient::didDeleteDatabase):
1000         (WebKit::WebIDBConnectionToClient::didOpenDatabase):
1001         (WebKit::WebIDBConnectionToClient::didAbortTransaction):
1002         (WebKit::WebIDBConnectionToClient::didCommitTransaction):
1003         (WebKit::WebIDBConnectionToClient::didCreateObjectStore):
1004         (WebKit::WebIDBConnectionToClient::didDeleteObjectStore):
1005         (WebKit::WebIDBConnectionToClient::didRenameObjectStore):
1006         (WebKit::WebIDBConnectionToClient::didClearObjectStore):
1007         (WebKit::WebIDBConnectionToClient::didCreateIndex):
1008         (WebKit::WebIDBConnectionToClient::didDeleteIndex):
1009         (WebKit::WebIDBConnectionToClient::didRenameIndex):
1010         (WebKit::WebIDBConnectionToClient::didPutOrAdd):
1011         (WebKit::WebIDBConnectionToClient::handleGetResult):
1012         (WebKit::WebIDBConnectionToClient::didGetRecord):
1013         (WebKit::WebIDBConnectionToClient::didGetAllRecords):
1014         (WebKit::WebIDBConnectionToClient::didGetCount):
1015         (WebKit::WebIDBConnectionToClient::didDeleteRecord):
1016         (WebKit::WebIDBConnectionToClient::didOpenCursor):
1017         (WebKit::WebIDBConnectionToClient::didIterateCursor):
1018         (WebKit::WebIDBConnectionToClient::fireVersionChangeEvent):
1019         (WebKit::WebIDBConnectionToClient::didStartTransaction):
1020         (WebKit::WebIDBConnectionToClient::didCloseFromServer):
1021         (WebKit::WebIDBConnectionToClient::notifyOpenDBRequestBlocked):
1022         (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNames):
1023         (WebKit::WebIDBConnectionToClient::deleteDatabase):
1024         (WebKit::WebIDBConnectionToClient::openDatabase):
1025         (WebKit::WebIDBConnectionToClient::abortTransaction):
1026         (WebKit::WebIDBConnectionToClient::commitTransaction):
1027         (WebKit::WebIDBConnectionToClient::didFinishHandlingVersionChangeTransaction):
1028         (WebKit::WebIDBConnectionToClient::createObjectStore):
1029         (WebKit::WebIDBConnectionToClient::deleteObjectStore):
1030         (WebKit::WebIDBConnectionToClient::renameObjectStore):
1031         (WebKit::WebIDBConnectionToClient::clearObjectStore):
1032         (WebKit::WebIDBConnectionToClient::createIndex):
1033         (WebKit::WebIDBConnectionToClient::deleteIndex):
1034         (WebKit::WebIDBConnectionToClient::renameIndex):
1035         (WebKit::WebIDBConnectionToClient::putOrAdd):
1036         (WebKit::WebIDBConnectionToClient::getRecord):
1037         (WebKit::WebIDBConnectionToClient::getAllRecords):
1038         (WebKit::WebIDBConnectionToClient::getCount):
1039         (WebKit::WebIDBConnectionToClient::deleteRecord):
1040         (WebKit::WebIDBConnectionToClient::openCursor):
1041         (WebKit::WebIDBConnectionToClient::iterateCursor):
1042         (WebKit::WebIDBConnectionToClient::establishTransaction):
1043         (WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose):
1044         (WebKit::WebIDBConnectionToClient::databaseConnectionClosed):
1045         (WebKit::WebIDBConnectionToClient::abortOpenAndUpgradeNeeded):
1046         (WebKit::WebIDBConnectionToClient::didFireVersionChangeEvent):
1047         (WebKit::WebIDBConnectionToClient::openDBRequestCancelled):
1048         (WebKit::WebIDBConnectionToClient::confirmDidCloseFromServer):
1049         (WebKit::WebIDBConnectionToClient::getAllDatabaseNames):
1050         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.h.
1051         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.messages.in: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.messages.in.
1052         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1053         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1054
1055         Code moved from StorageToWebProcessConnection::didReceiveMessage.
1056
1057         (WebKit::NetworkConnectionToWebProcess::didClose):
1058         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
1059
1060         Network process receives and stores sandbox extension of temporary files for later indexedDB
1061         use.
1062
1063         (WebKit::generateIDBConnectionToServerIdentifier):
1064         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
1065         (WebKit::NetworkConnectionToWebProcess::removeIDBConnectionToServer):
1066         * NetworkProcess/NetworkConnectionToWebProcess.h:
1067         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1068         * NetworkProcess/NetworkProcess.cpp:
1069         (WebKit::NetworkProcess::NetworkProcess):
1070         (WebKit::NetworkProcess::initializeNetworkProcess):
1071         (WebKit::NetworkProcess::addWebsiteDataStore):
1072         (WebKit::NetworkProcess::fetchWebsiteData):
1073         (WebKit::NetworkProcess::deleteWebsiteData):
1074         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1075         (WebKit::NetworkProcess::idbServer):
1076         (WebKit::NetworkProcess::ensurePathExists):
1077         (WebKit::NetworkProcess::postStorageTask):
1078         (WebKit::NetworkProcess::performNextStorageTask):
1079         (WebKit::NetworkProcess::prepareForAccessToTemporaryFile):
1080         (WebKit::NetworkProcess::accessToTemporaryFileComplete):
1081         (WebKit::NetworkProcess::indexedDatabaseOrigins):
1082         (WebKit::NetworkProcess::addIndexedDatabaseSession):
1083         (WebKit::NetworkProcess::getSandboxExtensionsForBlobFiles):
1084
1085         Instead of asking UI process to grant sandbox extension to storage process, now network 
1086         process just asks for sandbox extension fot itself.
1087
1088         (WebKit::NetworkProcess::didGetSandboxExtensionsForBlobFiles):
1089         (WebKit::NetworkProcess::updateTemporaryFileSandboxExtensions):
1090         (WebKit::NetworkProcess::grantSandboxExtensionsToStorageProcessForBlobs): Deleted.
1091         (WebKit::NetworkProcess::didGrantSandboxExtensionsToStorageProcessForBlobs): Deleted.
1092         * NetworkProcess/NetworkProcess.h:
1093         (WebKit::NetworkProcess::queue):
1094         * NetworkProcess/NetworkProcess.messages.in:
1095         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1096         (WebKit::NetworkProcessCreationParameters::encode const):
1097         (WebKit::NetworkProcessCreationParameters::decode):
1098         * NetworkProcess/NetworkProcessCreationParameters.h:
1099         * Shared/Storage/StorageProcessCreationParameters.cpp:
1100         (WebKit::StorageProcessCreationParameters::encode const):
1101         (WebKit::StorageProcessCreationParameters::decode):
1102         * Shared/Storage/StorageProcessCreationParameters.h:
1103         * Shared/WebsiteDataStoreParameters.cpp:
1104         (WebKit::WebsiteDataStoreParameters::encode const):
1105         (WebKit::WebsiteDataStoreParameters::decode):
1106         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
1107         * Shared/WebsiteDataStoreParameters.h:
1108         * Sources.txt:
1109         * StorageProcess/StorageProcess.cpp:
1110         (WebKit::StorageProcess::initializeWebsiteDataStore):
1111         (WebKit::StorageProcess::fetchWebsiteData):
1112         (WebKit::StorageProcess::deleteWebsiteData):
1113         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
1114         (WebKit::StorageProcess::idbServer): Deleted.
1115         (WebKit::StorageProcess::grantSandboxExtensionsForBlobs): Deleted.
1116         (WebKit::StorageProcess::prepareForAccessToTemporaryFile): Deleted.
1117         (WebKit::StorageProcess::accessToTemporaryFileComplete): Deleted.
1118         (WebKit::StorageProcess::indexedDatabaseOrigins): Deleted.
1119         (WebKit::StorageProcess::getSandboxExtensionsForBlobFiles): Deleted.
1120         (WebKit::StorageProcess::didGetSandboxExtensionsForBlobFiles): Deleted.
1121         * StorageProcess/StorageProcess.h:
1122         (WebKit::StorageProcess::queue): Deleted.
1123         * StorageProcess/StorageProcess.messages.in:
1124         * StorageProcess/StorageToWebProcessConnection.cpp:
1125         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
1126         (WebKit::StorageToWebProcessConnection::didClose):
1127         (WebKit::generateIDBConnectionToServerIdentifier): Deleted.
1128         (WebKit::StorageToWebProcessConnection::establishIDBConnectionToServer): Deleted.
1129         (WebKit::StorageToWebProcessConnection::removeIDBConnectionToServer): Deleted.
1130         * StorageProcess/StorageToWebProcessConnection.h:
1131         * StorageProcess/StorageToWebProcessConnection.messages.in:
1132         * UIProcess/Network/NetworkProcessProxy.cpp:
1133         (WebKit::NetworkProcessProxy::getSandboxExtensionsForBlobFiles):
1134         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToStorageProcessForBlobs): Deleted.
1135         * UIProcess/Network/NetworkProcessProxy.h:
1136         * UIProcess/Network/NetworkProcessProxy.messages.in:
1137         * UIProcess/Storage/StorageProcessProxy.cpp:
1138         (WebKit::StorageProcessProxy::getSandboxExtensionsForBlobFiles): Deleted.
1139         * UIProcess/Storage/StorageProcessProxy.h:
1140         * UIProcess/Storage/StorageProcessProxy.messages.in:
1141         * UIProcess/WebProcessPool.cpp:
1142         (WebKit::WebProcessPool::ensureNetworkProcess):
1143         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
1144         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
1145         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1146         (WebKit::WebsiteDataStore::parameters):
1147         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1148         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
1149         (WebKit::WebsiteDataStore::fetchDataAndApply):
1150         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
1151         (WebKit::WebsiteDataStore::removeData):
1152         (WebKit::WebsiteDataStore::storageProcessParameters):
1153         (WebKit::WebsiteDataStore::parameters):
1154         * WebKit.xcodeproj/project.pbxproj:
1155         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1156         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
1157         (WebKit::WebIDBConnectionToServer::~WebIDBConnectionToServer):
1158         (WebKit::WebIDBConnectionToServer::messageSenderConnection):
1159         * WebProcess/Databases/WebDatabaseProvider.cpp:
1160         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
1161         * WebProcess/Network/NetworkProcessConnection.cpp:
1162         (WebKit::NetworkProcessConnection::didReceiveMessage):
1163         (WebKit::NetworkProcessConnection::didClose):
1164         (WebKit::NetworkProcessConnection::idbConnectionToServerForSession):
1165         * WebProcess/Network/NetworkProcessConnection.h:
1166         (WebKit::NetworkProcessConnection::existingIDBConnectionToServerForIdentifier):
1167         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
1168         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
1169
1170         Code moved from WebToStorageProcessConnection::didReceiveMessage.
1171
1172         (WebKit::WebToStorageProcessConnection::didClose):
1173         (WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession): Deleted.
1174         * WebProcess/Storage/WebToStorageProcessConnection.h:
1175         (WebKit::WebToStorageProcessConnection::existingIDBConnectionToServerForIdentifier): Deleted.
1176         * WebProcess/WebProcess.cpp:
1177         (WebKit::WebProcess::networkProcessConnectionClosed):
1178         (WebKit::WebProcess::webToStorageProcessConnectionClosed):
1179
1180 2018-09-11  Simon Fraser  <simon.fraser@apple.com>
1181
1182         Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings
1183         https://bugs.webkit.org/show_bug.cgi?id=189521
1184
1185         Reviewed by Tim Horton.
1186
1187         Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>.
1188         
1189         RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>.
1190         
1191         All the other changes are just to adapt to the new ownership patterns.
1192         
1193         I verified that no GraphicsLayers were leaked or abandoned after this change.
1194
1195         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
1196         (WebKit::WebInspectorClient::~WebInspectorClient):
1197         (WebKit::WebInspectorClient::showPaintRect):
1198         (WebKit::WebInspectorClient::animationEndedForLayer):
1199         * WebProcess/WebCoreSupport/WebInspectorClient.h:
1200         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
1201         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
1202         (WebKit::RemoteLayerTreeContext::createGraphicsLayer):
1203         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
1204         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1205         (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers):
1206         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1207
1208 2018-09-12  Chris Dumez  <cdumez@apple.com>
1209
1210         PSON: No process swap on back navigation after URL bar navigation
1211         https://bugs.webkit.org/show_bug.cgi?id=189557
1212         <rdar://problem/44353108>
1213
1214         Reviewed by Alex Christensen.
1215
1216         Our logic in WebProcessPool::processForNavigationInternal() was wrongly using
1217         WebBackForwardList::currentItem() as source item of the navigation, instead of
1218         using Navigation::fromItem(). In case of back navigation, by the time
1219         processForNavigation() is called, the WebBackForwardList's currentItem has already
1220         been updated to be the target item, via a Sync IPC from the WebProcess. As a result,
1221         the source and target items would be the same in the following check:
1222         ` if (currentItem->itemID().processIdentifier == backForwardListItem->itemID().processIdentifier)`
1223
1224         This would cause us to reuse the same process incorrectly. Our existing API test coverage
1225         did not catch this because our target HistoryItem usually has a SuspendedPage and we decide
1226         to use the SuspendedPage's process a few lines above in WebProcessPool::processForNavigationInternal().
1227
1228         * UIProcess/WebProcessPool.cpp:
1229         (WebKit::WebProcessPool::processForNavigationInternal):
1230
1231 2018-09-12  Alex Christensen  <achristensen@webkit.org>
1232
1233         Make IPC::SharedBufferDataReference a type that decodes into but does not inherit from IPC::DataReference
1234         https://bugs.webkit.org/show_bug.cgi?id=189519
1235
1236         Reviewed by Chris Dumez.
1237
1238         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1239         * NetworkProcess/NetworkResourceLoader.cpp:
1240         (WebKit::NetworkResourceLoader::bufferingTimerFired):
1241         (WebKit::NetworkResourceLoader::sendBuffer):
1242         * Platform/IPC/DataReference.cpp:
1243         (IPC::SharedBufferDataReference::encode const): Deleted.
1244         * Platform/IPC/DataReference.h:
1245         (IPC::SharedBufferDataReference::SharedBufferDataReference): Deleted.
1246         * Platform/IPC/HandleMessage.h:
1247         * Platform/IPC/SharedBufferDataReference.h: Added.
1248         (IPC::SharedBufferDataReference::SharedBufferDataReference):
1249         (IPC::SharedBufferDataReference::encode const):
1250         * Scripts/webkit/messages.py:
1251         * Shared/API/APIData.h:
1252         * StorageProcess/StorageProcess.messages.in:
1253         * UIProcess/WebPageProxy.messages.in:
1254         * UIProcess/WebURLSchemeTask.cpp:
1255         (WebKit::WebURLSchemeTask::didReceiveData):
1256         * WebKit.xcodeproj/project.pbxproj:
1257         * WebProcess/Network/WebLoaderStrategy.cpp:
1258         (WebKit::WebLoaderStrategy::storeDerivedDataToCache):
1259         * WebProcess/Network/WebResourceLoader.messages.in:
1260         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
1261         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
1262         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveBlobChunk):
1263         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1264         (WebKit::WebEditorClient::registerAttachmentIdentifier):
1265         * WebProcess/WebPage/WebPage.cpp:
1266         (WebKit::WebPage::getContentsAsMHTMLData):
1267         (WebKit::WebPage::getSelectionAsWebArchiveData):
1268         (WebKit::WebPage::getMainResourceDataOfFrame):
1269         (WebKit::WebPage::getResourceDataFromFrame):
1270         (WebKit::WebPage::getWebArchiveOfFrame):
1271         (WebKit::WebPage::drawPagesToPDF):
1272         * WebProcess/WebPage/WebPage.messages.in:
1273
1274 2018-09-11  Dean Jackson  <dino@apple.com>
1275
1276         Header parsing for experimental and internal debug features
1277         https://bugs.webkit.org/show_bug.cgi?id=189486
1278         <rdar://problem/44320618>
1279
1280         Reviewed by Tim Horton.
1281
1282         Provide key-based (string) access to experimental and internal features.
1283
1284         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
1285         * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb:
1286         * UIProcess/API/C/WKPreferences.cpp:
1287         (WKPreferencesSetExperimentalFeatureForKey):
1288         (WKPreferencesResetAllInternalDebugFeatures):
1289         (WKPreferencesSetInternalDebugFeatureForKey):
1290         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1291         * UIProcess/WebPreferences.h:
1292
1293 2018-09-10  Matt Rajca  <mrajca@apple.com>
1294
1295         Expose a few WebPlaybackControlsManager-driven PIP APIs to clients
1296         https://bugs.webkit.org/show_bug.cgi?id=189478
1297         <rdar://problem/44312650>
1298
1299         Reviewed by Eric Carlson.
1300
1301         This patch exposes APIs necessary to toggle PIP and query its status from clients of WKWebView.
1302         The existing PIP test has been updated to use the new APIs instead of simulating mouse clicks.
1303         I also increased the size of the video element in the test page so it gets picked up by the
1304         main content heuristics.
1305
1306         * UIProcess/API/Cocoa/WKWebView.mm:
1307         (-[WKWebView _updateMediaPlaybackControlsManager]): Create a media playback controls manager if necessary.
1308         (-[WKWebView _isPictureInPictureActive]): Return true if the "active" media element is in PIP.
1309         (-[WKWebView _togglePictureInPicture]): Toggle PIP on the "active" media element.
1310         (-[WKWebView _canTogglePictureInPicture]): Renamed from...
1311         (-[WKWebView _canTogglePictureInPictureForTesting]):
1312         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1313         * UIProcess/Cocoa/WebViewImpl.h:
1314         * UIProcess/Cocoa/WebViewImpl.mm:
1315         (WebKit::WebViewImpl::isPictureInPictureActive): Return true if the "active" media element is in PIP.
1316         (WebKit::WebViewImpl::togglePictureInPicture): Toggle PIP on the "active" media element.
1317         (WebKit::WebViewImpl::updateMediaPlaybackControlsManager): Let clients create a playback
1318          controls manager even when there is no Touch Bar present.
1319         (WebKit::WebViewImpl::updateMediaTouchBar): Extract some code into a helper method.
1320         (WebKit::WebViewImpl::canTogglePictureInPicture): Renamed from...
1321         (WebKit::WebViewImpl::canTogglePictureInPictureForTesting):
1322
1323 2018-09-12  Fujii Hironori  <Hironori.Fujii@sony.com>
1324
1325         [Win][Clang] error: non-constant-expression cannot be narrowed from type 'int' to 'SHORT'
1326         https://bugs.webkit.org/show_bug.cgi?id=189542
1327
1328         Reviewed by Alex Christensen.
1329
1330         * UIProcess/win/WebInspectorProxyWin.cpp:
1331         (WebKit::WebInspectorProxy::platformCreateFrontendPage): Narrowed initialWindowWidth and initialWindowHeight by using static_cast.
1332
1333 2018-09-12  Chris Dumez  <cdumez@apple.com>
1334
1335         Clean up SuspendedPageProxy
1336         https://bugs.webkit.org/show_bug.cgi?id=189517
1337
1338         Reviewed by Alex Christensen.
1339
1340         Clean up SuspendedPageProxy:
1341         1. SuspendedPageProxy does not need to be RefCounted. It is even dangerous given that WebPageProxy
1342            owns the SuspendedPageProxy and SuspendedPageProxy has a WebPageProxy& data member. We definitely
1343            do not want it to outlive its WebPageProxy.
1344         2. The SuspendedPageProxy destructor does not need to be virtual.
1345         3. Have WebBackForwardListItem keep a WeakPtr<SuspendedPageProxy> instead of a SuspendedPageProxy*.
1346            This is safer and avoid having to explicitly clear the pointer.
1347         4. m_finishedSuspending data member does not need a getter and is only needed if !LOG_DISABLED.
1348
1349         * Shared/WebBackForwardListItem.cpp:
1350         (WebKit::WebBackForwardListItem::setSuspendedPage):
1351         * Shared/WebBackForwardListItem.h:
1352         (WebKit::WebBackForwardListItem::suspendedPage const):
1353         * UIProcess/SuspendedPageProxy.cpp:
1354         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
1355         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
1356         (WebKit::SuspendedPageProxy::webProcessDidClose):
1357         (WebKit::SuspendedPageProxy::didFinishLoad):
1358         * UIProcess/SuspendedPageProxy.h:
1359         (WebKit::SuspendedPageProxy::process const):
1360         * UIProcess/WebPageProxy.cpp:
1361         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
1362         (WebKit::WebPageProxy::reattachToWebProcess):
1363         * UIProcess/WebPageProxy.h:
1364
1365 2018-09-12  Guillaume Emont  <guijemont@igalia.com>
1366
1367         Add IGNORE_WARNING_.* macros
1368         https://bugs.webkit.org/show_bug.cgi?id=188996
1369
1370         Reviewed by Michael Catanzaro.
1371
1372         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1373         (WebKit::NetworkDataTaskCocoa::statelessCookieStorage):
1374         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1375         (WebKit::NetworkProcess::platformSyncAllCookies):
1376         * PluginProcess/mac/PluginProcessMac.mm:
1377         (WebKit::beginModal):
1378         * PluginProcess/mac/PluginProcessShim.mm:
1379         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
1380         (WebKit::NetscapePluginModule::tryLoad):
1381         * Shared/ios/ChildProcessIOS.mm:
1382         (WebKit::ChildProcess::initializeSandbox):
1383         * Shared/mac/ChildProcessMac.mm:
1384         (WebKit::compileAndApplySandboxSlowCase):
1385         * Shared/mac/ColorSpaceData.mm:
1386         (WebKit::ColorSpaceData::decode):
1387         * Shared/mac/SandboxExtensionMac.mm:
1388         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
1389         * UIProcess/API/Cocoa/WKWebView.mm:
1390         (-[WKWebView _web_superAccessibilityAttributeValue:]):
1391         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1392         * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm:
1393         * UIProcess/API/glib/WebKitWebView.cpp:
1394         (webkitWebViewRunAsModal):
1395         * UIProcess/API/mac/WKView.mm:
1396         (-[WKView _web_superAccessibilityAttributeValue:]):
1397         * UIProcess/Cocoa/DownloadClient.mm:
1398         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
1399         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
1400         (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
1401         * UIProcess/Cocoa/NavigationState.mm:
1402         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1403         * UIProcess/Cocoa/UIDelegate.mm:
1404         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
1405         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1406         (WebKit::WebProcessPool::platformInitializeWebProcess):
1407         * UIProcess/Cocoa/WebViewImpl.mm:
1408         (-[WKTextListTouchBarViewController initWithWebViewImpl:]):
1409         (WebKit::WebViewImpl::updateWindowAndViewFrames):
1410         (WebKit::WebViewImpl::sendDragEndToPage):
1411         (WebKit::WebViewImpl::startDrag):
1412         (WebKit::WebViewImpl::characterIndexForPoint):
1413         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
1414         (WebKit::PluginProcessProxy::getPluginProcessSerialNumber):
1415         (WebKit::PluginProcessProxy::makePluginProcessTheFrontProcess):
1416         (WebKit::PluginProcessProxy::makeUIProcessTheFrontProcess):
1417         (WebKit::PluginProcessProxy::exitFullscreen):
1418         * UIProcess/ios/SmartMagnificationController.mm:
1419         * UIProcess/ios/WKGeolocationProviderIOS.mm:
1420         * UIProcess/ios/WKLegacyPDFView.mm:
1421         * UIProcess/ios/WKPDFPageNumberIndicator.mm:
1422         (-[WKPDFPageNumberIndicator _makeRoundedCorners]):
1423         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
1424         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1425         (-[WKFileUploadPanel _presentPopoverWithContentViewController:animated:]):
1426         * UIProcess/ios/forms/WKFormColorControl.mm:
1427         (-[WKColorPopover initWithView:]):
1428         * UIProcess/ios/forms/WKFormInputControl.mm:
1429         (-[WKDateTimePopover initWithView:datePickerMode:]):
1430         * UIProcess/ios/forms/WKFormPopover.h:
1431         * UIProcess/ios/forms/WKFormPopover.mm:
1432         * UIProcess/ios/forms/WKFormSelectPopover.mm:
1433         (-[WKSelectPopover initWithView:hasGroups:]):
1434         * UIProcess/mac/PageClientImplMac.mm:
1435         (WebKit::PageClientImpl::screenToRootView):
1436         (WebKit::PageClientImpl::rootViewToScreen):
1437         * UIProcess/mac/WKFullScreenWindowController.mm:
1438         (-[WKFullScreenWindowController enterFullScreen:]):
1439         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
1440         (-[WKFullScreenWindowController exitFullScreen]):
1441         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
1442         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
1443         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
1444         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
1445         (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):
1446         * UIProcess/mac/WKPrintingView.mm:
1447         (-[WKPrintingView _setAutodisplay:]):
1448         (-[WKPrintingView _drawPDFDocument:page:atPoint:]):
1449         (-[WKPrintingView _drawPreview:]):
1450         (-[WKPrintingView drawRect:]):
1451         * UIProcess/mac/WKTextInputWindowController.mm:
1452         (-[WKTextInputPanel _interpretKeyEvent:usingLegacyCocoaTextInput:string:]):
1453         (-[WKTextInputPanel _hasMarkedText]):
1454         * UIProcess/mac/WebPopupMenuProxyMac.mm:
1455         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
1456         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
1457         (WebKit::initializeEventRecord):
1458         (WebKit::NetscapePlugin::sendComplexTextInput):
1459         (WebKit::makeCGLPresentLayerOpaque):
1460         (WebKit::NetscapePlugin::nullEventTimerFired):
1461         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1462         (-[WKPDFPluginAccessibilityObject accessibilityFocusedUIElement]):
1463         (-[WKPDFLayerControllerDelegate writeItemsToPasteboard:withTypes:]):
1464         (WebKit::PDFPlugin::handleEditingCommand):
1465         (WebKit::PDFPlugin::setActiveAnnotation):
1466         (WebKit:: const):
1467         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.h:
1468         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
1469         (WebKit::PDFPluginChoiceAnnotation::createAnnotationElement):
1470         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h:
1471         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
1472         (WebKit::PDFPluginTextAnnotation::createAnnotationElement):
1473         * WebProcess/WebCoreSupport/WebAlternativeTextClient.h:
1474         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1475         (WebKit::convertImageToBitmap):
1476         (WebKit::WebDragClient::declareAndWriteDragImage):
1477         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1478         * WebProcess/WebPage/mac/WebPageMac.mm:
1479         (WebKit::drawPDFPage):
1480
1481 2018-09-11  Olivia Barnett  <obarnett@apple.com>
1482
1483         Implement the Web Share API for mac
1484         https://bugs.webkit.org/show_bug.cgi?id=189443
1485
1486         Reviewed by Tim Horton.
1487
1488         * Shared/WebPreferencesDefaultValues.h:
1489         * UIProcess/API/Cocoa/WKWebView.mm:
1490         (-[WKWebView shareSheetDidDismiss:]):
1491         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1492         * UIProcess/API/mac/WKView.mm:
1493         (-[WKView shareSheetDidDismiss:]):
1494         * UIProcess/Cocoa/WebViewImpl.h:
1495         * UIProcess/Cocoa/WebViewImpl.mm:
1496         (WebKit::WebViewImpl::showShareSheet):
1497         (WebKit::WebViewImpl::shareSheetDidDismiss):
1498         Implemented function for WKShareSheetDelegate.
1499
1500         * UIProcess/Cocoa/WKShareSheet.h:
1501         * UIProcess/Cocoa/WKShareSheet.mm:
1502         (-[WKShareSheet initWithView:initWithView:]):
1503         (-[WKShareSheet presentWithParameters:completionHandler:]):
1504         (-[WKShareSheet sharingServicePicker:didChooseSharingService:]):
1505         (-[WKShareSheet _cancel]):
1506         (-[WKShareSheet dismiss]):
1507         (-[WKShareSheet _dismissDisplayAnimated:]):
1508         (-[WKShareSheet invokeShareSheetWithResolution:]):
1509         (-[WKShareSheet initWithView:]): Deleted.
1510         Added mac platform checks and share sheet functionality.
1511
1512         * UIProcess/mac/PageClientImplMac.h:
1513         * UIProcess/mac/PageClientImplMac.mm:
1514         (WebKit::PageClientImpl::showShareSheet):
1515         Allows macos to invoke the system share sheet.
1516
1517 2018-09-07  Dean Jackson  <dino@apple.com>
1518
1519         Add and expose Internal features from WebKit
1520         https://bugs.webkit.org/show_bug.cgi?id=189442
1521         <rdar://problem/44243404>
1522
1523         Reviewed by Simon Fraser.
1524
1525         Experimental features have become a mess. People are using them for
1526         anything that they want to be easily toggled from a host app (e.g.
1527         Safari), which means the user-facing menu has become large and
1528         confusing.
1529
1530         Introduce the idea of Internal features, that will be exposed in a way
1531         that end-users are not expected to ever see (unless they really want
1532         to).
1533
1534         * CMakeLists.txt: Add new files.
1535         * Sources.txt:
1536         * SourcesCocoa.txt:
1537         * WebKit.xcodeproj/project.pbxproj:
1538
1539         * DerivedSources.make: Add new generated files.
1540         * Scripts/GeneratePreferences.rb: Generate the preferences stuff for Internal Debug features.
1541         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
1542         * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb: Added.
1543
1544         * Shared/API/APIObject.h: New API object for InternalDebugFeature.
1545         * Shared/Cocoa/APIObject.mm:
1546         (API::Object::newObject):
1547
1548         * Shared/WebPreferences.yaml: Change some of the existing experimental features to "internal".
1549
1550         * UIProcess/API/APIInternalDebugFeature.cpp: New API type - just like APIExperimentalFeature.
1551         (API::InternalDebugFeature::create):
1552         (API::InternalDebugFeature::InternalDebugFeature):
1553         (API::InternalDebugFeature::~InternalDebugFeature):
1554         * UIProcess/API/APIInternalDebugFeature.h:
1555         * UIProcess/API/C/WKAPICast.h:
1556
1557         * UIProcess/API/Cocoa/WKPreferences.mm: Change the naming of the experimental feature API so that it
1558         won't clash with internal debug features. We can remove the old API once Safari has adopted.
1559         (+[WKPreferences _internalDebugFeatures]):
1560         (-[WKPreferences _isEnabledForInternalDebugFeature:]):
1561         (-[WKPreferences _setEnabled:forInternalDebugFeature:]):
1562         (-[WKPreferences _isEnabledForFeature:]):
1563         (-[WKPreferences _setEnabled:forFeature:]):
1564         (-[WKPreferences _isEnabledForExperimentalFeature:]):
1565         (-[WKPreferences _setEnabled:forExperimentalFeature:]):
1566         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1567
1568         * UIProcess/API/Cocoa/_WKInternalDebugFeature.h: New object - same as _WKExperimentalFeature.
1569         * UIProcess/API/Cocoa/_WKInternalDebugFeature.mm:
1570         (-[_WKInternalDebugFeature dealloc]):
1571         (-[_WKInternalDebugFeature description]):
1572         (-[_WKInternalDebugFeature name]):
1573         (-[_WKInternalDebugFeature key]):
1574         (-[_WKInternalDebugFeature details]):
1575         (-[_WKInternalDebugFeature defaultValue]):
1576         (-[_WKInternalDebugFeature isHidden]):
1577         (-[_WKInternalDebugFeature _apiObject]):
1578         * UIProcess/API/Cocoa/_WKInternalDebugFeatureInternal.h:
1579
1580         * UIProcess/WebPreferences.cpp: Add support for Internal Debug features.
1581         (WebKit::WebPreferences::updateBoolValueForInternalDebugFeatureKey):
1582         (WebKit::WebPreferences::updateBoolValueForExperimentalFeatureKey):
1583         * UIProcess/WebPreferences.h:
1584
1585         * UIProcess/WebProcessPool.cpp: Change a comment now that it is an internal feature.
1586         (WebKit::WebProcessPool::createWebPage):
1587
1588 2018-09-11  Eric Carlson  <eric.carlson@apple.com>
1589
1590         WebPage::close should clear UserMediaPermissionRequestManager
1591         https://bugs.webkit.org/show_bug.cgi?id=189369
1592         <rdar://problem/44196724>
1593
1594         Reviewed by Youenn Fablet.
1595
1596         * WebProcess/WebPage/WebPage.cpp:
1597         (WebKit::WebPage::close): Clear m_userMediaPermissionRequestManager.
1598
1599 2018-09-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1600
1601         [macOS] [WK2] Support changing foreground colors via color panel
1602         https://bugs.webkit.org/show_bug.cgi?id=189382
1603         <rdar://problem/44227311>
1604
1605         Reviewed by Ryosuke Niwa.
1606
1607         Adds support for changing font color in a richly editable element in WebKit2 via NSColorPanel. See below for
1608         more detail, as well as the WebCore ChangeLog.
1609
1610         * UIProcess/API/Cocoa/WKWebView.mm:
1611         (-[WKWebView changeColor:]):
1612
1613         Implement this selector; AppKit calls into this when changing font color using NSColorPanel.
1614
1615         * UIProcess/Cocoa/WebViewImpl.h:
1616         * UIProcess/Cocoa/WebViewImpl.mm:
1617         (WebKit::WebViewImpl::changeFontColorFromSender):
1618
1619         Creates and populates new FontAttributeChanges, with only the foreground color determined by asking the sender
1620         object for its -color.
1621
1622         * WebProcess/WebPage/mac/WebPageMac.mm:
1623
1624         Use the relevant EditAction for the incoming FontAttributeChanges, instead of always specifying
1625         EditAction::ChangeAttributes.
1626
1627         (WebKit::WebPage::changeFontAttributes):
1628
1629 2018-09-11  Myles C. Maxfield  <mmaxfield@apple.com>
1630
1631         Crash under PlatformPopupMenuData::encode when interacting with a select menu that has variable fonts
1632         https://bugs.webkit.org/show_bug.cgi?id=188008
1633
1634         Reviewed by Alex Christensen.
1635
1636         This patch is a follow-up to https://bugs.webkit.org/show_bug.cgi?id=180307.
1637         Variable fonts have CFDictionaries with non-string keys. We need to support that in our IPC code.
1638
1639         * Shared/cf/ArgumentCodersCF.cpp:
1640         (IPC::encode):
1641         (IPC::decode):
1642
1643 2018-09-11  Adrian Perez de Castro  <aperez@igalia.com>
1644
1645         [WPE][GTK] API documentation is unclear about how to modify requests before sending them
1646         https://bugs.webkit.org/show_bug.cgi?id=189505
1647
1648         Reviewed by Michael Catanzaro.
1649
1650         Add notes to the API documentation to make explicit where modification
1651         of WebKitURIRequest instances affects the request data sent over the
1652         network.
1653
1654         * UIProcess/API/glib/WebKitNavigationAction.cpp: Clarify that
1655         modifications to the associated WebKitURIRequest do not affect the
1656         actual request. Point to WebKitPage::send-request instead.
1657         * UIProcess/API/glib/WebKitResponsePolicyDecision.cpp: Ditto.
1658         * UIProcess/API/glib/WebKitWebView.cpp:
1659         (webkit_web_view_class_init): Ditto for the description of the
1660         WebKitWebView::decide-policy signal. Also fix the syntax of example.
1661         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
1662         (webkit_web_page_class_init): Indicate that modifications to the
1663         WebKitURIRequest will change the actual network request data.
1664
1665 2018-09-11  Michael Catanzaro  <mcatanzaro@igalia.com>
1666
1667         Unreviewed, attempt to fix Apple builds after r235903
1668         https://bugs.webkit.org/show_bug.cgi?id=188872
1669
1670         If it really needs to be inlined, it will need to move to the header....
1671
1672         * UIProcess/WebPageProxy.cpp:
1673         (WebKit::WebPageProxy::pageClient const):
1674
1675 2018-09-11  Michael Catanzaro  <mcatanzaro@igalia.com>
1676
1677         Unreviewed, fix build after r235903
1678         https://bugs.webkit.org/show_bug.cgi?id=188872
1679
1680         This broke all ports except GTK. Need to add a missing header.
1681
1682         * UIProcess/PageClient.h:
1683
1684 2018-09-11  Pablo Saavedra  <psaavedra@igalia.com>
1685
1686         Add missing #if ENABLE(VIDEO) WebProcess/FullScreen/WebFullScreenManager.cpp
1687         https://bugs.webkit.org/show_bug.cgi?id=189506
1688
1689         Reviewed by Tim Horton.
1690
1691         m_pipStandbyElement is only defined in
1692         WebKit/WebProcess/FullScreen/WebFullScreenManager.h
1693         only when ENABLE(VIDEO) (see
1694         https://bugs.webkit.org/show_bug.cgi?id=181338)
1695
1696         * WebProcess/FullScreen/WebFullScreenManager.cpp:
1697         (WebKit::WebFullScreenManager::setPIPStandbyElement):
1698
1699 2018-09-11  Michael Catanzaro  <mcatanzaro@igalia.com>
1700
1701         WebPageProxy should hold a WeakPtr to its PageClient
1702         https://bugs.webkit.org/show_bug.cgi?id=188872
1703
1704         Reviewed by Ryosuke Niwa.
1705
1706         This ensures the PageClient reference is always valid when used.
1707
1708         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1709         (WebKit::WebPageProxy::startDrag):
1710         (WebKit::WebPageProxy::setDragCaretRect):
1711         * UIProcess/PageClient.h:
1712         * UIProcess/WebPageProxy.cpp:
1713         (WebKit::PageClientProtector::PageClientProtector):
1714         (WebKit::PageClientProtector::~PageClientProtector):
1715         (WebKit::WebPageProxy::WebPageProxy):
1716         (WebKit::m_resetRecentCrashCountTimer):
1717         (WebKit::WebPageProxy::pageClient const):
1718         (WebKit::WebPageProxy::reattachToWebProcess):
1719         (WebKit::WebPageProxy::initializeWebPage):
1720         (WebKit::WebPageProxy::close):
1721         (WebKit::WebPageProxy::didChangeBackForwardList):
1722         (WebKit::WebPageProxy::willGoToBackForwardListItem):
1723         (WebKit::WebPageProxy::shouldKeepCurrentBackForwardListItemInList):
1724         (WebKit::WebPageProxy::setViewNeedsDisplay):
1725         (WebKit::WebPageProxy::requestScroll):
1726         (WebKit::WebPageProxy::viewScrollPosition const):
1727         (WebKit::WebPageProxy::updateActivityState):
1728         (WebKit::WebPageProxy::activityStateDidChange):
1729         (WebKit::WebPageProxy::viewDidEnterWindow):
1730         (WebKit::WebPageProxy::dispatchActivityStateChange):
1731         (WebKit::WebPageProxy::layerHostingModeDidChange):
1732         (WebKit::WebPageProxy::viewSize const):
1733         (WebKit::WebPageProxy::startDrag):
1734         (WebKit::WebPageProxy::didPerformDragOperation):
1735         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
1736         (WebKit::WebPageProxy::findPlugin):
1737         (WebKit::WebPageProxy::handleTouchEventSynchronously):
1738         (WebKit::WebPageProxy::handleTouchEvent):
1739         (WebKit::WebPageProxy::preferencesDidChange):
1740         (WebKit::WebPageProxy::didCreateMainFrame):
1741         (WebKit::WebPageProxy::didCreateSubframe):
1742         (WebKit::WebPageProxy::didStartProgress):
1743         (WebKit::WebPageProxy::didChangeProgress):
1744         (WebKit::WebPageProxy::didFinishProgress):
1745         (WebKit::WebPageProxy::didDestroyNavigation):
1746         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
1747         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
1748         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
1749         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
1750         (WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
1751         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
1752         (WebKit::WebPageProxy::didCommitLoadForFrame):
1753         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
1754         (WebKit::WebPageProxy::didFinishLoadForFrame):
1755         (WebKit::WebPageProxy::didFailLoadForFrame):
1756         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
1757         (WebKit::WebPageProxy::didReceiveTitleForFrame):
1758         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
1759         (WebKit::WebPageProxy::didReachLayoutMilestone):
1760         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
1761         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
1762         (WebKit::WebPageProxy::frameDidBecomeFrameSet):
1763         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1764         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1765         (WebKit::WebPageProxy::decidePolicyForResponse):
1766         (WebKit::WebPageProxy::unableToImplementPolicy):
1767         (WebKit::WebPageProxy::didNavigateWithNavigationData):
1768         (WebKit::WebPageProxy::didPerformClientRedirect):
1769         (WebKit::WebPageProxy::didPerformServerRedirect):
1770         (WebKit::WebPageProxy::didUpdateHistoryTitle):
1771         (WebKit::WebPageProxy::closePage):
1772         (WebKit::WebPageProxy::setWindowFrame):
1773         (WebKit::WebPageProxy::getWindowFrame):
1774         (WebKit::WebPageProxy::getWindowFrameWithCallback):
1775         (WebKit::WebPageProxy::screenToRootView):
1776         (WebKit::WebPageProxy::rootViewToScreen):
1777         (WebKit::WebPageProxy::syncRootViewToScreen):
1778         (WebKit::WebPageProxy::accessibilityScreenToRootView):
1779         (WebKit::WebPageProxy::rootViewToAccessibilityScreen):
1780         (WebKit::WebPageProxy::didChangeViewportProperties):
1781         (WebKit::WebPageProxy::runOpenPanel):
1782         (WebKit::WebPageProxy::showShareSheet):
1783         (WebKit::WebPageProxy::handleDownloadRequest):
1784         (WebKit::WebPageProxy::didChangeContentSize):
1785         (WebKit::WebPageProxy::showColorPicker):
1786         (WebKit::WebPageProxy::showDataListSuggestions):
1787         (WebKit::WebPageProxy::compositionWasCanceled):
1788         (WebKit::WebPageProxy::registerInsertionUndoGrouping):
1789         (WebKit::WebPageProxy::canUndoRedo):
1790         (WebKit::WebPageProxy::executeUndoRedo):
1791         (WebKit::WebPageProxy::clearAllEditCommands):
1792         (WebKit::WebPageProxy::setTextIndicator):
1793         (WebKit::WebPageProxy::clearTextIndicator):
1794         (WebKit::WebPageProxy::setTextIndicatorAnimationProgress):
1795         (WebKit::WebPageProxy::showPopupMenu):
1796         (WebKit::WebPageProxy::showContextMenu):
1797         (WebKit::WebPageProxy::registerEditCommand):
1798         (WebKit::WebPageProxy::canUndo):
1799         (WebKit::WebPageProxy::canRedo):
1800         (WebKit::WebPageProxy::setToolTip):
1801         (WebKit::WebPageProxy::setCursor):
1802         (WebKit::WebPageProxy::setCursorHiddenUntilMouseMoves):
1803         (WebKit::WebPageProxy::didReceiveEvent):
1804         (WebKit::WebPageProxy::resetState):
1805         (WebKit::WebPageProxy::resetStateAfterProcessExited):
1806         (WebKit::WebPageProxy::creationParameters):
1807         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
1808         (WebKit::WebPageProxy::exitAcceleratedCompositingMode):
1809         (WebKit::WebPageProxy::updateAcceleratedCompositingMode):
1810         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
1811         (WebKit::WebPageProxy::recommendedScrollbarStyleDidChange):
1812         (WebKit::WebPageProxy::didChangeScrollOffsetPinningForMainFrame):
1813         (WebKit::WebPageProxy::didFinishLoadingDataForCustomContentProvider):
1814         (WebKit::WebPageProxy::updateBackingStoreDiscardableState):
1815         (WebKit::WebPageProxy::showCorrectionPanel):
1816         (WebKit::WebPageProxy::dismissCorrectionPanel):
1817         (WebKit::WebPageProxy::dismissCorrectionPanelSoon):
1818         (WebKit::WebPageProxy::recordAutocorrectionResponse):
1819         (WebKit::WebPageProxy::useDarkAppearance const):
1820         (WebKit::WebPageProxy::showDictationAlternativeUI):
1821         (WebKit::WebPageProxy::removeDictationAlternatives):
1822         (WebKit::WebPageProxy::dictationAlternatives):
1823         (WebKit::WebPageProxy::setEditableElementIsFocused):
1824         (WebKit::WebPageProxy::takeViewSnapshot):
1825         (WebKit::WebPageProxy::wrapCryptoKey):
1826         (WebKit::WebPageProxy::unwrapCryptoKey):
1827         (WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
1828         (WebKit::WebPageProxy::navigationGestureDidBegin):
1829         (WebKit::WebPageProxy::navigationGestureWillEnd):
1830         (WebKit::WebPageProxy::navigationGestureDidEnd):
1831         (WebKit::WebPageProxy::willRecordNavigationSnapshot):
1832         (WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved):
1833         (WebKit::WebPageProxy::isPlayingMediaDidChange):
1834         (WebKit::WebPageProxy::videoControlsManagerDidChange):
1835         (WebKit::WebPageProxy::handleControlledElementIDResponse const):
1836         (WebKit::WebPageProxy::didPerformImmediateActionHitTest):
1837         (WebKit::WebPageProxy::immediateActionAnimationControllerForHitTestResult):
1838         (WebKit::WebPageProxy::didHandleAcceptedCandidate):
1839         (WebKit::WebPageProxy::addPlaybackTargetPickerClient):
1840         (WebKit::WebPageProxy::removePlaybackTargetPickerClient):
1841         (WebKit::WebPageProxy::showPlaybackTargetPicker):
1842         (WebKit::WebPageProxy::playbackTargetPickerClientStateDidChange):
1843         (WebKit::WebPageProxy::setMockMediaPlaybackTargetPickerEnabled):
1844         (WebKit::WebPageProxy::setMockMediaPlaybackTargetPickerState):
1845         (WebKit::WebPageProxy::didChangeBackgroundColor):
1846         (WebKit::WebPageProxy::didRestoreScrollPosition):
1847         (WebKit::WebPageProxy::userInterfaceLayoutDirection):
1848         (WebKit::WebPageProxy::didInsertAttachment):
1849         (WebKit::WebPageProxy::didRemoveAttachment):
1850         * UIProcess/WebPageProxy.h:
1851         * UIProcess/gstreamer/WebPageProxyGStreamer.cpp:
1852         (WebKit::WebPageProxy::requestInstallMissingMediaPlugins):
1853         * UIProcess/gtk/WebPageProxyGtk.cpp:
1854         (WebKit::WebPageProxy::viewWidget):
1855         (WebKit::WebPageProxy::editorStateChanged):
1856         * UIProcess/ios/WebPageProxyIOS.mm:
1857         (WebKit::WebPageProxy::computeCustomFixedPositionRect const):
1858         (WebKit::WebPageProxy::overflowScrollViewWillStartPanGesture):
1859         (WebKit::WebPageProxy::overflowScrollViewDidScroll):
1860         (WebKit::WebPageProxy::overflowScrollWillStartScroll):
1861         (WebKit::WebPageProxy::overflowScrollDidEndScroll):
1862         (WebKit::WebPageProxy::didCommitLayerTree):
1863         (WebKit::WebPageProxy::layerTreeCommitComplete):
1864         (WebKit::WebPageProxy::didReceivePositionInformation):
1865         (WebKit::WebPageProxy::saveImageToLibrary):
1866         (WebKit::WebPageProxy::interpretKeyEvent):
1867         (WebKit::WebPageProxy::registerWebProcessAccessibilityToken):
1868         (WebKit::WebPageProxy::couldNotRestorePageState):
1869         (WebKit::WebPageProxy::restorePageState):
1870         (WebKit::WebPageProxy::restorePageCenterAndScale):
1871         (WebKit::WebPageProxy::didGetTapHighlightGeometries):
1872         (WebKit::WebPageProxy::startAssistingNode):
1873         (WebKit::WebPageProxy::stopAssistingNode):
1874         (WebKit::WebPageProxy::showInspectorHighlight):
1875         (WebKit::WebPageProxy::hideInspectorHighlight):
1876         (WebKit::WebPageProxy::showInspectorIndication):
1877         (WebKit::WebPageProxy::hideInspectorIndication):
1878         (WebKit::WebPageProxy::enableInspectorNodeSearch):
1879         (WebKit::WebPageProxy::disableInspectorNodeSearch):
1880         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
1881         (WebKit::WebPageProxy::showPlaybackTargetPicker):
1882         (WebKit::WebPageProxy::commitPotentialTapFailed):
1883         (WebKit::WebPageProxy::didNotHandleTapAsClick):
1884         (WebKit::WebPageProxy::didCompleteSyntheticClick):
1885         (WebKit::WebPageProxy::disableDoubleTapGesturesDuringTapIfNecessary):
1886         (WebKit::WebPageProxy::editorStateChanged):
1887         (WebKit::WebPageProxy::showValidationMessage):
1888         (WebKit::WebPageProxy::didHandleStartDataInteractionRequest):
1889         (WebKit::WebPageProxy::didHandleAdditionalDragItemsRequest):
1890         (WebKit::WebPageProxy::didConcludeEditDataInteraction):
1891         (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame):
1892         * UIProcess/mac/WebPageProxyMac.mm:
1893         (WebKit::WebPageProxy::windowAndViewFramesChanged):
1894         (WebKit::WebPageProxy::insertDictatedTextAsync):
1895         (WebKit::WebPageProxy::setPromisedDataForImage):
1896         (WebKit::WebPageProxy::didPerformDictionaryLookup):
1897         (WebKit::WebPageProxy::registerWebProcessAccessibilityToken):
1898         (WebKit::WebPageProxy::makeFirstResponder):
1899         (WebKit::WebPageProxy::assistiveTechnologyMakeFirstResponder):
1900         (WebKit::WebPageProxy::colorSpace):
1901         (WebKit::WebPageProxy::pluginFocusOrWindowFocusChanged):
1902         (WebKit::WebPageProxy::setPluginComplexTextInputState):
1903         (WebKit::WebPageProxy::executeSavedCommandBySelector):
1904         (WebKit::WebPageProxy::intrinsicContentSizeDidChange):
1905         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
1906         (WebKit::WebPageProxy::acceleratedCompositingRootLayer const):
1907         (WebKit::WebPageProxy::showPDFContextMenu):
1908         (WebKit::WebPageProxy::showTelephoneNumberMenu):
1909         (WebKit::WebPageProxy::boundsOfLayerInLayerBackedWindowCoordinates const):
1910         (WebKit::WebPageProxy::editorStateChanged):
1911         (WebKit::WebPageProxy::startWindowDrag):
1912         (WebKit::WebPageProxy::platformWindow):
1913         (WebKit::WebPageProxy::rootViewToWindow):
1914         (WebKit::WebPageProxy::showValidationMessage):
1915         (WebKit::WebPageProxy::inspectorAttachmentView):
1916         (WebKit::WebPageProxy::remoteObjectRegistry):
1917         * UIProcess/win/WebPageProxyWin.cpp:
1918         (WebKit::WebPageProxy::viewWidget):
1919         * UIProcess/wpe/WebPageProxyWPE.cpp:
1920         (WebKit::WebPageProxy::viewBackend):
1921
1922 2018-09-11  Chris Dumez  <cdumez@apple.com>
1923
1924         Regression(PSON): "Swipe back" snapshot is missing when navigating back cross-process
1925         https://bugs.webkit.org/show_bug.cgi?id=189482
1926         <rdar://problem/44317222>
1927
1928         Reviewed by Geoffrey Garen.
1929
1930         The issue was that when we swap process on navigation, we:
1931         1. Call processDidTerminate() which calls resetState() and clears the displayed content
1932         2. Reattach the WebPageProxy to a new WebProcess
1933         3. Trigger the navigation
1934         4. Take the navigation snapshot
1935
1936         When the navigation snapshot occurs at step 4, the view is already blank in the case of
1937         process swap. To avoid the issue, we take the navigation snapshot earlier, before calling
1938         processDidTerminate() and we suppress the next navigation snapshot as it would be blank.
1939
1940         At some point, we will likely want to display the previous' WebProcess content longer,
1941         until the new WebProcess has something interesting to display. Once this is implemented,
1942         we'll likely be able to drop the early snapshotting logic.
1943
1944         * UIProcess/WebPageProxy.cpp:
1945         (WebKit::WebPageProxy::recordAutomaticNavigationSnapshot):
1946         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1947         (WebKit::WebPageProxy::restoreFromSessionState):
1948         (WebKit::WebPageProxy::didCommitLoadForFrame):
1949         * UIProcess/WebPageProxy.h:
1950         (WebKit::WebPageProxy::suppressNextAutomaticNavigationSnapshot):
1951
1952 2018-09-11  Woodrow Wang  <woodrow_wang@apple.com>
1953
1954         Add Web API Statistics Collection
1955         https://bugs.webkit.org/show_bug.cgi?id=187773
1956         <rdar://problem/44155162>
1957
1958         Reviewed by Brent Fulgham.
1959
1960         * Shared/WebCoreArgumentCoders.cpp:
1961         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
1962         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
1963         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
1964
1965 == Rolled over to ChangeLog-2018-09-11 ==