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