Add a class for parsing application manifests
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2017-12-04  David Quesada  <david_quesada@apple.com>
2
3         Add a class for parsing application manifests
4         https://bugs.webkit.org/show_bug.cgi?id=177973
5         rdar://problem/34747949
6
7         Reviewed by Geoffrey Garen.
8
9         * Configurations/FeatureDefines.xcconfig: Add ENABLE_APPLICATION_MANIFEST feature flag.
10
11 2017-12-04  Wenson Hsieh  <wenson_hsieh@apple.com>
12
13         Rename a static helper in TouchBarMenuItemData.cpp to match style guidelines.
14         https://bugs.webkit.org/show_bug.cgi?id=180305
15
16         Reviewed by Andy Estes.
17
18         Style guidelines state that we should use bare words for getters, so getItemType should just be
19         itemType. Since this collides with the itemType member variable, this patch also renames that
20         member variable to the more concise "type".
21
22         No change in behavior.
23
24         * Shared/TouchBarMenuItemData.cpp:
25         (WebKit::itemType):
26         (WebKit::TouchBarMenuItemData::TouchBarMenuItemData):
27         (WebKit::TouchBarMenuItemData::encode const):
28         (WebKit::TouchBarMenuItemData::decode):
29         (WebKit::getItemType): Deleted.
30         * Shared/TouchBarMenuItemData.h:
31         (WebKit::operator==):
32
33 2017-12-04  Brian Burg  <bburg@apple.com>
34
35         Web Automation: add flag to preserve legacy page screenshot behavior
36         https://bugs.webkit.org/show_bug.cgi?id=180313
37         <rdar://problem/34379930>
38
39         Reviewed by Joseph Pecoraro.
40
41         For compatibility with JSON Wire Protocol implemented by Safari,
42         we need to retain the ability to perform whole page contents
43         snapshots using Automation.takeScreenshot. Add an extra flag,
44         clipToViewport, which can be used by W3C-conforming drivers.
45
46         * UIProcess/Automation/Automation.json: Add new flag.
47         * UIProcess/Automation/WebAutomationSession.h:
48         * UIProcess/Automation/WebAutomationSession.cpp:
49         (WebKit::WebAutomationSession::takeScreenshot):
50         * WebProcess/Automation/WebAutomationSessionProxy.h:
51         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
52         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
53         (WebKit::snapshotRectForScreenshot):
54         (WebKit::WebAutomationSessionProxy::takeScreenshot):
55         If the flag is false, take a screenshot of the whole page contents.
56
57 2017-12-04  JF Bastien  <jfbastien@apple.com>
58
59         Update std::expected to match libc++ coding style
60         https://bugs.webkit.org/show_bug.cgi?id=180264
61
62         Reviewed by Alex Christensen.
63
64         Update various uses of Expected, mostly renaming valueOr and
65         hasValue to the STL naming convention.
66
67         * NetworkProcess/cache/CacheStorageEngine.cpp:
68         (WebKit::CacheStorage::Engine::open):
69         (WebKit::CacheStorage::Engine::retrieveCaches):
70         (WebKit::CacheStorage::Engine::retrieveRecords):
71         (WebKit::CacheStorage::Engine::putRecords):
72         (WebKit::CacheStorage::Engine::deleteMatchingRecords):
73         (WebKit::CacheStorage::Engine::fetchEntries):
74         (WebKit::CacheStorage::Engine::clearMemoryRepresentation):
75         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
76         (WebKit::CacheStorage::ReadRecordTaskCounter::appendRecord):
77         (WebKit::CacheStorage::Cache::updateRecordToDisk):
78         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
79         (WebKit::CacheStorage::Caches::initialize):
80         (WebKit::CacheStorage::Caches::readCachesFromDisk):
81         * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
82         (WebKit::NetworkRTCProvider::createResolver):
83         * Platform/IPC/ArgumentCoders.h:
84
85 2017-12-04  Brady Eidson  <beidson@apple.com>
86
87         Get a directory path to SWServers for storing ServiceWorker registrations.
88         https://bugs.webkit.org/show_bug.cgi?id=180362
89
90         Reviewed by Chris Dumez.
91
92         This gets all of the plumbing in place for specifying a ServiceWorker registration storage path
93         in a particular WebsiteDataStore.
94
95         * Shared/Storage/StorageProcessCreationParameters.cpp:
96         (WebKit::StorageProcessCreationParameters::encode const):
97         (WebKit::StorageProcessCreationParameters::decode):
98         * Shared/Storage/StorageProcessCreationParameters.h:
99
100         * StorageProcess/StorageProcess.cpp:
101         (WebKit::StorageProcess::initializeWebsiteDataStore):
102         (WebKit::StorageProcess::swServerForSession):
103         * StorageProcess/StorageProcess.h:
104
105         * UIProcess/API/APIProcessPoolConfiguration.cpp:
106         (API::ProcessPoolConfiguration::createWithLegacyOptions):
107         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
108         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
109         * UIProcess/API/APIProcessPoolConfiguration.h:
110
111         * UIProcess/API/APIWebsiteDataStore.h:
112         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
113         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
114         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
115         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
116
117         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
118         (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory):
119         (WebKit::WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory):
120         * UIProcess/WebProcessPool.cpp:
121         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
122         * UIProcess/WebProcessPool.h:
123
124         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
125         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
126         (WebKit::WebsiteDataStore::storageProcessParameters):
127         * UIProcess/WebsiteData/WebsiteDataStore.h:
128         (WebKit::WebsiteDataStore::resolvedServiceWorkerRegistrationDirectory const):
129
130         * UIProcess/gtk/WebProcessPoolGtk.cpp:
131         (WebKit::WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory):
132
133         * UIProcess/wpe/WebProcessPoolWPE.cpp:
134         (WebKit::WebProcessPool::legacyPlatformDefaultServiceWorkerRegistrationDirectory):
135
136 2017-12-04  Frederic Wang  <fwang@igalia.com>
137
138         Make ScrollingTreeNode::enclosingFrameNode return the node itself for frame nodes
139         https://bugs.webkit.org/show_bug.cgi?id=180353
140
141         Reviewed by Antonio Gomes.
142
143         This function was introduced in bug 175135 to solve a rendering bug with fixed positioned
144         nodes in overflow nodes. For a frame node, the reference frame to use for fixed nodes is
145         actually the frame node itself or otherwise we will get the same rendering bug. This patch
146         makes enclosingFrameNode return the node itself when it is a frame node and renames it to
147         clarify this behavior. Currently, enclosingFrameNode is not used for frame nodes so the
148         behavior is unchanged.
149
150         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
151         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll): Use auto* and
152         the new function name.
153
154 2017-12-04  Michael Catanzaro  <mcatanzaro@igalia.com>
155
156         [GTK] Implement PAL::SleepDisabler
157         https://bugs.webkit.org/show_bug.cgi?id=178485
158
159         Reviewed by Carlos Garcia Campos.
160
161         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
162         (webkitWebViewBaseDispose):
163         (webkitWebViewBaseEnterFullScreen):
164         (webkitWebViewBaseExitFullScreen):
165         (screenSaverInhibitedCallback): Deleted.
166         (webkitWebViewBaseSendInhibitMessageToScreenSaver): Deleted.
167         (screenSaverProxyCreatedCallback): Deleted.
168         (webkitWebViewBaseInhibitScreenSaver): Deleted.
169         (webkitWebViewBaseUninhibitScreenSaver): Deleted.
170
171 2017-12-03  Yusuke Suzuki  <utatane.tea@gmail.com>
172
173         WTF shouldn't have both Thread and ThreadIdentifier
174         https://bugs.webkit.org/show_bug.cgi?id=180308
175
176         Reviewed by Darin Adler.
177
178         * UIProcess/API/glib/IconDatabase.cpp:
179         * UIProcess/GenericCallback.h:
180         (WebKit::GenericCallback::~GenericCallback):
181         (WebKit::GenericCallback::performCallbackWithReturnValue):
182
183 2017-12-03  Chris Dumez  <cdumez@apple.com>
184
185         Support serviceWorker.postMessage() inside service workers
186         https://bugs.webkit.org/show_bug.cgi?id=180328
187
188         Reviewed by Darin Adler.
189
190         Support serviceWorker.postMessage() inside service workers.
191
192         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
193         (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromClient):
194         (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker):
195         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
196         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
197         * WebProcess/Storage/WebSWClientConnection.cpp:
198         (WebKit::WebSWClientConnection::postMessageToServiceWorker):
199         * WebProcess/Storage/WebSWClientConnection.h:
200         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
201         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerFromClient):
202         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerFromServiceWorker):
203         * WebProcess/Storage/WebSWContextManagerConnection.h:
204         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
205
206 2017-12-03  Chris Dumez  <cdumez@apple.com>
207
208         Implement self.skipWaiting() inside service workers
209         https://bugs.webkit.org/show_bug.cgi?id=180329
210
211         Reviewed by Darin Adler.
212
213         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
214         (WebKit::WebSWServerToContextConnection::didFinishSkipWaiting):
215         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
216         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
217         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
218         (WebKit::WebSWContextManagerConnection::skipWaiting):
219         (WebKit::WebSWContextManagerConnection::didFinishSkipWaiting):
220         * WebProcess/Storage/WebSWContextManagerConnection.h:
221         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
222
223 2017-12-02  Youenn Fablet  <youenn@apple.com>
224
225         Implement https://w3c.github.io/ServiceWorker/#clients-getall
226         https://bugs.webkit.org/show_bug.cgi?id=180276
227
228         Reviewed by Chris Dumez.
229
230         Add IPC plumbery for clients.matchAll between ServiceWorker process and Storage process.
231
232         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
233         (WebKit::WebSWServerToContextConnection::matchAllCompleted):
234         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
235         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
236         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
237         (WebKit::WebSWContextManagerConnection::matchAll):
238         (WebKit::WebSWContextManagerConnection::matchAllCompleted):
239         * WebProcess/Storage/WebSWContextManagerConnection.h:
240         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
241
242 2017-12-02  Joseph Pecoraro  <pecoraro@apple.com>
243
244         Remote Web Inspector window always shows up at the default size
245         https://bugs.webkit.org/show_bug.cgi?id=180284
246         <rdar://problem/35430255>
247
248         Reviewed by Brian Burg.
249
250         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
251         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
252         Give remote web inspector windows an autosave name so that their frame can
253         be automatically saved and restored by the system.
254
255 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
256
257         Add a log channel for viewports
258         https://bugs.webkit.org/show_bug.cgi?id=180295
259
260         Reviewed by Zalan Bujtas.
261
262         Add a "Viewports" log channel to log viewport scaling information, and enhance the
263         WebKit "VisibleRects" channel to log additional data for the same reason.
264
265         * UIProcess/API/Cocoa/WKWebView.mm:
266         (-[WKWebView _didCommitLayerTree:]):
267         (-[WKWebView _dynamicViewportUpdateChangedTargetToScale:position:nextValidLayerTreeTransactionID:]):
268         (-[WKWebView _dispatchSetMinimumLayoutSize:]):
269         (-[WKWebView _endAnimatedResize]):
270         (-[WKWebView _resizeWhileHidingContentWithUpdates:]):
271         * WebProcess/WebPage/WebPage.cpp:
272         (WebKit::WebPage::setFixedLayoutSize):
273         (WebKit::WebPage::mainFrameDidLayout):
274         (WebKit::WebPage::didCommitLoad):
275         * WebProcess/WebPage/ios/WebPageIOS.mm:
276         (WebKit::scaleAfterViewportWidthChange):
277         (WebKit::WebPage::setViewportConfigurationMinimumLayoutSize):
278         (WebKit::WebPage::dynamicViewportSizeUpdate):
279         (WebKit::WebPage::resetViewportDefaultConfiguration):
280         (WebKit::WebPage::viewportConfigurationChanged):
281         (WebKit::WebPage::updateVisibleContentRects):
282
283 2017-12-02  Carlos Garcia Campos  <cgarcia@igalia.com>
284
285         WebDriver: handle user prompts shown while executing scripts
286         https://bugs.webkit.org/show_bug.cgi?id=179979
287
288         Reviewed by Brian Burg.
289
290         * UIProcess/Automation/Automation.json: Add UnexpectedAlertOpen error.
291         * UIProcess/Automation/WebAutomationSession.cpp:
292         (WebKit::WebAutomationSession::willShowJavaScriptDialog): Finish pending evaluateJavaScriptFunction operations
293         with UnexpectedAlertOpen error.
294
295 2017-12-02  Wenson Hsieh  <wenson_hsieh@apple.com>
296
297         Make some minor adjustments to TouchBarMenuData and TouchBarMenuItemData
298         https://bugs.webkit.org/show_bug.cgi?id=180305
299
300         Reviewed by Joseph Pecoraro.
301
302         Mark some methods and parameters as const, use the default constructor in more places, and also remove a few
303         extraneous imported headers.
304
305         * Shared/TouchBarMenuData.cpp:
306         (WebKit::TouchBarMenuData::TouchBarMenuData):
307
308         Add a FIXME regarding the use of the 'id' attribute.
309
310         (WebKit::TouchBarMenuData::decode):
311         * Shared/TouchBarMenuData.h:
312         (WebKit::TouchBarMenuData::items const):
313         (WebKit::TouchBarMenuData::setID):
314         (WebKit::TouchBarMenuData::isPageCustomized const):
315         (WebKit::TouchBarMenuData::items): Deleted.
316         (WebKit::TouchBarMenuData::isPageCustomized): Deleted.
317         * Shared/TouchBarMenuItemData.cpp:
318         (WebKit::getItemType):
319
320         Change a helper method from a static class function to a static function in the implementation file.
321
322         (WebKit::TouchBarMenuItemData::TouchBarMenuItemData):
323         (WebKit::TouchBarMenuItemData::encode const):
324         (WebKit::TouchBarMenuItemData::decode):
325         (WebKit::TouchBarMenuItemData::getItemType): Deleted.
326         * Shared/TouchBarMenuItemData.h:
327         (WebKit::operator==):
328
329         Remove the commandName member variable, since it doesn't make sense to propagate an event handler
330         attribute from WebCore to the client layer.
331
332         * UIProcess/WebPageProxy.messages.in:
333
334 2017-12-01  Zan Dobersek  <zdobersek@igalia.com>
335
336         Unreviewed GTK+ debug build fix. Replace ASSERT_UNUSED() with UNUSED_PARAM()
337         in WebKit::WebPage methods that used to operate on HTMLMenuElement pointer
338         values (which have been converted to references).
339
340         * WebProcess/WebPage/WebPage.cpp:
341         (WebKit::WebPage::didInsertMenuElement):
342         (WebKit::WebPage::didRemoveMenuElement):
343         (WebKit::WebPage::didInsertMenuItemElement):
344         (WebKit::WebPage::didRemoveMenuItemElement):
345
346 2017-12-01  Simon Fraser  <simon.fraser@apple.com>
347
348         Reduce the number of calls to ViewportConfiguration::updateConfiguration()
349         https://bugs.webkit.org/show_bug.cgi?id=180299
350
351         Reviewed by Zalan Bujtas.
352
353         There are several calls to ViewportConfiguration::setDefaultConfiguration() during loading
354         with the same arguments. We can avoid unnecessary calls to updateConfiguration() by returning
355         early if the configuration hasn't changed.
356
357         Also move the fetching of ViewportConfiguration::xhtmlMobileParameters() from didReceiveMobileDocType()
358         into resetViewportDefaultConfiguration() where we grab all the other default configs.
359
360         * WebProcess/WebPage/WebPage.h:
361         * WebProcess/WebPage/ios/WebPageIOS.mm:
362         (WebKit::WebPage::didReceiveMobileDocType):
363         (WebKit::WebPage::resetViewportDefaultConfiguration):
364
365 2017-12-01  Aishwarya Nirmal  <anirmal@apple.com>
366
367         [Touch Bar Web API] Object representing Touch Bar Menu to send between Web and UI Processes
368         https://bugs.webkit.org/show_bug.cgi?id=179714
369
370         Reviewed by Wenson Hsieh.
371
372         These changes define the TouchBarMenuData and TouchBarMenuItemData objects which draw information
373         from touch bar HTMLMenuElement and HTMLMenuItemElement. These objects represent the contents of
374         the page-customized touch bar. Changes to the html elements representing the touch bar are sent 
375         to the UI process.
376
377         * Shared/TouchBarMenuData.cpp: Copied from Source/WebCore/html/HTMLMenuItemElement.cpp.
378         (WebKit::TouchBarMenuData::TouchBarMenuData):
379         (WebKit::TouchBarMenuData::addMenuItem):
380         (WebKit::TouchBarMenuData::removeMenuItem):
381         (WebKit::TouchBarMenuData::encode const):
382         (WebKit::TouchBarMenuData::decode):
383         * Shared/TouchBarMenuData.h: Copied from Source/WebCore/html/HTMLMenuItemElement.h.
384         (WebKit::TouchBarMenuData::items):
385         (WebKit::TouchBarMenuData::isPageCustomized):
386         (WebKit::TouchBarMenuData::setIsPageCustomized):
387         * Shared/TouchBarMenuItemData.cpp: Added.
388         (WebKit::TouchBarMenuItemData::getItemType):
389         (WebKit::TouchBarMenuItemData::TouchBarMenuItemData):
390         (WebKit::TouchBarMenuItemData::encode const):
391         (WebKit::TouchBarMenuItemData::decode):
392         * Shared/TouchBarMenuItemData.h: Added.
393         (WebKit::operator<):
394         (WebKit::operator>):
395         (WebKit::operator<=):
396         (WebKit::operator>=):
397         (WebKit::operator==):
398         (WebKit::operator!=):
399         * UIProcess/WebPageProxy.cpp:
400         (WebKit::WebPageProxy::touchBarMenuDataChanged):
401         (WebKit::WebPageProxy::touchBarMenuItemDataAdded):
402         (WebKit::WebPageProxy::touchBarMenuItemDataRemoved):
403         * UIProcess/WebPageProxy.h:
404         (WebKit::WebPageProxy::touchBarMenuData const):
405         * UIProcess/WebPageProxy.messages.in:
406         * WebKit.xcodeproj/project.pbxproj:
407         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
408         (WebKit::WebChromeClient::didInsertMenuElement):
409         (WebKit::WebChromeClient::didRemoveMenuElement):
410         (WebKit::WebChromeClient::didInsertMenuItemElement):
411         (WebKit::WebChromeClient::didRemoveMenuItemElement):
412         * WebProcess/WebCoreSupport/WebChromeClient.h:
413         * WebProcess/WebPage/WebPage.cpp:
414         (WebKit::WebPage::didInsertMenuElement):
415         (WebKit::WebPage::didRemoveMenuElement):
416         (WebKit::WebPage::didInsertMenuItemElement):
417         (WebKit::WebPage::didRemoveMenuItemElement):
418         (WebKit::WebPage::sendTouchBarMenuDataRemovedUpdate):
419         (WebKit::WebPage::sendTouchBarMenuDataAddedUpdate):
420         (WebKit::WebPage::sendTouchBarMenuItemDataAddedUpdate):
421         (WebKit::WebPage::sendTouchBarMenuItemDataRemovedUpdate):
422         * WebProcess/WebPage/WebPage.h:
423
424 2017-12-01  Daniel Bates  <dabates@apple.com>
425
426         Alternative Presentation Button: Provide a way to query for the replaced elements
427         https://bugs.webkit.org/show_bug.cgi?id=180114
428         <rdar://problem/35710539>
429
430         Reviewed by Tim Horton.
431
432         Add SPI to query for the elements that were replaced by an Alternative Presentation Button.
433
434         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
435         (-[WKWebProcessPlugInFrame elementsReplacedByAlternativePresentationButtonWithIdentifier:]): Added.
436         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFramePrivate.h:
437         * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
438         (WKBundleElementsReplacedByAlternativePresentationButton): Added.
439         * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
440
441 2017-12-01  Youenn Fablet  <youenn@apple.com>
442
443         Implement https://w3c.github.io/ServiceWorker/#clients-get
444         https://bugs.webkit.org/show_bug.cgi?id=180167
445
446         Reviewed by Chris Dumez.
447
448         Add IPC plumbery for clientFromId between ServiceWorker process and Storage process.
449
450         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
451         (WebKit::WebSWServerToContextConnection::clientFromIdCompleted):
452         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
453         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
454         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
455         (WebKit::WebSWContextManagerConnection::findClientByIdentifier):
456         (WebKit::WebSWContextManagerConnection::findClientByIdentifierCompleted):
457         * WebProcess/Storage/WebSWContextManagerConnection.h:
458         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
459
460 2017-12-01  Brian Burg  <bburg@apple.com>
461
462         Web Inspector: move Inspector::Protocol::Array<T> to JSON namespace
463         https://bugs.webkit.org/show_bug.cgi?id=173662
464
465         Reviewed by Joseph Pecoraro.
466
467         Adopt new type names.
468
469         * UIProcess/Automation/WebAutomationSession.cpp:
470         (WebKit::WebAutomationSession::getNextContext):
471         (WebKit::WebAutomationSession::getBrowsingContexts):
472         (WebKit::buildArrayForCookies):
473         (WebKit::WebAutomationSession::getSessionPermissions):
474         * UIProcess/Automation/WebAutomationSession.h:
475
476 2017-12-01  Wenson Hsieh  <wenson_hsieh@apple.com>
477
478         [Attachment Support] Implement SPI for clients to update a given attachment's data
479         https://bugs.webkit.org/show_bug.cgi?id=180184
480         <rdar://problem/35355731>
481
482         Reviewed by Tim Horton.
483
484         Add plumbing to the web process for setting the attachment data (and optionally, the content type and/or file
485         name) of a given attachment. See WebCore ChangeLog for more detail. Changes covered by new API tests.
486
487         * UIProcess/API/APIAttachment.cpp:
488         (API::Attachment::setDataAndContentType):
489         * UIProcess/API/APIAttachment.h:
490         * UIProcess/API/Cocoa/_WKAttachment.h:
491
492         Add nullability annotations around _WKAttachment SPI methods.
493
494         * UIProcess/API/Cocoa/_WKAttachment.mm:
495         (-[_WKAttachment setData:newContentType:newFilename:completion:]):
496         * UIProcess/WebPageProxy.cpp:
497         (WebKit::WebPageProxy::setAttachmentDataAndContentType):
498         * UIProcess/WebPageProxy.h:
499         * WebProcess/WebPage/WebPage.cpp:
500         (WebKit::WebPage::setAttachmentDataAndContentType):
501         * WebProcess/WebPage/WebPage.h:
502         * WebProcess/WebPage/WebPage.messages.in:
503
504 2017-12-01  Brady Eidson  <beidson@apple.com>
505
506         Add Internals.terminateServiceWorker, and the ability to restart service workers for postMessage.
507         https://bugs.webkit.org/show_bug.cgi?id=180170
508
509         Reviewed by Chris Dumez.
510
511         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
512         (WebKit::WebSWServerConnection::startFetch):
513         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
514         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
515         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
516
517         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
518         (WebKit::WebSWServerToContextConnection::syncTerminateWorker):
519         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
520
521         * StorageProcess/StorageToWebProcessConnection.cpp:
522         (WebKit::StorageToWebProcessConnection::didReceiveSyncMessage):
523
524         * WebProcess/Storage/WebSWClientConnection.cpp:
525         (WebKit::WebSWClientConnection::syncTerminateWorker):
526         * WebProcess/Storage/WebSWClientConnection.h:
527
528         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
529         (WebKit::WebSWContextManagerConnection::terminateWorker):
530         (WebKit::WebSWContextManagerConnection::syncTerminateWorker):
531         * WebProcess/Storage/WebSWContextManagerConnection.h:
532         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
533
534         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
535         (WebKit::WebToStorageProcessConnection::didReceiveSyncMessage):
536         * WebProcess/Storage/WebToStorageProcessConnection.h:
537
538 2017-12-01  Youenn Fablet  <youenn@apple.com>
539
540         Clear WebSWClientConnection in case storage process IPC connection is closing
541         https://bugs.webkit.org/show_bug.cgi?id=180210
542
543         Reviewed by Chris Dumez.
544
545         Clear the sw connection maps when connection is closing.
546         Call related completion handlers for each connection.
547
548         * WebProcess/Storage/WebSWClientConnection.cpp:
549         (WebKit::WebSWClientConnection::connectionToServerLost):
550         * WebProcess/Storage/WebSWClientConnection.h:
551         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
552         (WebKit::WebToStorageProcessConnection::didClose):
553         (WebKit::WebToStorageProcessConnection::idbConnectionToServerForSession):
554         (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession):
555         * WebProcess/Storage/WebToStorageProcessConnection.h:
556
557 2017-12-01  Eric Carlson  <eric.carlson@apple.com>
558
559         [MediaStream] Use CaptureDevice instead of device ID to identify devices
560         https://bugs.webkit.org/show_bug.cgi?id=180206
561         <rdar://problem/35775758>
562
563         Reviewed by Youenn Fablet.
564
565         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
566         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
567         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
568         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
569         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
570         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
571         (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess):
572         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
573         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
574         * UIProcess/UserMediaPermissionRequestProxy.cpp:
575         (WebKit::UserMediaPermissionRequestProxy::allow):
576         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
577         (WebKit::UserMediaPermissionRequestManager::userMediaAccessWasGranted):
578         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
579         * WebProcess/WebPage/WebPage.cpp:
580         (WebKit::WebPage::userMediaAccessWasGranted):
581         * WebProcess/WebPage/WebPage.h:
582         * WebProcess/WebPage/WebPage.messages.in:
583         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
584         (WebKit::UserMediaCaptureManager::createCaptureSource):
585         * WebProcess/cocoa/UserMediaCaptureManager.h:
586
587 2017-12-01  Carlos Garcia Campos  <cgarcia@igalia.com>
588
589         WebDriver: link and partial links queries don't work in xhtml documents
590         https://bugs.webkit.org/show_bug.cgi?id=180191
591
592         Reviewed by Brian Burg.
593
594         We convert the queries to use xpath, which works for html documents, but it doesn't work for xhtml. In case of
595         xhtml we would need to provide a namespace resolver and elements would need to be prefixed with 'xhtml:'. It's
596         easier to simply iterate the link elements and compare the text.
597
598         Fixes: imported/w3c/webdriver/tests/retrieval/find_element_from_element.py::test_xhtml_namespace[link text-full link text]
599                imported/w3c/webdriver/tests/retrieval/find_element_from_element.py::test_xhtml_namespace[partial link text-link text]
600                imported/w3c/webdriver/tests/retrieval/find_element_from_elements.py::test_xhtml_namespace[link text-full link text]
601                imported/w3c/webdriver/tests/retrieval/find_element_from_elements.py::test_xhtml_namespace[partial link text-link text]
602                imported/w3c/webdriver/tests/retrieval/find_element.py::test_xhtml_namespace[link text-full link text]
603                imported/w3c/webdriver/tests/retrieval/find_element.py::test_xhtml_namespace[partial link text-link text]
604                imported/w3c/webdriver/tests/retrieval/find_elements.py::test_xhtml_namespace[link text-full link text]
605                imported/w3c/webdriver/tests/retrieval/find_elements.py::test_xhtml_namespace[partial link text-link text]
606
607         * UIProcess/Automation/atoms/FindNodes.js:
608         (switch):
609         (tryToFindNode):
610
611 2017-11-30  Alex Christensen  <achristensen@webkit.org>
612
613         REGRESSION (r224791): cookies are shared between ephemeral sessions in the same process pool
614         https://bugs.webkit.org/show_bug.cgi?id=180235
615
616         Reviewed by Joseph Pecoraro.
617
618         In r224791 I assumed that uiProcessCookieStorageIdentifier would be empty in the ephemeral session initialization message.
619         This is not the case.  We did not catch this because almost all of our ephemeral session testing uses the legacyPrivateSessionID.
620         I add checks for if the SessionID is ephemeral like we already have in WebFrameNetworkingContext::ensureWebsiteDataStoreSession.
621         I also add an API test that makes sure cookies are not shared between ephemeral sessions the way they are made through the API.
622
623         * NetworkProcess/mac/RemoteNetworkingContext.mm:
624         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
625
626 2017-11-30  Stephan Szabo  <stephan.szabo@sony.com>
627
628         Make LegacyCustomProtocolManager optional for network process
629         https://bugs.webkit.org/show_bug.cgi?id=176230
630
631         Reviewed by Alex Christensen.
632
633         * CMakeLists.txt:
634         * Configurations/FeatureDefines.xcconfig:
635         * NetworkProcess/NetworkProcess.cpp:
636         (WebKit::NetworkProcess::NetworkProcess):
637         (WebKit::NetworkProcess::initializeNetworkProcess):
638         * PlatformGTK.cmake:
639         * PlatformMac.cmake:
640         * PlatformWPE.cmake:
641         * UIProcess/Network/NetworkProcessProxy.cpp:
642         (WebKit::NetworkProcessProxy::NetworkProcessProxy):
643         (WebKit::NetworkProcessProxy::didClose):
644         * UIProcess/Network/NetworkProcessProxy.h:
645         * UIProcess/WebProcessPool.cpp:
646         (WebKit::WebProcessPool::setLegacyCustomProtocolManagerClient):
647         (WebKit::WebProcessPool::registerSchemeForCustomProtocol):
648         (WebKit::WebProcessPool::unregisterSchemeForCustomProtocol):
649
650 2017-11-30  Ryan Haddad  <ryanhaddad@apple.com>
651
652         Unreviewed build fix, suppress deprecation warnings.
653
654         * Shared/mac/SandboxExtensionMac.mm:
655         (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
656
657 2017-11-30  Daniel Bates  <dabates@apple.com>
658
659         Expose SPI didClickAlternativePresentationButtonWithUserInfo on iOS
660         https://bugs.webkit.org/show_bug.cgi?id=180218
661         <rdar://problem/35782555>
662
663         Reviewed by Alex Christensen.
664
665         We want to support the SPI didClickAlternativePresentationButtonWithUserInfo on Cocoa platforms.
666
667         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
668         * UIProcess/Cocoa/UIDelegate.h:
669         * UIProcess/Cocoa/UIDelegate.mm:
670         (WebKit::UIDelegate::setDelegate):
671         (WebKit::UIDelegate::UIClient::didClickAlternativePresentationButton):
672
673 2017-11-30  Joseph Pecoraro  <pecoraro@apple.com>
674
675         [Cocoa] Web Automation: _WKAutomationSessionConfiguration leak
676         https://bugs.webkit.org/show_bug.cgi?id=180222
677
678         Reviewed by Brian Burg.
679
680         * UIProcess/Cocoa/AutomationClient.mm:
681         (WebKit::AutomationClient::requestAutomationSessionWithCapabilities):
682
683 2017-11-30  Joseph Pecoraro  <pecoraro@apple.com>
684
685         Fix some NSOperationQueue leaks
686         https://bugs.webkit.org/show_bug.cgi?id=180221
687
688         Reviewed by Wenson Hsieh.
689
690         * UIProcess/Cocoa/WebViewImpl.mm:
691         (WebKit::WebViewImpl::performDragOperation):
692
693 2017-11-30  Brian Burg  <bburg@apple.com>
694
695         Web Automation: computeElementLayout does not correctly translate iframe client coordinates to main frame coordinates
696         https://bugs.webkit.org/show_bug.cgi?id=180213
697         <rdar://problem/30260141>
698
699         Reviewed by Simon Fraser.
700
701         The current implementation computes points in terms of the frame in which the element is located.
702         However, WebDriver expects coordinates to be relative to the top-level document since
703         these coordinates are used for generating click events, among other things.
704
705         To convert from frame client coordinates to main frame client coordinates, round-trip
706         both inViewCenterPoint and elementBounds to root view coordinates and back
707         to the main frame's contents/client coordinates. Then convert this to page coordinates if needed.
708
709         This progresses several tests in the Selenium Python test suite:
710
711          - event_firing_webdriver_tests.py::test_should_fire_navigation_events
712          - frame_switching_tests.py::testShouldBeAbleToClickInAFrameThatRewritesTopWindowLocation
713          - frame_switching_tests.py::testShouldBeAbleToSwitchToTheTopIfTheFrameIsDeletedFromUnderUs
714          - frame_switching_tests.py::testShouldBeAbleToSwitchToTheTopIfTheFrameIsDeletedFromUnderUsWithFrameIndex
715          - frame_switching_tests.py::testShouldBeAbleToSwitchToTheTopIfTheFrameIsDeletedFromUnderUsWithWebelement
716          - frame_switching_tests.py::testShouldNotBeAbleToDoAnythingTheFrameIsDeletedFromUnderUs
717          - position_and_size_tests.py::testShouldGetCoordinatesOfAnInvisibleElement
718
719         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
720         (WebKit::WebAutomationSessionProxy::computeElementLayout):
721         Get both the frame and main frame FrameViews and convert coordinates to the root view.
722         This is somewhat lossy as clientToDocument* deals with FloatPoints but contentsToRootView
723         deals with IntPoints. For the purposes of WebDriver, lossiness is not a problem since
724         integer values are expected anyway.
725
726         The imperative nature of the coordinate calculations is difficult to debug, so I converted
727         this function to only assign to each variable once.
728
729 2017-11-30  Alex Christensen  <achristensen@webkit.org>
730
731         WKURLSchemeHandler.request should include HTTPBody
732         https://bugs.webkit.org/show_bug.cgi?id=180220
733
734         Reviewed by Brady Eidson.
735
736         * Shared/URLSchemeTaskParameters.cpp: Added.
737         (WebKit::URLSchemeTaskParameters::encode const):
738         (WebKit::URLSchemeTaskParameters::decode):
739         * Shared/URLSchemeTaskParameters.h: Added.
740         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
741         (-[WKURLSchemeTaskImpl request]):
742         * UIProcess/WebPageProxy.cpp:
743         (WebKit::WebPageProxy::startURLSchemeTask):
744         * UIProcess/WebPageProxy.h:
745         * UIProcess/WebPageProxy.messages.in:
746         * UIProcess/WebURLSchemeHandler.cpp:
747         (WebKit::WebURLSchemeHandler::startTask):
748         * UIProcess/WebURLSchemeHandler.h:
749         * UIProcess/WebURLSchemeTask.cpp:
750         (WebKit::WebURLSchemeTask::create):
751         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
752         * UIProcess/WebURLSchemeTask.h:
753         * WebKit.xcodeproj/project.pbxproj:
754         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
755         (WebKit::WebURLSchemeTaskProxy::startLoading):
756
757 2017-11-30  Darin Adler  <darin@apple.com>
758
759         [Mac] remove unneeded RetainPtr use introduced in r225142
760         https://bugs.webkit.org/show_bug.cgi?id=180202
761
762         Reviewed by Tim Horton.
763
764         * WebProcess/Plugins/PDF/PDFPlugin.h: Got rid of unnecessary RetainPtr.
765         * WebProcess/Plugins/PDF/PDFPlugin.mm:
766         (WebKit::PDFPlugin::lookupTextAtLocation const): Ditto.
767         * WebProcess/WebPage/WebPage.h: Ditto.
768         * WebProcess/WebPage/mac/WebPageMac.mm:
769         (WebKit::WebPage::performDictionaryLookupAtLocation): Ditto.
770         (WebKit::WebPage::performDictionaryLookupForSelection): Ditto.
771         (WebKit::WebPage::performImmediateActionHitTestAtLocation): Ditto.
772         (WebKit::WebPage::lookupTextAtLocation): Ditto.
773
774 2017-11-30  Zan Dobersek  <zdobersek@igalia.com>
775
776         [CoordGraphics] Move CoordinatedGraphicsLayer painting behind Nicosia::PaintingEngine
777         https://bugs.webkit.org/show_bug.cgi?id=180141
778
779         Reviewed by Carlos Garcia Campos.
780
781         CompositingCoordinator must implement the paintingEngine() method now
782         that the method's been added to the CoordinatedGraphicsLayerClient
783         interface. The CompositingCoordinator manages the Nicosia::PaintingEngine
784         object through the new m_paintingEngine member variable, and returns the
785         reference to this object in the paintingEngine() method.
786
787         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
788         (WebKit::CompositingCoordinator::CompositingCoordinator):
789         (WebKit::CompositingCoordinator::paintingEngine):
790         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
791         Drop unnecessary typedefs.
792
793 2017-11-29  Wenson Hsieh  <wenson_hsieh@apple.com>
794
795         [Attachment Support] Implement SPI for clients to make an attachment element display in-place
796         https://bugs.webkit.org/show_bug.cgi?id=180153
797         <rdar://problem/35735252>
798
799         Reviewed by Tim Horton.
800
801         Add new WebKit SPI, -[_WKAttachment setDisplayOptions:completion:], and add plumbing for attachment display
802         options to the web content process. Changes covered by 4 new API tests.
803
804         * Scripts/webkit/messages.py:
805         (headers_for_type):
806         * UIProcess/API/APIAttachment.cpp:
807         (API::Attachment::setDisplayOptions):
808         * UIProcess/API/APIAttachment.h:
809         * UIProcess/API/Cocoa/WKWebView.mm:
810         (-[WKWebView _insertAttachmentWithFilename:contentType:data:options:completion:]):
811
812         Respect given display options when inserting a new attachment.
813
814         * UIProcess/API/Cocoa/_WKAttachment.h:
815         * UIProcess/API/Cocoa/_WKAttachment.mm:
816         (-[_WKAttachmentDisplayOptions coreDisplayOptions]):
817
818         Introduce a helper to convert from the Cocoa _WKAttachmentDisplayOptions object to platform-agnostic
819         AttachmentDisplayOptions.
820
821         (-[_WKAttachment setDisplayOptions:completion:]):
822         (WebKit::if): Deleted.
823         * UIProcess/API/Cocoa/_WKAttachmentInternal.h:
824         * UIProcess/WebPageProxy.cpp:
825         (WebKit::WebPageProxy::insertAttachment):
826         (WebKit::WebPageProxy::setAttachmentDisplayOptions):
827         * UIProcess/WebPageProxy.h:
828         * WebProcess/WebPage/WebPage.cpp:
829         (WebKit::WebPage::insertAttachment):
830         (WebKit::WebPage::requestAttachmentData):
831         (WebKit::WebPage::setAttachmentDisplayOptions):
832         (WebKit::WebPage::attachmentElementWithIdentifier const):
833
834         Pull common logic to retrieve an attachment element matching a given identifier out into a helper.
835
836         * WebProcess/WebPage/WebPage.h:
837         * WebProcess/WebPage/WebPage.messages.in:
838
839 2017-11-29  Brent Fulgham  <bfulgham@apple.com>
840
841         Part 2: Adopt updated NSKeyed[Un]Archiver API when available
842         https://bugs.webkit.org/show_bug.cgi?id=180127
843         <rdar://problem/35710738>
844
845         Reviewed by Simon Fraser.
846
847         The API that accepts a user-allocated NSMutableData is deprecated. Switch (for macOS 10.12 and newer)
848         to the modern API. Use the original API for macOS builds prior to 10.12.
849
850         * Shared/Cocoa/DataDetectionResult.mm:
851         (WebKit::DataDetectionResult::encode const):
852         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
853         (IPC::ArgumentCoder<WebCore::Payment>::encode):
854         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode):
855         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode):
856         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode):
857         * Shared/ios/InteractionInformationAtPosition.mm:
858         (WebKit::InteractionInformationAtPosition::encode const):
859         * Shared/mac/WebCoreArgumentCodersMac.mm:
860         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData):
861         (IPC::ArgumentCoder<Credential>::encodePlatformData):
862         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode):
863         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData):
864         * Shared/mac/WebHitTestResultData.mm:
865         (WebKit::WebHitTestResultData::platformEncode const):
866         * UIProcess/API/Cocoa/WKProcessPool.mm:
867         (-[WKProcessPool _setObject:forBundleParameter:]):
868         (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]):
869         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
870         (WebKit::WebProcessPool::platformInitializeWebProcess):
871         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
872         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]):
873
874 2017-11-29  Brady Eidson  <beidson@apple.com>
875
876         When managing context startups, make ServiceWorkerJobDataIdentifier's optional.
877         https://bugs.webkit.org/show_bug.cgi?id=180166
878
879         Reviewed by Chris Dumez.
880
881         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
882
883         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
884         (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
885         (WebKit::WebSWContextManagerConnection::didFinishInstall):
886         * WebProcess/Storage/WebSWContextManagerConnection.h:
887
888 2017-11-29  Youenn Fablet  <youenn@apple.com>
889
890         Add support for service worker generated redirections
891         https://bugs.webkit.org/show_bug.cgi?id=179498
892
893         Reviewed by Darin Adler.
894
895         Small refactoring to allow a service worker redirected fetch to follow the redirection through the service worker.
896
897         * WebProcess/Network/WebLoaderStrategy.cpp:
898         (WebKit::WebLoaderStrategy::scheduleLoad): Make use of the loader request in case a network load is needed after a service worker redirection.
899         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
900         (WebKit::ServiceWorkerClientFetch::create):
901         (WebKit::ServiceWorkerClientFetch::~ServiceWorkerClientFetch):
902         (WebKit::ServiceWorkerClientFetch::ServiceWorkerClientFetch):
903         (WebKit::ServiceWorkerClientFetch::start):
904         (WebKit::ServiceWorkerClientFetch::didReceiveResponse): Check for response.
905         Generate redirected request if needed and call loader callback to process the redirection.
906         Adding some states so that if didFinish is called before the willSendRequest callback, redirection is followed.
907         (WebKit::ServiceWorkerClientFetch::didFinish):
908         In case redirection should be followed, wait for didFinish to follow it.
909         This simplifies the model although introducing some limited latency.
910         * WebProcess/Storage/ServiceWorkerClientFetch.h:
911         * WebProcess/Storage/WebSWClientConnection.cpp:
912         (WebKit::WebSWClientConnection::startFetch):
913         * WebProcess/Storage/WebSWClientConnection.h:
914         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
915         (WebKit::WebServiceWorkerProvider::handleFetch):
916
917 2017-11-29  Youenn Fablet  <youenn@apple.com>
918
919         Add support for FetchEvent.clientId
920         https://bugs.webkit.org/show_bug.cgi?id=180052
921
922         Reviewed by Chris Dumez.
923
924         Using FetchOption persistency coders for cache API and modernizing IPC FetchOptions decoding.
925
926         * WebKit/Shared/WebCoreArgumentCoders.cpp:
927         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
928         (WebKit::CacheStorage::Cache::encode):
929         (WebKit::CacheStorage::Cache::decodeRecordHeader):
930         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
931         (WebKit::WebSWContextManagerConnection::startFetch):
932         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
933         (WebKit::WebSWContextManagerConnection::startFetch):
934
935 2017-11-29  Alex Christensen  <achristensen@webkit.org>
936
937         Make WebFrameLoaderClient more robust against null pointer dereferencing
938         https://bugs.webkit.org/show_bug.cgi?id=180157
939         <rdar://problem/34895616>
940
941         Reviewed by Tim Horton.
942
943         There has always been rare null pointer crashes in this code, but they have become more common
944         now that we are waiting for completion handlers for redirects, which makes it more likely that
945         we are hitting this code after we have detached from the core frame.
946
947         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
948         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
949         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
950         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
951         * WebProcess/WebPage/WebFrame.cpp:
952         (WebKit::WebFrame::page const):
953
954 2017-11-29  Alex Christensen  <achristensen@webkit.org>
955
956         Fix Mac CMake build.
957
958         * PlatformMac.cmake:
959
960 2017-11-29  Chris Dumez  <cdumez@apple.com>
961
962         StorageToWebProcessConnection & WebSWServerToContextConnection should use the same underlying IPC::Connection
963         https://bugs.webkit.org/show_bug.cgi?id=180147
964
965         Reviewed by Brady Eidson.
966
967         StorageToWebProcessConnection & WebSWServerToContextConnection should use the same underlying IPC::Connection.
968         Otherwise, we have with 2 IPC::Connections between the StorageProcess and the ServiceWorker (aka Context) process,
969         which makes synchronization of IPC messages difficult.
970
971         * StorageProcess/StorageProcess.cpp:
972         (WebKit::StorageProcess::createStorageToWebProcessConnection):
973         (WebKit::StorageProcess::createServerToContextConnection):
974         * StorageProcess/StorageProcess.h:
975         * StorageProcess/StorageProcess.messages.in:
976         * StorageProcess/StorageToWebProcessConnection.cpp:
977         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
978         * UIProcess/ServiceWorkerProcessProxy.cpp:
979         (WebKit::ServiceWorkerProcessProxy::start):
980         * UIProcess/ServiceWorkerProcessProxy.h:
981         * UIProcess/Storage/StorageProcessProxy.cpp:
982         (WebKit::StorageProcessProxy::getStorageProcessConnection):
983         (WebKit::StorageProcessProxy::didFinishLaunching):
984         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcess):
985         * UIProcess/Storage/StorageProcessProxy.h:
986         * UIProcess/Storage/StorageProcessProxy.messages.in:
987         * UIProcess/WebProcessPool.cpp:
988         (WebKit::WebProcessPool::getStorageProcessConnection):
989         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
990         * UIProcess/WebProcessPool.h:
991         * UIProcess/WebProcessProxy.cpp:
992         (WebKit::WebProcessProxy::getStorageProcessConnection):
993         * UIProcess/WebProcessProxy.h:
994         (WebKit::WebProcessProxy::isServiceWorkerProcess const):
995         * UIProcess/WebProcessProxy.messages.in:
996         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
997         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
998         * WebProcess/WebProcess.cpp:
999         (WebKit::WebProcess::didReceiveMessage):
1000         (WebKit::WebProcess::establishWorkerContextConnectionToStorageProcess):
1001         * WebProcess/WebProcess.h:
1002         * WebProcess/WebProcess.messages.in:
1003
1004 2017-11-29  Chris Dumez  <cdumez@apple.com>
1005
1006         ensure*Connection() methods on WebProcess should return a reference
1007         https://bugs.webkit.org/show_bug.cgi?id=180149
1008
1009         Reviewed by Alex Christensen.
1010
1011         ensure*Connection() methods on WebProcess should return a reference instead of not returning
1012         anything. Also get rid of the non-ensure variants which called "ensure" internally and are
1013         no longer needed.
1014
1015         * Shared/mac/CookieStorageShim.mm:
1016         (WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL):
1017         * WebProcess/Cache/WebCacheStorageConnection.cpp:
1018         (WebKit::WebCacheStorageConnection::connection):
1019         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1020         (WebKit::WebIDBConnectionToServer::messageSenderConnection):
1021         (WebKit::preregisterSandboxExtensionsIfNecessary):
1022         * WebProcess/Databases/WebDatabaseProvider.cpp:
1023         (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
1024         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
1025         (WebKit::BlobRegistryProxy::registerFileBlobURL):
1026         (WebKit::BlobRegistryProxy::registerBlobURL):
1027         (WebKit::BlobRegistryProxy::registerBlobURLOptionallyFileBacked):
1028         (WebKit::BlobRegistryProxy::unregisterBlobURL):
1029         (WebKit::BlobRegistryProxy::registerBlobURLForSlice):
1030         (WebKit::BlobRegistryProxy::blobSize):
1031         (WebKit::BlobRegistryProxy::writeBlobsToTemporaryFiles):
1032         * WebProcess/Network/NetworkProcessConnection.cpp:
1033         (WebKit::NetworkProcessConnection::writeBlobsToTemporaryFiles):
1034         * WebProcess/Network/WebLoaderStrategy.cpp:
1035         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1036         (WebKit::WebLoaderStrategy::remove):
1037         (WebKit::WebLoaderStrategy::setDefersLoading):
1038         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1039         (WebKit::WebLoaderStrategy::startPingLoad):
1040         (WebKit::WebLoaderStrategy::preconnectTo):
1041         (WebKit::WebLoaderStrategy::storeDerivedDataToCache):
1042         (WebKit::WebLoaderStrategy::setCaptureExtraNetworkLoadMetricsEnabled):
1043         * WebProcess/Network/WebResourceLoader.cpp:
1044         (WebKit::WebResourceLoader::messageSenderConnection):
1045         * WebProcess/Network/WebSocketStream.cpp:
1046         (WebKit::WebSocketStream::WebSocketStream):
1047         (WebKit::WebSocketStream::messageSenderConnection):
1048         * WebProcess/Network/webrtc/LibWebRTCResolver.cpp:
1049         (WebKit::sendOnMainThread):
1050         * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
1051         (WebKit::sendOnMainThread):
1052         * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
1053         (WebKit::LibWebRTCSocketFactory::CreateServerTcpSocket):
1054         (WebKit::LibWebRTCSocketFactory::CreateUdpSocket):
1055         (WebKit::LibWebRTCSocketFactory::CreateClientTcpSocket):
1056         (WebKit::LibWebRTCSocketFactory::createNewConnectionSocket):
1057         * WebProcess/Network/webrtc/WebRTCMonitor.cpp:
1058         (WebKit::sendOnMainThread):
1059         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
1060         (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
1061         (WebKit::WebServiceWorkerProvider::handleFetch):
1062         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1063         (WebKit::WebPlatformStrategies::cookiesForDOM):
1064         (WebKit::WebPlatformStrategies::setCookiesFromDOM):
1065         (WebKit::WebPlatformStrategies::cookiesEnabled):
1066         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
1067         (WebKit::WebPlatformStrategies::getRawCookies):
1068         (WebKit::WebPlatformStrategies::deleteCookie):
1069         * WebProcess/WebPage/WebFrame.cpp:
1070         (WebKit::WebFrame::startDownload):
1071         (WebKit::WebFrame::convertMainResourceLoadToDownload):
1072         * WebProcess/WebProcess.cpp:
1073         (WebKit::WebProcess::ensureLegacyPrivateBrowsingSessionInNetworkProcess):
1074         (WebKit::WebProcess::ensureNetworkProcessConnection):
1075         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
1076         (WebKit::WebProcess::prefetchDNS):
1077         * WebProcess/WebProcess.h:
1078
1079 2017-11-29  Alex Christensen  <achristensen@webkit.org>
1080
1081         Modernize API::SerializedScriptValue
1082         https://bugs.webkit.org/show_bug.cgi?id=180115
1083
1084         Reviewed by Brady Eidson.
1085
1086         Also remove some SPI that hasn't been used anywhere since Mountain Lion.
1087
1088         * Shared/API/APISerializedScriptValue.h:
1089         (API::SerializedScriptValue::create):
1090         (API::SerializedScriptValue::internalRepresentation):
1091         (API::SerializedScriptValue::SerializedScriptValue):
1092         * Shared/API/c/WKSerializedScriptValue.cpp:
1093         (WKSerializedScriptValueDeserialize):
1094         (WKSerializedScriptValueCreateWithInternalRepresentation): Deleted.
1095         (WKSerializedScriptValueGetInternalRepresentation): Deleted.
1096         * Shared/API/c/WKSerializedScriptValuePrivate.h: Removed.
1097         * UIProcess/API/Cocoa/WKWebView.mm:
1098         (-[WKWebView _evaluateJavaScript:forceUserGesture:completionHandler:]):
1099         * WebKit.xcodeproj/project.pbxproj:
1100
1101 2017-11-29  Michael Catanzaro  <mcatanzaro@igalia.com>
1102
1103         REGRESSION(r218064): [GTK] Broke entering fullscreen mode in debug builds
1104         https://bugs.webkit.org/show_bug.cgi?id=180120
1105
1106         Reviewed by Carlos Garcia Campos.
1107
1108         These assertions need to be swapped. Fixes /webkit2/WebKitWebView/fullscreen in debug mode.
1109
1110         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1111         (webkitWebViewBaseEnterFullScreen):
1112         (webkitWebViewBaseExitFullScreen):
1113
1114 2017-11-29  Zan Dobersek  <zdobersek@igalia.com>
1115
1116         [CoordGraphics] Rename CoordinatedBuffer to Nicosia::Buffer
1117         https://bugs.webkit.org/show_bug.cgi?id=180135
1118
1119         Reviewed by Carlos Garcia Campos.
1120
1121         Adjust code to the CoordinatedBuffer -> Nicosia::Buffer transition.
1122
1123         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
1124         (WebKit::CoordinatedBackingStoreTile::setBackBuffer):
1125         (WebKit::CoordinatedBackingStore::updateTile):
1126         * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
1127         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1128         (WebKit::CoordinatedGraphicsScene::createUpdateAtlas):
1129         (WebKit::CoordinatedGraphicsScene::updateImageBacking):
1130         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1131         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1132         (WebKit::CompositingCoordinator::updateImageBacking):
1133         (WebKit::CompositingCoordinator::createUpdateAtlas):
1134         (WebKit::CompositingCoordinator::getCoordinatedBuffer):
1135         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1136         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
1137         (WebKit::UpdateAtlas::UpdateAtlas):
1138         (WebKit::UpdateAtlas::getCoordinatedBuffer):
1139         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h:
1140
1141 2017-11-28  Brent Fulgham  <bfulgham@apple.com>
1142
1143         Adopt updated NSKeyed[Un]Archiver API when available
1144         https://bugs.webkit.org/show_bug.cgi?id=180127
1145         <rdar://problem/35710738>
1146
1147         Reviewed by Alex Christensen.
1148
1149         Switch to new NSKeyed[Un]Archiver methods when available. We do not attempt
1150         to adopt secure coding in places we were not under the original API.
1151
1152         * Platform/ios/AccessibilityIOS.mm:
1153         (WebKit::newAccessibilityRemoteToken): Use secure-by-default API.
1154         * Shared/Cocoa/DataDetectionResult.mm:
1155         (WebKit::DataDetectionResult::encode const): Ditto.
1156         (WebKit::DataDetectionResult::decode): Ditto.
1157         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1158         (IPC::ArgumentCoder<WebCore::Payment>::encode): Ditto.
1159         (IPC::ArgumentCoder<WebCore::Payment>::decode): Ditto.
1160         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode): Ditto.
1161         (IPC::ArgumentCoder<WebCore::PaymentContact>::decode): Ditto.
1162         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode): Ditto.
1163         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::decode): Ditto.
1164         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode): Ditto.
1165         (IPC::ArgumentCoder<WebCore::PaymentMethod>::decode): Ditto.
1166         * Shared/ios/InteractionInformationAtPosition.mm:
1167         (WebKit::InteractionInformationAtPosition::encode const): Ditto.
1168         (WebKit::InteractionInformationAtPosition::decode): Ditto.
1169         * Shared/mac/WebCoreArgumentCodersMac.mm:
1170         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData): Ditto.
1171         (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData): Ditto.
1172         (IPC::ArgumentCoder<Credential>::encodePlatformData): Ditto.
1173         (IPC::ArgumentCoder<Credential>::decodePlatformData): Ditto.
1174         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode): Ditto.
1175         (IPC::ArgumentCoder<ContentFilterUnblockHandler>::decode): Ditto.
1176         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData): Ditto.
1177         (IPC::ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData): Ditto.
1178         * Shared/mac/WebHitTestResultData.mm:
1179         (WebKit::WebHitTestResultData::platformEncode const): Ditto.
1180         (WebKit::WebHitTestResultData::platformDecode): Ditto.
1181         * UIProcess/API/Cocoa/WKProcessPool.mm:
1182         (-[WKProcessPool _setObject:forBundleParameter:]): Ditto.
1183         (-[WKProcessPool _setObjectsForBundleParametersWithDictionary:]): Ditto.
1184         * UIProcess/API/Cocoa/WKWebView.mm:
1185         (-[WKWebView _setInputDelegate:]): Ditto.
1186         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1187         (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
1188         * UIProcess/ios/PageClientImplIOS.mm:
1189         (WebKit::PageClientImpl::startAssistingNode): Ditto.
1190         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1191         (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Ditto.
1192         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
1193         (WebKit::InjectedBundle::initialize): Ditto.
1194         (WebKit::InjectedBundle::setBundleParameter): Ditto.
1195         (WebKit::InjectedBundle::setBundleParameters): Ditto.
1196
1197 2017-11-28  Youenn Fablet  <youenn@apple.com>
1198
1199         NetworkCache::Storage should protect itself when removing operations from its maps
1200         https://bugs.webkit.org/show_bug.cgi?id=180118
1201
1202         Reviewed by Antti Koivisto.
1203
1204         The operations can contain ref to the Storage object and removing them from the map may destroy the Storage object
1205
1206         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1207         (WebKit::NetworkCache::Storage::remove):
1208         (WebKit::NetworkCache::Storage::finishReadOperation):
1209         (WebKit::NetworkCache::Storage::finishWriteOperation):
1210         (WebKit::NetworkCache::Storage::traverse):
1211
1212 2017-11-28  Youenn Fablet  <youenn@apple.com>
1213
1214         Register Documents as ServiceWorker clients to the StorageProcess
1215         https://bugs.webkit.org/show_bug.cgi?id=180047
1216
1217         Reviewed by Brady Eidson.
1218
1219         Adding IPC to register/unregister clients to the storage process.
1220         This will be used to enable service worker termination, and implementation of Clients API.
1221
1222         WebSWServerConnection keeps a hash map of all its related clients.
1223         This allows unregistering these clients if the corresponding web process crashes.
1224
1225         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1226         (WebKit::WebSWServerConnection::~WebSWServerConnection):
1227         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
1228         (WebKit::WebSWServerConnection::unregisterServiceWorkerClient):
1229         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1230         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1231         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
1232         * WebProcess/Storage/WebSWClientConnection.cpp:
1233         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
1234         (WebKit::WebSWClientConnection::unregisterServiceWorkerClient):
1235         * WebProcess/Storage/WebSWClientConnection.h:
1236
1237 2017-11-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
1238
1239         [CG] PostScript images should be supported if they are sub-resource images
1240         https://bugs.webkit.org/show_bug.cgi?id=178502
1241         <rdar://problem/35102988>
1242
1243         Reviewed by Simon Fraser.
1244
1245         Make convertPostScriptDataToPDF() be as static function of PDFDocumentImage
1246         in WebCore.
1247
1248         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1249         (WebKit::PDFPlugin::convertPostScriptDataIfNeeded):
1250         (WebKit::convertPostScriptDataToPDF): Deleted.
1251
1252 2017-11-28  Alex Christensen  <achristensen@webkit.org>
1253
1254         Add SPI for adding strings directly to a _WKVisitedLinkStore
1255         https://bugs.webkit.org/show_bug.cgi?id=180100
1256
1257         Reviewed by Geoffrey Garen.
1258
1259         * UIProcess/API/Cocoa/_WKVisitedLinkStore.h:
1260         * UIProcess/API/Cocoa/_WKVisitedLinkStore.mm:
1261         (-[_WKVisitedLinkStore addVisitedLinkWithString:]):
1262         This is a performance optimization for rdar://problem/16321391
1263
1264 2017-11-28  Joseph Pecoraro  <pecoraro@apple.com>
1265
1266         REGRESSION: Web Inspector: context menu actions "Download Image" and "Open Image in New Window" don't work
1267         https://bugs.webkit.org/show_bug.cgi?id=178808
1268         <rdar://problem/35176608>
1269
1270         Reviewed by Brian Burg.
1271
1272         * UIProcess/mac/WKInspectorViewController.mm:
1273         (-[WKInspectorViewController _webView:contextMenu:forElement:]):
1274         Continue to hide the image context menu actions like we used to.
1275         Investigating making these context menus work can be done as a
1276         follow-up task.
1277
1278         * UIProcess/mac/WKWebInspectorWKWebView.mm:
1279         (-[WKWebInspectorWKWebView initWithFrame:configuration:]):
1280         Use nullptr instead of 0.
1281
1282 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1283
1284         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
1285         https://bugs.webkit.org/show_bug.cgi?id=173793
1286
1287         Reviewed by Joseph Pecocaro.
1288
1289         Based on patch by Brian Burg.
1290
1291         * UIProcess/Automation/WebAutomationSession.cpp:
1292         (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext):
1293         (WebKit::WebAutomationSession::moveWindowOfBrowsingContext):
1294         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage):
1295         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame):
1296         (WebKit::WebAutomationSession::respondToPendingPageNavigationCallbacksWithTimeout):
1297         (WebKit::WebAutomationSession::respondToPendingFrameNavigationCallbacksWithTimeout):
1298         (WebKit::WebAutomationSession::navigationOccurredForFrame):
1299         (WebKit::WebAutomationSession::documentLoadedForFrame):
1300         (WebKit::WebAutomationSession::inspectorFrontendLoaded):
1301         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
1302         (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
1303         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload):
1304         (WebKit::WebAutomationSession::addSingleCookie):
1305         (WebKit::WebAutomationSession::setSessionPermissions):
1306         (WebKit::WebAutomationSession::performMouseInteraction):
1307         (WebKit::WebAutomationSession::performKeyboardInteractions):
1308         * UIProcess/Automation/WebAutomationSession.h:
1309
1310 2017-11-28  Daniel Bates  <dabates@apple.com>
1311
1312         [Cocoa] First pass at implementing alternative presentation button element
1313         https://bugs.webkit.org/show_bug.cgi?id=179785
1314         Part of <rdar://problem/34917108>
1315
1316         Reviewed by Brent Fulgham.
1317
1318         Expose SPI to substitute the alternative presentation button for one or more elements
1319         and remove the alternative presentation button. Add a private delegate callback when
1320         the alternative presentation button is clicked.
1321
1322         * UIProcess/API/APIUIClient.h:
1323         (API::UIClient::didClickAlternativePresentationButton): Added.
1324         * UIProcess/API/C/WKPageUIClient.h:
1325         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1326         * UIProcess/Cocoa/UIDelegate.h:
1327         * UIProcess/Cocoa/UIDelegate.mm:
1328         (WebKit::UIDelegate::setDelegate): Wired up delegate callback.
1329         (WebKit::UIDelegate::UIClient::didClickAlternativePresentationButton): Added.
1330         * UIProcess/WebPageProxy.cpp:
1331         (WebKit::WebPageProxy::handleAlternativePresentationButtonClick): Added.
1332         * UIProcess/WebPageProxy.h:
1333         * UIProcess/WebPageProxy.messages.in:
1334         * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
1335         (API::InjectedBundle::PageUIClient::didClickAlternativePresentationButton): Added.
1336         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
1337         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
1338         (-[WKWebProcessPlugInFrame substituteElements:withAlternativePresentationButtonWithIdentifier:]): Added.
1339         (-[WKWebProcessPlugInFrame removeAlternativePresentationButton:]): Added.
1340         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFramePrivate.h:
1341         * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
1342         (WKBundleSubstituteWithAlternativePresentationButton): Added.
1343         (WKBundleRemoveAlternativePresentationButton): Added.
1344         * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
1345         * WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h:
1346         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
1347         (WebKit::InjectedBundlePageUIClient::didClickAlternativePresentationButton): Added.
1348         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
1349         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1350         (WebKit::WebChromeClient::handleAlternativePresentationButtonClick): Added.
1351         * WebProcess/WebCoreSupport/WebChromeClient.h:
1352
1353 2017-11-27  Chris Dumez  <cdumez@apple.com>
1354
1355         ASSERTION FAILED: addResult.isNewEntry WebCore::SWServerRegistration::addClientUsingRegistration(WebCore::ServiceWorkerClientIdentifier const&) + 141
1356         https://bugs.webkit.org/show_bug.cgi?id=180049
1357
1358         Reviewed by Brady Eidson.
1359
1360         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1361         * WebProcess/Storage/WebSWClientConnection.cpp:
1362         (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
1363         (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
1364         (WebKit::WebSWClientConnection::serviceWorkerStartedControllingClient):
1365         (WebKit::WebSWClientConnection::serviceWorkerStoppedControllingClient):
1366         * WebProcess/Storage/WebSWClientConnection.h:
1367
1368 2017-11-27  Jeremy Jones  <jeremyj@apple.com>
1369
1370         downcast to WebKit::FullscreenClient can sometimes fail.
1371         https://bugs.webkit.org/show_bug.cgi?id=179849
1372
1373         Reviewed by Darin Adler.
1374
1375         There are cases during teardown where fullscreenClient() has been cleared back to an API::FullscreenClient.
1376         Because those cases, WKWebView should test before downcasting to WebKit::FullscreenClient.
1377
1378         This is causing a crash when fullscreen delegate is cleared after a page is closed.
1379
1380         * UIProcess/API/Cocoa/WKWebView.mm:
1381         (-[WKWebView _setFullscreenDelegate:]):
1382         (-[WKWebView _fullscreenDelegate]):
1383
1384 2017-11-27  Chris Dumez  <cdumez@apple.com>
1385
1386         Give Document a strongly typed identifier instead of a uint64_t
1387         https://bugs.webkit.org/show_bug.cgi?id=180041
1388
1389         Reviewed by Youenn Fablet.
1390
1391         Give Document a strongly typed identifier instead of a uint64_t, for clarity.
1392
1393         * Platform/IPC/ArgumentCoders.h:
1394         * Scripts/webkit/messages.py:
1395         (forward_declarations_and_headers):
1396         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1397         (WebKit::WebSWServerConnection::notifyClientsOfControllerChange):
1398         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
1399         (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
1400         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
1401         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
1402         * StorageProcess/StorageProcess.cpp:
1403         (WebKit::StorageProcess::postMessageToServiceWorkerClient):
1404         * WebProcess/Storage/WebSWClientConnection.cpp:
1405         (WebKit::WebSWClientConnection::postMessageToServiceWorkerGlobalScope):
1406         (WebKit::WebSWClientConnection::serviceWorkerStartedControllingClient):
1407         (WebKit::WebSWClientConnection::serviceWorkerStoppedControllingClient):
1408         (WebKit::WebSWClientConnection::postMessageToServiceWorkerClient):
1409         * WebProcess/Storage/WebSWClientConnection.h:
1410         * WebProcess/Storage/WebSWClientConnection.messages.in:
1411
1412 2017-11-27  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1413
1414         [GTK][WPE] Add "enable-encrypted-media" property to WebKitWebSettings
1415         https://bugs.webkit.org/show_bug.cgi?id=18005
1416
1417         Reviewed by Michael Catanzaro.
1418
1419         EncryptedMedia is an experimental JavaScript API for playing encrypted media in HTML.
1420         This property will only work as intended if the EncryptedMedia feature is enabled at build time
1421         with the ENABLE_ENCRYPTED_MEDIA flag.
1422
1423         * UIProcess/API/glib/WebKitSettings.cpp:
1424         (webKitSettingsSetProperty):
1425         (webKitSettingsGetProperty):
1426         (webkit_settings_class_init):
1427         (webkit_settings_get_enable_encrypted_media):
1428         (webkit_settings_set_enable_encrypted_media):
1429         * UIProcess/API/gtk/WebKitSettings.h:
1430         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1431         * UIProcess/API/wpe/WebKitSettings.h:
1432
1433 2017-11-27  Tim Horton  <timothy_horton@apple.com>
1434
1435         One too many zeroes in macOS version number in FeatureDefines
1436         https://bugs.webkit.org/show_bug.cgi?id=180011
1437
1438         Reviewed by Dan Bernstein.
1439
1440         * Configurations/FeatureDefines.xcconfig:
1441
1442 2017-11-27  Zan Dobersek  <zdobersek@igalia.com>
1443
1444         [CoordGraphics] Prettify ID value handling in UpdateAtlas and UpdateAtlas::Client
1445         https://bugs.webkit.org/show_bug.cgi?id=180038
1446
1447         Reviewed by Carlos Garcia Campos.
1448
1449         In the UpdateAtlas class, provide an ID type that aliases to uint32_t.
1450         The m_id member variable (ex-m_ID) uses this type, and it's also now
1451         used in the Client interface.
1452
1453         While poking around, the header is modified to use '#pragma once',
1454         and m_id is moved to the more logical first position among member
1455         variables.
1456
1457         The static ID variable is modified to use the new type, and renamed
1458         to s_nextID. Comment alongside the namespace scope closure is fixed
1459         to use the appropriate name.
1460
1461         createUpdateAtlas() and removeUpdateAtlas() methods in the
1462         CompositingCoordinator class are modified to use the UpdateAtlas::ID
1463         type, and the former has the second parameter changed from RefPtr<>
1464         to Ref<>.
1465
1466         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1467         (WebKit::CompositingCoordinator::createUpdateAtlas):
1468         (WebKit::CompositingCoordinator::removeUpdateAtlas):
1469         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1470         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
1471         (WebKit::UpdateAtlas::UpdateAtlas):
1472         (WebKit::UpdateAtlas::~UpdateAtlas):
1473         (WebKit::UpdateAtlas::getCoordinatedBuffer):
1474         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h:
1475
1476 2017-11-27  Zan Dobersek  <zdobersek@igalia.com>
1477
1478         [CoordGraphics] CompositingCoordinator: clean up Client vtable, GraphicsLayerClient overrides
1479         https://bugs.webkit.org/show_bug.cgi?id=180037
1480
1481         Reviewed by Carlos Garcia Campos.
1482
1483         Remove the CompositingCoordinator::Client::paintLayerContents() method since
1484         the only implementation in CoordinatedLayerTreeHost was empty.
1485
1486         Subsequently, the CompositingCoordinator::paintContents() override of the
1487         GraphicsLayerClient method can also be removed. The notifyAnimationStarted()
1488         override is empty, just like the base method, so it's removed as well.
1489
1490         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1491         (WebKit::CompositingCoordinator::deviceScaleFactor const): Bring method up
1492         to the notifyFlushRequired() code, since both are overrides of the
1493         GraphicsLayerClient-inherited methods.
1494         (WebKit::CompositingCoordinator::pageScaleFactor const): Ditto.
1495         (WebKit::CompositingCoordinator::notifyAnimationStarted): Deleted.
1496         (WebKit::CompositingCoordinator::paintContents): Deleted.
1497         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1498         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
1499         (WebKit::CoordinatedLayerTreeHost::paintLayerContents): Deleted.
1500         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
1501
1502 2017-11-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1503
1504         REGRESSION(r223073): disk cache directory is no longer copied in ProcessPoolConfiguration::copy()
1505         https://bugs.webkit.org/show_bug.cgi?id=180031
1506
1507         Reviewed by Youenn Fablet.
1508
1509         This has caused GTK/WPE test /webkit2/WebKitWebsiteData/configuration to fail, and the wrong directory is used
1510         by the network process. I think it was removed by mistake in r223073.
1511
1512         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1513         (API::ProcessPoolConfiguration::copy): Copy m_diskCacheDirectory too.
1514
1515 2017-11-27  Adrian Perez de Castro  <aperez@igalia.com>
1516
1517         [WPE][GTK] Improve contents of pkg-config .pc files
1518         https://bugs.webkit.org/show_bug.cgi?id=180032
1519
1520         Reviewed by Carlos Garcia Campos.
1521
1522         * gtk/webkit2gtk-web-extension.pc.in: Add URL, edit Name and Description.
1523         * gtk/webkit2gtk.pc.in: Add URL, edit Name.
1524         * wpe/wpe-webkit.pc.in: Add URL, edit Name and Description.
1525
1526 2017-11-23  Darin Adler  <darin@apple.com>
1527
1528         Fix dictionary leak in lookup, convert FindOptions to OptionSet, tweak code style nearby
1529         https://bugs.webkit.org/show_bug.cgi?id=179981
1530
1531         Reviewed by Sam Weinig.
1532
1533         * WebProcess/Plugins/PDF/PDFPlugin.h: Use some references instead of pointers. Made more
1534         things final and private. Changed functions with multiple return values to use tuples
1535         instead of out arguments for clarity, especially because some were using pointers and it
1536         was ambiguous whether the pointers could be nullptr. Tweaked formatting. Moved initialization
1537         of data members into the class definition.
1538
1539         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1540         (WebKit::PDFPlugin::create): Take a reference.
1541         (WebKit::PDFPlugin::PDFPlugin): Ditto. Also moved some initialization to the class definition.
1542         (WebKit::PDFPlugin::countFindMatches): Added comment about ignored maxMatchCount argument.
1543         (WebKit::PDFPlugin::findString): Use contains instead of & to check bits in options.
1544         Simplified slightly confusing match count code that was doing some unnecessary comparisons
1545         with the maximum match count. Use auto a bit.
1546         (WebKit::coreCursor): Renamed from pdfLayerControllerCursorTypeToCursor since this is C++
1547         and overloading works based on the argument type.
1548         (WebKit::PDFPlugin::notifyCursorChanged): Updated for name change.
1549         (WebKit::PDFPlugin::lookupTextAtLocation const): Return a tuple instead of using two out
1550         arguments and use a RetainPtr so we don't leak the options dictionary.
1551
1552         * WebProcess/Plugins/PluginProxy.h: Removed unneeded include of FindOptions.h.
1553
1554         * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
1555         (WebKit::WebContextMenuClient::lookUpInDictionary): Pass a reference.
1556
1557         * WebProcess/WebPage/FindController.cpp:
1558         (WebKit::core): Use |= instead of | to build up a FindOptions.
1559         (WebKit::FindController::FindController): Initialize data members in the class definition.
1560         (WebKit::pluginViewForFrame): Deleted. Callers now use WebPage::pluginViewForFrame.
1561         (WebKit::FindController::updateFindUIAfterPageScroll): Added a FIXME about some peculiar code.
1562         (WebKit::FindController::findString): Use |= rather than | to add in an option.
1563         (WebKit::FindController::hideFindUI): Use { } rather than 0 for no options.
1564         * WebProcess/WebPage/FindController.h: Moved initialization to the header. Exported the core
1565         function that converts WebKit::FindOptions to WebCore::FindOptions.
1566
1567         * WebProcess/WebPage/WebFrame.cpp:
1568         (WebKit::WebFrame::handlesPageScaleGesture const): Use WebPage::pluginViewForFrame.
1569         (WebKit::WebFrame::requiresUnifiedScaleFactor const): Use WebPage::pluginViewForFrame.
1570
1571         * WebProcess/WebPage/WebPage.cpp:
1572         (WebKit::WebPage::createPlugin): Removed unneeded local variable and UNUSED_PARAM.
1573         (WebKit::WebPage::focusedPluginViewForFrame): Use pluginViewForFrame.
1574         (WebKit::WebPage::pluginViewForFrame): Added a null check since this takes a pointer.
1575         Use is/downcast insteadof more ad hoc coding style.
1576         (WebKit::WebPage::findStringFromInjectedBundle): Call core to convert WebKit::FindOptions
1577         to WebCore::FindOptions. Before, this was accidentally relying on the bits from the two
1578         enumrations matching! The stricter type checking of OptionSet helps us catch mistakes
1579         like this.
1580
1581         * WebProcess/WebPage/WebPage.h: Updated for the above. Also flattened out nested #if
1582         statements, made forward declarations unconditional, and re-sorted them. Changed the
1583         Mac-specific lookupTextAtLocation to return a tuple (see below).
1584
1585         * WebProcess/WebPage/ios/WebPageIOS.mm:
1586         (WebKit::WebPage::performDictionaryLookupForSelection): Take a reference instead of a pointer.
1587         (WebKit::WebPage::performDictionaryLookupForRange): Ditto.
1588         (WebKit::rangeNearPositionMatchesText): Use { } rather than 0 for no options.
1589
1590         * WebProcess/WebPage/mac/WebPageMac.mm:
1591         (WebKit::WebPage::performDictionaryLookupAtLocation): Use RetainPtr<NSDictionary> to fix
1592         code that used to leak.
1593         (WebKit::WebPage::performDictionaryLookupForSelection): Ditto.
1594         (WebKit::WebPage::performDictionaryLookupOfCurrentSelection): Use a reference.
1595         (WebKit::WebPage::dictionaryPopupInfoForRange): Updated for changed argument types.
1596         (WebKit::WebPage::dictionaryPopupInfoForSelectionInPDFPlugin): Ditto.
1597         (WebKit::WebPage::performDictionaryLookupForRange): Ditto.
1598         (WebKit::WebPage::performImmediateActionHitTestAtLocation): Updated to handle the
1599         tuple result from the lookupTextAtLocation functions.
1600         (WebKit::WebPage::lookupTextAtLocation): Changed to return a tuple and use RetainPtr
1601         for the NSDictionary to help fix the leak.
1602
1603 2017-11-24  Zan Dobersek  <zdobersek@igalia.com>
1604
1605         [CoordGraphics] CoordinatedGraphicsLayer::updateContentBuffers() should always assume a non-null CoordinatedBuffer
1606         https://bugs.webkit.org/show_bug.cgi?id=179977
1607
1608         Reviewed by Carlos Garcia Campos.
1609
1610         Make CompositingCoordinator::getCoordinatedBuffer() return a Ref<CoordinatedBuffer>
1611         value. In case an UpdateAtlas with enough free area is found, its CoordinatedBuffer
1612         is dereferenced into the return value. In case a new UpdateAtlas is created, the
1613         returned CoordinatedBuffer pointer is asserted to be non-null and dereferenced.
1614
1615         The retrieved CoordinatedBuffer pointer on a newly-created UpdateAtlas should never
1616         be null since the tiles are smaller in size than the UpdateAtlas area. The assert
1617         is done in release configurations as well since the code in CoordinatedGraphicsLayer
1618         assumes the returned pointer will be non-null, so it's just a matter of where to
1619         crash first in case somehow a null value is returned.
1620
1621         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1622         (WebKit::CompositingCoordinator::getCoordinatedBuffer):
1623         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1624
1625 2017-11-24  Zan Dobersek  <zdobersek@igalia.com>
1626
1627         [CoordGraphics] UpdateAtlas constructor should receive an IntSize, not a dimension value
1628         https://bugs.webkit.org/show_bug.cgi?id=179976
1629
1630         Reviewed by Carlos Garcia Campos.
1631
1632         Have the UpdateAtlas constructor receive an IntSize object that specifies
1633         the desired size for the CoordinatedBuffer. Passing in a dimension doesn't
1634         really make sense since this value isn't dynamically configurable, and
1635         the only value that is passed in is already a power-of-two.
1636
1637         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1638         (WebKit::CompositingCoordinator::getCoordinatedBuffer):
1639         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
1640         (WebKit::UpdateAtlas::UpdateAtlas):
1641         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h:
1642
1643 2017-11-23  Sam Weinig  <sam@webkit.org>
1644
1645         Remove unneeded ScriptController::processingUserGesture() forwarding functions
1646         https://bugs.webkit.org/show_bug.cgi?id=179954
1647
1648         Reviewed by Darin Adler.
1649
1650         Replace ScriptController::processingUserGesture() and ScriptController::processingUserGestureForMedia()
1651         with direct calls to the corresponding UserGestureIndicator functions.
1652
1653         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1654         (WebKit::InjectedBundle::isProcessingUserGesture):
1655         * WebProcess/WebPage/WebPage.cpp:
1656         (WebKit::WebPage::addResourceRequest):
1657
1658 2017-11-23  Chris Dumez  <cdumez@apple.com>
1659
1660         WebSWServerConnection should register/unregister itself with the StorageProcess
1661         https://bugs.webkit.org/show_bug.cgi?id=179965
1662
1663         Reviewed by Darin Adler.
1664
1665         WebSWServerConnection should register/unregister itself with the StorageProcess instead of relying
1666         on StorageToWebProcessConnection to do so on its behalf. This is less error-prone.
1667
1668         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1669         (WebKit::WebSWServerConnection::WebSWServerConnection):
1670         (WebKit::WebSWServerConnection::~WebSWServerConnection):
1671         * StorageProcess/StorageToWebProcessConnection.cpp:
1672         (WebKit::StorageToWebProcessConnection::~StorageToWebProcessConnection):
1673         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
1674         (WebKit::StorageToWebProcessConnection::removeSWServerConnection):
1675
1676 2017-11-23  Darin Adler  <darin@apple.com>
1677
1678         Reduce WTF::String operations that do unnecessary Unicode operations instead of ASCII
1679         https://bugs.webkit.org/show_bug.cgi?id=179907
1680
1681         Reviewed by Sam Weinig.
1682
1683         * NetworkProcess/cache/NetworkCache.cpp:
1684         (WebKit::NetworkCache::isMediaMIMEType): Use startsWithLettersIgnoringASCIICase.
1685         * NetworkProcess/cache/NetworkCacheKey.cpp:
1686         (WebKit::NetworkCache::hashString): Use isAllASCII..
1687         * UIProcess/API/C/WKWebsitePolicies.cpp:
1688         (WKWebsitePoliciesSetCustomHeaderFields): Use startsWithLettersIgnoringASCIICase..
1689         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
1690         (-[_WKWebsitePolicies setCustomHeaderFields:]): Ditto.
1691         * UIProcess/WebPageProxy.cpp:
1692         (WebKit::WebPageProxy::savePDFToFileInDownloadsFolder): Use endsWithIgnoringASCIICase.
1693         * UIProcess/WebPreferences.cpp:
1694         (WebKit::WebPreferences::WebPreferences): Initialize m_identifier explicitly. Somehow
1695         changing the String default constructor to be "= default" led to a warning that we
1696         otherwise did not get about not initializing m_identifier. Arguably a compiler bug,
1697         but legitimately strange that the copy constructor does not copy m_identifier and so
1698         nice to be explicit about it, I guess.
1699         * UIProcess/mac/WebPageProxyMac.mm:
1700         (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplicationRaw): Use
1701         endsWithIgnoringASCIICase.
1702         (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication): Ditto.
1703         * WebProcess/WebPage/WebPage.cpp:
1704         (WebKit::WebPage::createPlugin): Ditto.
1705         * WebProcess/WebPage/ios/WebPageIOS.mm:
1706         (WebKit::WebPage::platformEditorState const): Use isAllSpecialCharacters<isHTMLSpace>.
1707
1708 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
1709
1710         [CoordGraphics] Simplify CoordinatedGraphicsLayer's content buffer updates
1711         https://bugs.webkit.org/show_bug.cgi?id=179972
1712
1713         Reviewed by Carlos Garcia Campos.
1714
1715         In CompositingCoordinator, add the getCoordinatedBuffer() method, replacing
1716         paintToSurface(). The new method traverses the list of UpdateAtlases and
1717         returns any CoordinatedBuffer object that was free to use. If none exist,
1718         a new UpdateAtlas object is created, and its CoordinatedBuffer is returned.
1719
1720         In  UpdateAtlas, the paintOnAvailableBuffer() method is replaced with
1721         getCoordinatedBuffer(). The latter allocates the necessary area but then
1722         returns a reference to the CoordinatedBuffer buffer, along with the atlas ID
1723         and the allocated rectangle information, and does not invoke any painting
1724         operation like paintOnAvailableBuffer() did.
1725
1726         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1727         (WebKit::CompositingCoordinator::getCoordinatedBuffer):
1728         (WebKit::CompositingCoordinator::paintToSurface): Deleted.
1729         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1730         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
1731         (WebKit::UpdateAtlas::getCoordinatedBuffer):
1732         (WebKit::UpdateAtlas::paintOnAvailableBuffer): Deleted.
1733         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h:
1734
1735 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
1736
1737         [CoordGraphics] Remove relay CoordinatedBuffer::Client implementations
1738         https://bugs.webkit.org/show_bug.cgi?id=179970
1739
1740         Reviewed by Carlos Garcia Campos.
1741
1742         Drop the helper UpdateAtlasSurfaceClient class and instead directly use
1743         the CoordinatedBuffer's GraphicsContext to perform clip and translation
1744         operations based on the allocated rectangle, to pre-fill the target rect
1745         with transparent color in case the alpha channel is supported, and to
1746         then invoke CoordinatedBuffer::Client::paintToSurfaceContext() method,
1747         passing the GraphicsContext as the argument.
1748
1749         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
1750         (WebKit::UpdateAtlas::paintOnAvailableBuffer):
1751         (): Deleted.
1752
1753 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
1754
1755         [CoordGraphics] Replace CoordinatedSurface, ThreadSafeCoordinatedSurface with CoordinatedBuffer
1756         https://bugs.webkit.org/show_bug.cgi?id=179967
1757
1758         Reviewed by Carlos Garcia Campos.
1759
1760         Replace uses of CoordinatedSurface class with CoordinatedBuffer. The
1761         ThreadSafeCoordinatedSurface class is removed, along with the code in
1762         CoordinatedLayerTreeHost that established a CoordinatedSurface factory.
1763
1764         * PlatformGTK.cmake:
1765         * PlatformWPE.cmake:
1766         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
1767         (WebKit::CoordinatedBackingStoreTile::swapBuffers):
1768         (WebKit::CoordinatedBackingStoreTile::setBackBuffer):
1769         (WebKit::CoordinatedBackingStore::updateTile):
1770         * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
1771         Rename m_surface to m_buffer, m_surfaceOffset to m_bufferOffset.
1772         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1773         (WebKit::CoordinatedGraphicsScene::createUpdateAtlas):
1774         (WebKit::CoordinatedGraphicsScene::updateImageBacking):
1775         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1776         * Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.cpp: Removed.
1777         * Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.h: Removed.
1778         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1779         (WebKit::CompositingCoordinator::updateImageBacking):
1780         (WebKit::CompositingCoordinator::createUpdateAtlas):
1781         (WebKit::CompositingCoordinator::paintToSurface):
1782         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1783         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
1784         (WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
1785         (WebKit::CoordinatedLayerTreeHost::createCoordinatedSurface): Deleted.
1786         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
1787         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
1788         (WebKit::UpdateAtlas::UpdateAtlas):
1789         (WebKit::UpdateAtlas::~UpdateAtlas):
1790         (WebKit::UpdateAtlas::paintOnAvailableBuffer):
1791         * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h:
1792         Rename m_surface to m_buffer.
1793         (WebKit::UpdateAtlas::size const):
1794         (WebKit::UpdateAtlas::supportsAlpha const):
1795
1796 2017-11-22  Ali Juma  <ajuma@chromium.org>
1797
1798         Implement VisualViewport API attributes
1799         https://bugs.webkit.org/show_bug.cgi?id=179385
1800
1801         Reviewed by Frédéric Wang.
1802
1803         Add a VisualViewportAPI experimental feature.
1804
1805         * Shared/WebPreferences.yaml:
1806
1807 2017-11-22  Tim Horton <timothy_horton@apple.com> and Michael Catanzaro <mcatanzaro@igalia.com>
1808
1809         Remove build-webkit's notion of feature flags having a default value
1810         https://bugs.webkit.org/show_bug.cgi?id=177338
1811
1812         Reviewed by Carlos Alberto Lopez Perez.
1813
1814         Use ENABLE_EXPERIMENTAL_FEATURES instead of ENABLE_DEVELOPER_MODE to enable runtime
1815         experimental features.
1816
1817         * Shared/WebPreferencesDefaultValues.h:
1818
1819 2017-11-22  Commit Queue  <commit-queue@webkit.org>
1820
1821         Unreviewed, rolling out r225093.
1822         https://bugs.webkit.org/show_bug.cgi?id=179938
1823
1824         Compilation failed on WinCairo 64-bit Release (Requested by
1825         fredw on #webkit).
1826
1827         Reverted changeset:
1828
1829         "Implement VisualViewport API attributes"
1830         https://bugs.webkit.org/show_bug.cgi?id=179385
1831         https://trac.webkit.org/changeset/225093
1832
1833 2017-11-21  Ali Juma  <ajuma@chromium.org>
1834
1835         Implement VisualViewport API attributes
1836         https://bugs.webkit.org/show_bug.cgi?id=179385
1837
1838         Reviewed by Frédéric Wang.
1839
1840         Add a VisualViewportAPI experimental feature.
1841
1842         * Shared/WebPreferences.yaml:
1843
1844 2017-11-21  Christopher Reid  <chris.reid@sony.com>
1845
1846         [PAL] Remove FileSystem's dependency on WebCoreNSStringExtras
1847         https://bugs.webkit.org/show_bug.cgi?id=179504
1848
1849         Reviewed by Darin Adler.
1850
1851         * UIProcess/Cocoa/WebViewImpl.mm:
1852         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1853         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
1854
1855 2017-11-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1856
1857         [WPE] WPEWebProcess: Couldn't find current GLX or EGL context
1858         https://bugs.webkit.org/show_bug.cgi?id=179883
1859
1860         Reviewed by Žan Doberšek.
1861
1862         I'm seeing that message quite often when running the unit tests. The problem seems to be that some tests run so
1863         fast that the web process never renders the first frame, so the context is created but never made current. I've
1864         checked with apitrace that there are calls to eglQueryContext with null display, causing a EGL_BAD_DISPLAY, but
1865         I don't know where those calls are originated. Making the context current right after it's created fixes the
1866         problem.
1867
1868         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1869         (WebKit::ThreadedCompositor::createGLContext): Always call makeContextCurrent() right after the context is created.
1870
1871 2017-11-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1872
1873         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.19.2 release.
1874
1875         * gtk/NEWS: Add release notes for 2.19.2.
1876
1877 2017-11-20  Don Olmstead  <don.olmstead@sony.com>
1878
1879         Add declspec within WebKit API
1880         https://bugs.webkit.org/show_bug.cgi?id=179893
1881
1882         Reviewed by Darin Adler.
1883
1884         * Shared/API/c/WKDeclarationSpecifiers.h:
1885
1886 2017-11-20  Mario Sanchez Prada  <mario@endlessm.com>
1887
1888         [GTK] New API to add, retrieve and delete cookies via WebKitCookieManager
1889         https://bugs.webkit.org/show_bug.cgi?id=177932
1890
1891         Reviewed by Carlos Garcia Campos.
1892
1893         Added new API to WebKitCookieManager to add, retrieve and delete complete
1894         cookies into/out-of a running session, and updated documentation sections.
1895
1896         * UIProcess/API/glib/WebKitCookieManager.cpp:
1897         (webkit_cookie_manager_add_cookie): New function.
1898         (webkit_cookie_manager_add_cookie_finish): Ditto.
1899         (webkit_cookie_manager_get_cookies): Ditto.
1900         (webkit_cookie_manager_get_cookies_finish): Ditto.
1901         (webkit_cookie_manager_delete_cookie): Ditto.
1902         (webkit_cookie_manager_delete_cookie_finish): Ditto.
1903         * UIProcess/API/gtk/WebKitCookieManager.h: Added new functions.
1904         * UIProcess/API/wpe/WebKitCookieManager.h: Ditto.
1905         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Ditto.
1906
1907 2017-11-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1908
1909         [WPE] webkit_web_view_new() should enable specifying wpe_view_backend object
1910         https://bugs.webkit.org/show_bug.cgi?id=178655
1911
1912         Reviewed by Michael Catanzaro.
1913
1914         Update all WebKitWebView constructors to receive a WebKitWebViewBackend as argument. It's now required to
1915         provide a backend to create a web view, but it can be NULL to use the default one. WebKitWebViewBackend is a
1916         boxed type wrapping a struct wpe_view_backend* used as construct only property of WebKitWebView. The view always
1917         takes the ownership of the WebKitWebViewBackend which owns the struct wpe_view_backend*. An optional
1918         GDestroyNotify and user data pointer can be passed to the WebKitWebViewBackend constructor to provide a custom
1919         deleter for the backend. In the C API the struct wpe_view_backend* is also mandatory now, but it can't be NULL
1920         and it's owned by the caller, not the view.
1921
1922         * PlatformWPE.cmake:
1923         * UIProcess/API/C/wpe/WKView.cpp:
1924         (WKViewCreate):
1925         * UIProcess/API/C/wpe/WKView.h:
1926         * UIProcess/API/glib/WebKitWebView.cpp:
1927         (_WebKitWebViewPrivate::~_WebKitWebViewPrivate):
1928         (webkitWebViewConstructed):
1929         (webkitWebViewSetProperty):
1930         (webkitWebViewGetProperty):
1931         (webkit_web_view_class_init):
1932         (webkitWebViewCreatePage):
1933         (webkit_web_view_get_backend):
1934         * UIProcess/API/wpe/WPEView.cpp:
1935         (WKWPE::m_backend):
1936         (WKWPE::View::~View):
1937         * UIProcess/API/wpe/WebKitWebView.h:
1938         * UIProcess/API/wpe/WebKitWebViewBackend.cpp: Added.
1939         (_WebKitWebViewBackend::_WebKitWebViewBackend):
1940         (_WebKitWebViewBackend::~_WebKitWebViewBackend):
1941         (webkitWebViewBackendRef):
1942         (webkitWebViewBackendUnref):
1943         (webkitWebViewBackendCreateDefault):
1944         (webkit_web_view_backend_new):
1945         (webkit_web_view_backend_get_wpe_backend):
1946         * UIProcess/API/wpe/WebKitWebViewBackend.h: Added.
1947         * UIProcess/API/wpe/WebKitWebViewBackendPrivate.h: Added.
1948         * UIProcess/API/wpe/WebKitWebViewWPE.cpp:
1949         (webkit_web_view_new):
1950         (webkit_web_view_new_with_context):
1951         (webkit_web_view_new_with_related_view):
1952         (webkit_web_view_new_with_settings):
1953         (webkit_web_view_new_with_user_content_manager):
1954         * UIProcess/API/wpe/webkit.h:
1955
1956 2017-11-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1957
1958         [GTK][WPE] webkit_cookie_manager_delete_all_cookies doesn't delete the cookies if called before a web process is running
1959         https://bugs.webkit.org/show_bug.cgi?id=175265
1960
1961         Reviewed by Michael Catanzaro.
1962
1963         This is what happens:
1964
1965         1- We create our WebKitWebContext that creates its WebProcessPool.
1966         2- We set a persistent cookies storage.
1967         3- We ask the website data store to delete all cookies, but since website data store is a web process observer
1968            and we haven't spawned any web process yet, it creates a new WebProcessPool with the default configuration
1969            (no persistent cookies) and sends the message to delete the cookies there.
1970         4- The network process of the second process pool does nothing because it doesn't have cookies at all.
1971
1972         We need to set the primary data store of the WebProcessPool when WebKitWebContext is constructed to ensure that
1973         one is used before the web process is launched.
1974
1975         * UIProcess/API/glib/WebKitWebContext.cpp:
1976         (webkitWebContextConstructed):
1977
1978 2017-11-19  Tim Horton  <timothy_horton@apple.com>
1979
1980         Remove unused TOUCH_ICON_LOADING feature flag
1981         https://bugs.webkit.org/show_bug.cgi?id=179873
1982
1983         Reviewed by Simon Fraser.
1984
1985         * Configurations/FeatureDefines.xcconfig:
1986
1987 2017-11-19  Tim Horton  <timothy_horton@apple.com>
1988
1989         Remove unused LEGACY_VENDOR_PREFIXES feature flag
1990         https://bugs.webkit.org/show_bug.cgi?id=179872
1991
1992         Reviewed by Darin Adler.
1993
1994         * Configurations/FeatureDefines.xcconfig:
1995
1996 2017-11-18  Chris Dumez  <cdumez@apple.com>
1997
1998         ASSERTION FAILED: registration in WebCore::SWServerJobQueue::scriptContextStarted(ServiceWorkerIdentifier)
1999         https://bugs.webkit.org/show_bug.cgi?id=179846
2000
2001         Reviewed by Darin Adler.
2002
2003         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2004         (WebKit::WebSWServerConnection::rejectJobInClient):
2005         (WebKit::WebSWServerConnection::resolveRegistrationJobInClient):
2006         (WebKit::WebSWServerConnection::resolveUnregistrationJobInClient):
2007         (WebKit::WebSWServerConnection::startScriptFetchInClient):
2008         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2009         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
2010         * WebProcess/Storage/WebSWClientConnection.messages.in:
2011         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2012         (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
2013         (WebKit::WebSWContextManagerConnection::didFinishInstall):
2014         * WebProcess/Storage/WebSWContextManagerConnection.h:
2015
2016 2017-11-18  Tim Horton  <timothy_horton@apple.com>
2017
2018         Rename some Network Capture debugging defines
2019         https://bugs.webkit.org/show_bug.cgi?id=179870
2020
2021         Reviewed by Darin Adler.
2022
2023         * NetworkProcess/capture/NetworkCaptureLogging.h:
2024         * NetworkProcess/capture/NetworkCaptureManager.cpp:
2025         (WebKit::NetworkCapture::Manager::findMatch):
2026         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
2027         These shouldn't have WTF in their name - they have nothing to do with WTF.
2028         These shouldn't use ENABLE(), since they're not features, just debugging macros.
2029
2030 2017-11-17  Chris Dumez  <cdumez@apple.com>
2031
2032         [Service Workers] Implement "Notify Controller Change" algorithm
2033         https://bugs.webkit.org/show_bug.cgi?id=179822
2034
2035         Reviewed by Youenn Fablet.
2036
2037         * Scripts/webkit/messages.py:
2038         (class_template_headers):
2039         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2040         (WebKit::WebSWServerConnection::notifyClientsOfControllerChange):
2041         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2042         * WebProcess/Storage/WebSWClientConnection.messages.in:
2043
2044 2017-11-17  Chris Dumez  <cdumez@apple.com>
2045
2046         Use a strongly typed identifier for SWServer::Connection
2047         https://bugs.webkit.org/show_bug.cgi?id=179848
2048
2049         Reviewed by Brady Eidson.
2050
2051         Use a strongly typed identifier for SWServer::Connection, for clarity.
2052
2053         * Scripts/webkit/messages.py:
2054         (forward_declarations_and_headers):
2055         (forward_declarations_and_headers.templates):
2056         (headers_for_type):
2057         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2058         (WebKit::WebSWServerConnection::WebSWServerConnection):
2059         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
2060         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2061         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2062         * StorageProcess/StorageProcess.cpp:
2063         (WebKit::StorageProcess::didFailFetch):
2064         (WebKit::StorageProcess::didNotHandleFetch):
2065         (WebKit::StorageProcess::didReceiveFetchResponse):
2066         (WebKit::StorageProcess::didReceiveFetchData):
2067         (WebKit::StorageProcess::didReceiveFetchFormData):
2068         (WebKit::StorageProcess::didFinishFetch):
2069         * StorageProcess/StorageProcess.h:
2070         * StorageProcess/StorageProcess.messages.in:
2071         * StorageProcess/StorageToWebProcessConnection.cpp:
2072         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
2073         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
2074         (WebKit::StorageToWebProcessConnection::removeSWServerConnection):
2075         (WebKit::generateIDBConnectionToServerIdentifier):
2076         (WebKit::StorageToWebProcessConnection::establishIDBConnectionToServer):
2077         * StorageProcess/StorageToWebProcessConnection.h:
2078         * StorageProcess/StorageToWebProcessConnection.messages.in:
2079         * WebProcess/Storage/WebSWClientConnection.cpp:
2080         (WebKit::WebSWClientConnection::postMessageToServiceWorkerGlobalScope):
2081         * WebProcess/Storage/WebSWClientConnection.h:
2082         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2083         (WebKit::WebSWContextManagerConnection::startFetch):
2084         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope):
2085         * WebProcess/Storage/WebSWContextManagerConnection.h:
2086         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2087         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
2088         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
2089         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
2090         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
2091         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
2092         (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession):
2093         * WebProcess/Storage/WebToStorageProcessConnection.h:
2094
2095 2017-11-17  John Wilander  <wilander@apple.com>
2096
2097         Storage Access API: UI process should update network process about granted access
2098         https://bugs.webkit.org/show_bug.cgi?id=176943
2099         <rdar://problem/34440612>
2100
2101         Reviewed by Alex Christensen.
2102
2103         * NetworkProcess/NetworkProcess.cpp:
2104         (WebKit::NetworkProcess::updateStorageAccessForPrevalentDomains):
2105             Updates storage access on the session.
2106         * NetworkProcess/NetworkProcess.h:
2107         * NetworkProcess/NetworkProcess.messages.in:
2108         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2109         (WebKit::NetworkProcessCreationParameters::encode const):
2110         (WebKit::NetworkProcessCreationParameters::decode):
2111         * NetworkProcess/NetworkProcessCreationParameters.h:
2112         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2113         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2114         (WebKit::NetworkProcess::setStorageAccessAPIEnabled):
2115         * UIProcess/API/C/WKCookieManager.cpp:
2116         (WKCookieManagerSetStorageAccessAPIEnabled):
2117         * UIProcess/API/C/WKCookieManager.h:
2118         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2119         (WKWebsiteDataStoreSetStatisticsHasHadNonRecentUserInteraction):
2120         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2121         * UIProcess/API/Cocoa/WKProcessPool.mm:
2122         (-[WKProcessPool _isStorageAccessAPIEnabled]):
2123         (-[WKProcessPool _setStorageAccessAPIEnabled:]):
2124         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2125         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2126         (-[WKWebsiteDataStore _resourceLoadStatisticsSetHasHadNonRecentUserInteractionForHost:]):
2127             Test infrastructure.
2128         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2129         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2130         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2131         (WebKit::WebProcessPool::setStorageAccessAPIEnabled):
2132         * UIProcess/Network/NetworkProcessProxy.cpp:
2133         (WebKit::nextRequestStorageAccessContextId):
2134         (WebKit::NetworkProcessProxy::updateStorageAccessForPrevalentDomains):
2135             Sends a message to the network process to update storage access.
2136         (WebKit::NetworkProcessProxy::storageAccessRequestResult):
2137             Receives a message from the network process that storage access
2138             was updated.
2139         * UIProcess/Network/NetworkProcessProxy.h:
2140         * UIProcess/Network/NetworkProcessProxy.messages.in:
2141         * UIProcess/WebCookieManagerProxy.cpp:
2142         (WebKit::WebCookieManagerProxy::setStorageAccessAPIEnabled):
2143         * UIProcess/WebCookieManagerProxy.h:
2144         * UIProcess/WebProcessPool.h:
2145         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2146         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
2147         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
2148         (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction):
2149             Test infrastructure.
2150         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
2151             Now makes the API call even if the only operation is to clear first.
2152         * UIProcess/WebResourceLoadStatisticsStore.h:
2153         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2154         (WebKit::WebsiteDataStore::updateStorageAccessForPrevalentDomainsHandler):
2155             Propagates the storage access directive to the network process proxy.
2156         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
2157         * UIProcess/WebsiteData/WebsiteDataStore.h:
2158
2159 2017-11-16  Yousuke Kimoto  <yousuke.kimoto@sony.com>
2160
2161         [WinCairo] Add network (curl) files for wincairo webkit
2162         https://bugs.webkit.org/show_bug.cgi?id=179474
2163
2164         Reviewed by Alex Christensen.
2165
2166         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
2167         (IPC::ArgumentCoder<CertificateInfo>::decode): Fidex return value since currently no operation is needed for wincairo webkit.
2168         (IPC::ArgumentCoder<ResourceError>::decodePlatformData): Fidex return value since currently no operation is needed for wincairo webkit.
2169         * WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.cpp: Renamed from Source/WebKit/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.cpp.
2170         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
2171         * WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.h: Renamed from Source/WebKit/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h.
2172
2173 2017-11-16  Don Olmstead  <don.olmstead@sony.com>
2174
2175         [WinCairo] Update WinCairoRequirements
2176         https://bugs.webkit.org/show_bug.cgi?id=179790
2177
2178         Reviewed by Alex Christensen.
2179
2180         * PlatformWin.cmake:
2181
2182 2017-11-16  Youenn Fablet  <youenn@apple.com>
2183
2184         Service Worker should get the body of intercepted requests
2185         https://bugs.webkit.org/show_bug.cgi?id=179776
2186
2187         Reviewed by Alex Christensen.
2188
2189         Pass a FormDataReference when starting fetch IPC.
2190         Convert this FormDataReference in a FormData and using it to set the FetchRequest body properly in Service Worker process.
2191         Forbid fetch interception when URL is not HTTP/HTTPS.
2192
2193         * Platform/IPC/FormDataReference.h:
2194         (IPC::FormDataReference::FormDataReference):
2195         (IPC::FormDataReference::takeData):
2196         (IPC::FormDataReference::encode const):
2197         (IPC::FormDataReference::decode):
2198         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2199         (WebKit::WebSWServerConnection::startFetch):
2200         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2201         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2202         * WebProcess/Storage/WebSWClientConnection.cpp:
2203         (WebKit::WebSWClientConnection::startFetch):
2204         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2205         (WebKit::WebSWContextManagerConnection::startFetch):
2206         * WebProcess/Storage/WebSWContextManagerConnection.h:
2207         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2208         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2209         (WebKit::WebServiceWorkerProvider::handleFetch):
2210
2211 2017-11-16  Daniel Bates  <dabates@apple.com>
2212
2213         Add feature define for alternative presentation button element
2214         https://bugs.webkit.org/show_bug.cgi?id=179692
2215         Part of <rdar://problem/34917108>
2216
2217         Reviewed by Andy Estes.
2218
2219         Only enabled on Cocoa platforms by default.
2220
2221         * Configurations/FeatureDefines.xcconfig:
2222
2223 2017-11-16  Chris Dumez  <cdumez@apple.com>
2224
2225         [Service Worker] Implement "Try Clear Registration" algorithm
2226         https://bugs.webkit.org/show_bug.cgi?id=179791
2227
2228         Reviewed by Youenn Fablet.
2229
2230         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2231         * WebProcess/Storage/WebSWClientConnection.cpp:
2232         (WebKit::WebSWClientConnection::serviceWorkerStartedControllingClient):
2233         (WebKit::WebSWClientConnection::serviceWorkerStoppedControllingClient):
2234         * WebProcess/Storage/WebSWClientConnection.h:
2235
2236 2017-11-16  Michael Catanzaro  <mcatanzaro@igalia.com>
2237
2238         REGRESSION(r224179): layer flush now requires sync IPC to compute undo/redo availability in EditorState
2239         https://bugs.webkit.org/show_bug.cgi?id=179797
2240
2241         Reviewed by Simon Fraser.
2242
2243         r224179 introduced a performance regression. The newly-added code in WebPage::editorState is
2244         part of a performance-critical path. (The editor state is computed and sent to the UI
2245         process during the layer flush.) Calls to Editor::canUndo and Editor::canRedo were added,
2246         but these calls are both implemented with sync IPC calls to WebPageProxy in the UI process.
2247         WebPageProxy passes them along to PageClientImpl to compute the availability of the
2248         commands.
2249
2250         That's all pointless because this code only exists for the purpose of getting editing
2251         command availability to the UI process. In the case of undo and redo, it's not needed at
2252         all. I did not realize that when writing the code. So canUndo and canRedo should be removed
2253         from EditorState. This ought to be sufficient to avoid the perf regression.
2254
2255         No changes are needed to the GTK/WPE WebKitEditorState API. The API is reimplemented using
2256         WebPageProxy::canUndoRedo instead of EditorState. There should be no changes in behavior,
2257         only performance.
2258
2259         * Shared/EditorState.cpp:
2260         (WebKit::EditorState::PostLayoutData::encode const):
2261         (WebKit::EditorState::PostLayoutData::decode):
2262         * Shared/EditorState.h:
2263         * UIProcess/API/glib/WebKitEditorState.cpp:
2264         (webkitEditorStateCreate):
2265         (webkitEditorStateChanged):
2266         * UIProcess/API/glib/WebKitEditorStatePrivate.h:
2267         * UIProcess/API/glib/WebKitWebView.cpp:
2268         (webkit_web_view_get_editor_state):
2269         * UIProcess/WebPageProxy.cpp:
2270         (WebKit::WebPageProxy::canUndo):
2271         (WebKit::WebPageProxy::canRedo):
2272         * UIProcess/WebPageProxy.h:
2273         * WebProcess/WebPage/WebPage.cpp:
2274         (WebKit::WebPage::editorState const):
2275
2276 2017-11-16  Megan Gardner  <megan_gardner@apple.com>
2277
2278         Remove allowBlockSelection as block selection is not supported anymore
2279         https://bugs.webkit.org/show_bug.cgi?id=179738
2280
2281         Reviewed by Tim Horton.
2282
2283         Remove all instances of the alloweBlockSelection flag. Blocks selection is fully disabled
2284         and thus this flag will do nothing. This was only added as a debug measure last year, and nothing
2285         ever actually used it.
2286
2287         * Shared/WebPageCreationParameters.cpp:
2288         (WebKit::WebPageCreationParameters::encode const):
2289         (WebKit::WebPageCreationParameters::decode):
2290         * Shared/WebPageCreationParameters.h:
2291         * UIProcess/API/Cocoa/WKWebView.mm:
2292         (-[WKWebView _allowsBlockSelection]): Deleted.
2293         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2294         (-[WKWebViewConfiguration init]):
2295         (-[WKWebViewConfiguration copyWithZone:]):
2296         (-[WKWebViewConfiguration _allowsBlockSelection]): Deleted.
2297         (-[WKWebViewConfiguration _setAllowsBlockSelection:]): Deleted.
2298         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2299         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2300         * UIProcess/PageClient.h:
2301         * UIProcess/WebPageProxy.cpp:
2302         (WebKit::WebPageProxy::creationParameters):
2303         * UIProcess/ios/PageClientImplIOS.h:
2304         * UIProcess/ios/PageClientImplIOS.mm:
2305         (WebKit::PageClientImpl::allowsBlockSelection): Deleted.
2306         * WebProcess/WebPage/WebPage.cpp:
2307         * WebProcess/WebPage/WebPage.h:
2308
2309 2017-11-16  Brent Fulgham  <bfulgham@apple.com>
2310
2311         Whitelist additional IOKit properties based on customer feedback
2312         https://bugs.webkit.org/show_bug.cgi?id=179782
2313         <rdar://problem/35508246>
2314
2315         Reviewed by Dean Jackson.
2316
2317         Expand the IOKit property whitelist to recognize a few more properties as valid based on review of logs
2318         from customer systems and our test infrastructure.
2319
2320         * WebProcess/com.apple.WebProcess.sb.in:
2321
2322 2017-11-15  Brady Eidson  <beidson@apple.com>
2323
2324         Implement basics of "Terminate Service Worker" algorithm.
2325         https://bugs.webkit.org/show_bug.cgi?id=179551
2326
2327         Reviewed by Chris Dumez.
2328
2329         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2330         (WebKit::WebSWServerToContextConnection::terminateWorker):
2331         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
2332         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
2333
2334         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2335         (WebKit::WebSWContextManagerConnection::terminateWorker):
2336         (WebKit::WebSWContextManagerConnection::workerTerminated):
2337         * WebProcess/Storage/WebSWContextManagerConnection.h:
2338         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2339
2340 2017-11-15  Brent Fulgham  <bfulgham@apple.com>
2341
2342         Remove access to 'com.apple.mediaaccessibility.public' preferences in WebContent sandbox
2343         https://bugs.webkit.org/show_bug.cgi?id=179747
2344         <rdar://problem/35367346>
2345
2346         Reviewed by Dean Jackson.
2347
2348         The 'mediaaccessibilityd' process handles access to MediaAccessibility preferences. We don't need
2349         to grant the WebContent Process sandbox access to them.
2350
2351         * WebProcess/com.apple.WebProcess.sb.in: 
2352
2353 2017-11-15  Alex Christensen  <achristensen@webkit.org>
2354
2355         Revert r224885
2356         https://bugs.webkit.org/show_bug.cgi?id=179719
2357
2358         * UIProcess/API/APIContentRuleListStore.cpp:
2359         (API::compiledToFile):
2360         r224885 was a speculative fix that did not fix anything on the bots.
2361
2362 2017-11-15  Brent Fulgham  <bfulgham@apple.com>
2363
2364         Unreviewed build fix after r224830.
2365
2366         * WebProcess/com.apple.WebProcess.sb.in: Add missing sysctl-read permissions needed
2367         to support testing on Mac Mini hardware.
2368
2369 2017-11-15  Youenn Fablet  <youenn@apple.com>
2370
2371         Add ServiceWorker to WebProcess plumbery for FormData fetch responses
2372         https://bugs.webkit.org/show_bug.cgi?id=179694
2373
2374         Reviewed by Alex Christensen.
2375
2376         Added plumbery from Service Worker up to Web Process to pass form data response bodies.
2377         A follow-up patch should read the data from Network Process and send it to the ResourceLoader.
2378
2379         * Platform/IPC/FormDataReference.h: Added.
2380         (IPC::FormDataReference::FormDataReference):
2381         (IPC::FormDataReference::takeData):
2382         (IPC::FormDataReference::encode const):
2383         (IPC::FormDataReference::decode):
2384         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2385         (WebKit::WebSWServerConnection::didReceiveFetchFormData):
2386         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2387         * StorageProcess/StorageProcess.cpp:
2388         (WebKit::StorageProcess::didReceiveFetchFormData):
2389         * StorageProcess/StorageProcess.h:
2390         * StorageProcess/StorageProcess.messages.in:
2391         * WebKit.xcodeproj/project.pbxproj:
2392         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2393         (WebKit::ServiceWorkerClientFetch::didReceiveFormData):
2394         * WebProcess/Storage/ServiceWorkerClientFetch.h:
2395         * WebProcess/Storage/ServiceWorkerClientFetch.messages.in:
2396         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
2397         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormData):
2398         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
2399
2400 2017-11-15  Alex Christensen  <achristensen@webkit.org>
2401
2402         Move a compiled WKContentRuleList to its destination before calling mmap
2403         https://bugs.webkit.org/show_bug.cgi?id=179719
2404
2405         Reviewed by Brady Eidson.
2406
2407         Right now we compile a WKContentRuleList to a temporary file, call mmap, close the file, then move it.
2408         Sometimes, especially on bots running tests, the move fails because the temporary file doesn't exist
2409         any more.  Moving the file before mmaping and closing the file might prevent this failure.
2410
2411         * UIProcess/API/APIContentRuleListStore.cpp:
2412         (API::compiledToFile):
2413
2414 2017-11-15  Chris Dumez  <cdumez@apple.com>
2415
2416         [Service Workers] Implement Client API
2417         https://bugs.webkit.org/show_bug.cgi?id=179709
2418
2419         Reviewed by Alex Christensen.
2420
2421         * Shared/WebCoreArgumentCoders.cpp:
2422         * Shared/WebCoreArgumentCoders.h:
2423         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2424         (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope):
2425         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2426         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2427         * WebProcess/Storage/WebSWClientConnection.cpp:
2428         (WebKit::WebSWClientConnection::postMessageToServiceWorkerGlobalScope):
2429         * WebProcess/Storage/WebSWClientConnection.h:
2430         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2431         (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope):
2432         * WebProcess/Storage/WebSWContextManagerConnection.h:
2433         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2434
2435 2017-11-15  Ryan Haddad  <ryanhaddad@apple.com>
2436
2437         Unreviewed, rolling out r224863.
2438
2439         Introduced LayoutTest crashes on iOS Simulator.
2440
2441         Reverted changeset:
2442
2443         "Move JSONValues to WTF and convert uses of InspectorValues.h
2444         to JSONValues.h"
2445         https://bugs.webkit.org/show_bug.cgi?id=173793
2446         https://trac.webkit.org/changeset/224863
2447
2448 2017-11-14  Brent Fulgham  <bfulgham@apple.com>
2449
2450         Remove access to "com.apple.pbs.fetch_services" from WebContent sandbox
2451         https://bugs.webkit.org/show_bug.cgi?id=179689
2452         <rdar://problem/35369172>
2453
2454         Reviewed by Per Arne Vollan.
2455
2456         WebKit's WebContent process should not have any need to interact with the fetch_services
2457         API exposed to the system. These interactions (if needed) should be happening in the UIProcess,
2458         so we should prevent the untrusted Web Content Process from being able to connect.
2459
2460         * WebProcess/com.apple.WebProcess.sb.in:
2461
2462 2017-11-15  Michael Catanzaro  <mcatanzaro@igalia.com>
2463
2464         Remove GTK web inspector images
2465         https://bugs.webkit.org/show_bug.cgi?id=179716
2466
2467         Reviewed by Carlos Garcia Campos.
2468
2469         * InspectorGResources.cmake:
2470
2471 2017-11-15  Gabriel Ivascu  <givascu@igalia.com>
2472
2473         [GTK] Automatically adjust font size when gtk-xft-dpi changes
2474         https://bugs.webkit.org/show_bug.cgi?id=142673
2475
2476         Some follow-up fixes for the previous patch.
2477
2478         Reviewed by Carlos Garcia Campos.
2479
2480         * UIProcess/API/glib/WebKitSettings.cpp:
2481         (webKitSettingsDispose):
2482         (webKitSettingsConstructed):
2483
2484 2017-11-14  Nan Wang  <n_wang@apple.com>
2485
2486         AX: AOM: Implement AccessibleNode class and support label and role attributes
2487         https://bugs.webkit.org/show_bug.cgi?id=179494
2488
2489         Reviewed by Ryosuke Niwa.
2490
2491         * Shared/WebPreferences.yaml:
2492         * UIProcess/API/C/WKPreferences.cpp:
2493         (WKPreferencesSetAccessibilityObjectModelEnabled):
2494         (WKPreferencesGetAccessibilityObjectModelEnabled):
2495         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2496
2497 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2498
2499         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
2500         https://bugs.webkit.org/show_bug.cgi?id=173793
2501
2502         Reviewed by Brian Burg.
2503
2504         Based on patch by Brian Burg.
2505
2506         * UIProcess/Automation/WebAutomationSession.cpp:
2507         (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext):
2508         (WebKit::WebAutomationSession::moveWindowOfBrowsingContext):
2509         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage):
2510         (WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame):
2511         (WebKit::WebAutomationSession::respondToPendingPageNavigationCallbacksWithTimeout):
2512         (WebKit::WebAutomationSession::respondToPendingFrameNavigationCallbacksWithTimeout):
2513         (WebKit::WebAutomationSession::navigationOccurredForFrame):
2514         (WebKit::WebAutomationSession::documentLoadedForFrame):
2515         (WebKit::WebAutomationSession::inspectorFrontendLoaded):
2516         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
2517         (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
2518         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload):
2519         (WebKit::WebAutomationSession::addSingleCookie):
2520         (WebKit::WebAutomationSession::setSessionPermissions):
2521         (WebKit::WebAutomationSession::performMouseInteraction):
2522         (WebKit::WebAutomationSession::performKeyboardInteractions):
2523         * UIProcess/Automation/WebAutomationSession.h:
2524
2525 2017-11-14  Chris Dumez  <cdumez@apple.com>
2526
2527         [Service Workers] Implement container.getRegistrations()
2528         https://bugs.webkit.org/show_bug.cgi?id=179672
2529
2530         Reviewed by Brady Eidson.
2531
2532         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2533         (WebKit::WebSWServerConnection::getRegistrations):
2534         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2535         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
2536         * WebProcess/Storage/WebSWClientConnection.cpp:
2537         (WebKit::WebSWClientConnection::didGetRegistrations):
2538         (WebKit::WebSWClientConnection::getRegistrations):
2539         * WebProcess/Storage/WebSWClientConnection.h:
2540         * WebProcess/Storage/WebSWClientConnection.messages.in:
2541
2542 2017-11-14  Youenn Fablet  <youenn@apple.com>
2543
2544         Implement ServiceWorker handle fetch for navigation loads
2545         https://bugs.webkit.org/show_bug.cgi?id=179404
2546
2547         Reviewed by Alex Christensen and Chris Dumez.
2548
2549         Update handle fetch algorithm to support navigation requests.
2550         In case of navigation requests, set service worker response mime type to text/html if none is provided.
2551
2552         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2553         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
2554         * WebProcess/Storage/WebSWClientConnection.cpp:
2555         (WebKit::WebSWClientConnection::startFetch):
2556         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2557         (WebKit::shouldHandleFetch):
2558         (WebKit::WebServiceWorkerProvider::handleFetch):
2559
2560 2017-11-14  Alex Christensen  <achristensen@webkit.org>
2561
2562         Remove Cocoa CFURLConnection loading code
2563         https://bugs.webkit.org/show_bug.cgi?id=179688
2564
2565         Reviewed by Antti Koivisto.
2566
2567         * NetworkProcess/Downloads/Download.h:
2568
2569 2017-11-14  Daniel Bates  <dabates@apple.com>
2570
2571         Update comment in FeatureDefines.xcconfig to reflect location of Visual Studio property files
2572         for feature defines
2573
2574         Following r195498 and r201917 the Visual Studio property files for feature defines have
2575         moved from directory WebKitLibraries/win/tools/vsprops to directory Source/cmake/tools/vsprops.
2576         Update the comment in FeatureDefines.xcconfig to reflect the new location and names of these
2577         files.
2578
2579         * Configurations/FeatureDefines.xcconfig:
2580
2581 2017-11-14  Brent Fulgham  <bfulgham@apple.com>
2582
2583         Whitelist some IOKIt properties to avoid sandbox violations on YouTube
2584         https://bugs.webkit.org/show_bug.cgi?id=179683
2585         <rdar://problem/35415368>
2586
2587         Reviewed by Dean Jackson.
2588
2589         YouTube video playback on some hardware (and some video encodings) generates sandbox violations. Add
2590         whitelist entries for the relevant IOKit properties needed to support these activities.
2591
2592         * WebProcess/com.apple.WebProcess.sb.in:
2593
2594 2017-11-14  Daniel Bates  <dabates@apple.com>
2595
2596         Mark WebChromeClient::requestStorageAccess() as final
2597         https://bugs.webkit.org/show_bug.cgi?id=179673
2598
2599         Reviewed by Sam Weinig.
2600
2601         Mark WebChromeClient::requestStorageAccess() as final so that it overrides the virtual function
2602         in ChromeClient with the same name and hence we actually call it through a ChromeClient pointer.
2603
2604         * WebProcess/WebCoreSupport/WebChromeClient.h:
2605
2606 2017-11-14  Youenn Fablet  <youenn@apple.com>
2607
2608         WebSWClientConnection should do IPC to StorageProcess if its WebSWOriginTable is not yet initialized
2609         https://bugs.webkit.org/show_bug.cgi?id=179668
2610
2611         Reviewed by Chris Dumez.
2612
2613         There may be cases where the origin table is not initialized and we would think there is no service worker registration.
2614         In such a case, we should go to the StorageProcess.
2615         StorageProcess is now sending an IPC message back to each registered SW connection so that WebProcess will know whether its map
2616         is correctly initialized or not.
2617
2618         Renaming hasServiceWorkerRegisteredForOrigin in mayHaveServiceWorkerRegisteredForOrigin.
2619
2620         * WebProcess/Storage/WebSWClientConnection.cpp:
2621         (WebKit::WebSWClientConnection::mayHaveServiceWorkerRegisteredForOrigin const):
2622         (WebKit::WebSWClientConnection::matchRegistration):
2623         (WebKit::WebSWClientConnection::hasServiceWorkerRegisteredForOrigin const): Deleted.
2624         * WebProcess/Storage/WebSWClientConnection.h:
2625         * WebProcess/Storage/WebSWOriginTable.h:
2626         (WebKit::WebSWOriginTable::isInitialized const):
2627         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2628         (WebKit::shouldHandleFetch):
2629
2630 2017-11-14  Brent Fulgham  <bfulgham@apple.com>
2631
2632         Consolidate sysctl-read rules in WebProcess sandbox
2633         https://bugs.webkit.org/show_bug.cgi?id=179674
2634         <rdar://problem/35367154>
2635
2636         Reviewed by Dean Jackson.
2637
2638         Consolidate the various calls to 'allow sysctl-read' imported during Bug 179548 into
2639         the main function in the sandbox profile.
2640
2641         Remove the statement to grant global sysctl-read permissions that was copied into this
2642         sandbox profile in an earlier checkin. We started blocking the blanket read permissions in
2643         macOS 10.13, and want to continue to do so.
2644         
2645         The earlier "grant global read access" in 'system.sb' apparently allowed some sysctl reads
2646         to occur before we hit the block declaration in the WebContent sandbox. Now that we are
2647         consistently blocking systcl reads from the start, we need to add whitelist entries for a
2648         few more entries to avoid creating new sandbox violations.
2649
2650         * WebProcess/com.apple.WebProcess.sb.in:
2651
2652 2017-11-14  Alex Christensen  <achristensen@webkit.org>
2653
2654         Remove WebKit CFURLConnection code
2655         https://bugs.webkit.org/show_bug.cgi?id=179645
2656
2657         Reviewed by Alexey Proskuryakov.
2658
2659         The CFURLConnection code is Windows-specific now. Nobody can use it in modern WebKit.
2660
2661         * NetworkProcess/Downloads/Download.h:
2662         * NetworkProcess/Downloads/mac/DownloadMac.mm:
2663         * NetworkProcess/NetworkLoad.h:
2664         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2665         (WebKit::serverTrustCredential):
2666         * NetworkProcess/mac/NetworkLoadMac.mm:
2667         * Shared/Authentication/AuthenticationManager.cpp:
2668         (WebKit::AuthenticationManager::useCredentialForSingleChallenge):
2669         (WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge):
2670         (WebKit::AuthenticationManager::cancelSingleChallenge):
2671         (WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge):
2672         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge):
2673         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
2674         * Shared/Authentication/mac/AuthenticationManager.mac.mm:
2675         (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge):
2676         * Shared/WebProcessCreationParameters.cpp:
2677         (WebKit::WebProcessCreationParameters::encode const):
2678         (WebKit::WebProcessCreationParameters::decode):
2679         * Shared/WebProcessCreationParameters.h:
2680         * Shared/mac/WebCoreArgumentCodersMac.mm:
2681         (IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
2682         (IPC::ArgumentCoder<ResourceRequest>::decodePlatformData):
2683         * config.h:
2684
2685 2017-11-14  Alex Christensen  <achristensen@webkit.org>
2686
2687         Remove assertions added in r224791
2688         https://bugs.webkit.org/show_bug.cgi?id=178751#c10
2689
2690         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2691         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2692         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
2693         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
2694         I had added assertions that sandbox extension handle consumption succeeds.
2695         In the API test IndexedDB.StructuredCloneBackwardCompatibility we get a sandbox extension handle
2696         to give access to a directory that does not exist and consumption fails.  We want it to fail,
2697         so my optimistic addition of a success assertion was incorrect.  The test passes without it
2698         and behaves like it used to.
2699
2700 2017-11-14  Tim Horton  <timothy_horton@apple.com>
2701
2702         Don't use -[NSString stringWithFormat:] to build defaults keys
2703         https://bugs.webkit.org/show_bug.cgi?id=179680
2704
2705         Reviewed by Simon Fraser.
2706
2707         * UIProcess/mac/WebPreferencesMac.mm:
2708         (WebKit::makeKey):
2709         (WebKit::debugUserDefaultsValue):
2710         Use string concatenation instead of stringWithFormat to build
2711         preference keys. This wasn't a huge cost, but it shaves a few milliseconds
2712         off process launch.
2713
2714 2017-11-14  Alex Christensen  <achristensen@webkit.org>
2715
2716         Clean up old URL parser remnants
2717         https://bugs.webkit.org/show_bug.cgi?id=179573
2718
2719         Reviewed by Darin Adler.
2720
2721         * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
2722         (WebKit::WebContextMenuClient::searchWithGoogle):
2723         Use https if we do end up searching with google.
2724
2725 2017-11-14  Antti Koivisto  <antti@apple.com>
2726
2727         Enable display:contents by default
2728         https://bugs.webkit.org/show_bug.cgi?id=179655
2729
2730         Reviewed by Sam Weinig.
2731
2732         * Shared/WebPreferences.yaml:
2733
2734         Make non-experimental and enabled.
2735
2736 2017-11-10  Brent Fulgham  <bfulgham@apple.com>
2737
2738         Consolidate mach-lookup calls in WebProcess sandbox
2739         https://bugs.webkit.org/show_bug.cgi?id=179650
2740         <rdar://problem/35367154>
2741
2742         Reviewed by Dean Jackson.
2743
2744         Consolidate the various calls to 'allow mach-lookup' imported during Bug 179548 into the main
2745         function in the sandbox profile. Remove some entries that are not needed by WebKit.
2746
2747         Remove the statement to grant global permission to perform mach-lookup for any xpc
2748         service name that was copied into this sandbox profile in Bug 179548. We started blocking
2749         this in macOS 10.13 and want to continue to do so.
2750         
2751         The earlier "grant global permission" in 'system.sb' apparently allowed some xpc lookups to occur
2752         before we hit the block declaration in the WebContent sandbox. Now that we are consistently blocking
2753         mach lookups we need to add whitelist entries for a few more services to avoid creating new
2754         sandbox violations.
2755
2756         * WebProcess/com.apple.WebProcess.sb.in:
2757
2758 2017-11-14  Tim Horton  <timothy_horton@apple.com>
2759
2760         Long pressing a phone number with spaces in it results in a link sheet instead of a data detectors sheet
2761         https://bugs.webkit.org/show_bug.cgi?id=179646
2762         <rdar://problem/35337288>
2763
2764         Reviewed by Simon Fraser.
2765
2766         * UIProcess/ios/WKActionSheetAssistant.mm:
2767         (-[WKActionSheetAssistant showImageSheet]):
2768         (-[WKActionSheetAssistant showLinkSheet]):
2769         (-[WKActionSheetAssistant showDataDetectorsSheet]):
2770         * UIProcess/ios/WKContentViewInteraction.mm:
2771         (-[WKContentView _actionForLongPressFromPositionInformation:]):
2772         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
2773         Make use of canBePresentedByDataDetectors with our WebCore URL instead
2774         of (sometimes unsucessfully) reparsing the URL with NSURL's parser.
2775         Also, avoid a few unnecessary round-trips through String when converting
2776         from URL to NSURL.
2777
2778 2017-11-14  Brent Fulgham  <bfulgham@apple.com>
2779
2780         REGRESSION(r224799): WebKit crashes on Sierra due to sandbox violation
2781         https://bugs.webkit.org/show_bug.cgi?id=179656
2782         
2783         Unreviewed build fix.
2784
2785         * WebProcess/com.apple.WebProcess.sb.in: Switch to Dan's recommended version check.
2786
2787 2017-11-13  Joseph Pecoraro  <pecoraro@apple.com>
2788
2789         Give a ServiceWorker WebContentProcess a different display name
2790         https://bugs.webkit.org/show_bug.cgi?id=179653
2791
2792         Reviewed by Brady Eidson.
2793
2794         * UIProcess/WebProcessProxy.h:
2795         * UIProcess/WebProcessProxy.cpp:
2796         (WebKit::WebProcessProxy::create):
2797         Call connect after construction so virtual methods will use subclass implementations.
2798
2799         * UIProcess/ServiceWorkerProcessProxy.h:
2800         * UIProcess/ServiceWorkerProcessProxy.cpp:
2801         (WebKit::ServiceWorkerProcessProxy::create):
2802         Copy the pattern from WebProcessProxy to ensure connect() gets called after construction.
2803
2804         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
2805         Set a launch option to signal this is a Service Worker process.
2806
2807         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
2808         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
2809         * WebProcess/cocoa/WebProcessCocoa.mm:
2810         (WebKit::WebProcess::initializeProcessName):
2811         Consume the launch option to configuration the process name.
2812
2813 2017-11-13  Ryosuke Niwa  <rniwa@webkit.org>
2814
2815         REGRESSION(r224799): WebKit crashes at launch on macOS Sierra due to a sandbox violation
2816         https://bugs.webkit.org/show_bug.cgi?id=179656
2817
2818         Unreviewed. Revert r224799 on macOS Sierra.
2819
2820         * WebProcess/com.apple.WebProcess.sb.in:
2821
2822 2017-11-13  Chris Dumez  <cdumez@apple.com>
2823
2824         Send ServiceWorkerData structs to the WebProcesses instead of ServiceWorkerIdentifiers
2825         https://bugs.webkit.org/show_bug.cgi?id=179649
2826
2827         Reviewed by Brady Eidson.
2828
2829         * Shared/WebCoreArgumentCoders.h:
2830         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2831         (WebKit::WebSWServerConnection::updateRegistrationStateInClient):
2832         (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
2833         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2834         * WebProcess/Storage/WebSWClientConnection.cpp:
2835         (WebKit::WebSWClientConnection::postMessageToServiceWorkerClient):
2836         * WebProcess/Storage/WebSWClientConnection.h:
2837         * WebProcess/Storage/WebSWClientConnection.messages.in:
2838
2839 2017-11-13  Brady Eidson  <beidson@apple.com>
2840
2841         Massive "Server-process-to-context-process" connection overhaul.
2842         https://bugs.webkit.org/show_bug.cgi?id=179554
2843
2844         Reviewed by Chris Dumez.
2845
2846         * DerivedSources.make:
2847         * WebKit.xcodeproj/project.pbxproj:
2848
2849         * Shared/WebCoreArgumentCoders.h:
2850
2851         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2852         (WebKit::WebSWServerConnection::sendToContextProcess):
2853         (WebKit::WebSWServerConnection::installServiceWorkerContext): Deleted.
2854         (WebKit::WebSWServerConnection::fireInstallEvent): Deleted.
2855         (WebKit::WebSWServerConnection::fireActivateEvent): Deleted.
2856         (WebKit::WebSWServerConnection::setContextConnection): Deleted.
2857         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2858
2859         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp: Copied from Source/WebCore/workers/service/server/SWServerWorker.cpp.
2860         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
2861         (WebKit::WebSWServerToContextConnection::messageSenderConnection):
2862         (WebKit::WebSWServerToContextConnection::messageSenderDestinationID):
2863         (WebKit::WebSWServerToContextConnection::connectionClosed):
2864         (WebKit::WebSWServerToContextConnection::installServiceWorkerContext):
2865         (WebKit::WebSWServerToContextConnection::fireInstallEvent):
2866         (WebKit::WebSWServerToContextConnection::fireActivateEvent):
2867         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h: Copied from Source/WebCore/workers/service/ServiceWorkerTypes.h.
2868         (WebKit::WebSWServerToContextConnection::create):
2869         (WebKit::WebSWServerToContextConnection::ipcConnection const):
2870         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: Copied from Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in.
2871
2872         * StorageProcess/StorageProcess.cpp:
2873         (WebKit::StorageProcess::didClose):
2874         (WebKit::StorageProcess::didReceiveMessage):
2875         (WebKit::StorageProcess::globalServerToContextConnection):
2876         (WebKit::StorageProcess::createServerToContextConnection):
2877         (WebKit::StorageProcess::didGetWorkerContextProcessConnection):
2878         (WebKit::StorageProcess::workerContextProcessConnection): Deleted.
2879         (WebKit::StorageProcess::createWorkerContextProcessConnection): Deleted.
2880         (WebKit::StorageProcess::serviceWorkerContextFailedToStart): Deleted.
2881         (WebKit::StorageProcess::serviceWorkerContextStarted): Deleted.
2882         (WebKit::StorageProcess::didFinishServiceWorkerInstall): Deleted.
2883         (WebKit::StorageProcess::didFinishServiceWorkerActivation): Deleted.
2884         (WebKit::StorageProcess::setServiceWorkerHasPendingEvents): Deleted.
2885         * StorageProcess/StorageProcess.h:
2886         * StorageProcess/StorageProcess.messages.in:
2887
2888         * StorageProcess/StorageToWebProcessConnection.cpp:
2889         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
2890         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
2891         (WebKit::StorageToWebProcessConnection::workerContextProcessConnectionCreated):
2892
2893         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2894         (WebKit::WebSWContextManagerConnection::installServiceWorker):
2895         (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
2896         (WebKit::WebSWContextManagerConnection::fireInstallEvent):
2897         (WebKit::WebSWContextManagerConnection::fireActivateEvent):
2898         (WebKit::WebSWContextManagerConnection::didFinishInstall):
2899         (WebKit::WebSWContextManagerConnection::didFinishActivation):
2900         (WebKit::WebSWContextManagerConnection::setServiceWorkerHasPendingEvents):
2901         * WebProcess/Storage/WebSWContextManagerConnection.h:
2902         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2903
2904 2017-11-13  Brent Fulgham  <bfulgham@apple.com>
2905
2906         WebContent sandbox should not include 'system.sb'
2907         https://bugs.webkit.org/show_bug.cgi?id=179548
2908         <rdar://problem/35367154>
2909
2910         Reviewed by Darin Adler.
2911
2912         Stop including 'system.sb', and just include the portions of that sandbox that we
2913         actually use in WebContent Process. This is the first step in some further sandbox
2914         tightening.
2915
2916         * WebProcess/com.apple.WebProcess.sb.in:
2917
2918 2017-11-13  Simon Fraser  <simon.fraser@apple.com>
2919
2920         When navigating back to a page, compositing layers may not use accelerated drawing
2921         https://bugs.webkit.org/show_bug.cgi?id=178749
2922         rdar://problem/35158946
2923
2924         Reviewed by Dean Jackson.
2925
2926         Avoid assertions when a test enables accelerated drawing (which we can't support
2927         in the iOS simulator).
2928
2929         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
2930         (WebKit::RemoteLayerBackingStore::ensureBackingStore):
2931
2932 2017-11-13  Youenn Fablet  <youenn@apple.com>
2933
2934         matchRegistration does not need to go to StorageProcess if no service worker is registered
2935         https://bugs.webkit.org/show_bug.cgi?id=179480
2936
2937         Reviewed by Chris Dumez.
2938
2939         Removed origin store handling from StorageProcess since it is now handled within SWServer.
2940         Updated clearing of web site data accordingly.
2941         Optimized matchRegistration by looking at the origin store before doing any IPC.
2942         Do IPC to the StorageProcess if the origin store is not yet initialized on the WebProcess.
2943
2944         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
2945         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2946         (WebKit::WebSWServerConnection::resolveRegistrationJobInClient):
2947         (WebKit::WebSWServerConnection::resolveUnregistrationJobInClient):
2948         * StorageProcess/StorageProcess.cpp:
2949         (WebKit::StorageProcess::deleteWebsiteData):
2950         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
2951         (WebKit::StorageProcess::swServerForSession):
2952         (WebKit::StorageProcess::swOriginStoreForSession):
2953         (WebKit::StorageProcess::registerSWServerConnection):
2954         (WebKit::StorageProcess::unregisterSWServerConnection):
2955         (WebKit::StorageProcess::ensureSWOriginStoreForSession): Deleted.
2956         (WebKit::StorageProcess::swOriginStoreForSession const): Deleted.
2957         * StorageProcess/StorageProcess.h:
2958         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp:
2959         (WebKit::WebSWOriginStore::addToStore):
2960         (WebKit::WebSWOriginStore::removeFromStore):
2961         (WebKit::WebSWOriginStore::clearStore):
2962         (WebKit::WebSWOriginStore::add): Deleted.
2963         (WebKit::WebSWOriginStore::remove): Deleted.
2964         (WebKit::WebSWOriginStore::clear): Deleted.
2965         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
2966         * WebProcess/Storage/WebSWClientConnection.cpp:
2967         (WebKit::WebSWClientConnection::matchRegistration):
2968
2969 2017-11-13  Alex Christensen  <achristensen@webkit.org>
2970
2971         Merge NetworkProcess::EnsurePrivateBrowsingSession and NetworkProcess::AddWebsiteDataStore into one message type
2972         https://bugs.webkit.org/show_bug.cgi?id=178751
2973
2974         Reviewed by Brady Eidson.
2975
2976         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2977         (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
2978         * NetworkProcess/NetworkProcess.cpp:
2979         (WebKit::NetworkProcess::initializeNetworkProcess):
2980         (WebKit::NetworkProcess::ensurePrivateBrowsingSession): Deleted.
2981         * NetworkProcess/NetworkProcess.h:
2982         * NetworkProcess/NetworkProcess.messages.in:
2983         * NetworkProcess/RemoteNetworkingContext.h:
2984         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2985         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2986         (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession): Deleted.
2987         * Shared/WebsiteDataStoreParameters.cpp:
2988         (WebKit::WebsiteDataStoreParameters::legacyPrivateSessionParameters):
2989         * Shared/WebsiteDataStoreParameters.h:
2990         * UIProcess/WebProcessPool.cpp:
2991         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
2992         (WebKit::WebProcessPool::createNewWebProcess):
2993         (WebKit::WebProcessPool::pageAddedToProcess):
2994         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2995         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
2996         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
2997         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
2998         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
2999         (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession): Deleted.
3000         * WebProcess/WebPage/WebPage.cpp:
3001         (WebKit::WebPage::setSessionID):
3002         * WebProcess/WebProcess.cpp:
3003         (WebKit::WebProcess::ensurePrivateBrowsingSession): Deleted.
3004         * WebProcess/WebProcess.h:
3005         * WebProcess/WebProcess.messages.in:
3006
3007 2017-11-13  Alex Christensen  <achristensen@webkit.org>
3008
3009         Add logs to debug content extension test failures
3010         https://bugs.webkit.org/show_bug.cgi?id=179624
3011
3012         Reviewed by Chris Dumez.
3013
3014         * UIProcess/API/APIContentRuleListStore.cpp:
3015         (API::compiledToFile):
3016         Right now I'm seeing this log:
3017         "Rule list compilation failed: Unspecified error during compile."
3018         I need more information to debug what is failing on the bots.
3019
3020 2017-11-07  Brian Burg  <bburg@apple.com>
3021
3022         Web Automation: inViewCenterPoint should not include topContentInset when computed in viewport coordinates
3023         https://bugs.webkit.org/show_bug.cgi?id=179129
3024         <rdar://problem/35297038>
3025
3026         Reviewed by Simon Fraser.
3027
3028         When computing the in view center point per W3C specification, the top content inset
3029         is inadvertently added back in when converting to the root view coordinate system.
3030
3031         This patch reworks the protocol command so that it explicitly requests a coordinate
3032         system, with options for "Page" (root / contents), "LayoutViewport", and "VisualViewport".
3033         The latter is not implemented in this patch, since it is intended for use on iOS someday.
3034
3035         * UIProcess/Automation/Automation.json:
3036         Change usesViewport to CoordinateSystem.
3037         Add a new coordinate system enum type and use it.
3038         Fix relevant comments for Automation.computElementLayout.
3039
3040         * UIProcess/Automation/WebAutomationSession.h:
3041         * UIProcess/Automation/WebAutomationSession.cpp:
3042         (WebKit::protocolStringToCoordinateSystem):
3043         (WebKit::WebAutomationSession::computeElementLayout):
3044         Parse the requested coordinate system and send it in the message to the web process.
3045
3046         * WebKit.xcodeproj/project.pbxproj:
3047         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
3048         * WebProcess/Automation/WebAutomationSessionProxy.h:
3049         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3050         (WebKit::WebAutomationSessionProxy::computeElementLayout):
3051         Rework the implementation. Get the element bounds and in-view center point in
3052         client coordinates and convert back to root view coordinates for CoordinateSystem::Page.
3053
3054 2017-11-08  Keith Miller  <keith_miller@apple.com>
3055
3056         Async iteration should only fetch the next method once and add feature flag
3057         https://bugs.webkit.org/show_bug.cgi?id=179451
3058
3059         Reviewed by Geoffrey Garen.
3060
3061         Add feature flag for Async iteration.
3062
3063         * Configurations/FeatureDefines.xcconfig:
3064
3065 2017-11-13  Mark Lam  <mark.lam@apple.com>
3066
3067         Add more overflow check book-keeping for MarkedArgumentBuffer.
3068         https://bugs.webkit.org/show_bug.cgi?id=179634
3069         <rdar://problem/35492517>
3070
3071         Reviewed by Saam Barati.
3072
3073         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
3074         (WebKit::NPJSObject::construct):
3075         (WebKit::NPJSObject::invoke):
3076
3077 2017-11-13  Timothy Horton  <timothy_horton@apple.com>
3078
3079         Address some post-landing review comments from r224728
3080         https://bugs.webkit.org/show_bug.cgi?id=179576
3081
3082         * Platform/IPC/mac/MachMessage.h:
3083         (IPC::MachMessage::setMessageReceiverName):
3084         (IPC::MachMessage::setMessageName):
3085         More moving!
3086
3087 2017-11-13  Tim Horton  <timothy_horton@apple.com>
3088
3089         Occasional MobileSafari crash under -[WKPDFView web_setMinimumSize:]
3090         https://bugs.webkit.org/show_bug.cgi?id=179628
3091         <rdar://problem/34773037>
3092
3093         Reviewed by Simon Fraser.
3094
3095         * UIProcess/ios/WKPDFView.mm:
3096         (-[WKPDFView _computePageAndDocumentFrames]):
3097         Similar to r223444, avoid propagating null CGRects into the view hierarchy.
3098         In this case, the null rect comes from applying margins to a rect that is 
3099         smaller than the margins. We could check for that specifically, but a
3100         more-general check for a null rect seems reasonable.
3101
3102 2017-11-13  Tim Horton  <timothy_horton@apple.com>
3103
3104         Use the real mach type instead of reinterpret_casting in MachMessage
3105         https://bugs.webkit.org/show_bug.cgi?id=179629
3106
3107         Reviewed by Dan Bernstein.
3108
3109         * Platform/IPC/mac/MachMessage.cpp:
3110         (IPC::MachMessage::header):
3111         * Platform/IPC/mac/MachMessage.h:
3112         Just use mach_msg_header_t proper, and avoid the reinterpret_cast.
3113         This also corrects the alignment of the struct on platforms where
3114         alignof(mach_msg_header_t) != alignof(uint8_t).
3115
3116 2017-11-13  Gabriel Ivascu  <givascu@igalia.com>
3117
3118         [GTK] Automatically adjust font size when gtk-xft-dpi changes
3119         https://bugs.webkit.org/show_bug.cgi?id=142673
3120
3121         Reviewed by Michael Catanzaro.
3122
3123         * UIProcess/API/glib/WebKitSettings.cpp:
3124         (webKitSettingsDispose):
3125         (webKitSettingsConstructed):
3126         (webkit_settings_class_init):
3127
3128 2017-11-13  Chris Dumez  <cdumez@apple.com>
3129
3130         Implement "Service Worker Has No Pending Events" / "Update Service Worker Extended Events Set" algorithms
3131         https://bugs.webkit.org/show_bug.cgi?id=179618
3132
3133         Reviewed by Brady Eidson.
3134
3135         * StorageProcess/StorageProcess.cpp:
3136         (WebKit::StorageProcess::setServiceWorkerHasPendingEvents):
3137         * StorageProcess/StorageProcess.h:
3138         * StorageProcess/StorageProcess.messages.in:
3139         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3140         (WebKit::WebSWContextManagerConnection::setServiceWorkerHasPendingEvents):
3141         * WebProcess/Storage/WebSWContextManagerConnection.h:
3142
3143 2017-11-13  Wenson Hsieh  <wenson_hsieh@apple.com>
3144
3145         [Attachment Support] Implement SPI for clients to request data for a given attachment
3146         https://bugs.webkit.org/show_bug.cgi?id=179586
3147         <rdar://problem/35355720>
3148
3149         Reviewed by Darin Adler.
3150
3151         Adds support in WebKit for fetching data for a given attachment element. See WebCore/ChangeLog for more details.
3152         Most of the changes here are boilerplate plumbing of -requestAttachmentData through the client layers.
3153
3154         Test coverage by augmenting existing API tests in WKAttachmentTests, and adding 3 new tests.
3155
3156         * UIProcess/API/APIAttachment.cpp:
3157         (API::Attachment::requestData):
3158         * UIProcess/API/APIAttachment.h:
3159         * UIProcess/API/Cocoa/_WKAttachment.h:
3160         * UIProcess/API/Cocoa/_WKAttachment.mm:
3161         (-[_WKAttachment requestData:]):
3162         * UIProcess/WebPageProxy.cpp:
3163         (WebKit::WebPageProxy::sharedBufferCallback):
3164
3165         Add a new IPC callback helper type, SharedBufferCallback. This is similar to the existing DataCallback, but
3166         instead of deserializing to an API::Data, we convert to a SharedBuffer instead. Additionally,
3167         SharedBufferCallback is able to draw a distinction between null data and empty data. This allows -requestData:
3168         to distinguish between cases where (for instance) the data for a given attachment is an empty blob, and when
3169         the attachment doesn't exist at all.
3170
3171         (WebKit::WebPageProxy::dataCallback):
3172         (WebKit::WebPageProxy::insertAttachment):
3173         (WebKit::WebPage::invokeSharedBufferCallback):
3174         (WebKit::WebPageProxy::requestAttachmentData):
3175         * UIProcess/WebPageProxy.h:
3176         * UIProcess/WebPageProxy.messages.in:
3177         * WebProcess/WebPage/WebPage.cpp:
3178         (WebKit::WebPage::requestAttachmentData):
3179         * WebProcess/WebPage/WebPage.h:
3180         * WebProcess/WebPage/WebPage.messages.in:
3181
3182 2017-11-12  Darin Adler  <darin@apple.com>
3183
3184         More is<> and downcast<>, less static_cast<>
3185         https://bugs.webkit.org/show_bug.cgi?id=179600
3186
3187         Reviewed by Chris Dumez.
3188
3189         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.cpp:
3190         (WebKit::wrap): Use is/downcast.
3191         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
3192         (WebKit::WebEditorClient::handleKeyboardEvent): Ditto.
3193         * WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp:
3194         (WebKit::WebEditorClient::handleKeyboardEvent): Ditto.
3195         * WebProcess/WebPage/WebPage.cpp:
3196         (WebKit::WebPage::handleEditingKeyboardEvent): Ditto.
3197         * WebProcess/WebPage/mac/WebPageMac.mm:
3198         (WebKit::frameForEvent): Ditto.
3199
3200 2017-11-12  Gabriel Ivascu  <givascu@igalia.com>
3201
3202         [GTK] Add functionality to handle font sizes in points
3203         https://bugs.webkit.org/show_bug.cgi?id=179285
3204
3205         Reviewed by Carlos Garcia Campos and Michael Catanzaro.
3206
3207         * UIProcess/API/glib/WebKitSettings.cpp:
3208         (webkit_settings_class_init):
3209         (webkit_settings_font_size_to_points):
3210         (webkit_settings_font_size_to_pixels):
3211         * UIProcess/API/gtk/WebKitSettings.h:
3212         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
3213
3214 2017-11-11  Tim Horton  <timothy_horton@apple.com>
3215
3216         Increase the alignment requirement of WKObject's wrapped C++ object
3217         https://bugs.webkit.org/show_bug.cgi?id=179518
3218
3219         Reviewed by Dan Bernstein.
3220
3221         * Shared/API/APIObject.h:
3222         * Shared/Cocoa/APIObject.mm:
3223         (API::allocateWKObject):
3224         (API::Object::fromWKObjectExtraSpace):
3225         (API::Object::newObject):
3226         * Shared/Cocoa/WKObject.mm:
3227         (-[WKObject dealloc]):
3228         (-[WKObject _apiObject]):
3229         * UIProcess/API/Cocoa/WKConnection.mm:
3230         (-[WKConnection dealloc]):
3231         (-[WKConnection _apiObject]):
3232         (-[WKConnection _connection]):
3233         Increase the alignment of the C++ object stored inside WKObject's extra space
3234         to 8-bytes, for platforms where some types require greater-than-pointer alignment.
3235         To achieve this, increase the size of the extra-space allocation by the difference
3236         between 8 bytes and pointer-alignment, and then align within that.
3237
3238 2017-11-11  Tim Horton  <timothy_horton@apple.com>
3239
3240         Avoid composing the message + recipient name for crash logs until a failure actually occurs
3241         https://bugs.webkit.org/show_bug.cgi?id=179576
3242
3243         Reviewed by Dan Bernstein.
3244
3245         * Platform/IPC/mac/ConnectionMac.mm:
3246         (IPC::Connection::sendMessage):
3247         (IPC::Connection::sendOutgoingMessage):
3248         * Platform/IPC/mac/MachMessage.h:
3249         (IPC::MachMessage::messageReceiverName const):
3250         (IPC::MachMessage::setMessageReceiverName):
3251         (IPC::MachMessage::messageName const):
3252         (IPC::MachMessage::setMessageName):
3253         Store the message name and receiver name separately on MachMessage,
3254         only composing them into a string if the message is unhandled. This
3255         makes the time spent composing the string in sendOutgoingMessage
3256         completely disappear. In absolute terms, it wasn't huge, but if you
3257         do enough IPC it starts to add up.
3258
3259 2017-11-10  Chris Dumez  <cdumez@apple.com>
3260
3261         [Service Workers] Implement "Try Activate" / "Activate" algorithms
3262         https://bugs.webkit.org/show_bug.cgi?id=179436
3263
3264         Reviewed by Brady Eidson.
3265
3266         Implement proper "Try Activate" / "Activate" algorithms as per:
3267         - https://w3c.github.io/ServiceWorker/#try-activate-algorithm
3268         - https://w3c.github.io/ServiceWorker/#activation-algorithm
3269
3270         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3271         (WebKit::WebSWServerConnection::fireActivateEvent):
3272         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3273         * StorageProcess/StorageProcess.cpp:
3274         (WebKit::StorageProcess::didFinishServiceWorkerActivation):
3275         * StorageProcess/StorageProcess.h:
3276         * StorageProcess/StorageProcess.messages.in:
3277         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3278         (WebKit::WebSWContextManagerConnection::fireActivateEvent):
3279         (WebKit::WebSWContextManagerConnection::didFinishActivation):
3280         * WebProcess/Storage/WebSWContextManagerConnection.h:
3281         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
3282
3283 2017-11-10  John Wilander  <wilander@apple.com>
3284
3285         Ignore HSTS for partitioned, cross-origin subresource requests
3286         https://bugs.webkit.org/show_bug.cgi?id=178993
3287         <rdar://problem/34962462>
3288
3289         Reviewed by Brent Fulgham.
3290
3291         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3292         (downgradeRequest):
3293             Convenience function to downgrade a request if
3294             CFNetwork as already upgraded it during
3295             canonicalization. This allows the rest of 
3296             WebKit's processing to function, such as UIR
3297             and mixed content blocking.
3298         (updateIgnoreStrictTransportSecuritySettingIfNecessary):
3299             Adds and removed the ignore request accordingly.
3300         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
3301             Now asks CFNetwork to ignore HSTS on resource loads we
3302             partition cookies for.
3303         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
3304             Now asks CFNetwork to ignore HSTS on resource loads we
3305             partition cookies for.
3306
3307 2017-11-10  Alex Christensen  <achristensen@webkit.org>
3308
3309         _WKThumbnailView initialization with WKWebView needs to call correct initWithFrame
3310         https://bugs.webkit.org/show_bug.cgi?id=179537
3311         <rdar://problem/35275219>
3312
3313         Reviewed by Darin Adler.
3314
3315         I introduced this in r223439 and made an ObjC mistake.  This is what I get for adding SPI with no tests.
3316         I fixed this by making the existing WKView/_WKThumbnailView API tests work with WKWebView.
3317
3318         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
3319         (-[_WKThumbnailView initWithFrame:fromWKWebView:]):
3320
3321 2017-11-10  Carlos Garcia Campos  <cgarcia@igalia.com>
3322
3323         [GTK][WPE] Switch to use API::NavigationClient
3324         https://bugs.webkit.org/show_bug.cgi?id=178720
3325
3326         Reviewed by Alex Christensen.
3327
3328         Replace WebKitLoaderClient and WebKitPolicyClient with WebKitNavigationClient that implements
3329         API::NavigationClient.
3330
3331         * PlatformGTK.cmake:
3332         * PlatformWPE.cmake:
3333         * UIProcess/API/APINavigationAction.h: Add new constructor that receives a target frame name instead of a target
3334         frame info.
3335         * UIProcess/API/APINavigationClient.h:
3336         (API::NavigationClient::didDisplayInsecureContent): Added.
3337         (API::NavigationClient::didRunInsecureContent): Added.
3338         (API::NavigationClient::decidePolicyForNavigationResponse): Change NavigationResponse parameter to be a
3339         Ref<NavigationResponse>&& instead of a NavigationResponse&.
3340         * UIProcess/API/C/WKPage.cpp:
3341         (WKPageSetPageNavigationClient): Update NavigationResponse parameter.
3342         * UIProcess/API/glib/WebKitBackForwardList.cpp:
3343         (webkitBackForwardListChanged):
3344         * UIProcess/API/glib/WebKitBackForwardListPrivate.h:
3345         * UIProcess/API/glib/WebKitNavigationAction.cpp:
3346         (webkitNavigationActionCreate): Wrap the given API::NavigationAction.
3347         (webkit_navigation_action_get_navigation_type): Use the wrapped API::NavigationAction.
3348         (webkit_navigation_action_get_mouse_button): Ditto.
3349         (webkit_navigation_action_get_modifiers): Ditto.
3350         (webkit_navigation_action_get_request): Ditto.
3351         (webkit_navigation_action_is_user_gesture): Ditto.
3352         (webkit_navigation_action_is_redirect): Ditto.
3353         * UIProcess/API/glib/WebKitNavigationActionPrivate.h:
3354         (_WebKitNavigationAction::_WebKitNavigationAction):
3355         * UIProcess/API/glib/WebKitNavigationClient.cpp: Renamed from Source/WebKit/UIProcess/API/glib/WebKitLoaderClient.cpp.
3356         (NavigationClient::NavigationClient):
3357         (attachNavigationClientToView):
3358         * UIProcess/API/glib/WebKitNavigationClient.h: Renamed from Source/WebKit/UIProcess/API/glib/WebKitLoaderClient.h.
3359         * UIProcess/API/glib/WebKitNavigationPolicyDecision.cpp:
3360         (webkit_navigation_policy_decision_get_frame_name): Add FIXME.
3361         (webkitNavigationPolicyDecisionCreate): Get the target frame name from the API::NavigationAction.
3362         * UIProcess/API/glib/WebKitNavigationPolicyDecisionPrivate.h:
3363         * UIProcess/API/glib/WebKitPolicyClient.cpp: Removed.
3364         * UIProcess/API/glib/WebKitPolicyClient.h: Removed.
3365         * UIProcess/API/glib/WebKitPolicyDecision.cpp:
3366         (webkitPolicyDecisionSetListener): Remove the madePolicyDecision boolean member, we can null-check the listener instead.
3367         (webkit_policy_decision_use): Ensure listener is nullptr after being invoked to prevent the decision from being made
3368         more than once.
3369         (webkit_policy_decision_ignore): Ditto.
3370         (webkit_policy_decision_download): Ditto.
3371         * UIProcess/API/glib/WebKitPolicyDecisionPrivate.h:
3372         * UIProcess/API/glib/WebKitResponsePolicyDecision.cpp:
3373         (webkit_response_policy_decision_get_request): Use the wrapped API::NavigationResponse.
3374         (webkit_response_policy_decision_get_response): Ditto.
3375         (webkit_response_policy_decision_is_mime_type_supported): Ditto.
3376         (webkitResponsePolicyDecisionCreate): Wrap the given API::NavigationResponse.
3377         * UIProcess/API/glib/WebKitResponsePolicyDecisionPrivate.h:
3378         * UIProcess/API/glib/WebKitUIClient.cpp:
3379         (UIClient::createNewPage): Create the WebKitNavigationAction from a new API::NavigationAction.
3380         * UIProcess/API/glib/WebKitWebView.cpp:
3381         (webkitWebViewConstructed): Attach navigation client.
3382         * UIProcess/Cocoa/NavigationState.h: Update API::NavigationResponse parameter of decidePolicyForNavigationResponse.
3383         * UIProcess/Cocoa/NavigationState.mm:
3384         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
3385         * UIProcess/WebPageProxy.cpp:
3386         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame): Notify the navigation client if it's used.
3387         (WebKit::WebPageProxy::didRunInsecureContentForFrame): Ditto.
3388         (WebKit::WebPageProxy::decidePolicyForNewWindowAction): Use the new API::NavigationAction constructor to pass
3389         the target frame name, instead of a null target frame info.
3390         (WebKit::WebPageProxy::decidePolicyForResponse): Move the API::NavigationResponse.
3391
3392 2017-11-09  Chris Dumez  <cdumez@apple.com>
3393
3394         Unreviewed, rolling out r224661.
3395
3396         Broke build on several internal Mac/iOS bots
3397
3398         Reverted changeset:
3399
3400         "Ignore HSTS for partitioned, cross-origin subresource
3401         requests"
3402         https://bugs.webkit.org/show_bug.cgi?id=178993
3403         https://trac.webkit.org/changeset/224661
3404
3405 2017-11-09  Chris Dumez  <cdumez@apple.com>
3406
3407         ServiceWorkerRegistration objects may get recycled for different SWServerRegistration objects
3408         https://bugs.webkit.org/show_bug.cgi?id=179517
3409
3410         Reviewed by Brady Eidson.
3411
3412         * Scripts/webkit/messages.py:
3413         (forward_declarations_and_headers):
3414         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3415         (WebKit::WebSWServerConnection::updateRegistrationStateInClient):
3416         (WebKit::WebSWServerConnection::fireUpdateFoundEvent):
3417         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3418         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
3419         * WebProcess/Storage/WebSWClientConnection.cpp:
3420         (WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
3421         (WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
3422         * WebProcess/Storage/WebSWClientConnection.h:
3423         * WebProcess/Storage/WebSWClientConnection.messages.in:
3424
3425 2017-11-09  John Wilander  <wilander@apple.com>
3426
3427         Ignore HSTS for partitioned, cross-origin subresource requests
3428         https://bugs.webkit.org/show_bug.cgi?id=178993
3429         <rdar://problem/34962462>
3430
3431         Reviewed by Brent Fulgham.
3432
3433         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3434         (downgradeRequest):
3435             Convenience function to downgrade a request if
3436             CFNetwork as already upgraded it during
3437             canonicalization. This allows the rest of 
3438             WebKit's processing to function, such as UIR
3439             and mixed content blocking.
3440         (updateIgnoreStrictTransportSecuritySettingIfNecessary):
3441             Adds and removed the ignore request accordingly.
3442         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
3443            &nb