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