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