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