3cec09266161ba718a6bcaaa391dd258221fdc3a
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-09-13  Chris Dumez  <cdumez@apple.com>
2
3         ProcessSwap.BackWithoutSuspendedPage API test hits assertion under WebPageProxy::didCreateMainFrame()
4         https://bugs.webkit.org/show_bug.cgi?id=189599
5
6         Reviewed by Geoffrey Garen.
7
8         The code in WebPageProxy::reattachToWebProcess() was re-initializing m_mainFrame unconditionally in case
9         of a HistoryNavigation. The reason we need to initialize m_mainFrame in reattachToWebProcess() is if the
10         process we're reattaching to already has a WebPage (with a main frame), in which case
11         WebPageProxy::didCreateMainFrame() would not get called to initialize WebPageProxy::m_mainFrame.
12
13         The process we're reattaching to can be in such a state only if it comes from a SuspendedPageProxy (we
14         detached the WebProcessProxy from the WebPageProxy but kept the WebPage in the "suspended" WebProcess).
15         It is true that we're only reattaching to a SuspendedPageProxy's process in the event of history
16         navigations. However, it is not true that all history navigations will use a SuspendedPageProxy's process.
17         For example, no SuspendedPageProxy may be available for the history navigation because the history
18         was restored to a new view from disk, or because the WebBackForwardListItem no longer has a
19         SuspendedPageProxy (we currently only keep a single SuspendedPageProxy for the last HistoryItem).
20
21         Therefore, unconditionally initializating m_mainFrame in reattachToWebProcess() for history navigations
22         is incorrect and we should instead check if we're reattaching to a SuspendedPage's process.
23
24         Change is covered by ProcessSwap.BackWithoutSuspendedPage API test which is no longer crashes and
25         existing Back/Forward PSON API tests which are still passing.
26
27         * UIProcess/WebPageProxy.cpp:
28         (WebKit::WebPageProxy::reattachToWebProcess):
29         (WebKit::WebPageProxy::continueNavigationInNewProcess):
30         * UIProcess/WebPageProxy.h:
31
32 2018-09-13  Chris Dumez  <cdumez@apple.com>
33
34         Add release logging to help debug PSON issues
35         https://bugs.webkit.org/show_bug.cgi?id=189562
36
37         Reviewed by Ryosuke Niwa.
38
39         Add release logging to help debug issues related to process swap on navigation.
40
41         * UIProcess/WebPageProxy.cpp:
42         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
43         * UIProcess/WebProcessPool.cpp:
44         (WebKit::WebProcessPool::processForNavigation):
45         (WebKit::WebProcessPool::processForNavigationInternal):
46         * UIProcess/WebProcessPool.h:
47
48 2018-09-13  Chris Dumez  <cdumez@apple.com>
49
50         Add null check for drawing area in WebPage::didCompletePageTransition() after r235867
51         https://bugs.webkit.org/show_bug.cgi?id=189587
52
53         Reviewed by Geoffrey Garen.
54
55         Add null check for drawing area in WebPage::didCompletePageTransition() after r235867
56         as this is causing crashes on the bots.
57
58         * WebProcess/WebPage/WebPage.cpp:
59         (WebKit::WebPage::didCompletePageTransition):
60
61 2018-09-13  Ryan Haddad  <ryanhaddad@apple.com>
62
63         Unreviewed, rolling out r235953.
64
65         Caused layout test crashes under GuardMalloc.
66
67         Reverted changeset:
68
69         "Make GraphicsLayers ref-counted, so their tree can persist
70         when disconnected from RenderLayerBackings"
71         https://bugs.webkit.org/show_bug.cgi?id=189521
72         https://trac.webkit.org/changeset/235953
73
74 2018-09-13  Carlos Garcia Campos  <cgarcia@igalia.com>
75
76         [GTK][WPE] Allow to run script dialogs asynchronously in the UI process
77         https://bugs.webkit.org/show_bug.cgi?id=189544
78
79         Reviewed by Michael Catanzaro.
80
81         Script dialogs are sync in the WebProcess, but we don't need to block the UI process while they are running. Our
82         current API doesn't allow it, because it always expects the dialog to be closed in the signal handler. API
83         changes are backwards compatible.
84
85         * UIProcess/API/glib/WebKitScriptDialog.cpp:
86         (webkitScriptDialogCreate): Added to heap allocate a WebKitScriptDialog.
87         (webkitScriptDialogIsRunning): Common implementation here, a script dialog is considered to be running if it has
88         a competion handler pending.
89         (webkit_script_dialog_ref): WebKitScriptDialog is now refcounted.
90         (webkit_script_dialog_unref): Ditto.
91         (webkit_script_dialog_close): New method to notify that we are done with the dialog.
92         * UIProcess/API/glib/WebKitScriptDialogPrivate.h:
93         (_WebKitScriptDialog::_WebKitScriptDialog): Use a single constructor and keep the completion handler.
94         * UIProcess/API/glib/WebKitUIClient.cpp: Do not call the completion handler, pass it to the web view.
95         * UIProcess/API/glib/WebKitWebView.cpp:
96         (webkitWebViewDispose): Close the current script dialog if there's any.
97         (webkit_web_view_class_init): Document how to handle dialogs asynchronously.
98         (webkitWebViewRunJavaScriptAlert): Do not stack allocate the WebKitScriptDialog, create it with
99         webkitScriptDialogCreate() passing the completion handler.
100         (webkitWebViewRunJavaScriptConfirm): Ditto.
101         (webkitWebViewRunJavaScriptPrompt): Ditto.
102         (webkitWebViewRunJavaScriptBeforeUnloadConfirm): Ditto.
103         * UIProcess/API/glib/WebKitWebViewPrivate.h:
104         * UIProcess/API/gtk/WebKitScriptDialog.h:
105         * UIProcess/API/gtk/WebKitScriptDialogGtk.cpp:
106         (scriptDialogResponseCallback): Hnadle the response callback.
107         (webkitScriptDialogRun): Do not use gtk_dialog_run(), connect to response signal and show the dialogs instead.
108         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
109         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
110         * UIProcess/API/wpe/WebKitScriptDialogWPE.cpp:
111
112 2018-09-12  Dan Bernstein  <mitz@apple.com>
113
114         Update availability annotations to match the macOS and iOS SDKs in the Xcode 10 GM seed
115         https://bugs.webkit.org/show_bug.cgi?id=189561
116
117         Reviewed by Tim Horton.
118
119         Changed WK_MAC_TBA and WK_IOS_TBA to 10.14 and 12.0, respectively, in all declarations that
120         appear in the GM seed SDKs.
121
122         * Shared/API/Cocoa/_WKRenderingProgressEvents.h:
123         * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
124         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
125         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
126         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
127         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
128         * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
129         * UIProcess/API/Cocoa/WKViewPrivate.h:
130         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
131         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
132         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
133         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
134         * UIProcess/API/Cocoa/_WKAttachment.h:
135         * UIProcess/API/Cocoa/_WKAutomationDelegate.h:
136         * UIProcess/API/Cocoa/_WKAutomationSession.h:
137         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
138         * UIProcess/API/Cocoa/_WKFormInputSession.h:
139         * UIProcess/API/Cocoa/_WKInputDelegate.h:
140         * UIProcess/API/Cocoa/_WKLinkIconParameters.h:
141         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
142         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
143         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h:
144         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.h:
145         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h:
146         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
147
148 2018-09-12  Dan Bernstein  <mitz@apple.com>
149
150         [Cocoa] Complete support for Paste as Quotation
151         https://bugs.webkit.org/show_bug.cgi?id=189504
152
153         Reviewed by Wenson Hsieh.
154
155         * UIProcess/API/Cocoa/WKWebView.mm:
156         (-[WKWebView canPerformAction:withSender:]): Handle _pasteAsQuotation:. It’s not included
157           in FOR_EACH_WKCONTENTVIEW_ACTION, because it’s declared and implemented in the WKPrivate
158           category. If we add more actions in the category, it could make sense to fold them into
159           a new FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION.
160         (-[WKWebView targetForAction:withSender:]): Handle _pasteAsQuotation:.
161         (-[WKWebView _pasteAsQuotation:]): Send to the WebViewImpl or the WKContentView.
162         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declared a new _pasteAsQuotation: action.
163
164         * UIProcess/Cocoa/WebViewImpl.mm:
165         (WebKit::selectorExceptionMap): Added a custom mapping from the new selector to the
166           PasteAsQuotation command.
167
168         * UIProcess/ios/WKContentViewInteraction.h: Declare methods for the new action.
169         * UIProcess/ios/WKContentViewInteraction.mm:
170           Forward _pasteAsQuotation: to the WKWebView so that clients get a chance to override its
171           behavior.
172         (-[WKContentView _pasteAsQuotationForWebView:]): Send the command to the page.
173
174 2018-09-12  Sihui Liu  <sihui_liu@apple.com>
175
176         Move IndexedDB to Network Process
177         https://bugs.webkit.org/show_bug.cgi?id=189415
178
179         Reviewed by Geoffrey Garen.
180
181         We are going to eliminate storage process and move its functionality to network process. 
182         The reasons why we want to do this:
183         1. Lower resource usage of having an additional process for storage operations, especially
184         memory. Single storage process takes about 5MB memory on macOS.
185         2. Reduce latency of Service Workers. After enabling Service Workers, we've seen
186         regression in app launch. The launch time of storage process is partly attributed to this:
187         Service Workers delay page loading until receiving response from storage process.
188         3. We choose network process because UI process may have broader access in file system
189         that we don't want the storage operations to have.
190
191         This patch is the first piece towards the goal. It mainly moves indexedDB from storage process
192         to corresponding components of network process. Moving of Service Worker and stopping to 
193         launch storage process will be done in following patches.
194
195         We expect to see the higher cpu and memory usage of network process as it is taking more work,
196         but the overall gain in memory and latency after we completely remove storage process should be 
197         positive.
198
199
200         * CMakeLists.txt:
201         * DerivedSources.make:
202
203         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.cpp.
204         (WebKit::WebIDBConnectionToClient::create):
205         (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient):
206         (WebKit::WebIDBConnectionToClient::~WebIDBConnectionToClient):
207         (WebKit::WebIDBConnectionToClient::disconnectedFromWebProcess):
208         (WebKit::WebIDBConnectionToClient::messageSenderConnection):
209         (WebKit::WebIDBConnectionToClient::connectionToClient):
210         (WebKit::WebIDBConnectionToClient::didDeleteDatabase):
211         (WebKit::WebIDBConnectionToClient::didOpenDatabase):
212         (WebKit::WebIDBConnectionToClient::didAbortTransaction):
213         (WebKit::WebIDBConnectionToClient::didCommitTransaction):
214         (WebKit::WebIDBConnectionToClient::didCreateObjectStore):
215         (WebKit::WebIDBConnectionToClient::didDeleteObjectStore):
216         (WebKit::WebIDBConnectionToClient::didRenameObjectStore):
217         (WebKit::WebIDBConnectionToClient::didClearObjectStore):
218         (WebKit::WebIDBConnectionToClient::didCreateIndex):
219         (WebKit::WebIDBConnectionToClient::didDeleteIndex):
220         (WebKit::WebIDBConnectionToClient::didRenameIndex):
221         (WebKit::WebIDBConnectionToClient::didPutOrAdd):
222         (WebKit::WebIDBConnectionToClient::handleGetResult):
223         (WebKit::WebIDBConnectionToClient::didGetRecord):
224         (WebKit::WebIDBConnectionToClient::didGetAllRecords):
225         (WebKit::WebIDBConnectionToClient::didGetCount):
226         (WebKit::WebIDBConnectionToClient::didDeleteRecord):
227         (WebKit::WebIDBConnectionToClient::didOpenCursor):
228         (WebKit::WebIDBConnectionToClient::didIterateCursor):
229         (WebKit::WebIDBConnectionToClient::fireVersionChangeEvent):
230         (WebKit::WebIDBConnectionToClient::didStartTransaction):
231         (WebKit::WebIDBConnectionToClient::didCloseFromServer):
232         (WebKit::WebIDBConnectionToClient::notifyOpenDBRequestBlocked):
233         (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNames):
234         (WebKit::WebIDBConnectionToClient::deleteDatabase):
235         (WebKit::WebIDBConnectionToClient::openDatabase):
236         (WebKit::WebIDBConnectionToClient::abortTransaction):
237         (WebKit::WebIDBConnectionToClient::commitTransaction):
238         (WebKit::WebIDBConnectionToClient::didFinishHandlingVersionChangeTransaction):
239         (WebKit::WebIDBConnectionToClient::createObjectStore):
240         (WebKit::WebIDBConnectionToClient::deleteObjectStore):
241         (WebKit::WebIDBConnectionToClient::renameObjectStore):
242         (WebKit::WebIDBConnectionToClient::clearObjectStore):
243         (WebKit::WebIDBConnectionToClient::createIndex):
244         (WebKit::WebIDBConnectionToClient::deleteIndex):
245         (WebKit::WebIDBConnectionToClient::renameIndex):
246         (WebKit::WebIDBConnectionToClient::putOrAdd):
247         (WebKit::WebIDBConnectionToClient::getRecord):
248         (WebKit::WebIDBConnectionToClient::getAllRecords):
249         (WebKit::WebIDBConnectionToClient::getCount):
250         (WebKit::WebIDBConnectionToClient::deleteRecord):
251         (WebKit::WebIDBConnectionToClient::openCursor):
252         (WebKit::WebIDBConnectionToClient::iterateCursor):
253         (WebKit::WebIDBConnectionToClient::establishTransaction):
254         (WebKit::WebIDBConnectionToClient::databaseConnectionPendingClose):
255         (WebKit::WebIDBConnectionToClient::databaseConnectionClosed):
256         (WebKit::WebIDBConnectionToClient::abortOpenAndUpgradeNeeded):
257         (WebKit::WebIDBConnectionToClient::didFireVersionChangeEvent):
258         (WebKit::WebIDBConnectionToClient::openDBRequestCancelled):
259         (WebKit::WebIDBConnectionToClient::confirmDidCloseFromServer):
260         (WebKit::WebIDBConnectionToClient::getAllDatabaseNames):
261         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.h.
262         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.messages.in: Renamed from Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.messages.in.
263         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
264         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
265
266         Code moved from StorageToWebProcessConnection::didReceiveMessage.
267
268         (WebKit::NetworkConnectionToWebProcess::didClose):
269         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
270
271         Network process receives and stores sandbox extension of temporary files for later indexedDB
272         use.
273
274         (WebKit::generateIDBConnectionToServerIdentifier):
275         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
276         (WebKit::NetworkConnectionToWebProcess::removeIDBConnectionToServer):
277         * NetworkProcess/NetworkConnectionToWebProcess.h:
278         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
279         * NetworkProcess/NetworkProcess.cpp:
280         (WebKit::NetworkProcess::NetworkProcess):
281         (WebKit::NetworkProcess::initializeNetworkProcess):
282         (WebKit::NetworkProcess::addWebsiteDataStore):
283         (WebKit::NetworkProcess::fetchWebsiteData):
284         (WebKit::NetworkProcess::deleteWebsiteData):
285         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
286         (WebKit::NetworkProcess::idbServer):
287         (WebKit::NetworkProcess::ensurePathExists):
288         (WebKit::NetworkProcess::postStorageTask):
289         (WebKit::NetworkProcess::performNextStorageTask):
290         (WebKit::NetworkProcess::prepareForAccessToTemporaryFile):
291         (WebKit::NetworkProcess::accessToTemporaryFileComplete):
292         (WebKit::NetworkProcess::indexedDatabaseOrigins):
293         (WebKit::NetworkProcess::addIndexedDatabaseSession):
294         (WebKit::NetworkProcess::getSandboxExtensionsForBlobFiles):
295
296         Instead of asking UI process to grant sandbox extension to storage process, now network 
297         process just asks for sandbox extension fot itself.
298
299         (WebKit::NetworkProcess::didGetSandboxExtensionsForBlobFiles):
300         (WebKit::NetworkProcess::updateTemporaryFileSandboxExtensions):
301         (WebKit::NetworkProcess::grantSandboxExtensionsToStorageProcessForBlobs): Deleted.
302         (WebKit::NetworkProcess::didGrantSandboxExtensionsToStorageProcessForBlobs): Deleted.
303         * NetworkProcess/NetworkProcess.h:
304         (WebKit::NetworkProcess::queue):
305         * NetworkProcess/NetworkProcess.messages.in:
306         * NetworkProcess/NetworkProcessCreationParameters.cpp:
307         (WebKit::NetworkProcessCreationParameters::encode const):
308         (WebKit::NetworkProcessCreationParameters::decode):
309         * NetworkProcess/NetworkProcessCreationParameters.h:
310         * Shared/Storage/StorageProcessCreationParameters.cpp:
311         (WebKit::StorageProcessCreationParameters::encode const):
312         (WebKit::StorageProcessCreationParameters::decode):
313         * Shared/Storage/StorageProcessCreationParameters.h:
314         * Shared/WebsiteDataStoreParameters.cpp:
315         (WebKit::WebsiteDataStoreParameters::encode const):
316         (WebKit::WebsiteDataStoreParameters::decode):
317         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
318         * Shared/WebsiteDataStoreParameters.h:
319         * Sources.txt:
320         * StorageProcess/StorageProcess.cpp:
321         (WebKit::StorageProcess::initializeWebsiteDataStore):
322         (WebKit::StorageProcess::fetchWebsiteData):
323         (WebKit::StorageProcess::deleteWebsiteData):
324         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
325         (WebKit::StorageProcess::idbServer): Deleted.
326         (WebKit::StorageProcess::grantSandboxExtensionsForBlobs): Deleted.
327         (WebKit::StorageProcess::prepareForAccessToTemporaryFile): Deleted.
328         (WebKit::StorageProcess::accessToTemporaryFileComplete): Deleted.
329         (WebKit::StorageProcess::indexedDatabaseOrigins): Deleted.
330         (WebKit::StorageProcess::getSandboxExtensionsForBlobFiles): Deleted.
331         (WebKit::StorageProcess::didGetSandboxExtensionsForBlobFiles): Deleted.
332         * StorageProcess/StorageProcess.h:
333         (WebKit::StorageProcess::queue): Deleted.
334         * StorageProcess/StorageProcess.messages.in:
335         * StorageProcess/StorageToWebProcessConnection.cpp:
336         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
337         (WebKit::StorageToWebProcessConnection::didClose):
338         (WebKit::generateIDBConnectionToServerIdentifier): Deleted.
339         (WebKit::StorageToWebProcessConnection::establishIDBConnectionToServer): Deleted.
340         (WebKit::StorageToWebProcessConnection::removeIDBConnectionToServer): Deleted.
341         * StorageProcess/StorageToWebProcessConnection.h:
342         * StorageProcess/StorageToWebProcessConnection.messages.in:
343         * UIProcess/Network/NetworkProcessProxy.cpp:
344         (WebKit::NetworkProcessProxy::getSandboxExtensionsForBlobFiles):
345         (WebKit::NetworkProcessProxy::grantSandboxExtensionsToStorageProcessForBlobs): Deleted.
346         * UIProcess/Network/NetworkProcessProxy.h:
347         * UIProcess/Network/NetworkProcessProxy.messages.in:
348         * UIProcess/Storage/StorageProcessProxy.cpp:
349         (WebKit::StorageProcessProxy::getSandboxExtensionsForBlobFiles): Deleted.
350         * UIProcess/Storage/StorageProcessProxy.h:
351         * UIProcess/Storage/StorageProcessProxy.messages.in:
352         * UIProcess/WebProcessPool.cpp:
353         (WebKit::WebProcessPool::ensureNetworkProcess):
354         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
355         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
356         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
357         (WebKit::WebsiteDataStore::parameters):
358         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
359         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
360         (WebKit::WebsiteDataStore::fetchDataAndApply):
361         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
362         (WebKit::WebsiteDataStore::removeData):
363         (WebKit::WebsiteDataStore::storageProcessParameters):
364         (WebKit::WebsiteDataStore::parameters):
365         * WebKit.xcodeproj/project.pbxproj:
366         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
367         (WebKit::WebIDBConnectionToServer::WebIDBConnectionToServer):
368         (WebKit::WebIDBConnectionToServer::~WebIDBConnectionToServer):
369         (WebKit::WebIDBConnectionToServer::messageSenderConnection):
370         * WebProcess/Databases/WebDatabaseProvider.cpp:
371         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
372         * WebProcess/Network/NetworkProcessConnection.cpp:
373         (WebKit::NetworkProcessConnection::didReceiveMessage):
374         (WebKit::NetworkProcessConnection::didClose):
375         (WebKit::NetworkProcessConnection::idbConnectionToServerForSession):
376         * WebProcess/Network/NetworkProcessConnection.h:
377         (WebKit::NetworkProcessConnection::existingIDBConnectionToServerForIdentifier):
378         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
379         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
380
381         Code moved from WebToStorageProcessConnection::didReceiveMessage.
382
383         (WebKit::WebToStorageProcessConnection::didClose):
384         (WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession): Deleted.
385         * WebProcess/Storage/WebToStorageProcessConnection.h:
386         (WebKit::WebToStorageProcessConnection::existingIDBConnectionToServerForIdentifier): Deleted.
387         * WebProcess/WebProcess.cpp:
388         (WebKit::WebProcess::networkProcessConnectionClosed):
389         (WebKit::WebProcess::webToStorageProcessConnectionClosed):
390
391 2018-09-11  Simon Fraser  <simon.fraser@apple.com>
392
393         Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings
394         https://bugs.webkit.org/show_bug.cgi?id=189521
395
396         Reviewed by Tim Horton.
397
398         Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>.
399         
400         RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>.
401         
402         All the other changes are just to adapt to the new ownership patterns.
403         
404         I verified that no GraphicsLayers were leaked or abandoned after this change.
405
406         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
407         (WebKit::WebInspectorClient::~WebInspectorClient):
408         (WebKit::WebInspectorClient::showPaintRect):
409         (WebKit::WebInspectorClient::animationEndedForLayer):
410         * WebProcess/WebCoreSupport/WebInspectorClient.h:
411         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
412         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
413         (WebKit::RemoteLayerTreeContext::createGraphicsLayer):
414         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
415         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
416         (WebKit::RemoteLayerTreeDrawingArea::updateRootLayers):
417         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
418
419 2018-09-12  Chris Dumez  <cdumez@apple.com>
420
421         PSON: No process swap on back navigation after URL bar navigation
422         https://bugs.webkit.org/show_bug.cgi?id=189557
423         <rdar://problem/44353108>
424
425         Reviewed by Alex Christensen.
426
427         Our logic in WebProcessPool::processForNavigationInternal() was wrongly using
428         WebBackForwardList::currentItem() as source item of the navigation, instead of
429         using Navigation::fromItem(). In case of back navigation, by the time
430         processForNavigation() is called, the WebBackForwardList's currentItem has already
431         been updated to be the target item, via a Sync IPC from the WebProcess. As a result,
432         the source and target items would be the same in the following check:
433         ` if (currentItem->itemID().processIdentifier == backForwardListItem->itemID().processIdentifier)`
434
435         This would cause us to reuse the same process incorrectly. Our existing API test coverage
436         did not catch this because our target HistoryItem usually has a SuspendedPage and we decide
437         to use the SuspendedPage's process a few lines above in WebProcessPool::processForNavigationInternal().
438
439         * UIProcess/WebProcessPool.cpp:
440         (WebKit::WebProcessPool::processForNavigationInternal):
441
442 2018-09-12  Alex Christensen  <achristensen@webkit.org>
443
444         Make IPC::SharedBufferDataReference a type that decodes into but does not inherit from IPC::DataReference
445         https://bugs.webkit.org/show_bug.cgi?id=189519
446
447         Reviewed by Chris Dumez.
448
449         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
450         * NetworkProcess/NetworkResourceLoader.cpp:
451         (WebKit::NetworkResourceLoader::bufferingTimerFired):
452         (WebKit::NetworkResourceLoader::sendBuffer):
453         * Platform/IPC/DataReference.cpp:
454         (IPC::SharedBufferDataReference::encode const): Deleted.
455         * Platform/IPC/DataReference.h:
456         (IPC::SharedBufferDataReference::SharedBufferDataReference): Deleted.
457         * Platform/IPC/HandleMessage.h:
458         * Platform/IPC/SharedBufferDataReference.h: Added.
459         (IPC::SharedBufferDataReference::SharedBufferDataReference):
460         (IPC::SharedBufferDataReference::encode const):
461         * Scripts/webkit/messages.py:
462         * Shared/API/APIData.h:
463         * StorageProcess/StorageProcess.messages.in:
464         * UIProcess/WebPageProxy.messages.in:
465         * UIProcess/WebURLSchemeTask.cpp:
466         (WebKit::WebURLSchemeTask::didReceiveData):
467         * WebKit.xcodeproj/project.pbxproj:
468         * WebProcess/Network/WebLoaderStrategy.cpp:
469         (WebKit::WebLoaderStrategy::storeDerivedDataToCache):
470         * WebProcess/Network/WebResourceLoader.messages.in:
471         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
472         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
473         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveBlobChunk):
474         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
475         (WebKit::WebEditorClient::registerAttachmentIdentifier):
476         * WebProcess/WebPage/WebPage.cpp:
477         (WebKit::WebPage::getContentsAsMHTMLData):
478         (WebKit::WebPage::getSelectionAsWebArchiveData):
479         (WebKit::WebPage::getMainResourceDataOfFrame):
480         (WebKit::WebPage::getResourceDataFromFrame):
481         (WebKit::WebPage::getWebArchiveOfFrame):
482         (WebKit::WebPage::drawPagesToPDF):
483         * WebProcess/WebPage/WebPage.messages.in:
484
485 2018-09-11  Dean Jackson  <dino@apple.com>
486
487         Header parsing for experimental and internal debug features
488         https://bugs.webkit.org/show_bug.cgi?id=189486
489         <rdar://problem/44320618>
490
491         Reviewed by Tim Horton.
492
493         Provide key-based (string) access to experimental and internal features.
494
495         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
496         * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb:
497         * UIProcess/API/C/WKPreferences.cpp:
498         (WKPreferencesSetExperimentalFeatureForKey):
499         (WKPreferencesResetAllInternalDebugFeatures):
500         (WKPreferencesSetInternalDebugFeatureForKey):
501         * UIProcess/API/C/WKPreferencesRefPrivate.h:
502         * UIProcess/WebPreferences.h:
503
504 2018-09-10  Matt Rajca  <mrajca@apple.com>
505
506         Expose a few WebPlaybackControlsManager-driven PIP APIs to clients
507         https://bugs.webkit.org/show_bug.cgi?id=189478
508         <rdar://problem/44312650>
509
510         Reviewed by Eric Carlson.
511
512         This patch exposes APIs necessary to toggle PIP and query its status from clients of WKWebView.
513         The existing PIP test has been updated to use the new APIs instead of simulating mouse clicks.
514         I also increased the size of the video element in the test page so it gets picked up by the
515         main content heuristics.
516
517         * UIProcess/API/Cocoa/WKWebView.mm:
518         (-[WKWebView _updateMediaPlaybackControlsManager]): Create a media playback controls manager if necessary.
519         (-[WKWebView _isPictureInPictureActive]): Return true if the "active" media element is in PIP.
520         (-[WKWebView _togglePictureInPicture]): Toggle PIP on the "active" media element.
521         (-[WKWebView _canTogglePictureInPicture]): Renamed from...
522         (-[WKWebView _canTogglePictureInPictureForTesting]):
523         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
524         * UIProcess/Cocoa/WebViewImpl.h:
525         * UIProcess/Cocoa/WebViewImpl.mm:
526         (WebKit::WebViewImpl::isPictureInPictureActive): Return true if the "active" media element is in PIP.
527         (WebKit::WebViewImpl::togglePictureInPicture): Toggle PIP on the "active" media element.
528         (WebKit::WebViewImpl::updateMediaPlaybackControlsManager): Let clients create a playback
529          controls manager even when there is no Touch Bar present.
530         (WebKit::WebViewImpl::updateMediaTouchBar): Extract some code into a helper method.
531         (WebKit::WebViewImpl::canTogglePictureInPicture): Renamed from...
532         (WebKit::WebViewImpl::canTogglePictureInPictureForTesting):
533
534 2018-09-12  Fujii Hironori  <Hironori.Fujii@sony.com>
535
536         [Win][Clang] error: non-constant-expression cannot be narrowed from type 'int' to 'SHORT'
537         https://bugs.webkit.org/show_bug.cgi?id=189542
538
539         Reviewed by Alex Christensen.
540
541         * UIProcess/win/WebInspectorProxyWin.cpp:
542         (WebKit::WebInspectorProxy::platformCreateFrontendPage): Narrowed initialWindowWidth and initialWindowHeight by using static_cast.
543
544 2018-09-12  Chris Dumez  <cdumez@apple.com>
545
546         Clean up SuspendedPageProxy
547         https://bugs.webkit.org/show_bug.cgi?id=189517
548
549         Reviewed by Alex Christensen.
550
551         Clean up SuspendedPageProxy:
552         1. SuspendedPageProxy does not need to be RefCounted. It is even dangerous given that WebPageProxy
553            owns the SuspendedPageProxy and SuspendedPageProxy has a WebPageProxy& data member. We definitely
554            do not want it to outlive its WebPageProxy.
555         2. The SuspendedPageProxy destructor does not need to be virtual.
556         3. Have WebBackForwardListItem keep a WeakPtr<SuspendedPageProxy> instead of a SuspendedPageProxy*.
557            This is safer and avoid having to explicitly clear the pointer.
558         4. m_finishedSuspending data member does not need a getter and is only needed if !LOG_DISABLED.
559
560         * Shared/WebBackForwardListItem.cpp:
561         (WebKit::WebBackForwardListItem::setSuspendedPage):
562         * Shared/WebBackForwardListItem.h:
563         (WebKit::WebBackForwardListItem::suspendedPage const):
564         * UIProcess/SuspendedPageProxy.cpp:
565         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
566         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
567         (WebKit::SuspendedPageProxy::webProcessDidClose):
568         (WebKit::SuspendedPageProxy::didFinishLoad):
569         * UIProcess/SuspendedPageProxy.h:
570         (WebKit::SuspendedPageProxy::process const):
571         * UIProcess/WebPageProxy.cpp:
572         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
573         (WebKit::WebPageProxy::reattachToWebProcess):
574         * UIProcess/WebPageProxy.h:
575
576 2018-09-12  Guillaume Emont  <guijemont@igalia.com>
577
578         Add IGNORE_WARNING_.* macros
579         https://bugs.webkit.org/show_bug.cgi?id=188996
580
581         Reviewed by Michael Catanzaro.
582
583         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
584         (WebKit::NetworkDataTaskCocoa::statelessCookieStorage):
585         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
586         (WebKit::NetworkProcess::platformSyncAllCookies):
587         * PluginProcess/mac/PluginProcessMac.mm:
588         (WebKit::beginModal):
589         * PluginProcess/mac/PluginProcessShim.mm:
590         * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
591         (WebKit::NetscapePluginModule::tryLoad):
592         * Shared/ios/ChildProcessIOS.mm:
593         (WebKit::ChildProcess::initializeSandbox):
594         * Shared/mac/ChildProcessMac.mm:
595         (WebKit::compileAndApplySandboxSlowCase):
596         * Shared/mac/ColorSpaceData.mm:
597         (WebKit::ColorSpaceData::decode):
598         * Shared/mac/SandboxExtensionMac.mm:
599         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
600         * UIProcess/API/Cocoa/WKWebView.mm:
601         (-[WKWebView _web_superAccessibilityAttributeValue:]):
602         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
603         * UIProcess/API/Cocoa/_WKWebsiteDataStore.mm:
604         * UIProcess/API/glib/WebKitWebView.cpp:
605         (webkitWebViewRunAsModal):
606         * UIProcess/API/mac/WKView.mm:
607         (-[WKView _web_superAccessibilityAttributeValue:]):
608         * UIProcess/Cocoa/DownloadClient.mm:
609         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
610         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
611         (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
612         * UIProcess/Cocoa/NavigationState.mm:
613         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
614         * UIProcess/Cocoa/UIDelegate.mm:
615         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
616         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
617         (WebKit::WebProcessPool::platformInitializeWebProcess):
618         * UIProcess/Cocoa/WebViewImpl.mm:
619         (-[WKTextListTouchBarViewController initWithWebViewImpl:]):
620         (WebKit::WebViewImpl::updateWindowAndViewFrames):
621         (WebKit::WebViewImpl::sendDragEndToPage):
622         (WebKit::WebViewImpl::startDrag):
623         (WebKit::WebViewImpl::characterIndexForPoint):
624         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
625         (WebKit::PluginProcessProxy::getPluginProcessSerialNumber):
626         (WebKit::PluginProcessProxy::makePluginProcessTheFrontProcess):
627         (WebKit::PluginProcessProxy::makeUIProcessTheFrontProcess):
628         (WebKit::PluginProcessProxy::exitFullscreen):
629         * UIProcess/ios/SmartMagnificationController.mm:
630         * UIProcess/ios/WKGeolocationProviderIOS.mm:
631         * UIProcess/ios/WKLegacyPDFView.mm:
632         * UIProcess/ios/WKPDFPageNumberIndicator.mm:
633         (-[WKPDFPageNumberIndicator _makeRoundedCorners]):
634         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
635         * UIProcess/ios/forms/WKFileUploadPanel.mm:
636         (-[WKFileUploadPanel _presentPopoverWithContentViewController:animated:]):
637         * UIProcess/ios/forms/WKFormColorControl.mm:
638         (-[WKColorPopover initWithView:]):
639         * UIProcess/ios/forms/WKFormInputControl.mm:
640         (-[WKDateTimePopover initWithView:datePickerMode:]):
641         * UIProcess/ios/forms/WKFormPopover.h:
642         * UIProcess/ios/forms/WKFormPopover.mm:
643         * UIProcess/ios/forms/WKFormSelectPopover.mm:
644         (-[WKSelectPopover initWithView:hasGroups:]):
645         * UIProcess/mac/PageClientImplMac.mm:
646         (WebKit::PageClientImpl::screenToRootView):
647         (WebKit::PageClientImpl::rootViewToScreen):
648         * UIProcess/mac/WKFullScreenWindowController.mm:
649         (-[WKFullScreenWindowController enterFullScreen:]):
650         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
651         (-[WKFullScreenWindowController exitFullScreen]):
652         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
653         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
654         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
655         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
656         (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):
657         * UIProcess/mac/WKPrintingView.mm:
658         (-[WKPrintingView _setAutodisplay:]):
659         (-[WKPrintingView _drawPDFDocument:page:atPoint:]):
660         (-[WKPrintingView _drawPreview:]):
661         (-[WKPrintingView drawRect:]):
662         * UIProcess/mac/WKTextInputWindowController.mm:
663         (-[WKTextInputPanel _interpretKeyEvent:usingLegacyCocoaTextInput:string:]):
664         (-[WKTextInputPanel _hasMarkedText]):
665         * UIProcess/mac/WebPopupMenuProxyMac.mm:
666         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
667         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
668         (WebKit::initializeEventRecord):
669         (WebKit::NetscapePlugin::sendComplexTextInput):
670         (WebKit::makeCGLPresentLayerOpaque):
671         (WebKit::NetscapePlugin::nullEventTimerFired):
672         * WebProcess/Plugins/PDF/PDFPlugin.mm:
673         (-[WKPDFPluginAccessibilityObject accessibilityFocusedUIElement]):
674         (-[WKPDFLayerControllerDelegate writeItemsToPasteboard:withTypes:]):
675         (WebKit::PDFPlugin::handleEditingCommand):
676         (WebKit::PDFPlugin::setActiveAnnotation):
677         (WebKit:: const):
678         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.h:
679         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
680         (WebKit::PDFPluginChoiceAnnotation::createAnnotationElement):
681         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h:
682         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
683         (WebKit::PDFPluginTextAnnotation::createAnnotationElement):
684         * WebProcess/WebCoreSupport/WebAlternativeTextClient.h:
685         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
686         (WebKit::convertImageToBitmap):
687         (WebKit::WebDragClient::declareAndWriteDragImage):
688         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
689         * WebProcess/WebPage/mac/WebPageMac.mm:
690         (WebKit::drawPDFPage):
691
692 2018-09-11  Olivia Barnett  <obarnett@apple.com>
693
694         Implement the Web Share API for mac
695         https://bugs.webkit.org/show_bug.cgi?id=189443
696
697         Reviewed by Tim Horton.
698
699         * Shared/WebPreferencesDefaultValues.h:
700         * UIProcess/API/Cocoa/WKWebView.mm:
701         (-[WKWebView shareSheetDidDismiss:]):
702         * UIProcess/API/Cocoa/WKWebViewInternal.h:
703         * UIProcess/API/mac/WKView.mm:
704         (-[WKView shareSheetDidDismiss:]):
705         * UIProcess/Cocoa/WebViewImpl.h:
706         * UIProcess/Cocoa/WebViewImpl.mm:
707         (WebKit::WebViewImpl::showShareSheet):
708         (WebKit::WebViewImpl::shareSheetDidDismiss):
709         Implemented function for WKShareSheetDelegate.
710
711         * UIProcess/Cocoa/WKShareSheet.h:
712         * UIProcess/Cocoa/WKShareSheet.mm:
713         (-[WKShareSheet initWithView:initWithView:]):
714         (-[WKShareSheet presentWithParameters:completionHandler:]):
715         (-[WKShareSheet sharingServicePicker:didChooseSharingService:]):
716         (-[WKShareSheet _cancel]):
717         (-[WKShareSheet dismiss]):
718         (-[WKShareSheet _dismissDisplayAnimated:]):
719         (-[WKShareSheet invokeShareSheetWithResolution:]):
720         (-[WKShareSheet initWithView:]): Deleted.
721         Added mac platform checks and share sheet functionality.
722
723         * UIProcess/mac/PageClientImplMac.h:
724         * UIProcess/mac/PageClientImplMac.mm:
725         (WebKit::PageClientImpl::showShareSheet):
726         Allows macos to invoke the system share sheet.
727
728 2018-09-07  Dean Jackson  <dino@apple.com>
729
730         Add and expose Internal features from WebKit
731         https://bugs.webkit.org/show_bug.cgi?id=189442
732         <rdar://problem/44243404>
733
734         Reviewed by Simon Fraser.
735
736         Experimental features have become a mess. People are using them for
737         anything that they want to be easily toggled from a host app (e.g.
738         Safari), which means the user-facing menu has become large and
739         confusing.
740
741         Introduce the idea of Internal features, that will be exposed in a way
742         that end-users are not expected to ever see (unless they really want
743         to).
744
745         * CMakeLists.txt: Add new files.
746         * Sources.txt:
747         * SourcesCocoa.txt:
748         * WebKit.xcodeproj/project.pbxproj:
749
750         * DerivedSources.make: Add new generated files.
751         * Scripts/GeneratePreferences.rb: Generate the preferences stuff for Internal Debug features.
752         * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
753         * Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb: Added.
754
755         * Shared/API/APIObject.h: New API object for InternalDebugFeature.
756         * Shared/Cocoa/APIObject.mm:
757         (API::Object::newObject):
758
759         * Shared/WebPreferences.yaml: Change some of the existing experimental features to "internal".
760
761         * UIProcess/API/APIInternalDebugFeature.cpp: New API type - just like APIExperimentalFeature.
762         (API::InternalDebugFeature::create):
763         (API::InternalDebugFeature::InternalDebugFeature):
764         (API::InternalDebugFeature::~InternalDebugFeature):
765         * UIProcess/API/APIInternalDebugFeature.h:
766         * UIProcess/API/C/WKAPICast.h:
767
768         * UIProcess/API/Cocoa/WKPreferences.mm: Change the naming of the experimental feature API so that it
769         won't clash with internal debug features. We can remove the old API once Safari has adopted.
770         (+[WKPreferences _internalDebugFeatures]):
771         (-[WKPreferences _isEnabledForInternalDebugFeature:]):
772         (-[WKPreferences _setEnabled:forInternalDebugFeature:]):
773         (-[WKPreferences _isEnabledForFeature:]):
774         (-[WKPreferences _setEnabled:forFeature:]):
775         (-[WKPreferences _isEnabledForExperimentalFeature:]):
776         (-[WKPreferences _setEnabled:forExperimentalFeature:]):
777         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
778
779         * UIProcess/API/Cocoa/_WKInternalDebugFeature.h: New object - same as _WKExperimentalFeature.
780         * UIProcess/API/Cocoa/_WKInternalDebugFeature.mm:
781         (-[_WKInternalDebugFeature dealloc]):
782         (-[_WKInternalDebugFeature description]):
783         (-[_WKInternalDebugFeature name]):
784         (-[_WKInternalDebugFeature key]):
785         (-[_WKInternalDebugFeature details]):
786         (-[_WKInternalDebugFeature defaultValue]):
787         (-[_WKInternalDebugFeature isHidden]):
788         (-[_WKInternalDebugFeature _apiObject]):
789         * UIProcess/API/Cocoa/_WKInternalDebugFeatureInternal.h:
790
791         * UIProcess/WebPreferences.cpp: Add support for Internal Debug features.
792         (WebKit::WebPreferences::updateBoolValueForInternalDebugFeatureKey):
793         (WebKit::WebPreferences::updateBoolValueForExperimentalFeatureKey):
794         * UIProcess/WebPreferences.h:
795
796         * UIProcess/WebProcessPool.cpp: Change a comment now that it is an internal feature.
797         (WebKit::WebProcessPool::createWebPage):
798
799 2018-09-11  Eric Carlson  <eric.carlson@apple.com>
800
801         WebPage::close should clear UserMediaPermissionRequestManager
802         https://bugs.webkit.org/show_bug.cgi?id=189369
803         <rdar://problem/44196724>
804
805         Reviewed by Youenn Fablet.
806
807         * WebProcess/WebPage/WebPage.cpp:
808         (WebKit::WebPage::close): Clear m_userMediaPermissionRequestManager.
809
810 2018-09-11  Wenson Hsieh  <wenson_hsieh@apple.com>
811
812         [macOS] [WK2] Support changing foreground colors via color panel
813         https://bugs.webkit.org/show_bug.cgi?id=189382
814         <rdar://problem/44227311>
815
816         Reviewed by Ryosuke Niwa.
817
818         Adds support for changing font color in a richly editable element in WebKit2 via NSColorPanel. See below for
819         more detail, as well as the WebCore ChangeLog.
820
821         * UIProcess/API/Cocoa/WKWebView.mm:
822         (-[WKWebView changeColor:]):
823
824         Implement this selector; AppKit calls into this when changing font color using NSColorPanel.
825
826         * UIProcess/Cocoa/WebViewImpl.h:
827         * UIProcess/Cocoa/WebViewImpl.mm:
828         (WebKit::WebViewImpl::changeFontColorFromSender):
829
830         Creates and populates new FontAttributeChanges, with only the foreground color determined by asking the sender
831         object for its -color.
832
833         * WebProcess/WebPage/mac/WebPageMac.mm:
834
835         Use the relevant EditAction for the incoming FontAttributeChanges, instead of always specifying
836         EditAction::ChangeAttributes.
837
838         (WebKit::WebPage::changeFontAttributes):
839
840 2018-09-11  Myles C. Maxfield  <mmaxfield@apple.com>
841
842         Crash under PlatformPopupMenuData::encode when interacting with a select menu that has variable fonts
843         https://bugs.webkit.org/show_bug.cgi?id=188008
844
845         Reviewed by Alex Christensen.
846
847         This patch is a follow-up to https://bugs.webkit.org/show_bug.cgi?id=180307.
848         Variable fonts have CFDictionaries with non-string keys. We need to support that in our IPC code.
849
850         * Shared/cf/ArgumentCodersCF.cpp:
851         (IPC::encode):
852         (IPC::decode):
853
854 2018-09-11  Adrian Perez de Castro  <aperez@igalia.com>
855
856         [WPE][GTK] API documentation is unclear about how to modify requests before sending them
857         https://bugs.webkit.org/show_bug.cgi?id=189505
858
859         Reviewed by Michael Catanzaro.
860
861         Add notes to the API documentation to make explicit where modification
862         of WebKitURIRequest instances affects the request data sent over the
863         network.
864
865         * UIProcess/API/glib/WebKitNavigationAction.cpp: Clarify that
866         modifications to the associated WebKitURIRequest do not affect the
867         actual request. Point to WebKitPage::send-request instead.
868         * UIProcess/API/glib/WebKitResponsePolicyDecision.cpp: Ditto.
869         * UIProcess/API/glib/WebKitWebView.cpp:
870         (webkit_web_view_class_init): Ditto for the description of the
871         WebKitWebView::decide-policy signal. Also fix the syntax of example.
872         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
873         (webkit_web_page_class_init): Indicate that modifications to the
874         WebKitURIRequest will change the actual network request data.
875
876 2018-09-11  Michael Catanzaro  <mcatanzaro@igalia.com>
877
878         Unreviewed, attempt to fix Apple builds after r235903
879         https://bugs.webkit.org/show_bug.cgi?id=188872
880
881         If it really needs to be inlined, it will need to move to the header....
882
883         * UIProcess/WebPageProxy.cpp:
884         (WebKit::WebPageProxy::pageClient const):
885
886 2018-09-11  Michael Catanzaro  <mcatanzaro@igalia.com>
887
888         Unreviewed, fix build after r235903
889         https://bugs.webkit.org/show_bug.cgi?id=188872
890
891         This broke all ports except GTK. Need to add a missing header.
892
893         * UIProcess/PageClient.h:
894
895 2018-09-11  Pablo Saavedra  <psaavedra@igalia.com>
896
897         Add missing #if ENABLE(VIDEO) WebProcess/FullScreen/WebFullScreenManager.cpp
898         https://bugs.webkit.org/show_bug.cgi?id=189506
899
900         Reviewed by Tim Horton.
901
902         m_pipStandbyElement is only defined in
903         WebKit/WebProcess/FullScreen/WebFullScreenManager.h
904         only when ENABLE(VIDEO) (see
905         https://bugs.webkit.org/show_bug.cgi?id=181338)
906
907         * WebProcess/FullScreen/WebFullScreenManager.cpp:
908         (WebKit::WebFullScreenManager::setPIPStandbyElement):
909
910 2018-09-11  Michael Catanzaro  <mcatanzaro@igalia.com>
911
912         WebPageProxy should hold a WeakPtr to its PageClient
913         https://bugs.webkit.org/show_bug.cgi?id=188872
914
915         Reviewed by Ryosuke Niwa.
916
917         This ensures the PageClient reference is always valid when used.
918
919         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
920         (WebKit::WebPageProxy::startDrag):
921         (WebKit::WebPageProxy::setDragCaretRect):
922         * UIProcess/PageClient.h:
923         * UIProcess/WebPageProxy.cpp:
924         (WebKit::PageClientProtector::PageClientProtector):
925         (WebKit::PageClientProtector::~PageClientProtector):
926         (WebKit::WebPageProxy::WebPageProxy):
927         (WebKit::m_resetRecentCrashCountTimer):
928         (WebKit::WebPageProxy::pageClient const):
929         (WebKit::WebPageProxy::reattachToWebProcess):
930         (WebKit::WebPageProxy::initializeWebPage):
931         (WebKit::WebPageProxy::close):
932         (WebKit::WebPageProxy::didChangeBackForwardList):
933         (WebKit::WebPageProxy::willGoToBackForwardListItem):
934         (WebKit::WebPageProxy::shouldKeepCurrentBackForwardListItemInList):
935         (WebKit::WebPageProxy::setViewNeedsDisplay):
936         (WebKit::WebPageProxy::requestScroll):
937         (WebKit::WebPageProxy::viewScrollPosition const):
938         (WebKit::WebPageProxy::updateActivityState):
939         (WebKit::WebPageProxy::activityStateDidChange):
940         (WebKit::WebPageProxy::viewDidEnterWindow):
941         (WebKit::WebPageProxy::dispatchActivityStateChange):
942         (WebKit::WebPageProxy::layerHostingModeDidChange):
943         (WebKit::WebPageProxy::viewSize const):
944         (WebKit::WebPageProxy::startDrag):
945         (WebKit::WebPageProxy::didPerformDragOperation):
946         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
947         (WebKit::WebPageProxy::findPlugin):
948         (WebKit::WebPageProxy::handleTouchEventSynchronously):
949         (WebKit::WebPageProxy::handleTouchEvent):
950         (WebKit::WebPageProxy::preferencesDidChange):
951         (WebKit::WebPageProxy::didCreateMainFrame):
952         (WebKit::WebPageProxy::didCreateSubframe):
953         (WebKit::WebPageProxy::didStartProgress):
954         (WebKit::WebPageProxy::didChangeProgress):
955         (WebKit::WebPageProxy::didFinishProgress):
956         (WebKit::WebPageProxy::didDestroyNavigation):
957         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
958         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
959         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
960         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
961         (WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
962         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
963         (WebKit::WebPageProxy::didCommitLoadForFrame):
964         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
965         (WebKit::WebPageProxy::didFinishLoadForFrame):
966         (WebKit::WebPageProxy::didFailLoadForFrame):
967         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
968         (WebKit::WebPageProxy::didReceiveTitleForFrame):
969         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
970         (WebKit::WebPageProxy::didReachLayoutMilestone):
971         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
972         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
973         (WebKit::WebPageProxy::frameDidBecomeFrameSet):
974         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
975         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
976         (WebKit::WebPageProxy::decidePolicyForResponse):
977         (WebKit::WebPageProxy::unableToImplementPolicy):
978         (WebKit::WebPageProxy::didNavigateWithNavigationData):
979         (WebKit::WebPageProxy::didPerformClientRedirect):
980         (WebKit::WebPageProxy::didPerformServerRedirect):
981         (WebKit::WebPageProxy::didUpdateHistoryTitle):
982         (WebKit::WebPageProxy::closePage):
983         (WebKit::WebPageProxy::setWindowFrame):
984         (WebKit::WebPageProxy::getWindowFrame):
985         (WebKit::WebPageProxy::getWindowFrameWithCallback):
986         (WebKit::WebPageProxy::screenToRootView):
987         (WebKit::WebPageProxy::rootViewToScreen):
988         (WebKit::WebPageProxy::syncRootViewToScreen):
989         (WebKit::WebPageProxy::accessibilityScreenToRootView):
990         (WebKit::WebPageProxy::rootViewToAccessibilityScreen):
991         (WebKit::WebPageProxy::didChangeViewportProperties):
992         (WebKit::WebPageProxy::runOpenPanel):
993         (WebKit::WebPageProxy::showShareSheet):
994         (WebKit::WebPageProxy::handleDownloadRequest):
995         (WebKit::WebPageProxy::didChangeContentSize):
996         (WebKit::WebPageProxy::showColorPicker):
997         (WebKit::WebPageProxy::showDataListSuggestions):
998         (WebKit::WebPageProxy::compositionWasCanceled):
999         (WebKit::WebPageProxy::registerInsertionUndoGrouping):
1000         (WebKit::WebPageProxy::canUndoRedo):
1001         (WebKit::WebPageProxy::executeUndoRedo):
1002         (WebKit::WebPageProxy::clearAllEditCommands):
1003         (WebKit::WebPageProxy::setTextIndicator):
1004         (WebKit::WebPageProxy::clearTextIndicator):
1005         (WebKit::WebPageProxy::setTextIndicatorAnimationProgress):
1006         (WebKit::WebPageProxy::showPopupMenu):
1007         (WebKit::WebPageProxy::showContextMenu):
1008         (WebKit::WebPageProxy::registerEditCommand):
1009         (WebKit::WebPageProxy::canUndo):
1010         (WebKit::WebPageProxy::canRedo):
1011         (WebKit::WebPageProxy::setToolTip):
1012         (WebKit::WebPageProxy::setCursor):
1013         (WebKit::WebPageProxy::setCursorHiddenUntilMouseMoves):
1014         (WebKit::WebPageProxy::didReceiveEvent):
1015         (WebKit::WebPageProxy::resetState):
1016         (WebKit::WebPageProxy::resetStateAfterProcessExited):
1017         (WebKit::WebPageProxy::creationParameters):
1018         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
1019         (WebKit::WebPageProxy::exitAcceleratedCompositingMode):
1020         (WebKit::WebPageProxy::updateAcceleratedCompositingMode):
1021         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
1022         (WebKit::WebPageProxy::recommendedScrollbarStyleDidChange):
1023         (WebKit::WebPageProxy::didChangeScrollOffsetPinningForMainFrame):
1024         (WebKit::WebPageProxy::didFinishLoadingDataForCustomContentProvider):
1025         (WebKit::WebPageProxy::updateBackingStoreDiscardableState):
1026         (WebKit::WebPageProxy::showCorrectionPanel):
1027         (WebKit::WebPageProxy::dismissCorrectionPanel):
1028         (WebKit::WebPageProxy::dismissCorrectionPanelSoon):
1029         (WebKit::WebPageProxy::recordAutocorrectionResponse):
1030         (WebKit::WebPageProxy::useDarkAppearance const):
1031         (WebKit::WebPageProxy::showDictationAlternativeUI):
1032         (WebKit::WebPageProxy::removeDictationAlternatives):
1033         (WebKit::WebPageProxy::dictationAlternatives):
1034         (WebKit::WebPageProxy::setEditableElementIsFocused):
1035         (WebKit::WebPageProxy::takeViewSnapshot):
1036         (WebKit::WebPageProxy::wrapCryptoKey):
1037         (WebKit::WebPageProxy::unwrapCryptoKey):
1038         (WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
1039         (WebKit::WebPageProxy::navigationGestureDidBegin):
1040         (WebKit::WebPageProxy::navigationGestureWillEnd):
1041         (WebKit::WebPageProxy::navigationGestureDidEnd):
1042         (WebKit::WebPageProxy::willRecordNavigationSnapshot):
1043         (WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved):
1044         (WebKit::WebPageProxy::isPlayingMediaDidChange):
1045         (WebKit::WebPageProxy::videoControlsManagerDidChange):
1046         (WebKit::WebPageProxy::handleControlledElementIDResponse const):
1047         (WebKit::WebPageProxy::didPerformImmediateActionHitTest):
1048         (WebKit::WebPageProxy::immediateActionAnimationControllerForHitTestResult):
1049         (WebKit::WebPageProxy::didHandleAcceptedCandidate):
1050         (WebKit::WebPageProxy::addPlaybackTargetPickerClient):
1051         (WebKit::WebPageProxy::removePlaybackTargetPickerClient):
1052         (WebKit::WebPageProxy::showPlaybackTargetPicker):
1053         (WebKit::WebPageProxy::playbackTargetPickerClientStateDidChange):
1054         (WebKit::WebPageProxy::setMockMediaPlaybackTargetPickerEnabled):
1055         (WebKit::WebPageProxy::setMockMediaPlaybackTargetPickerState):
1056         (WebKit::WebPageProxy::didChangeBackgroundColor):
1057         (WebKit::WebPageProxy::didRestoreScrollPosition):
1058         (WebKit::WebPageProxy::userInterfaceLayoutDirection):
1059         (WebKit::WebPageProxy::didInsertAttachment):
1060         (WebKit::WebPageProxy::didRemoveAttachment):
1061         * UIProcess/WebPageProxy.h:
1062         * UIProcess/gstreamer/WebPageProxyGStreamer.cpp:
1063         (WebKit::WebPageProxy::requestInstallMissingMediaPlugins):
1064         * UIProcess/gtk/WebPageProxyGtk.cpp:
1065         (WebKit::WebPageProxy::viewWidget):
1066         (WebKit::WebPageProxy::editorStateChanged):
1067         * UIProcess/ios/WebPageProxyIOS.mm:
1068         (WebKit::WebPageProxy::computeCustomFixedPositionRect const):
1069         (WebKit::WebPageProxy::overflowScrollViewWillStartPanGesture):
1070         (WebKit::WebPageProxy::overflowScrollViewDidScroll):
1071         (WebKit::WebPageProxy::overflowScrollWillStartScroll):
1072         (WebKit::WebPageProxy::overflowScrollDidEndScroll):
1073         (WebKit::WebPageProxy::didCommitLayerTree):
1074         (WebKit::WebPageProxy::layerTreeCommitComplete):
1075         (WebKit::WebPageProxy::didReceivePositionInformation):
1076         (WebKit::WebPageProxy::saveImageToLibrary):
1077         (WebKit::WebPageProxy::interpretKeyEvent):
1078         (WebKit::WebPageProxy::registerWebProcessAccessibilityToken):
1079         (WebKit::WebPageProxy::couldNotRestorePageState):
1080         (WebKit::WebPageProxy::restorePageState):
1081         (WebKit::WebPageProxy::restorePageCenterAndScale):
1082         (WebKit::WebPageProxy::didGetTapHighlightGeometries):
1083         (WebKit::WebPageProxy::startAssistingNode):
1084         (WebKit::WebPageProxy::stopAssistingNode):
1085         (WebKit::WebPageProxy::showInspectorHighlight):
1086         (WebKit::WebPageProxy::hideInspectorHighlight):
1087         (WebKit::WebPageProxy::showInspectorIndication):
1088         (WebKit::WebPageProxy::hideInspectorIndication):
1089         (WebKit::WebPageProxy::enableInspectorNodeSearch):
1090         (WebKit::WebPageProxy::disableInspectorNodeSearch):
1091         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
1092         (WebKit::WebPageProxy::showPlaybackTargetPicker):
1093         (WebKit::WebPageProxy::commitPotentialTapFailed):
1094         (WebKit::WebPageProxy::didNotHandleTapAsClick):
1095         (WebKit::WebPageProxy::didCompleteSyntheticClick):
1096         (WebKit::WebPageProxy::disableDoubleTapGesturesDuringTapIfNecessary):
1097         (WebKit::WebPageProxy::editorStateChanged):
1098         (WebKit::WebPageProxy::showValidationMessage):
1099         (WebKit::WebPageProxy::didHandleStartDataInteractionRequest):
1100         (WebKit::WebPageProxy::didHandleAdditionalDragItemsRequest):
1101         (WebKit::WebPageProxy::didConcludeEditDataInteraction):
1102         (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame):
1103         * UIProcess/mac/WebPageProxyMac.mm:
1104         (WebKit::WebPageProxy::windowAndViewFramesChanged):
1105         (WebKit::WebPageProxy::insertDictatedTextAsync):
1106         (WebKit::WebPageProxy::setPromisedDataForImage):
1107         (WebKit::WebPageProxy::didPerformDictionaryLookup):
1108         (WebKit::WebPageProxy::registerWebProcessAccessibilityToken):
1109         (WebKit::WebPageProxy::makeFirstResponder):
1110         (WebKit::WebPageProxy::assistiveTechnologyMakeFirstResponder):
1111         (WebKit::WebPageProxy::colorSpace):
1112         (WebKit::WebPageProxy::pluginFocusOrWindowFocusChanged):
1113         (WebKit::WebPageProxy::setPluginComplexTextInputState):
1114         (WebKit::WebPageProxy::executeSavedCommandBySelector):
1115         (WebKit::WebPageProxy::intrinsicContentSizeDidChange):
1116         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
1117         (WebKit::WebPageProxy::acceleratedCompositingRootLayer const):
1118         (WebKit::WebPageProxy::showPDFContextMenu):
1119         (WebKit::WebPageProxy::showTelephoneNumberMenu):
1120         (WebKit::WebPageProxy::boundsOfLayerInLayerBackedWindowCoordinates const):
1121         (WebKit::WebPageProxy::editorStateChanged):
1122         (WebKit::WebPageProxy::startWindowDrag):
1123         (WebKit::WebPageProxy::platformWindow):
1124         (WebKit::WebPageProxy::rootViewToWindow):
1125         (WebKit::WebPageProxy::showValidationMessage):
1126         (WebKit::WebPageProxy::inspectorAttachmentView):
1127         (WebKit::WebPageProxy::remoteObjectRegistry):
1128         * UIProcess/win/WebPageProxyWin.cpp:
1129         (WebKit::WebPageProxy::viewWidget):
1130         * UIProcess/wpe/WebPageProxyWPE.cpp:
1131         (WebKit::WebPageProxy::viewBackend):
1132
1133 2018-09-11  Chris Dumez  <cdumez@apple.com>
1134
1135         Regression(PSON): "Swipe back" snapshot is missing when navigating back cross-process
1136         https://bugs.webkit.org/show_bug.cgi?id=189482
1137         <rdar://problem/44317222>
1138
1139         Reviewed by Geoffrey Garen.
1140
1141         The issue was that when we swap process on navigation, we:
1142         1. Call processDidTerminate() which calls resetState() and clears the displayed content
1143         2. Reattach the WebPageProxy to a new WebProcess
1144         3. Trigger the navigation
1145         4. Take the navigation snapshot
1146
1147         When the navigation snapshot occurs at step 4, the view is already blank in the case of
1148         process swap. To avoid the issue, we take the navigation snapshot earlier, before calling
1149         processDidTerminate() and we suppress the next navigation snapshot as it would be blank.
1150
1151         At some point, we will likely want to display the previous' WebProcess content longer,
1152         until the new WebProcess has something interesting to display. Once this is implemented,
1153         we'll likely be able to drop the early snapshotting logic.
1154
1155         * UIProcess/WebPageProxy.cpp:
1156         (WebKit::WebPageProxy::recordAutomaticNavigationSnapshot):
1157         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1158         (WebKit::WebPageProxy::restoreFromSessionState):
1159         (WebKit::WebPageProxy::didCommitLoadForFrame):
1160         * UIProcess/WebPageProxy.h:
1161         (WebKit::WebPageProxy::suppressNextAutomaticNavigationSnapshot):
1162
1163 2018-09-11  Woodrow Wang  <woodrow_wang@apple.com>
1164
1165         Add Web API Statistics Collection
1166         https://bugs.webkit.org/show_bug.cgi?id=187773
1167         <rdar://problem/44155162>
1168
1169         Reviewed by Brent Fulgham.
1170
1171         * Shared/WebCoreArgumentCoders.cpp:
1172         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
1173         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
1174         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
1175
1176 == Rolled over to ChangeLog-2018-09-11 ==