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