9accf58f2856cdae93674548e6b4ea04e4a58178
[WebKit-https.git] / Source / WebKit2 / ChangeLog
1 2017-01-19  Carlos Garcia Campos  <cgarcia@igalia.com>
2
3         [GTK] Provide API to set proxy settings
4         https://bugs.webkit.org/show_bug.cgi?id=128674
5
6         Reviewed by Michael Catanzaro.
7
8         Add new method webkit_web_context_set_network_proxy_settings() that allows to set proxy settings in a
9         WebKitWebContext. It receives an enum WebKitNetworkProxyMode with modes Default, NoProxy and Custom, and an
10         optional WebKitNetworkProxySettings that is used when mode is Custom. WebKitNetworkProxySettings is a simple
11         boxed type that user can create to set proxy settins with a similar API to GSimpleProxyResolver.
12
13         * NetworkProcess/NetworkProcess.h:
14         * NetworkProcess/NetworkProcess.messages.in: Add SetNetworkProxySettings message.
15         * NetworkProcess/NetworkProcessCreationParameters.cpp:
16         (WebKit::NetworkProcessCreationParameters::encode): Encode proxy settings.
17         (WebKit::NetworkProcessCreationParameters::decode): Decode proxy settings.
18         * NetworkProcess/NetworkProcessCreationParameters.h:
19         * NetworkProcess/efl/NetworkProcessMainEfl.cpp: Use SoupNetworkSession::setProxySettingsFromEnvironment().
20         * NetworkProcess/soup/NetworkProcessSoup.cpp:
21         (WebKit::NetworkProcess::platformInitializeNetworkProcess): Set proxy settings if provided by the user.
22         (WebKit::NetworkProcess::setNetworkProxySettings): Set global proxy settings and setup the proxy for all
23         existing contexts.
24         * PlatformGTK.cmake: Add new files to compilation.
25         * Shared/WebCoreArgumentCoders.h:
26         * Shared/WebProcessCreationParameters.cpp:
27         (WebKit::WebProcessCreationParameters::encode): Encode proxy settings.
28         (WebKit::WebProcessCreationParameters::decode): Decode proxy settings.
29         * Shared/WebProcessCreationParameters.h:
30         * Shared/soup/WebCoreArgumentCodersSoup.cpp:
31         (IPC::ArgumentCoder<SoupNetworkProxySettings>::encode): Add encoder implementation for SoupNetworkProxySettings.
32         (IPC::ArgumentCoder<SoupNetworkProxySettings>::decode): add decoder implementation for SoupNetworkProxySettings.
33         * UIProcess/API/gtk/WebKitNetworkProxySettings.cpp: Added.
34         (_WebKitNetworkProxySettings::_WebKitNetworkProxySettings):
35         (webkitNetworkProxySettingsGetNetworkProxySettings):
36         (webkit_network_proxy_settings_new): Create a new WebKitNetworkProxySettings with optional default proxy uri and
37         ignore hosts list.
38         (webkit_network_proxy_settings_copy):
39         (webkit_network_proxy_settings_free):
40         (webkit_network_proxy_settings_add_proxy): Add a proxy uri for a given uri scheme.
41         * UIProcess/API/gtk/WebKitNetworkProxySettings.h: Added.
42         * UIProcess/API/gtk/WebKitNetworkProxySettingsPrivate.h: Added.
43         * UIProcess/API/gtk/WebKitWebContext.cpp:
44         (webkit_web_context_set_network_proxy_settings): Set proxy settings.
45         * UIProcess/API/gtk/WebKitWebContext.h:
46         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Add new symbols to the documentation.
47         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Add new section for WebKitNetworkProxySettings.
48         * UIProcess/API/gtk/webkit2.h: Include WebKitNetworkProxySettings.h.
49         * UIProcess/WebProcessPool.h: Add m_networkProxySettings and a setter for soup.
50         * UIProcess/efl/WebProcessPoolEfl.cpp:
51         (WebKit::WebProcessPool::platformInitializeWebProcess): Set m_networkProxySettings to parameters.
52         * UIProcess/gtk/WebProcessPoolGtk.cpp:
53         (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
54         * UIProcess/soup/WebProcessPoolSoup.cpp:
55         (WebKit::WebProcessPool::platformInitializeNetworkProcess): Ditto.
56         (WebKit::WebProcessPool::setNetworkProxySettings): Update m_networkProxySettings and notify all processes.
57         * WebProcess/WebProcess.h:
58         * WebProcess/WebProcess.messages.in: Add SetNetworkProxySettings message.
59         * WebProcess/efl/WebProcessMainEfl.cpp: Use SoupNetworkSession::setProxySettingsFromEnvironment().
60         * WebProcess/soup/WebProcessSoup.cpp:
61         (WebKit::WebProcess::platformSetCacheModel): Remove comment that is no longer true.
62         (WebKit::WebProcess::platformInitializeWebProcess): Set proxy settings if provided by the user.
63         (WebKit::WebProcess::setNetworkProxySettings): Set global proxy settings and setup the proxy for all
64         existing contexts.
65
66 2017-01-19  Carlos Garcia Campos  <cgarcia@igalia.com>
67
68         [GTK] Do not update the backing store state unnecessarily when page visibility changes
69         https://bugs.webkit.org/show_bug.cgi?id=167195
70
71         Reviewed by Sergio Villar Senin.
72
73         I've noticed that we are receiving UpdateBackingStoreState messages in the web process even when size and scale
74         factor didn't change. That's quite unfortunate because we do a lot of work unnecessarily and we tell the
75         threaded compositor that the size changed. This is not only a problem because it's not true, but also because
76         changing the size is a sync operation in the threaded compositor, so we block the compositing thread for
77         nothing. This is happening because the WebPageProxy notifies the drawing area that the backing store is
78         discardable when the page is not visible, and that always produces a new backing store state. In accelerating
79         compositing mode we don't even have a backing store to discard, so we should check we have something to discard
80         and also make sure we only generate a new backing store state if we really discarded the backing store.
81
82         * UIProcess/DrawingAreaProxyImpl.cpp:
83         (WebKit::DrawingAreaProxyImpl::discardBackingStoreSoon):
84         (WebKit::DrawingAreaProxyImpl::discardBackingStore):
85
86 2017-01-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
87
88         [iOS][WK2] Remove the WebView private configuration contentUpdateFrequency
89         https://bugs.webkit.org/show_bug.cgi?id=167188
90
91         Reviewed by Simon Fraser.
92
93         This patch reverts r209294. This configuration is not needed anymore.
94         The CADisplayLink::preferredFramesPerSecond for WK2 will be set to the
95         default value always.
96
97         * UIProcess/API/APIPageConfiguration.h:
98         (API::PageConfiguration::setAlwaysRunsAtForegroundPriority):
99         (API::PageConfiguration::contentUpdateFrequency): Deleted.
100         (API::PageConfiguration::setContentUpdateFrequency): Deleted.
101         (): Deleted.
102         * UIProcess/API/Cocoa/WKWebView.mm:
103         (-[WKWebView _initializeWithConfiguration:]):
104         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
105         (-[WKWebViewConfiguration init]):
106         (-[WKWebViewConfiguration copyWithZone:]):
107         (-[WKWebViewConfiguration _setAllowsInlineMediaPlaybackAfterFullscreen:]):
108         (-[WKWebViewConfiguration _contentUpdateFrequency]): Deleted.
109         (-[WKWebViewConfiguration _setContentUpdateFrequency:]): Deleted.
110         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
111         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
112         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
113         (-[WKOneShotDisplayLinkHandler initWithDrawingAreaProxy:]):
114         (WebKit::RemoteLayerTreeDrawingAreaProxy::contentUpdateFrequency): Deleted.
115
116 2017-01-18  Ryan Haddad  <ryanhaddad@apple.com>
117
118         Unreviewed, rolling out r210848.
119
120         This change introduced media-related LayoutTest failures and
121         crashes on macOS.
122
123         Reverted changeset:
124
125         "[Modern Media Controls] Turn modern media controls on by
126         default"
127         https://bugs.webkit.org/show_bug.cgi?id=165668
128         http://trac.webkit.org/changeset/210848
129
130 2017-01-18  Anders Carlsson  <andersca@apple.com>
131
132         Add instrumentation for when we fail to receive a message
133         https://bugs.webkit.org/show_bug.cgi?id=167179
134
135         Reviewed by Alexey Proskuryakov.
136
137         This will help us diagnose what the error from mach_msg is.
138
139         * Platform/IPC/mac/ConnectionMac.mm:
140         (IPC::readFromMachPort):
141
142 2017-01-18  Alex Christensen  <achristensen@webkit.org>
143
144         Fix CFURLConnection build on Mac
145         https://bugs.webkit.org/show_bug.cgi?id=167168
146
147         Reviewed by Andy Estes.
148
149         * NetworkProcess/Downloads/mac/DownloadMac.mm:
150         (WebKit::Download::resume):
151         (WebKit::Download::platformDidFinish):
152         (WebKit::Download::platformCancelNetworkLoad):
153         (WebKit::Download::startNetworkLoadWithHandle):
154         (WebKit::Download::startNetworkLoad):
155         (WebKit::Download::platformInvalidate):
156         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
157         (WebKit::NetworkDataTaskCocoa::allowsSpecificHTTPSCertificateForHost):
158         (WebKit::serverTrustCredential):
159         * Shared/Authentication/mac/AuthenticationManager.mac.mm:
160         (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge):
161         * config.h:
162
163 2017-01-18  Alex Christensen  <achristensen@webkit.org>
164
165         Modernize DelayedReply IPC code
166         https://bugs.webkit.org/show_bug.cgi?id=167176
167
168         Reviewed by Brady Eidson.
169
170         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
171         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
172         * NetworkProcess/NetworkConnectionToWebProcess.h:
173         * Platform/IPC/HandleMessage.h:
174         (IPC::callMemberFunctionImpl):
175         (IPC::callMemberFunction):
176         (IPC::handleMessageDelayed):
177         * Scripts/webkit/messages.py:
178         (message_to_struct_declaration):
179         (generate_message_handler):
180         * UIProcess/Databases/DatabaseProcessProxy.cpp:
181         (WebKit::DatabaseProcessProxy::getDatabaseProcessConnection):
182         * UIProcess/Databases/DatabaseProcessProxy.h:
183         * UIProcess/Network/NetworkProcessProxy.cpp:
184         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
185         (WebKit::NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch):
186         * UIProcess/Network/NetworkProcessProxy.h:
187         * UIProcess/Plugins/PluginProcessManager.cpp:
188         (WebKit::PluginProcessManager::getPluginProcessConnection):
189         * UIProcess/Plugins/PluginProcessManager.h:
190         * UIProcess/Plugins/PluginProcessProxy.cpp:
191         (WebKit::PluginProcessProxy::getPluginProcessConnection):
192         * UIProcess/Plugins/PluginProcessProxy.h:
193         * UIProcess/WebPageProxy.cpp:
194         (WebKit::WebPageProxy::runJavaScriptAlert):
195         (WebKit::WebPageProxy::runJavaScriptConfirm):
196         * UIProcess/WebPageProxy.h:
197         * UIProcess/WebProcessPool.cpp:
198         (WebKit::WebProcessPool::getNetworkProcessConnection):
199         (WebKit::WebProcessPool::getDatabaseProcessConnection):
200         * UIProcess/WebProcessPool.h:
201         * UIProcess/WebProcessProxy.cpp:
202         (WebKit::WebProcessProxy::getPluginProcessConnection):
203         (WebKit::WebProcessProxy::getNetworkProcessConnection):
204         (WebKit::WebProcessProxy::getDatabaseProcessConnection):
205         * UIProcess/WebProcessProxy.h:
206
207 2017-01-18  Alex Christensen  <achristensen@webkit.org>
208
209         Fix CMake build.
210
211         * PlatformMac.cmake:
212
213 2017-01-18  Megan Gardner  <megan_gardner@apple.com>
214
215         Ignore Connection Assertion if we are not using connection to send messages
216         https://bugs.webkit.org/show_bug.cgi?id=167022
217
218         Reviewed by Darin Adler.
219
220         Ask the process about a particular connection rather that getting it and making the     
221         comparison ourselves. 
222
223         * UIProcess/ChildProcessProxy.h:
224         (WebKit::ChildProcessProxy::hasConnection):
225         Check to see the the ProcessProxy has this particular connection. This get around the assert
226         that we would run into when just requesting the connection directly.
227         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
228         (WebKit::WebPasteboardProxy::setPasteboardPathnamesForType):
229         Use the new check instead of getting the raw connection.
230
231 2017-01-18  Andreas Kling  <akling@apple.com>
232
233         Document::securityOrigin() should return a reference.
234         <https://webkit.org/b/167124>
235
236         Reviewed by Sam Weinig.
237
238         * UIProcess/Storage/StorageManager.cpp:
239         (WebKit::StorageManager::createTransientLocalStorageMap):
240         * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
241         (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
242         * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
243         (WKBundleFrameCopySecurityOrigin):
244         * WebProcess/Plugins/PluginView.cpp:
245         (WebKit::PluginView::storageBlockingStateChanged):
246         (WebKit::PluginView::performFrameLoadURLRequest):
247         (WebKit::PluginView::isPrivateBrowsingEnabled):
248         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
249         (WebKit::WebPluginInfoProvider::getWebVisiblePluginInfo):
250         * WebProcess/Storage/StorageAreaMap.cpp:
251         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
252         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
253         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
254         (WebKit::WebChromeClient::exceededDatabaseQuota):
255         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
256         (WebKit::WebFrameLoaderClient::didRunInsecureContent):
257         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
258         * WebProcess/WebPage/WebFrame.cpp:
259         (WebKit::WebFrame::allowsFollowingLink):
260
261 2017-01-18  Antoine Quint  <graouts@apple.com>
262
263         [Modern Media Controls] Turn modern media controls on by default
264         https://bugs.webkit.org/show_bug.cgi?id=165668
265
266         Reviewed by Dean Jackson.
267
268         Use DEFAULT_EXPERIMENTAL_FEATURES_ENABLED as the default value for modern media controls, which is true.
269
270         * Shared/WebPreferencesDefinitions.h:
271
272 2017-01-15  Darin Adler  <darin@apple.com>
273
274         Remove PassRefPtr from "loader" directory of WebCore
275         https://bugs.webkit.org/show_bug.cgi?id=167055
276
277         Reviewed by Alex Christensen.
278
279         * Shared/APIWebArchive.h: Use RefPtr&& instead of PassRefPtr.
280         * Shared/APIWebArchive.mm:
281         (API::WebArchive::create): Ditto.
282         (API::WebArchive::WebArchive): Ditto.
283         (API::WebArchive::subresources): Ditto.
284         (API::WebArchive::subframeArchives): Ditto.
285
286         * Shared/TextCheckerState.h: Initialize data members so classes
287         using this won't have to explicitly initalize them.
288
289         * UIProcess/WebIconDatabase.cpp:
290         (WebKit::WebIconDatabase::setIconDataForIconURL): Pass a raw
291         pointer to WebCore.
292
293         * UIProcess/WebPageProxy.h: Removed forward declaration of
294         StringPairVector, not needed here.
295
296         * WebProcess/IconDatabase/WebIconDatabaseProxy.cpp:
297         (WebKit::WebIconDatabaseProxy::WebIconDatabaseProxy): Take a reference.
298         (WebKit::WebIconDatabaseProxy::retainIconForPageURL): Updated for reference.
299         (WebKit::WebIconDatabaseProxy::releaseIconForPageURL): Ditto.
300         (WebKit::WebIconDatabaseProxy::synchronousIconForPageURL): Ditto.
301         (WebKit::WebIconDatabaseProxy::loadDecisionForIconURL): Ditto.
302         (WebKit::WebIconDatabaseProxy::receivedIconLoadDecision): Ditto.
303         (WebKit::WebIconDatabaseProxy::iconDataForIconURL): Ditto.
304         (WebKit::WebIconDatabaseProxy::setIconURLForPageURL): Ditto.
305         (WebKit::WebIconDatabaseProxy::setIconDataForIconURL): Ditto.
306         * WebProcess/IconDatabase/WebIconDatabaseProxy.h: Updated for the above.
307         Marked the class final, made most functions private and final.
308
309         * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
310         (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
311         Removed assertion that a pointer is non-null since that pointer is now a
312         reference. Left use of PassRefPtr here for now.z
313
314         * WebProcess/Network/WebLoaderStrategy.cpp:
315         (WebKit::WebLoaderStrategy::scheduleLoad): Updated since application cache
316         host is now a reference rather thna a pointer.
317         * WebProcess/Network/WebResourceLoader.cpp:
318         (WebKit::WebResourceLoader::willSendRequest): Ditto.
319         (WebKit::WebResourceLoader::didReceiveResponse): Ditto.
320         (WebKit::WebResourceLoader::didFailResourceLoad): Ditto.
321
322         * WebProcess/Plugins/PluginView.cpp:
323         (WebKit::buildHTTPHeaders): Got rid of unneeded use of String::format.
324         (WebKit::PluginView::create): Take a reference instead of PassRefPtr.
325         (WebKit::PluginView::PluginView): Ditto. Also moved much of the data
326         member initialization to the class definition.
327         (WebKit::PluginView::recreateAndInitialize): Take Ref&& instead of PassRefPtr.
328         (WebKit::PluginView::manualLoadDidReceiveResponse): Updated for change to
329         ManualStreamState enumeration.
330         (WebKit::PluginView::manualLoadDidReceiveData): Ditto.
331         (WebKit::PluginView::manualLoadDidFinishLoading Ditto.):
332         (WebKit::PluginView::manualLoadDidFail): Ditto.
333         (WebKit::PluginView::liveResourceData): Return RefPtr insead of PassRefPtr.
334         (WebKit::PluginView::redeliverManualStream): Updated for ManualStreamState.
335         * WebProcess/Plugins/PluginView.h: Updated for the above. Also changed
336         ManualStreamState into an enum class.
337
338         * WebProcess/WebCoreSupport/WebChromeClient.cpp: Changed m_page to a reference.
339         (WebKit::WebChromeClient::runOpenPanel): Take both arguments as references.
340         * WebProcess/WebCoreSupport/WebChromeClient.h: Updated for the above.
341
342         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
343         (WebKit::WebEditorClient::registerUndoStep): Take reference instead of PassRefPtr.
344         (WebKit::WebEditorClient::registerRedoStep): Ditto.
345         * WebProcess/WebCoreSupport/WebEditorClient.h: Updated for the above
346
347         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
348         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
349         Updated for change to FrameLoaderClient.
350         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Ditto.
351         (WebKit::WebFrameLoaderClient::dispatchWillSendSubmitEvent): Ditto.
352         (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm): Ditto.
353         (WebKit::WebFrameLoaderClient::createFrame): Ditto.
354         (WebKit::WebFrameLoaderClient::createPlugin): Ditto.
355         (WebKit::WebFrameLoaderClient::recreatePlugin): Ditto.
356         (WebKit::WebFrameLoaderClient::createJavaAppletWidget): Ditto.
357         (WebKit::WebFrameLoaderClient::createNetworkingContext): Ditto.
358         (WebKit::WebFrameLoaderClient::didRequestAutocomplete): Ditto.
359         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: Updated for the above.
360
361         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
362         (WebKit::WebChromeClient::didReceiveMobileDocType): Updated since m_page is a
363         reference now.
364         (WebKit::WebChromeClient::observedContentChange): Ditto.
365         (WebKit::WebChromeClient::notifyRevealedSelectionByScrollingFrame): Ditto.
366         (WebKit::WebChromeClient::didLayout): Ditto.
367         (WebKit::WebChromeClient::didStartOverflowScroll): Ditto.
368         (WebKit::WebChromeClient::didEndOverflowScroll): Ditto.
369         (WebKit::WebChromeClient::hasStablePageScaleFactor): Ditto.
370         (WebKit::WebChromeClient::showPlaybackTargetPicker): Ditto.
371         (WebKit::WebChromeClient::eventThrottlingDelay): Ditto.
372         (WebKit::WebChromeClient::deviceOrientation): Ditto.
373
374         * WebProcess/WebPage/WebPage.cpp:
375         (WebKit::WebPage::WebPage): Pass reference.
376         (WebKit::WebPage::createPlugin): Return RefPtr instead of PassRefPtr.
377         (WebKit::WebPage::fromCorePage): Updated for change to WebChromeClient.
378         (WebKit::WebPage::setHeaderPageBanner): Take pointer instead of PassRefPtr.
379         (WebKit::WebPage::setFooterPageBanner): Ditto.
380         (WebKit::WebPage::setActiveOpenPanelResultListener): Take Ref&& instead of
381         PassRefPtr.
382         (WebKit::WebPage::currentSelectionAsRange): Return RefPtr instead of PassRefPtr.
383         (WebKit::WebPage::rangeFromEditingRange): Ditto.
384         * WebProcess/WebPage/WebPage.h: Updated for the above.
385
386         * WebProcess/WebPage/efl/WebPageEfl.cpp:
387         (WebKit::WebPage::cachedResponseDataForURL): Return RefPtr instead of PassRefPtr.
388         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
389         (WebKit::WebPage::cachedResponseDataForURL): Ditto.
390         * WebProcess/WebPage/ios/WebPageIOS.mm:
391         (WebKit::WebPage::cachedResponseDataForURL): Ditto.
392         * WebProcess/WebPage/mac/WebPageMac.mm:
393         (WebKit::WebPage::cachedResponseDataForURL): Ditto.
394         (WebKit::WebPage::setTopOverhangImage): Take raw pointer instead of PassRefPtr.
395         (WebKit::WebPage::setBottomOverhangImage): Ditto.
396
397         * WebProcess/WebProcess.cpp:
398         (WebKit::WebProcess::WebProcess): Pass a reference. Move most initialization to
399         the class definition.
400         * WebProcess/WebProcess.h: Updaed for the above.
401
402 2017-01-17  Michael Catanzaro  <mcatanzaro@igalia.com>
403
404         Unreviewed, rolling out r210834
405         https://bugs.webkit.org/show_bug.cgi?id=165668
406
407         It introduced dozens of test timeouts.
408
409         Reverted changeset:
410         "[Modern Media Controls] Turn modern media controls on by default"
411         https://bugs.webkit.org/show_bug.cgi?id=165668
412         http://trac.webkit.org/changeset/210834
413
414 2017-01-17  Antti Koivisto  <antti@apple.com>
415
416         Persist derived data
417         https://bugs.webkit.org/show_bug.cgi?id=167136
418
419         Reviewed by Andreas Kling.
420
421         Add a mechanism for storing arbitrary data into disk cache.
422
423         From WebCore level data can be stored using
424
425             loaderStrategy()->storeDerivedDataToCache(key, partition, type, data);
426
427         The data is keyed with the body hash of a network resource. It can be retrieved along
428         with the resource by specifying the type in ResourceLoaderOptions. If a related data
429         blob is found it will be deliver via CachedResource::didRetrieveDerivedDataFromCache()
430         callback.
431
432         This patch adds the mechanism but doesn't yet use it for anything.
433
434         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
435         (WebKit::NetworkConnectionToWebProcess::storeDerivedDataToCache):
436         * NetworkProcess/NetworkConnectionToWebProcess.h:
437         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
438         * NetworkProcess/NetworkResourceLoadParameters.cpp:
439         (WebKit::NetworkResourceLoadParameters::encode):
440         (WebKit::NetworkResourceLoadParameters::decode):
441         * NetworkProcess/NetworkResourceLoadParameters.h:
442         * NetworkProcess/NetworkResourceLoader.cpp:
443         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
444
445             Look for related resources to return if needed.
446
447         (WebKit::NetworkResourceLoader::sendResultForCacheEntry):
448         * NetworkProcess/NetworkResourceLoader.h:
449         * NetworkProcess/cache/NetworkCache.cpp:
450         (WebKit::NetworkCache::resourceType):
451          (WebKit::NetworkCache::Cache::retrieveData):
452         (WebKit::NetworkCache::Cache::storeData):
453         (WebKit::NetworkCache::Cache::makeCacheKey): Deleted.
454         * NetworkProcess/cache/NetworkCache.h:
455         * NetworkProcess/cache/NetworkCacheEntry.cpp:
456         (WebKit::NetworkCache::Entry::encodeAsStorageRecord):
457         (WebKit::NetworkCache::Entry::decodeStorageRecord):
458         * NetworkProcess/cache/NetworkCacheKey.cpp:
459         (WebKit::NetworkCache::Key::Key):
460         * NetworkProcess/cache/NetworkCacheKey.h:
461         (WebKit::NetworkCache::DataKey::encode):
462         (WebKit::NetworkCache::DataKey::decode):
463         * NetworkProcess/cache/NetworkCacheStorage.cpp:
464         (WebKit::NetworkCache::Storage::readRecord):
465         (WebKit::NetworkCache::Storage::traverse):
466         * NetworkProcess/cache/NetworkCacheStorage.h:
467
468             Return body hash with the Record.
469
470         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
471         (WebKit::NetworkCache::SubresourcesEntry::encodeAsStorageRecord):
472         * Platform/IPC/ArgumentCoders.cpp:
473         (IPC::ArgumentCoder<SHA1::Digest>::encode):
474         (IPC::ArgumentCoder<SHA1::Digest>::decode):
475         * Platform/IPC/ArgumentCoders.h:
476         * WebProcess/Network/WebLoaderStrategy.cpp:
477         (WebKit::WebLoaderStrategy::scheduleLoad):
478         (WebKit::WebLoaderStrategy::storeDerivedDataToCache):
479         * WebProcess/Network/WebLoaderStrategy.h:
480         * WebProcess/Network/WebResourceLoader.cpp:
481         (WebKit::WebResourceLoader::didRetrieveDerivedData):
482         * WebProcess/Network/WebResourceLoader.h:
483         * WebProcess/Network/WebResourceLoader.messages.in:
484
485 2017-01-17  Antoine Quint  <graouts@apple.com>
486
487         [Modern Media Controls] Turn modern media controls on by default
488         https://bugs.webkit.org/show_bug.cgi?id=165668
489
490         Reviewed by Dean Jackson.
491
492         Use DEFAULT_EXPERIMENTAL_FEATURES_ENABLED as the default value for modern media controls, which is true.
493
494         * Shared/WebPreferencesDefinitions.h:
495
496 2017-01-17  Joseph Pecoraro  <pecoraro@apple.com>
497
498         ENABLE(USER_TIMING) Not Defined for Apple Windows or OS X Ports
499         https://bugs.webkit.org/show_bug.cgi?id=116551
500         <rdar://problem/13949830>
501
502         Reviewed by Alex Christensen.
503
504         * Configurations/FeatureDefines.xcconfig:
505
506 2017-01-17  Filip Pizlo  <fpizlo@apple.com>
507
508         JSCell::classInfo() shouldn't have a bunch of mitigations for being called during destruction
509         https://bugs.webkit.org/show_bug.cgi?id=167066
510
511         Reviewed by Keith Miller and Michael Saboff.
512         
513         Just remove now-erroneous use of jsCast<>.
514
515         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
516         (WebKit::NPRuntimeObjectMap::finalize):
517
518 2017-01-17  Joseph Pecoraro  <pecoraro@apple.com>
519
520         Remove unnecessary includes
521         https://bugs.webkit.org/show_bug.cgi?id=167114
522
523         Reviewed by Alex Christensen.
524
525         * WebProcess/WebPage/ios/WebPageIOS.mm:
526
527 2017-01-17  Brady Eidson  <beidson@apple.com>
528
529         An update to one gamepad's values should only change that gamepad's modified timestamp.
530         <rdar://problem/28620865> and https://bugs.webkit.org/show_bug.cgi?id=167139
531
532         Reviewed by Andy Estes.
533
534         Track the lastModifiedTime for a gamepad in the UI process, and pass it along to web processes.
535
536         * Shared/Gamepad/GamepadData.cpp:
537         (WebKit::GamepadData::GamepadData):
538         (WebKit::GamepadData::encode):
539         (WebKit::GamepadData::decode):
540         * Shared/Gamepad/GamepadData.h:
541         (WebKit::GamepadData::lastUpdateTime):
542
543         * UIProcess/Gamepad/UIGamepad.cpp:
544         (WebKit::UIGamepad::UIGamepad):
545         (WebKit::UIGamepad::updateFromPlatformGamepad):
546         (WebKit::UIGamepad::condensedGamepadData):
547         (WebKit::UIGamepad::fullGamepadData):
548         * UIProcess/Gamepad/UIGamepad.h:
549
550         * WebProcess/Gamepad/WebGamepad.cpp:
551         (WebKit::WebGamepad::updateValues):
552
553 2017-01-17  Anders Carlsson  <andersca@apple.com>
554
555         It's not possible to perform a POST request with HTTPBody content in a WKWebView
556         https://bugs.webkit.org/show_bug.cgi?id=167131
557         rdar://problem/20464240
558
559         Reviewed by Beth Dakin.
560
561         Encode/decode the form data if necessary.
562
563         * Shared/LoadParameters.cpp:
564         (WebKit::LoadParameters::encode):
565         (WebKit::LoadParameters::decode):
566
567 2017-01-17  Joseph Pecoraro  <pecoraro@apple.com>
568
569         Crash when closing tab with debugger paused
570         https://bugs.webkit.org/show_bug.cgi?id=161746
571         <rdar://problem/15607819>
572
573         Reviewed by Brian Burg and Brent Fulgham.
574
575         * WebProcess/WebPage/WebPage.cpp:
576         (WebKit::DeferredPageDestructor::createDeferredPageDestructor):
577         (WebKit::DeferredPageDestructor::DeferredPageDestructor):
578         (WebKit::DeferredPageDestructor::tryDestruction):
579         (WebKit::WebPage::close):
580         Defer destruction of the Page and WebPage if we are in a nested runloop.
581         Also, proactively close all inspector frontends, including remote frontends.
582
583         * WebProcess/WebPage/ios/WebPageIOS.mm:
584         (WebKit::WebPage::handleSyntheticClick):
585         (WebKit::WebPage::completeSyntheticClick):
586         Return early in some cases where a nested run loop may have closed
587         the WebPage on us while handling JavaScript events.
588
589 2017-01-16  Joseph Pecoraro  <pecoraro@apple.com>
590
591         Remove the REQUEST_ANIMATION_FRAME flag
592         https://bugs.webkit.org/show_bug.cgi?id=156980
593         <rdar://problem/25906849>
594
595         Reviewed by Simon Fraser.
596
597         * Configurations/FeatureDefines.xcconfig:
598         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
599         * WebProcess/WebCoreSupport/WebChromeClient.h:
600         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
601         (WebKit::CompositingCoordinator::syncDisplayState):
602         (WebKit::CompositingCoordinator::nextAnimationServiceTime):
603         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
604         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
605         (WebKit::CoordinatedLayerTreeHost::scheduleAnimation):
606         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
607         * WebProcess/WebPage/LayerTreeHost.h:
608
609 2017-01-16  Carlos Garcia Campos  <cgarcia@igalia.com>
610
611         [SOUP] Accept-language could be set twice in a row for the default context
612         https://bugs.webkit.org/show_bug.cgi?id=167089
613
614         Reviewed by Žan Doberšek.
615
616         * NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp:
617         (WebKit::CustomProtocolManager::registerScheme): Use NetworkStorageSession::getOrCreateSoupNetworkSession().
618         * NetworkProcess/efl/NetworkProcessMainEfl.cpp:
619         * NetworkProcess/soup/NetworkProcessSoup.cpp:
620         (WebKit::NetworkProcess::userPreferredLanguagesChanged): Only set the languages if NetworkStorageSession has a
621         SoupNetworkSession.
622         * NetworkProcess/soup/NetworkSessionSoup.cpp:
623         (WebKit::NetworkSessionSoup::soupSession): Use NetworkStorageSession::getOrCreateSoupNetworkSession().
624         * WebProcess/Cookies/soup/WebCookieManagerSoup.cpp:
625         (WebKit::WebCookieManager::setCookiePersistentStorage): Ditto.
626         * WebProcess/efl/WebProcessMainEfl.cpp:
627
628 2017-01-16  Carlos Garcia Campos  <cgarcia@igalia.com>
629
630         [SOUP] Fix handling of accept language property
631         https://bugs.webkit.org/show_bug.cgi?id=166969
632
633         Reviewed by Michael Catanzaro.
634
635         * NetworkProcess/soup/NetworkProcessSoup.cpp:
636         (WebKit::buildAcceptLanguages): Moved from WebCore.
637         (WebKit::NetworkProcess::userPreferredLanguagesChanged): Build the accept language string from the vector and
638         pass set it to SoupNetworkSession to be used for new sessions, and also to all other existing sessions.
639
640 2017-01-14  Tim Horton  <timothy_horton@apple.com>
641
642         Remove unused WKView initializer parameter
643         https://bugs.webkit.org/show_bug.cgi?id=167046
644
645         Reviewed by Dan Bernstein.
646
647         * UIProcess/API/mac/WKView.mm:
648         (-[WKView initWithFrame:processPool:configuration:]):
649         (-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
650         (-[WKView initWithFrame:configurationRef:]):
651         (-[WKView initWithFrame:processPool:configuration:webView:]): Deleted.
652         * UIProcess/API/mac/WKViewInternal.h:
653         Ever since WKWebView stopped having WKView inside it, this parameter
654         has never been used. Now, it only leads to confusion.
655
656 2017-01-13  Joseph Pecoraro  <pecoraro@apple.com>
657
658         Remove ENABLE(DETAILS_ELEMENT) guards
659         https://bugs.webkit.org/show_bug.cgi?id=167042
660
661         Reviewed by Alex Christensen.
662
663         * Configurations/FeatureDefines.xcconfig:
664
665 2017-01-13  Brady Eidson  <beidson@apple.com>
666
667         Crash when visiting a webpage that uses Gamepads in a new WebProcess after a previous page has used gamepads..
668         https://bugs.webkit.org/show_bug.cgi?id=167033
669
670         Reviewed by Alex Christensen.
671
672         * UIProcess/Gamepad/UIGamepadProvider.cpp:
673         (WebKit::UIGamepadProvider::processPoolStartedUsingGamepads): Don't schedule a state update here.
674         (WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads): Ditto.
675         * UIProcess/Gamepad/UIGamepadProvider.h:
676         
677         * UIProcess/WebProcessPool.cpp:
678         (WebKit::WebProcessPool::startedUsingGamepads): Populate the WebProcess with initial gamepads.
679
680 2017-01-11  Darin Adler  <darin@apple.com>
681
682         Remove PassRefPtr from more of "platform"
683         https://bugs.webkit.org/show_bug.cgi?id=166809
684
685         Reviewed by Sam Weinig.
686
687         * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:
688         (IPC::ArgumentCoder<TextureMapperAnimation>::encode): Updated since timing function
689         returns a raw pointer.
690         (IPC::ArgumentCoder<TextureMapperAnimation>::decode): Updated since timing function
691         setters now takes an rvalue reference.
692
693         * WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
694         (WebKit::PDFPlugin::createScrollbar): Updated since addChild now takes a reference.
695
696 2017-01-13  Chris Dumez  <cdumez@apple.com>
697
698         [WK2] Add diagnostic logging to measure WebGL usage
699         https://bugs.webkit.org/show_bug.cgi?id=166730
700         <rdar://problem/29883469>
701
702         Reviewed by Alex Christensen.
703
704         Add diagnostic logging to measure high performance WebGL usage. We report
705         at regular intervals in which WebGL state Safari is:
706         - Inactive
707         - ActiveInForegroundTab
708         - ActiveInBackgroundTabOnly
709
710         This should give us an estimate of:
711         - What % of the time is Safari using high performance graphics
712         - What % of this time is only due to background tabs
713
714         * UIProcess/HighPerformanceGraphicsUsageSampler.cpp: Added.
715         (WebKit::HighPerformanceGraphicsUsageSampler::HighPerformanceGraphicsUsageSampler):
716         (WebKit::HighPerformanceGraphicsUsageSampler::timerFired):
717         * UIProcess/HighPerformanceGraphicsUsageSampler.h: Copied from Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h.
718         * UIProcess/WebPageProxy.h:
719         (WebKit::WebPageProxy::setIsUsingHighPerformanceWebGL):
720         (WebKit::WebPageProxy::isUsingHighPerformanceWebGL):
721         * UIProcess/WebPageProxy.messages.in:
722         * UIProcess/WebProcessPool.cpp:
723         (WebKit::m_highPerformanceGraphicsUsageSampler):
724         * UIProcess/WebProcessPool.h:
725         * WebKit2.xcodeproj/project.pbxproj:
726         * WebProcess/WebPage/WebPage.cpp:
727         (WebKit::m_userInterfaceLayoutDirection):
728
729 2017-01-13  Matt Rajca  <mrajca@apple.com>
730
731         Defer use of autoplay heuristics to clients
732         https://bugs.webkit.org/show_bug.cgi?id=167010
733
734         Reviewed by Alex Christensen.
735
736         Switch the autoplay policy tristate to an on/off option since clients should run any
737         heuristics and simply send their final decision to WebKit.
738
739         * Shared/WebsitePolicies.h:
740         (WebKit::WebsitePolicies::encode):
741         (WebKit::WebsitePolicies::decode):
742         * UIProcess/API/APIWebsitePolicies.h:
743         * UIProcess/API/C/WKWebsitePolicies.cpp:
744         (WKWebsitePoliciesGetAutoplayEnabled):
745         (WKWebsitePoliciesSetAutoplayEnabled):
746         (WKWebsitePoliciesGetAutoplayPolicy): Replaced.
747         (WKWebsitePoliciesSetAutoplayPolicy): Replaced.
748         * UIProcess/API/C/WKWebsitePolicies.h:
749         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
750         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
751         (-[_WKWebsitePolicies setAutoplayEnabled:]):
752         (-[_WKWebsitePolicies autoplayEnabled]):
753         (-[_WKWebsitePolicies setAutoplayPolicy:]): Replaced.
754         (-[_WKWebsitePolicies autoplayPolicy]): Replaced.
755
756 2017-01-13  Carlos Garcia Campos  <cgarcia@igalia.com>
757
758         [SOUP] Simplify cookie storage handling
759         https://bugs.webkit.org/show_bug.cgi?id=166967
760
761         Reviewed by Sergio Villar Senin.
762
763         Get the SoupSession from NetworkStorageSession::defaultStorageSession().
764
765         * NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp:
766         (WebKit::CustomProtocolManager::registerScheme): Get the SoupSession from NetworkStorageSession::defaultStorageSession().
767         * NetworkProcess/efl/NetworkProcessMainEfl.cpp: Ditto.
768         * NetworkProcess/soup/NetworkProcessSoup.cpp:
769         (WebKit::NetworkProcess::userPreferredLanguagesChanged): Ditto.
770         (WebKit::NetworkProcess::platformInitializeNetworkProcess): SoupNetworkSession::clearOldSoupCache is static.
771         * WebProcess/Cookies/soup/WebCookieManagerSoup.cpp:
772         (WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy): Use the cookie storage from NetworkStorageSession::defaultStorageSession().
773         (WebKit::WebCookieManager::setCookiePersistentStorage): Ditto.
774         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
775         (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts): Ditto.
776         * WebProcess/efl/WebProcessMainEfl.cpp:
777
778 2017-01-12  Carlos Garcia Campos  <cgarcia@igalia.com>
779
780         [SOUP] Do not use the legacy session ID in WebFrameNetworkingContext::storageSession()
781         https://bugs.webkit.org/show_bug.cgi?id=166970
782
783         Reviewed by Sergio Villar Senin.
784
785         Get the session for the current page instead.
786
787         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
788         (WebKit::WebFrameNetworkingContext::storageSession):
789
790 2017-01-12  Joseph Pecoraro  <pecoraro@apple.com>
791
792         Remove unnecessary includes of Page.h
793         https://bugs.webkit.org/show_bug.cgi?id=166996
794
795         Reviewed by Yusuke Suzuki.
796
797         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
798
799 2017-01-12  Chris Dumez  <cdumez@apple.com>
800
801         Add KEYBOARD_KEY_ATTRIBUTE / KEYBOARD_CODE_ATTRIBUTE to FeatureDefines.xcconfig
802         https://bugs.webkit.org/show_bug.cgi?id=166995
803
804         Reviewed by Jer Noble.
805
806         Add KEYBOARD_KEY_ATTRIBUTE / KEYBOARD_CODE_ATTRIBUTE to FeatureDefines.xcconfig
807         as some people are having trouble building without it.
808
809         * Configurations/FeatureDefines.xcconfig:
810         * Shared/WebKeyboardEvent.cpp:
811         (WebKit::WebKeyboardEvent::WebKeyboardEvent):
812
813 2017-01-12  Chris Dumez  <cdumez@apple.com>
814
815         [iOS] HTML form validation popover sometimes does not go away
816         https://bugs.webkit.org/show_bug.cgi?id=166990
817         <rdar://problem/29985957>
818
819         Reviewed by Tim Horton.
820
821         Update code using ValidationBubble now that it is RefCounted.
822
823         * UIProcess/PageClient.h:
824         * UIProcess/WebPageProxy.h:
825         * UIProcess/ios/PageClientImplIOS.h:
826         * UIProcess/ios/PageClientImplIOS.mm:
827         (WebKit::PageClientImpl::createValidationBubble):
828         * UIProcess/mac/PageClientImpl.h:
829         * UIProcess/mac/PageClientImpl.mm:
830         (WebKit::PageClientImpl::createValidationBubble):
831
832 2017-01-12  Enrica Casucci  <enrica@apple.com>
833
834         Do not allow selection of editable content when not editing.
835         https://bugs.webkit.org/show_bug.cgi?id=166897
836         <rdar://problem/29388806>
837
838         Reviewed by Tim Horton.
839
840         Test: fast/events/touch/ios/long-press-on-editable.html
841
842         When retrieving the position information, we should not consider
843         as candidates for selection editable elements, since this is only
844         used for non editable selections.
845
846         * WebProcess/WebPage/ios/WebPageIOS.mm:
847         (WebKit::isAssistableElement): Moved within the file.
848         (WebKit::WebPage::getPositionInformation):
849
850 2017-01-12  Megan Gardner  <megan_gardner@apple.com>
851
852         Double Check URLs on UI side before putting in pasteboard
853         https://bugs.webkit.org/show_bug.cgi?id=166945
854         <rdar://problem/11187315>
855
856         Reviewed by Tim Horton.
857
858         Check URLs sent from the web process before putting the on pasteboard.
859
860         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
861         (WebKit::WebPasteboardProxy::setPasteboardPathnamesForType):
862         Add a check to make sure the URLs we've received are valid and not compromising to the user's system.
863
864         * UIProcess/WebPasteboardProxy.cpp:
865         (WebKit::WebPasteboardProxy::addWebProcessProxy):
866         Keep track of the webProcesses associated with the pasteboard proxies specifically, so that we can
867         use it to check the URLs before putting them on pasteboard.
868         (WebKit::WebPasteboardProxy::removeWebProcessProxy):
869         Remove dead webProcesses.
870
871         * UIProcess/WebPasteboardProxy.h:
872         * UIProcess/WebPasteboardProxy.messages.in:
873         Allow for the connection to be passed in, so that we can determine which webProcess we need to
874         check the URLs of.
875
876         * UIProcess/WebProcessProxy.cpp:
877         (WebKit::WebProcessProxy::~WebProcessProxy):
878         Make sure to remove WebProcessProxys from the list stored in WebPasteboardProxy
879
880 2017-01-12  Chris Dumez  <cdumez@apple.com>
881
882         [iOS] Implement support for KeyboardEvent.code
883         https://bugs.webkit.org/show_bug.cgi?id=166932
884         <rdar://problem/29972518>
885
886         Reviewed by Darin Adler.
887
888         Make sure KeyboardEvent.code is properly initialized on
889         iOS WK2.
890
891         * Shared/WebEvent.h:
892         * Shared/WebKeyboardEvent.cpp:
893         (WebKit::WebKeyboardEvent::WebKeyboardEvent):
894         * Shared/ios/WebIOSEventFactory.mm:
895         (WebIOSEventFactory::createWebKeyboardEvent):
896
897 2017-01-12  Andreas Kling  <akling@apple.com>
898
899         WebBackForwardListProxy should remove restored session history items from PageCache on close.
900         <https://webkit.org/b/166972>
901         <rdar://problem/28904157>
902
903         Reviewed by Brady Eidson.
904
905         Register history item ID's from the UIProcess with the associated-items map
906         so that we can remove any PageCache entries associated with them immediately
907         when closing a WebPage.
908
909         Otherwise they might not get removed until the next PageCache pruning happens.
910         This patch is a speculative fix for what looks like it might be weirdness
911         related to a PageCache entry outliving its originating Page.
912
913         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
914         (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
915         * WebProcess/WebPage/WebBackForwardListProxy.h:
916         * WebProcess/WebPage/WebPage.cpp:
917         (WebKit::WebPage::restoreSessionInternal):
918
919 2017-01-12  Michael Catanzaro  <mcatanzaro@igalia.com>
920
921         [GTK] Correct license on WebKitSecurityOrigin headers
922
923         These ought to be LGPLv2+, because the rest of the GTK+ API is LPGLv2+.
924
925         * UIProcess/API/gtk/WebKitSecurityOrigin.cpp:
926         * UIProcess/API/gtk/WebKitSecurityOrigin.h:
927         * UIProcess/API/gtk/WebKitSecurityOriginPrivate.h:
928
929 2017-01-12  Eric Carlson  <eric.carlson@apple.com>
930
931         [MediaStream, Mac] Render media stream audio buffers
932         https://bugs.webkit.org/show_bug.cgi?id=159836
933         <rdar://problem/27380390>
934
935         Unreviewed, revert accidental change.
936
937         * WebProcess/com.apple.WebProcess.sb.in:
938
939 2017-01-11  Brady Eidson  <beidson@apple.com>
940
941         Add IconLoadingDelegate functionality to WKView.
942         https://bugs.webkit.org/show_bug.cgi?id=166951
943
944         Reviewed by Tim Horton.
945         
946         * UIProcess/API/mac/WKView.mm:
947         (-[WKView dealloc]):
948         (-[WKView maybeInstallIconLoadingClient]): If the subclass implements the delegate method, install the
949           icon loading client. Otherwise, maintain the normal IconDatabase loading behavior.
950         (-[WKView initWithFrame:processPool:configuration:webView:]):
951
952 2017-01-11  Brent Fulgham  <bfulgham@apple.com>
953
954         [WK2][Cocoa] Avoid null dereference in FullScreen code.
955         https://bugs.webkit.org/show_bug.cgi?id=166957
956         <rdar://problem/27745004>
957
958         Reviewed by Eric Carlson.
959
960         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
961         (WebKit::WebVideoFullscreenManager::didSetupFullscreen): Use protected reference to 'this', and check for valid
962         page before attempting to use it.
963
964 2017-01-11  Anders Carlsson  <andersca@apple.com>
965
966         navigator.plugins.refresh and WKContextRefreshPlugIns doesn't pick up changes to already-present plug-ins
967         https://bugs.webkit.org/show_bug.cgi?id=166942
968         rdar://problem/29839194
969
970         Reviewed by Sam Weinig.
971
972         Use _CFBundleCreateUnique so the resulting bundle won't be cached.
973
974         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
975         (WebKit::NetscapePluginModule::getPluginInfo):
976
977 2017-01-11  Anders Carlsson  <andersca@apple.com>
978
979         REGRESSION: Crash in com.apple.WebKit: IPC::Connection::sendMessage(std::__1::unique_ptr<IPC::MachMessage, std::__1::default_delete<IPC::MachMessage> >) + 27
980         https://bugs.webkit.org/show_bug.cgi?id=165854
981         rdar://problem/29757269
982
983         Reviewed by Tim Horton.
984
985         * Platform/IPC/mac/ConnectionMac.mm:
986         (IPC::Connection::sendMessage):
987         Add assertion.
988
989         (IPC::Connection::initializeSendSource):
990         Turns out the event handler can be called spuriously, so guard against that.
991
992 2017-01-11  Chris Dumez  <cdumez@apple.com>
993
994         [iOS][WK2] KeyboardEvent.key always returns an empty string
995         https://bugs.webkit.org/show_bug.cgi?id=166918
996         <rdar://problem/29861147>
997
998         Reviewed by Wenson Hsieh.
999
1000         Make sure that KeyboardEvent.key gets properly initialized on iOS / WK2.
1001
1002         * Shared/WebEvent.h:
1003         * Shared/WebKeyboardEvent.cpp:
1004         (WebKit::WebKeyboardEvent::WebKeyboardEvent):
1005         * Shared/ios/WebIOSEventFactory.mm:
1006         (WebIOSEventFactory::createWebKeyboardEvent):
1007
1008 2017-01-10  Michael Catanzaro  <mcatanzaro@igalia.com>
1009
1010         [GTK] No way for applications to set notification permissions without waiting for permission request
1011         https://bugs.webkit.org/show_bug.cgi?id=163366
1012
1013         Reviewed by Carlos Garcia Campos.
1014
1015         Websites can check the Notification.permission DOM property to check if they have permission
1016         to show notifications *without triggering a permission request*. But the WebKitGTK+ API has
1017         no way to affirmatively indicate notifications are allowed without a permission request. The
1018         only way is via the permission request API, which is too late. It's a problem for Epiphany.
1019         For example, open the Riot Matrix client in a web app; you will immediately see an info bar
1020         informing the user that Riot does not have permission to send desktop notifications, even
1021         though Epiphany automatically grants notification permission in web app mode when requested.
1022         This problem is not exclusive to web apps; there is simply no way for notification
1023         permission to be set correctly prior to a permission request for it. Fix this by introducing
1024         a webkit_web_context_initialize_notification_permissions() API, and add a signal
1025         WebKitWebContext::initialize-notification-permissions to indicate when it should be called.
1026
1027         * UIProcess/API/gtk/WebKitNotificationProvider.cpp:
1028         (notificationPermissionsCallback):
1029         (WebKitNotificationProvider::create):
1030         (WebKitNotificationProvider::WebKitNotificationProvider):
1031         (WebKitNotificationProvider::notificationPermissions):
1032         (WebKitNotificationProvider::setNotificationPermissions):
1033         * UIProcess/API/gtk/WebKitNotificationProvider.h:
1034         * UIProcess/API/gtk/WebKitSecurityOrigin.cpp:
1035         (webkitSecurityOriginGetSecurityOrigin):
1036         * UIProcess/API/gtk/WebKitSecurityOriginPrivate.h:
1037         * UIProcess/API/gtk/WebKitWebContext.cpp:
1038         (webkitWebContextConstructed):
1039         (webkit_web_context_class_init):
1040         (addOriginToMap):
1041         (webkit_web_context_initialize_notification_permissions):
1042         (webkitWebContextInitializeNotificationPermissions):
1043         * UIProcess/API/gtk/WebKitWebContext.h:
1044         * UIProcess/API/gtk/WebKitWebContextPrivate.h:
1045         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1046
1047 2017-01-10  Keith Rollin  <krollin@apple.com>
1048
1049         Record/replay: fix range used for fuzzy matching
1050         https://bugs.webkit.org/show_bug.cgi?id=166041
1051
1052         Reviewed by Darin Adler and Alex Christensen.
1053
1054         Because of two bugs, the attempt to determine the range of URLs to
1055         check as part of the process of fuzzy matching was failing. The intent
1056         was to find the range of URLs that started with the same
1057         <scheme://host:port> as a given URL. However, because of a reversed
1058         test, the upper end of the range ended up being the "end()" iterator
1059         of the entire collection of URLs. With that fixed, there was another
1060         bug due to one URL being given as <scheme://host:port> and the other
1061         given as <scheme://host:port/> (note the trailing slash). Both of
1062         these issues are now fixed.
1063
1064         * NetworkProcess/capture/NetworkCaptureManager.cpp:
1065         (WebKit::NetworkCapture::Manager::initialize):
1066         (WebKit::NetworkCapture::Manager::findBestFuzzyMatch):
1067         (WebKit::NetworkCapture::Manager::urlIdentifyingCommonDomain):
1068         * NetworkProcess/capture/NetworkCaptureManager.h:
1069         * NetworkProcess/capture/NetworkCaptureResource.cpp:
1070         (WebKit::NetworkCapture::Resource::url):
1071         (WebKit::NetworkCapture::Resource::urlIdentifyingCommonDomain):
1072         (WebKit::NetworkCapture::Resource::baseURL): Deleted.
1073         * NetworkProcess/capture/NetworkCaptureResource.h:
1074
1075 2017-01-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1076
1077         Implement "proximity" scroll snapping
1078         https://bugs.webkit.org/show_bug.cgi?id=135994
1079         <rdar://problem/18162418>
1080
1081         Reviewed by Dean Jackson.
1082
1083         Adds boilerplate support for plumbing lists of snap offset ranges from the web process to the UI process
1084         alongside the list of snap offsets.
1085
1086         * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
1087         (ArgumentCoder<ScrollingStateScrollingNode>::encode):
1088         (ArgumentCoder<ScrollingStateScrollingNode>::decode):
1089         * Shared/WebCoreArgumentCoders.cpp:
1090         (IPC::ArgumentCoder<ScrollOffsetRange<float>>::encode):
1091         (IPC::ArgumentCoder<ScrollOffsetRange<float>>::decode):
1092         * Shared/WebCoreArgumentCoders.h:
1093         * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
1094         (-[WKOverflowScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
1095         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1096
1097         Adjust mainframe proximity scroll snapping logic to not subtract out the top content inset when there is no
1098         active snap offset (i.e. when snapping rests in a snap offset range). Attempting to subtract out the top inset
1099         in this case caused the scroll offset to jump after ending a drag with no momentum in a snap offset range.
1100
1101         (WebKit::RemoteScrollingCoordinatorProxy::adjustTargetContentOffsetForSnapping):
1102         (WebKit::RemoteScrollingCoordinatorProxy::shouldSnapForMainFrameScrolling):
1103         (WebKit::RemoteScrollingCoordinatorProxy::closestSnapOffsetForMainFrameScrolling):
1104
1105 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
1106
1107         ThreadedCoordinatedLayerTreeHost::renderNextFrame() should short-cut to layer flushing
1108         https://bugs.webkit.org/show_bug.cgi?id=157614
1109
1110         Reviewed by Carlos Garcia Campos.
1111
1112         CoordinatedLayerTreeHost prevents any layer flushes while a previously-commited scene
1113         state is still being rendered on the composition thread. renderNextFrame() is called
1114         once that is complete, and a new layer flush is scheduled.
1115
1116         This change improves the whole ordeal by immediately performing the layer flush only if
1117         it was requested during the time we were waiting on the renderer (i.e. when the latest
1118         scene state was being composited), instead of scheduling it unconditionally.
1119         m_scheduledWhileWaitingForRenderer member variable is added to track that occurrence.
1120
1121         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
1122         (WebKit::CoordinatedLayerTreeHost::scheduleLayerFlush):
1123         (WebKit::CoordinatedLayerTreeHost::renderNextFrame):
1124         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
1125
1126 2017-01-09  Chris Dumez  <cdumez@apple.com>
1127
1128         [iOS] Drop VNodeTracker
1129         https://bugs.webkit.org/show_bug.cgi?id=166868
1130         <rdar://problem/29937587>
1131
1132         Reviewed by Andreas Kling.
1133
1134         * WebProcess/cocoa/WebProcessCocoa.mm:
1135         (WebKit::WebProcess::platformInitializeWebProcess):
1136
1137 2017-01-09  Enrica Casucci  <enrica@apple.com>
1138
1139         Selection animation flashing on editable content when zooming.
1140         https://bugs.webkit.org/show_bug.cgi?id=166863
1141         rdar://problem/29931470
1142
1143         Reviewed by Tim Horton.
1144
1145         Implementing _allowAnimatedUpdateSelectionRectView and returning NO,
1146         prevents the selection animation in UIKit.
1147
1148         * UIProcess/ios/WKContentViewInteraction.mm:
1149         (-[WKContentView _allowAnimatedUpdateSelectionRectViews]):
1150
1151 2017-01-06  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
1152
1153         [GTK] Should support key and code properties on keyboard events
1154         https://bugs.webkit.org/show_bug.cgi?id=166759
1155
1156         Reviewed by Carlos Garcia Campos.
1157
1158         * Shared/WebEvent.h:
1159         * Shared/WebKeyboardEvent.cpp:
1160         (WebKit::WebKeyboardEvent::WebKeyboardEvent): accept web key value and code on construction.
1161         * Shared/gtk/WebEventFactory.cpp:
1162         (WebKit::WebEventFactory::createWebKeyboardEvent): pass web key value and code on construction.
1163
1164 2017-01-08  Antti Koivisto  <antti@apple.com>
1165
1166         Move cache coders to WTF
1167         https://bugs.webkit.org/show_bug.cgi?id=166825
1168
1169         Rubber-stamped by Sam Weinig.
1170
1171         * NetworkProcess/cache/NetworkCache.h:
1172         * NetworkProcess/cache/NetworkCacheCoder.h: Removed.
1173         * NetworkProcess/cache/NetworkCacheCoders.cpp:
1174         (WebKit::NetworkCache::Coder<AtomicString>::encode): Deleted.
1175         (WebKit::NetworkCache::Coder<AtomicString>::decode): Deleted.
1176         (WebKit::NetworkCache::Coder<CString>::encode): Deleted.
1177         (WebKit::NetworkCache::Coder<CString>::decode): Deleted.
1178         (WebKit::NetworkCache::Coder<String>::encode): Deleted.
1179         (WebKit::NetworkCache::decodeStringText): Deleted.
1180         (WebKit::NetworkCache::Coder<String>::decode): Deleted.
1181         (WebKit::NetworkCache::Coder<SHA1::Digest>::encode): Deleted.
1182         (WebKit::NetworkCache::Coder<SHA1::Digest>::decode): Deleted.
1183         (WebKit::NetworkCache::Coder<WebCore::HTTPHeaderMap>::encode): Deleted.
1184         (WebKit::NetworkCache::Coder<WebCore::HTTPHeaderMap>::decode): Deleted.
1185         * NetworkProcess/cache/NetworkCacheCoders.h:
1186         (): Deleted.
1187         (WebKit::NetworkCache::Coder<std::optional<T>>::encode): Deleted.
1188         (WebKit::NetworkCache::Coder<std::optional<T>>::decode): Deleted.
1189         * NetworkProcess/cache/NetworkCacheCodersCocoa.cpp:
1190         (WebKit::NetworkCache::encodeCFData): Deleted.
1191         (WebKit::NetworkCache::decodeCFData): Deleted.
1192         (WebKit::NetworkCache::encodeSecTrustRef): Deleted.
1193         (WebKit::NetworkCache::decodeSecTrustRef): Deleted.
1194         (WebKit::NetworkCache::encodeCertificateChain): Deleted.
1195         (WebKit::NetworkCache::decodeCertificateChain): Deleted.
1196         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::encode): Deleted.
1197         (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::decode): Deleted.
1198         * NetworkProcess/cache/NetworkCacheDecoder.cpp: Removed.
1199         * NetworkProcess/cache/NetworkCacheDecoder.h: Removed.
1200         * NetworkProcess/cache/NetworkCacheEncoder.cpp: Removed.
1201         * NetworkProcess/cache/NetworkCacheEncoder.h: Removed.
1202         * NetworkProcess/cache/NetworkCacheEntry.cpp:
1203         (WebKit::NetworkCache::Entry::encodeAsStorageRecord):
1204         (WebKit::NetworkCache::Entry::decodeStorageRecord):
1205         * NetworkProcess/cache/NetworkCacheKey.cpp:
1206         (WebKit::NetworkCache::Key::encode):
1207         (WebKit::NetworkCache::Key::decode):
1208         * NetworkProcess/cache/NetworkCacheKey.h:
1209         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1210         (WebKit::NetworkCache::decodeRecordMetaData):
1211         (WebKit::NetworkCache::encodeRecordMetaData):
1212         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
1213         (WebKit::NetworkCache::SubresourceInfo::encode):
1214         (WebKit::NetworkCache::SubresourceInfo::decode):
1215         (WebKit::NetworkCache::SubresourcesEntry::encodeAsStorageRecord):
1216         (WebKit::NetworkCache::SubresourcesEntry::decodeStorageRecord):
1217         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
1218         * UIProcess/API/APIUserContentExtensionStore.cpp:
1219         (API::encodeContentExtensionMetaData):
1220         (API::decodeContentExtensionMetaData):
1221         * WebKit2.xcodeproj/project.pbxproj:
1222
1223 2017-01-09  Tomas Popela  <tpopela@redhat.com>
1224
1225         [GTK] Replace WebKitWebSettings with WebKitSettings in documentation
1226         https://bugs.webkit.org/show_bug.cgi?id=166836
1227
1228         Reviewed by Carlos Garcia Campos.
1229
1230         Don't use WebKitWebSettings (it was a WebKit1 thing) in documentation,
1231         but replace it with WebKitSettings.
1232
1233         * UIProcess/API/gtk/WebKitSettings.cpp:
1234         (webkit_settings_class_init):
1235         * UIProcess/API/gtk/WebKitWebView.cpp:
1236
1237 2017-01-06  Darin Adler  <darin@apple.com>
1238
1239         Remove PassRefPtr use from "inspector", "platform/sql", and "platform/text"
1240         https://bugs.webkit.org/show_bug.cgi?id=166797
1241
1242         Reviewed by Alex Christensen.
1243
1244         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1245         (WebKit::WebEditorClient::requestCheckingOfString): Take a reference
1246         instead of a PassRefPtr.
1247         * WebProcess/WebCoreSupport/WebEditorClient.h: Updated for above change.
1248
1249 2017-01-07  Andy Estes  <aestes@apple.com>
1250
1251         [QuickLook] Consolidate usage of QuickLookHandle into SubresourceLoader
1252         https://bugs.webkit.org/show_bug.cgi?id=166713
1253
1254         Reviewed by Alex Christensen.
1255
1256         * WebProcess/Network/WebResourceLoader.cpp:
1257         (WebKit::WebResourceLoader::didReceiveResponse): Removed QuickLook code.
1258         (WebKit::WebResourceLoader::didReceiveData): Ditto.
1259         (WebKit::WebResourceLoader::didFinishResourceLoad): Ditto.
1260         (WebKit::WebResourceLoader::didFailResourceLoad): Ditto.
1261         (WebKit::WebResourceLoader::didReceiveResource): Ditto.
1262
1263 2017-01-06  Daniel Bates  <dabates@apple.com>
1264
1265         Attempt to fix the EFL build following <http://trac.webkit.org/changeset/210461>
1266         (https://bugs.webkit.org/show_bug.cgi?id=166781)
1267
1268         * UIProcess/API/C/WKWebsitePolicies.cpp:
1269         (WKWebsitePoliciesGetAutoplayPolicy): Invoke ASSERT_NOT_REACHED() and return kWKWebsiteAutoplayPolicyUseHeuristics
1270         if the specified policy is not covered by a switch case.
1271         (WKWebsitePoliciesSetAutoplayPolicy): Substituted "return" for "break" in each switch case and
1272         invoke ASSERT_NOT_REACHED() if the specified policy is not covered by a switch case.
1273
1274 2017-01-06  Matt Rajca  <mrajca@apple.com>
1275
1276         Add infrastructure for sending autoplay website policies to WebKit
1277         https://bugs.webkit.org/show_bug.cgi?id=166781
1278
1279         Reviewed by Alex Christensen.
1280
1281         * Shared/WebsitePolicies.h:
1282         (WebKit::WebsitePolicies::encode):
1283         (WebKit::WebsitePolicies::decode):
1284         * UIProcess/API/APIWebsitePolicies.h:
1285         * UIProcess/API/C/WKWebsitePolicies.cpp:
1286         (WKWebsitePoliciesGetAutoplayPolicy):
1287         (WKWebsitePoliciesSetAutoplayPolicy):
1288         * UIProcess/API/C/WKWebsitePolicies.h:
1289         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
1290         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
1291         (-[_WKWebsitePolicies setAutoplayPolicy:]):
1292         (-[_WKWebsitePolicies autoplayPolicy]):
1293
1294 2017-01-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1295
1296         [SOUP] Network process crash in WebKit::CustomProtocolManagerImpl::didFailWithError
1297         https://bugs.webkit.org/show_bug.cgi?id=165082
1298
1299         Reviewed by Alex Christensen.
1300
1301         CustomProtocolManager uses a Workqueue to receive the IPC messages since r149194. Then we added the Soup
1302         implementation adopting that approach, but without making our implementation thread safe. The crash happens
1303         because the CustomProtocolManager implementation is used by two threads at the same time, the main thread
1304         because of a ping load (probably caused by an image load in the unload handler, I haven't been able to
1305         reproduce the crash) and the work queue thread. The reasons to make CustomProtocolManager use a WorkQueue
1306         are no longer valid because CustomProtocolManager is now only used in the network process and sync loads don't
1307         use any nested run loop, they are just an IPC sync message. So this patch makes CustomProtocolManager a normal
1308         message receiver again to ensure messages are handled in the main thread. It also adds the common implementation
1309         to a new CustomProtocolManager.cpp file shared by Cocoa and Soup based ports.
1310
1311         * CMakeLists.txt: Add CustomProtocolManager.cpp.
1312         * NetworkProcess/CustomProtocols/Cocoa/CustomProtocolManagerCocoa.mm:
1313         (-[WKCustomProtocol initWithRequest:cachedResponse:client:]): Use new CustomProtocolManager API.
1314         (-[WKCustomProtocol startLoading]): Ditto.
1315         (-[WKCustomProtocol stopLoading]): Ditto.
1316         (WebKit::CustomProtocolManager::registerProtocolClass): Register the NSURLProtocol class when not using the
1317         network session.
1318         (WebKit::CustomProtocolManager::didFailWithError): removeCustomProtocol now receives an ID.
1319         (WebKit::CustomProtocolManager::didFinishLoading): Ditto.
1320         * NetworkProcess/CustomProtocols/CustomProtocolManager.cpp: Added.
1321         (WebKit::generateCustomProtocolID): Moved from CustomProtocolManagerCocoa.mm and CustomProtocolManagerSoup.cpp.
1322         (WebKit::CustomProtocolManager::supplementName): Ditto.
1323         (WebKit::CustomProtocolManager::CustomProtocolManager): Also removes the work queue initialization.
1324         (WebKit::CustomProtocolManager::initialize): Copied and modernized the loop.
1325         (WebKit::CustomProtocolManager::addCustomProtocol): Copied from CustomProtocolManagerCocoa.mm.
1326         (WebKit::CustomProtocolManager::removeCustomProtocol): Ditto.
1327         (WebKit::CustomProtocolManager::startLoading): Send the StartLoading message to the proxy.
1328         (WebKit::CustomProtocolManager::stopLoading): Send the StopLoading message to the proxy.
1329         * NetworkProcess/CustomProtocols/CustomProtocolManager.h:
1330         * NetworkProcess/CustomProtocols/soup/CustomProtocolManagerImpl.cpp: Removed.
1331         * NetworkProcess/CustomProtocols/soup/CustomProtocolManagerImpl.h: Removed.
1332         * NetworkProcess/CustomProtocols/soup/CustomProtocolManagerSoup.cpp: Moved the implementation from
1333         CustomProtocolManagerImpl and updated to the new CustomProtocolManager API.
1334         (WebKit::CustomProtocolManager::WebSoupRequestAsyncData::WebSoupRequestAsyncData):
1335         (WebKit::CustomProtocolManager::WebSoupRequestAsyncData::~WebSoupRequestAsyncData):
1336         (WebKit::CustomProtocolManager::registerProtocolClass):
1337         (WebKit::CustomProtocolManager::registerScheme):
1338         (WebKit::CustomProtocolManager::supportsScheme):
1339         (WebKit::CustomProtocolManager::didFailWithError):
1340         (WebKit::CustomProtocolManager::didLoadData):
1341         (WebKit::CustomProtocolManager::didReceiveResponse):
1342         (WebKit::CustomProtocolManager::didFinishLoading):
1343         (WebKit::CustomProtocolManager::wasRedirectedToRequest):
1344         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1345         (WebKit::globalCustomProtocolManager):
1346         (WebKit::NetworkSessionCocoa::defaultSession):
1347         CustomProtocolManager is no longer refcounted, so just pass a pointer.
1348         A static pointer has the same lifetime as the NetworkProcess object in the NetworkProcess,
1349         and in the WebProcess it will remain nullptr, just like it used to.
1350         * PlatformEfl.cmake:
1351         * PlatformGTK.cmake:
1352         * WebKit2.xcodeproj/project.pbxproj:
1353
1354 2017-01-05  Antti Koivisto  <antti@apple.com>
1355
1356         Use WTF::Function instead of std::function in network cache code
1357         https://bugs.webkit.org/show_bug.cgi?id=166721
1358
1359         Reviewed by Andreas Kling.
1360
1361         Use better move-only type. Fix some unnecessary function copies.
1362
1363         * NetworkProcess/cache/NetworkCache.cpp:
1364         (WebKit::NetworkCache::Cache::retrieve):
1365         (WebKit::NetworkCache::Cache::clear):
1366         * NetworkProcess/cache/NetworkCache.h:
1367         * NetworkProcess/cache/NetworkCacheData.h:
1368         * NetworkProcess/cache/NetworkCacheDataCocoa.mm:
1369         (WebKit::NetworkCache::Data::apply):
1370         * NetworkProcess/cache/NetworkCacheDataSoup.cpp:
1371         (WebKit::NetworkCache::Data::apply):
1372         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
1373         (WebKit::NetworkCache::traverseDirectory):
1374         * NetworkProcess/cache/NetworkCacheFileSystem.h:
1375         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
1376         (WebKit::NetworkCache::SpeculativeLoadManager::canRetrieve):
1377         (WebKit::NetworkCache::SpeculativeLoadManager::retrieve):
1378
1379             Split retrieve() to canRetrieve() and retrieve() functions.
1380             This avoids the need to copy the completion handler in the caller.
1381
1382         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:
1383         * NetworkProcess/cache/NetworkCacheStorage.cpp:
1384         (WebKit::NetworkCache::Storage::ReadOperation::ReadOperation):
1385         (WebKit::NetworkCache::Storage::traverse):
1386         (WebKit::NetworkCache::Storage::clear):
1387         * NetworkProcess/cache/NetworkCacheStorage.h:
1388
1389 2017-01-05  Enrica Casucci  <enrica@apple.com>
1390
1391         Unreviewed build fix after https://trac.webkit.org/changeset/210360
1392
1393         * UIProcess/Cocoa/WebViewImpl.mm:
1394         (WebKit::WebViewImpl::performDragOperation):
1395
1396 2017-01-05  Enrica Casucci  <enrica@apple.com>
1397
1398         Support File Promise during drag for macOS.
1399         https://bugs.webkit.org/show_bug.cgi?id=165204
1400         rdar://problem/19595567
1401
1402         Reviewed by Tim Horton.
1403
1404         Adds support for dropping a File Promise in a WKWebView.
1405         The implementation uses new File Promise API available in Sierra.
1406
1407         * Shared/WebCoreArgumentCoders.cpp:
1408         (IPC::ArgumentCoder<DragData>::encode):
1409         (IPC::ArgumentCoder<DragData>::decode):
1410         * Shared/mac/PasteboardTypes.mm:
1411         (WebKit::PasteboardTypes::forURL):
1412         * UIProcess/Cocoa/WebViewImpl.h:
1413         * UIProcess/Cocoa/WebViewImpl.mm:
1414         (WebKit::WebViewImpl::createSandboxExtensionsIfNeeded):
1415         (WebKit::WebViewImpl::performDragOperation):
1416         (WebKit::maybeCreateSandboxExtensionFromPasteboard): Deleted.
1417         (WebKit::createSandboxExtensionsForFileUpload): Deleted.
1418
1419 2017-01-05  Andreas Kling  <akling@apple.com>
1420
1421         Remove ChromeClient::needTouchEvents().
1422         <https://webkit.org/b/166723>
1423
1424         Rubber-stamped by Antti Koivisto.
1425
1426         * WebProcess/WebCoreSupport/WebChromeClient.h:
1427
1428 2017-01-04  Darin Adler  <darin@apple.com>
1429
1430         Remove PassRefPtr use from the "html" directory, other improvements
1431         https://bugs.webkit.org/show_bug.cgi?id=166635
1432
1433         Reviewed by Alex Christensen.
1434
1435         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1436         (WebKit::WebChromeClient::loadIconForFiles): Take a reference instead of a pointer.
1437         * WebProcess/WebCoreSupport/WebChromeClient.h: Ditto.
1438
1439 2017-01-04  Myles C. Maxfield  <mmaxfield@apple.com>
1440
1441         Remove runtime flag for variation fonts
1442         https://bugs.webkit.org/show_bug.cgi?id=164251
1443
1444         Reviewed by Dean Jackson.
1445
1446         * Shared/WebPreferencesDefinitions.h:
1447         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1448         (WebKit::registerUserDefaultsIfNeeded):
1449         * WebProcess/WebPage/WebPage.cpp:
1450         (WebKit::WebPage::updatePreferences):
1451
1452 2017-01-04  Ryan Haddad  <ryanhaddad@apple.com>
1453
1454         Unreviewed, rolling out r210287.
1455
1456         This change caused editing test failures on macOS.
1457
1458         Reverted changeset:
1459
1460         "Support File Promise during drag for macOS."
1461         https://bugs.webkit.org/show_bug.cgi?id=165204
1462         http://trac.webkit.org/changeset/210287
1463
1464 2017-01-04  Enrica Casucci  <enrica@apple.com>
1465
1466         Support File Promise during drag for macOS.
1467         https://bugs.webkit.org/show_bug.cgi?id=165204
1468         rdar://problem/19595567
1469
1470         Reviewed by Tim Horton.
1471
1472         Adds support for dropping a File Promise in a WKWebView.
1473         The implementation uses new File Promise API available in Sierra.
1474
1475         * Shared/WebCoreArgumentCoders.cpp:
1476         (IPC::ArgumentCoder<DragData>::encode):
1477         (IPC::ArgumentCoder<DragData>::decode):
1478         * Shared/mac/PasteboardTypes.mm:
1479         (WebKit::PasteboardTypes::forURL):
1480         * UIProcess/Cocoa/WebViewImpl.h:
1481         * UIProcess/Cocoa/WebViewImpl.mm:
1482         (WebKit::WebViewImpl::createSandboxExtensionsIfNeeded):
1483         (WebKit::WebViewImpl::performDragOperation):
1484         (WebKit::maybeCreateSandboxExtensionFromPasteboard): Deleted.
1485         (WebKit::createSandboxExtensionsForFileUpload): Deleted.
1486
1487 2017-01-04  Jeremy Jones  <jeremyj@apple.com>
1488
1489         Release pointer lock when page state is reset for any reason, not just for process exited.
1490         https://bugs.webkit.org/show_bug.cgi?id=166654
1491         <rdar://problem/29849769>
1492
1493         Reviewed by Tim Horton.
1494
1495         Pointer lock was not being released when the window is closed.
1496         Move the pointer lock to resetState() so it happens whenever the page is
1497         reset, not just when it is reset after process exit.
1498
1499         * UIProcess/WebPageProxy.cpp:
1500         (WebKit::WebPageProxy::resetState): Release here.
1501         (WebKit::WebPageProxy::resetStateAfterProcessExited): Don't release here.
1502
1503 2017-01-03  Tim Horton  <timothy_horton@apple.com>
1504
1505         NSSpellChecker's recordResponse isn't called for unseen automatic corrections
1506         https://bugs.webkit.org/show_bug.cgi?id=166450
1507         <rdar://problem/29447824>
1508
1509         Reviewed by Darin Adler.
1510
1511         * UIProcess/mac/CorrectionPanel.h:
1512         * UIProcess/mac/CorrectionPanel.mm:
1513         (WebKit::CorrectionPanel::recordAutocorrectionResponse):
1514         (WebKit::CorrectionPanel::handleAcceptedReplacement):
1515         Funnel all calls to recordResponse:toCorrection:forWord:language:inSpellDocumentWithTag:
1516         through recordAutocorrectionResponse, for debugging's sake.
1517         Drop the NSView parameter because we don't need it, just the tag.
1518
1519         * UIProcess/mac/PageClientImpl.mm:
1520         (WebKit::toCorrectionResponse):
1521         (WebKit::PageClientImpl::recordAutocorrectionResponse):
1522         Convert the new AutocorrectionResponseType value to its corresponding
1523         NSCorrectionResponse value.
1524
1525 2017-01-03  Daniel Bates  <dabates@apple.com>
1526
1527         Another attempt to fix the Apple Sierra Release 32-bit Build following <https://trac.webkit.org/changeset/210075>
1528         (https://bugs.webkit.org/show_bug.cgi?id=166367)
1529
1530         Guard more code in WebViewImpl::handleRequestedCandidates() inside HAVE(TOUCH_BAR).
1531         Remove unused local variable weakThis.
1532
1533         * UIProcess/Cocoa/WebViewImpl.mm:
1534         (WebKit::WebViewImpl::handleRequestedCandidates):
1535
1536 2017-01-03  Daniel Bates  <dabates@apple.com>
1537
1538         Attempt to fix the Apple Sierra Release 32-bit Build following <https://trac.webkit.org/changeset/210075>
1539         (https://bugs.webkit.org/show_bug.cgi?id=166367)
1540
1541         Add HAVE(TOUCH_BAR)-guard around code that messages candidateListTouchBarItem() as
1542         candidateListTouchBarItem() is only defined when building with Touch Bar support.
1543
1544         Also added an inline comment to help demarcate the code when building without Touch Bar
1545         support. We should look to clean up WebViewImpl.mm including extracting out the Touch
1546         Bar code to another file or better demarcating it so as to improve the hackability of
1547         this code and prevent breaking the build when building without Touch Bar support.
1548
1549         * UIProcess/Cocoa/WebViewImpl.mm:
1550         (WebKit::WebViewImpl::handleRequestedCandidates):
1551
1552 2017-01-03  Michael Catanzaro  <mcatanzaro@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
1553
1554         [GTK] Expose WebKitSecurityOrigin API
1555         https://bugs.webkit.org/show_bug.cgi?id=166632
1556
1557         Reviewed by Carlos Garcia Campos.
1558
1559         This API will be useful to have for various purposes, such as setting initial notification
1560         permissions.
1561
1562         * PlatformGTK.cmake:
1563         * UIProcess/API/gtk/WebKitAutocleanups.h:
1564         * UIProcess/API/gtk/WebKitSecurityOrigin.cpp: Added.
1565         (_WebKitSecurityOrigin::_WebKitSecurityOrigin):
1566         (webkitSecurityOriginCreate):
1567         (webkit_security_origin_new):
1568         (webkit_security_origin_new_for_uri):
1569         (webkit_security_origin_ref):
1570         (webkit_security_origin_unref):
1571         (webkit_security_origin_get_protocol):
1572         (webkit_security_origin_get_host):
1573         (webkit_security_origin_get_port):
1574         (webkit_security_origin_is_opaque):
1575         (webkit_security_origin_to_string):
1576         * UIProcess/API/gtk/WebKitSecurityOrigin.h: Added.
1577         * UIProcess/API/gtk/WebKitSecurityOriginPrivate.h: Added.
1578         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1579         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
1580         * UIProcess/API/gtk/webkit2.h:
1581
1582 2017-01-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1583
1584         [SOUP] Load options allowStoredCredentials = DoNotAllowStoredCredentials with clientCredentialPolicy = MayAskClientForCredentials doesn't work
1585         https://bugs.webkit.org/show_bug.cgi?id=164471
1586
1587         Reviewed by Michael Catanzaro.
1588
1589         When DoNotAllowStoredCredentials is used we disable the SoupAuthManager feature for the message, but that
1590         disables all HTTP authentication, causing the load to always fail with Authorization required even when
1591         clientCredentialPolicy allows to ask the user for credentials. The problem is that even if we don't use the
1592         WebCore credentials for that request, libsoup will always use its internal cache of SoupAuth if we enable the
1593         SoupAuthManager feature. Libsoup 2.57.1 has new API to disable the use of cached credentials for a particular
1594         message, adding the new message flag SOUP_MESSAGE_DO_NOT_USE_AUTH_CACHE.
1595
1596         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1597         (WebKit::NetworkDataTaskSoup::createRequest): Set SOUP_MESSAGE_DO_NOT_USE_AUTH_CACHE flag to disable cached
1598         credentials for the message if libsoup >= 2.57.1 is used.
1599
1600 2017-01-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1601
1602         [GTK] HTTP auth layout tests are flaky
1603         https://bugs.webkit.org/show_bug.cgi?id=158919
1604
1605         Reviewed by Michael Catanzaro.
1606
1607         Implement NetworkSession::clearCredentials() for soup using the new libsoup API when available.
1608
1609         * NetworkProcess/soup/NetworkSessionSoup.cpp:
1610         (WebKit::NetworkSessionSoup::clearCredentials):
1611         * NetworkProcess/soup/NetworkSessionSoup.h:
1612
1613 2017-01-01  Jeff Miller  <jeffm@apple.com>
1614
1615         Update user-visible copyright strings to include 2017
1616         https://bugs.webkit.org/show_bug.cgi?id=166278
1617
1618         Reviewed by Dan Bernstein.
1619
1620         * DatabaseProcess/EntryPoint/mac/XPCService/DatabaseService/Info.plist:
1621         * Info.plist:
1622         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX-10.9-10.10.plist:
1623         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX.plist:
1624         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-iOS.plist:
1625         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64-10.9-10.10.Info.plist:
1626         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist:
1627         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX-10.9-10.10.plist:
1628         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist:
1629         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist:
1630
1631 2016-12-30  Darin Adler  <darin@apple.com>
1632
1633         Remove PassRefPtr use from the "dom" directory, related cleanup
1634         https://bugs.webkit.org/show_bug.cgi?id=166569
1635
1636         Reviewed by Alex Christensen.
1637
1638         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1639         (WebKit::WebFrameLoaderClient::dispatchDidReceiveTitle): Updated to use struct.
1640         (WebKit::WebFrameLoaderClient::updateGlobalHistory): Ditto.
1641         (WebKit::WebFrameLoaderClient::setTitle): Ditto.
1642
1643 2016-12-27  Alex Christensen  <achristensen@webkit.org>
1644
1645         reduce PassRefPtr use in WebKit2
1646         https://bugs.webkit.org/show_bug.cgi?id=166452
1647
1648         Reviewed by Yusuke Suzuki.
1649
1650         * Shared/API/c/cg/WKImageCG.cpp:
1651         (WKImageCreateCGImage):
1652         (WKImageCreateFromCGImage):
1653         * Shared/ShareableBitmap.cpp:
1654         (WebKit::ShareableBitmap::createHandle):
1655         * Shared/ShareableBitmap.h:
1656         * Shared/UserData.cpp:
1657         (WebKit::UserData::encode):
1658         (WebKit::UserData::decode):
1659         * Shared/WebImage.cpp:
1660         (WebKit::WebImage::create):
1661         (WebKit::WebImage::WebImage):
1662         * Shared/WebImage.h:
1663         (WebKit::WebImage::bitmap):
1664         * UIProcess/WebPageProxy.cpp:
1665         (WebKit::WebPageProxy::didGetImageForFindMatch):
1666         * UIProcess/mac/WKTextFinderClient.mm:
1667         (-[WKTextFinderClient didGetImageForMatchResult:]):
1668         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1669         (WebKit::WebAutomationSessionProxy::takeScreenshot):
1670         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
1671         (-[WKWebProcessPlugInNodeHandle renderedImageWithOptions:]):
1672         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
1673         (WebKit::imageForRect):
1674         (WebKit::InjectedBundleNodeHandle::renderedImage):
1675         (WebKit::InjectedBundleNodeHandle::visibleRange):
1676         (WebKit::InjectedBundleNodeHandle::htmlTableCellElementCellAbove):
1677         (WebKit::InjectedBundleNodeHandle::documentFrame):
1678         (WebKit::InjectedBundleNodeHandle::htmlFrameElementContentFrame):
1679         (WebKit::InjectedBundleNodeHandle::htmlIFrameElementContentFrame):
1680         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
1681         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
1682         (WebKit::InjectedBundleRangeHandle::renderedImage):
1683         * WebProcess/WebPage/WebPage.cpp:
1684         (WebKit::WebPage::takeSnapshot):
1685         (WebKit::WebPage::snapshotAtSize):
1686         (WebKit::WebPage::snapshotNode):
1687         (WebKit::WebPage::drawRectToImage):
1688         * WebProcess/WebPage/ios/WebPageIOS.mm:
1689         (WebKit::WebPage::getPositionInformation):
1690         * WebProcess/WebPage/mac/WebPageMac.mm:
1691         (WebKit::WebPage::setTopOverhangImage):
1692         (WebKit::WebPage::setBottomOverhangImage):
1693
1694 2016-12-27  Emanuele Aina  <emanuele.aina@collabora.com>
1695
1696         Ensure NetworkProcess is ready before whitelisting TLS certificates
1697         https://bugs.webkit.org/show_bug.cgi?id=162962
1698
1699         Reviewed by Alex Christensen.
1700
1701         If the API user tries to whitelist TLS certificates before any web
1702         view has been created, the action will be ignored because the
1703         NetworkProcess hasn't been fired up yet.
1704
1705         For example, the snippet below using the GTK+ API does not work,
1706         unless the whitelisting is moved after the web view creation:
1707
1708           webkit_web_context_allow_tls_certificate_for_host(webkit_web_context_get_default(), crt, host);
1709           webView = webkit_web_view_new();
1710
1711         * UIProcess/WebProcessPool.cpp:
1712         (WebKit::WebProcessPool::allowSpecificHTTPSCertificateForHost): Ensure
1713         that the NetworkProcess has been already fired up when adding
1714         certificates, so they can be whitelisted before the first web view is
1715         instantiated.
1716
1717 2016-12-25  Yusuke Suzuki  <utatane.tea@gmail.com>
1718
1719         Propagate the source origin as much as possible
1720         https://bugs.webkit.org/show_bug.cgi?id=166348
1721
1722         Reviewed by Darin Adler.
1723
1724         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
1725         (WebKit::NPRuntimeObjectMap::evaluate):
1726
1727 2016-12-22  Andy Estes  <aestes@apple.com>
1728
1729         Reduce QuickLook.h include overhead
1730         https://bugs.webkit.org/show_bug.cgi?id=166454
1731
1732         Reviewed by Andreas Kling.
1733
1734         * WebProcess/Network/WebLoaderStrategy.cpp: Included QuickLook.h for QLPreviewProtocol().
1735         * WebProcess/Network/WebResourceLoader.cpp: Included QuickLook.h for QuickLookHandle.
1736         * WebProcess/Network/WebResourceLoader.h: Stopped including QuickLook.h.
1737
1738 2016-12-22  Tim Horton  <timothy_horton@apple.com>
1739
1740         Null deref under WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground
1741         https://bugs.webkit.org/show_bug.cgi?id=166433
1742         <rdar://problem/29732407>
1743
1744         Reviewed by Daniel Bates.
1745
1746         * UIProcess/ios/WebPageProxyIOS.mm:
1747         (WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground):
1748         m_drawingArea can be null if the process is not valid.
1749
1750 2016-12-22  Andy Estes  <aestes@apple.com>
1751
1752         Make WebCore::EditorInsertAction an enum class
1753         https://bugs.webkit.org/show_bug.cgi?id=166424
1754
1755         Reviewed by Brent Fulgham.
1756
1757         * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
1758         (WebKit::toAPI):
1759         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1760         (toWK):
1761
1762 2016-12-22  Zhuo Li  <zachli@apple.com>
1763
1764         [Cocoa] SPI for setloadsImagesAutomatically
1765         https://bugs.webkit.org/show_bug.cgi?id=166401
1766
1767         Reviewed by Darin Adler.
1768
1769         * UIProcess/API/Cocoa/WKPreferences.mm: Call the C API under the hood.
1770         (-[WKPreferences _loadsImagesAutomatically]):
1771         (-[WKPreferences _setLoadsImagesAutomatically:]):
1772
1773         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1774         Add `_loadsImagesAutomatically` property.
1775
1776 2016-12-22  Eric Carlson  <eric.carlson@apple.com>
1777
1778         AVPlayerLayer isn't available on every system
1779         https://bugs.webkit.org/show_bug.cgi?id=166399
1780
1781         Reviewed by Jer Noble.
1782
1783         * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm: Use SOFT_LINK_CLASS_OPTIONAL.
1784
1785 2016-12-22  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
1786
1787         MediaStream: ASSERTION FAILED: m_ids.size() == m_handles.size() in MediaDeviceSandboxExtensions
1788         https://bugs.webkit.org/show_bug.cgi?id=166328
1789
1790         Reviewed by Eric Carlson.
1791
1792         This assertion failure happens for ports with sandbox extensions disabled. SandboxExtension is empty and
1793         HandleArray:size() always returns 0. Disable creation of MediaDevicesSandboxExtension in UserMediaProcessManager
1794         when building without support of sandbox extension. Disable also WebPage::grantUserMediaDeviceSandboxExtensions
1795         and WebPage::revokeUserMediaDeviceSandboxExtensions which can be avoided when sandbox extension is empty.
1796
1797         * UIProcess/UserMediaProcessManager.cpp:
1798         (WebKit::UserMediaProcessManager::willCreateMediaStream):
1799         (WebKit::UserMediaProcessManager::endedCaptureSession):
1800         * WebProcess/WebPage/WebPage.cpp:
1801         * WebProcess/WebPage/WebPage.h:
1802         * WebProcess/WebPage/WebPage.messages.in:
1803
1804 2016-12-22  Alejandro G. Castro  <alex@igalia.com>
1805
1806         [WebRTC] Add support for runtime PeeConnection setting, required after r209757
1807         https://bugs.webkit.org/show_bug.cgi?id=166346
1808
1809         Reviewed by Carlos Garcia Campos.
1810
1811         After that commit we have to enable the peerConnection runtime
1812         flag if we want webrtc to work. We are not adding a new API for
1813         the moment to control the peerConnection feature.
1814
1815         * UIProcess/API/gtk/WebKitSettings.cpp:
1816         (webkit_settings_set_enable_media_stream): Use the mediaStream
1817         setting to control the peerConnection
1818
1819 2016-12-21  Brent Fulgham  <bfulgham@apple.com>
1820
1821         [Mac][WK2] Stop using file* rules in WebProcess sandbox profiles
1822         https://bugs.webkit.org/show_bug.cgi?id=165824
1823         <rdar://problem/14024823>
1824
1825         Reviewed by Alexey Proskuryakov
1826
1827         Switch from blanket 'file*' sandbox rules, to the specific 'file-read*' and 'file-write*' rules
1828         we actually need.
1829
1830         * DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
1831         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
1832         * WebProcess/com.apple.WebProcess.sb.in:
1833
1834 2016-12-21  Beth Dakin  <bdakin@apple.com>
1835
1836         Holding down on candidates in the TouchBar should show panel on screen
1837         https://bugs.webkit.org/show_bug.cgi?id=166367
1838         -and corresponding-
1839         <rdar://problem/28479236>
1840
1841         Reviewed by Tim Horton.
1842
1843         The showCandidates() helper function is not needed. We can call the AppKit method 
1844         directly at the one call site.
1845         * UIProcess/Cocoa/WebViewImpl.h:
1846         * UIProcess/Cocoa/WebViewImpl.mm:
1847
1848         The panel should appear under the selection, so offset the selection rect.
1849         (WebKit::WebViewImpl::handleRequestedCandidates):
1850
1851         No more showCandidates() since we can call it directly. 
1852         (WebKit::WebViewImpl::showCandidates): Deleted.
1853
1854 2016-12-20  Taras Tsugrii  <ttsugrii@fb.com>
1855
1856         Fix undefined behavior caused by macro expansion producing 'defined'
1857         https://bugs.webkit.org/show_bug.cgi?id=166047
1858
1859         Reviewed by Darin Adler.
1860
1861         * Shared/API/Cocoa/WKFoundation.h:
1862
1863 2016-12-20  Brent Fulgham  <bfulgham@apple.com>
1864
1865         Address some style problems found by static analysis
1866         https://bugs.webkit.org/show_bug.cgi?id=165975
1867
1868         Reviewed by Alex Christensen.
1869
1870         Avoid passing large ANGLE data structures through the ANGLEWebKitBridge methods.
1871
1872         * Shared/WebBackForwardListItem.cpp:
1873         (WebKit::WebBackForwardListItem::create):
1874         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
1875         * Shared/WebBackForwardListItem.h:
1876
1877 2016-12-20  Simon Fraser  <simon.fraser@apple.com>
1878
1879         [iOS WK2] Switching or closing a tab leads to all-white tab content if the status bar is double height
1880         https://bugs.webkit.org/show_bug.cgi?id=166286
1881         rdar://problem/29593525
1882
1883         Reviewed by Tim Horton.
1884
1885         A double-height status bar triggers view resize while snapshotting in the background,
1886         which also triggers calls to _endAnimatedResize on tab resume. However, it was possible
1887         for _endAnimatedResize to re-enter via synchronizeDynamicViewportUpdate()/didCommitLayerTree(),
1888         causing us to use a nil _resizeAnimationView for scale computations, thus setting a zero
1889         scale on the WKContentView.
1890
1891         Fix by checking _dynamicViewportUpdateMode again after the call to synchronizeDynamicViewportUpdate(),
1892         and do a belt-and-braces check for a nil _resizeAnimationView.
1893
1894         * UIProcess/API/Cocoa/WKWebView.mm:
1895         (-[WKWebView _endAnimatedResize]):
1896
1897 2016-12-20  Andy Estes  <aestes@apple.com>
1898
1899         [Cocoa] REGRESSION (r209558): Calling decisionHandler multiple times in webView:decidePolicyForNavigationAction:decisionHandler: leads to a crash
1900         https://bugs.webkit.org/show_bug.cgi?id=165992
1901         <rdar://problem/29693817>
1902
1903         Reviewed by Brady Eidson.
1904
1905         r209558 added additional move semantics to the decisionHandler block passed to
1906         -webView:decidePolicyForNavigationAction:decisionHandler:, resulting in a null pointer
1907         dereference in clients that call the decisionHandler block more than once.
1908
1909         None of the completion handlers we expose in the WebKit API are intended to be called more
1910         than once, and we ASSERT in CompletionHandlerCallChecker::didCallCompletionHandler() that
1911         this doesn't happen.
1912
1913         This change strenghtens that protection by returning immediately in completion handlers
1914         called more than once. And in programs linked on or after WebKit 603.1.17, an NSException is
1915         thrown if a completion handler is called a second time, like we do for completion handlers
1916         that are never called.
1917
1918         New API test: WebKit2.DuplicateCompletionHandlerCalls
1919
1920         * Shared/Cocoa/CompletionHandlerCallChecker.h: Declared completionHandlerHasBeenCalled().
1921         * Shared/Cocoa/CompletionHandlerCallChecker.mm:
1922         (WebKit::shouldThrowExceptionForDuplicateCompletionHandlerCall): Added. Returns true if the
1923         program is linked on or after
1924         LibraryVersion::FirstWithExceptionsForDuplicateCompletionHandlerCalls.
1925         (WebKit::CompletionHandlerCallChecker::completionHandlerHasBeenCalled): Added. Returns
1926         whether or not the completion handler has been called. If it has, and
1927         shouldThrowExceptionForDuplicateCompletionHandlerCall() returns true, throws an
1928         NSInternalInconsistencyException.
1929         * UIProcess/API/Cocoa/WKWebView.mm:
1930         (-[WKWebView _setInputDelegate:]): Added an early return if the completion handler has
1931         already been called.
1932         * UIProcess/Cocoa/NavigationState.mm:
1933         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): Ditto.
1934         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse): Ditto.
1935         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge): Ditto.
1936         * UIProcess/Cocoa/UIDelegate.mm:
1937         (WebKit::UIDelegate::UIClient::runJavaScriptAlert): Ditto.
1938         (WebKit::UIDelegate::UIClient::runJavaScriptConfirm): Ditto.
1939         (WebKit::UIDelegate::UIClient::runJavaScriptPrompt): Ditto.
1940         (WebKit::UIDelegate::UIClient::exceededDatabaseQuota): Ditto.
1941         (WebKit::UIDelegate::UIClient::runOpenPanel): Ditto.
1942         (WebKit::UIDelegate::UIClient::reachedApplicationCacheOriginQuota): Ditto.
1943         * UIProcess/Cocoa/VersionChecks.h: Added
1944         FirstWithExceptionsForDuplicateCompletionHandlerCalls with the version number for 603.1.17.
1945
1946 2016-12-20  Dean Jackson  <dino@apple.com>
1947
1948         Remove INDIE_UI
1949         https://bugs.webkit.org/show_bug.cgi?id=165881
1950         <rdar://problem/29672532>
1951
1952         Reviewed by Simon Fraser.
1953
1954         The Indie UI work has been discontinued.
1955
1956         * Configurations/FeatureDefines.xcconfig:
1957
1958 2016-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
1959
1960         Implement the updated port/area-based Scroll Snap Module Level 1 Spec
1961         https://bugs.webkit.org/show_bug.cgi?id=165317
1962         <rdar://problem/29490956>
1963
1964         Reviewed by Dean Jackson.
1965
1966         Remove unused code for adopting scroll snapping in the PDF plugin.
1967
1968         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1969         (WebKit::PDFPlugin::didCalculateSizes):
1970
1971 2016-12-19  Yusuke Suzuki  <utatane.tea@gmail.com>
1972
1973         [ES6] Enable ES6 Modules
1974         https://bugs.webkit.org/show_bug.cgi?id=165849
1975
1976         Reviewed by Geoffrey Garen.
1977
1978         * Shared/WebPreferencesDefinitions.h:
1979         * UIProcess/API/C/WKPreferences.cpp:
1980         (WKPreferencesSetES6ModulesEnabled): Deleted.
1981         (WKPreferencesGetES6ModulesEnabled): Deleted.
1982         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1983         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1984         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1985         * WebProcess/WebPage/WebPage.cpp:
1986         (WebKit::WebPage::updatePreferences):
1987
1988 2016-12-19  Keith Rollin  <krollin@apple.com>
1989
1990         Fix unwanted deletion of record/replay files
1991         https://bugs.webkit.org/show_bug.cgi?id=166040
1992
1993         Reviewed by Alex Christensen.
1994
1995         As part of some refactoring, the objects that create the meta files
1996         that are part of the record/replay cache would get deleted. They were
1997         always getting opened in "write" mode", which would truncate the
1998         files. Fix this so that the files are opened in the right modes for
1999         record, replay, and neither.
2000
2001         * NetworkProcess/capture/NetworkCaptureManager.cpp:
2002         (WebKit::NetworkCapture::Manager::initialize):
2003
2004 2016-12-19  Gavin Barraclough  <barraclough@apple.com>
2005
2006         [CSS Parser] Enable CSS Deferred Parsing
2007         https://bugs.webkit.org/show_bug.cgi?id=165869
2008
2009         Unreviewed rollout – looks like this regressed performance.
2010
2011         * Shared/WebPreferencesDefinitions.h:
2012
2013 2016-12-19  Anders Carlsson  <andersca@apple.com>
2014
2015         REGRESSION: Crash in com.apple.WebKit:IPC::Connection::platformCanSendOutgoingMessages() const + 0
2016         https://bugs.webkit.org/show_bug.cgi?id=165817
2017         rdar://problem/29626731
2018
2019         Reviewed by Dan Bernstein.
2020
2021         If the receive right is invalidated before we send the message, the kernel won't be able to create a send right,
2022         and we'll crash due to mach_msg returning MACH_SEND_INVALID_RIGHT.
2023         
2024         Fix this by immediately creating a send right, and passing MACH_MSG_TYPE_MOVE_SEND to the attachment constructor.
2025
2026         * WebProcess/WebPage/WebInspector.cpp:
2027         (WebKit::WebInspector::openFrontendConnection):
2028
2029 2016-12-18  Simon Fraser  <simon.fraser@apple.com>
2030
2031         Expose a way for MiniBrowser to simulate header and footer banners
2032         https://bugs.webkit.org/show_bug.cgi?id=166005
2033
2034         Reviewed by Wenson Hsieh.
2035         
2036         Expose testing SPI that allows a client to simulate the presence of header
2037         and footer banners. These are simply plumbed through to set FrameView's
2038         m_headerHeight and m_footerHeight.
2039
2040         * UIProcess/API/Cocoa/WKWebView.mm:
2041         (-[WKWebView _setHeaderBannerHeightForTesting:]):
2042         (-[WKWebView _setFooterBannerHeightForTesting:]):
2043         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2044         * UIProcess/WebPageProxy.cpp:
2045         (WebKit::WebPageProxy::setHeaderBannerHeightForTesting):
2046         (WebKit::WebPageProxy::setFooterBannerHeightForTesting):
2047         * UIProcess/WebPageProxy.h:
2048         * WebProcess/WebPage/WebPage.cpp:
2049         (WebKit::WebPage::setHeaderBannerHeightForTesting):
2050         (WebKit::WebPage::setFooterBannerHeightForTesting):
2051         * WebProcess/WebPage/WebPage.h:
2052         * WebProcess/WebPage/WebPage.messages.in:
2053
2054 2016-12-16  Dave Hyatt  <hyatt@apple.com>
2055
2056         [CSS Values] Make separate wrapper classes for the deprecated CSS Values OM
2057         https://bugs.webkit.org/show_bug.cgi?id=165968
2058
2059         Reviewed by Andreas Kling.
2060
2061         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.cpp:
2062         (WebKit::kit):
2063         (WebKit::core):
2064         (WebKit::wrapCSSValue):
2065         (webkit_dom_css_value_constructor):
2066         (webkit_dom_css_value_get_css_text):
2067         (webkit_dom_css_value_set_css_text):
2068         (webkit_dom_css_value_get_css_value_type):
2069         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValuePrivate.h:
2070
2071 2016-12-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2072
2073         Visual viewports: bottom fixed elements disappear behind the keyboard
2074         https://bugs.webkit.org/show_bug.cgi?id=165983
2075         <rdar://problem/29409852>
2076
2077         Reviewed by Simon Fraser.
2078
2079         Accounts for input view bounds in WebPageProxy::computeCustomFixedPositionRect. To do this, we introduce and
2080         pass unobscuredContentRectRespectingInputViewBounds along with the regular unobscuredContentRect (which does not
2081         respect the obscuring keyboard rect). This unobscuredContentRectRespectingInputViewBounds is then used when
2082         computing the origin of the updated layout viewport rect (and also, when we are _not_ below minimum scale),
2083         
2084         Additionally, the size is computed using the (unconstrained) unobscured rect. This is because we previously
2085         would use the document-constrained version of the unobscured rect, which caused the layout viewport to shrink
2086         when approaching the max scroll extents of the document while the keyboard is up, since the unobscured rect
2087         would spill out of the document rect. However, using this unconstrained rect's size also means that if the user
2088         rubber-bands out of the document rect, we would end up pushing the layout viewport rect out of the document,
2089         with no way of adjusting it back in without the user scrolling to push the layout viewport into back document
2090         bounds. To address this, we move the layout rect to be within document bounds after computing its size and
2091         location.
2092
2093         Added a new layout test: fast/visual-viewport/ios/fixed-element-on-bottom-with-keyboard.html, and also tweaked
2094         fixed-caret-position-after-scroll.html to cover these changes.
2095
2096         * Shared/VisibleContentRectUpdateInfo.cpp:
2097         (WebKit::operator<<):
2098         * Shared/VisibleContentRectUpdateInfo.h:
2099         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
2100         (WebKit::VisibleContentRectUpdateInfo::unobscuredContentRectRespectingInputViewBounds):
2101         * UIProcess/API/Cocoa/WKWebView.mm:
2102         (-[WKWebView _updateContentRectsWithState:]):
2103         (-[WKWebView _inputViewBounds]):
2104
2105         Returns the current bounds of the input view. For testing purposes.
2106
2107         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2108         * UIProcess/WebPageProxy.h:
2109         (WebKit::WebPageProxy::unobscuredContentRectRespectingInputViewBounds):
2110         * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2111         (WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect):
2112         * UIProcess/ios/WKContentView.h:
2113         * UIProcess/ios/WKContentView.mm:
2114         (-[WKContentView _computeUnobscuredContentRectRespectingInputViewBounds:unobscuredContentRect:inputViewBounds:scale:]):
2115
2116         Helper to compute the unobscured rect, accounting for the bounds of the current input view.
2117
2118         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
2119         (-[WKContentView _didCommitLayerTree:]):
2120         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): Deleted.
2121         * UIProcess/ios/WebPageProxyIOS.mm:
2122         (WebKit::WebPageProxy::computeCustomFixedPositionRect):
2123         * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
2124         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2125
2126 2016-12-16  Ryosuke Niwa  <rniwa@webkit.org>
2127
2128         Deleting a character converted from pinyin after an image causes a Safari crash
2129         https://bugs.webkit.org/show_bug.cgi?id=165839
2130
2131         Reviewed by Darin Adler.
2132
2133         The crash was caused by the payload of the IPC not being decoded correctly when the encoded attributed string
2134         contains a NSTextAttachment but send<> would still gladly send it to the UIProcess.
2135
2136         Fixed it by omitting the image as done in r176412 since encoding NSFileWrapper, etc... would require
2137         quite a bit of work, and IME doesn't really need to see the image in its attributed string.
2138
2139         * WebProcess/WebPage/mac/WebPageMac.mm:
2140         (WebKit::WebPage::attributedSubstringForCharacterRangeAsync): Fixed the bug.
2141
2142 2016-12-16  Andy Estes  <aestes@apple.com>
2143
2144         Add a setting to suppress keyboard input during provisional navigation
2145         https://bugs.webkit.org/show_bug.cgi?id=165830
2146
2147         Reviewed by Brent Fulgham.
2148
2149         * Shared/WebPreferencesDefinitions.h: Defined
2150         shouldSuppressKeyboardDOMEventsDuringProvisionalNavigation.
2151         * UIProcess/API/C/WKPreferences.cpp:
2152         (WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation): Added.
2153         (WKPreferencesGetShouldSuppressKeyboardInputDuringProvisionalNavigation): Added.
2154         * UIProcess/API/C/WKPreferencesRefPrivate.h: Declared a getter and setter for the new
2155         preference.
2156         * UIProcess/API/Cocoa/WKPreferences.mm:
2157         (-[WKPreferences _shouldSuppressKeyboardInputDuringProvisionalNavigation]): Added.
2158         (-[WKPreferences _setShouldSuppressKeyboardInputDuringProvisionalNavigation:]): Added.
2159         * UIProcess/API/Cocoa/WKPreferencesPrivate.h: Declared a property for the new preference.
2160         * WebProcess/WebPage/WebPage.cpp:
2161         (WebKit::WebPage::updatePreferences): Mapped the new preference to its corresponding
2162         WebCore::Setting.
2163
2164 2016-12-16  Chris Dumez  <cdumez@apple.com>
2165
2166         HTML form validation bubble should be dismissed on navigation
2167         https://bugs.webkit.org/show_bug.cgi?id=165960
2168         <rdar://problem/29668086>
2169
2170         Reviewed by Simon Fraser.
2171
2172         Dismiss HTML form validation bubble on top-level navigation on WK2.
2173
2174         * UIProcess/WebPageProxy.cpp:
2175         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
2176
2177 2016-12-16  Jer Noble  <jer.noble@apple.com>
2178
2179         Small refactor: Use HashCountedSet rather than HashMap<..., int> to store client counts in WebPlaybackSessionManager{,Proxy}.
2180         https://bugs.webkit.org/show_bug.cgi?id=165807
2181
2182         Reviewed by Eric Carlson.
2183
2184         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
2185         * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
2186         (WebKit::WebPlaybackSessionManagerProxy::addClientForContext):
2187         (WebKit::WebPlaybackSessionManagerProxy::removeClientForContext):
2188         * WebProcess/cocoa/WebPlaybackSessionManager.h:
2189         * WebProcess/cocoa/WebPlaybackSessionManager.mm:
2190         (WebKit::WebPlaybackSessionManager::addClientForContext):
2191         (WebKit::WebPlaybackSessionManager::removeClientForContext):
2192
2193 2016-12-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2194
2195         Visual viewports: carets and selection UI are incorrectly positioned when editing fixed elements
2196         https://bugs.webkit.org/show_bug.cgi?id=165767
2197         <rdar://problem/29602382>
2198
2199         Reviewed by Simon Fraser.
2200
2201         When focusing an input, the position of the caret on iOS is determined by the overridden layout viewport rect in
2202         the web process. However, this rect is not updated until the end the scroll gesture. Whereas this is fine for
2203         non-fixed inputs since their document location does not change, fixed inputs effectively change their position
2204         in the document as the user scrolls. This causes the caret to be 'left behind' in the document position it was
2205         in at the start of the scroll. To fix this, we deactivate the selection when exiting stable state if the
2206         assisted node is in a fixed position container, and reenable it upon receiving the next stable state EditorState
2207         update (as indicated by postLayoutData().isStableStateUpdate). Additionally, we apply similar treatment to the
2208         web selection assistant -- this time, we need to force the selection view to hide (analagous to deactivating
2209         the text selection assistant) and show it again upon receiving the next selection change update when the WebPage
2210         (in the web process) is stable.
2211
2212         Furthermore, adds test support for querying text caret and selection rects, as well as perform a callback after
2213         the WebPage has indicated that it is stable, both as SPI on the WKWebView.
2214
2215         Covered by 4 new layout tests in fast/editing/caret/ios and fast/editing/selection/ios.
2216
2217         * Platform/spi/ios/UIKitSPI.h:
2218         * Shared/EditorState.cpp:
2219         (WebKit::EditorState::PostLayoutData::encode):
2220         (WebKit::EditorState::PostLayoutData::decode):
2221         * Shared/EditorState.h:
2222
2223         Introduce isStableStateUpdate, which is true when the WebPage is known to be in stable state, as well as
2224         insideFixedPosition, which is true when the current selection is inside a fixed position container.
2225
2226         * Shared/mac/RemoteLayerTreeTransaction.h:
2227         (WebKit::RemoteLayerTreeTransaction::isInStableState):
2228         (WebKit::RemoteLayerTreeTransaction::setIsInStableState):
2229         * Shared/mac/RemoteLayerTreeTransaction.mm:
2230         (WebKit::RemoteLayerTreeTransaction::encode):
2231         (WebKit::RemoteLayerTreeTransaction::decode):
2232         (WebKit::RemoteLayerTreeTransaction::description):
2233         * UIProcess/API/Cocoa/WKWebView.mm:
2234         (-[WKWebView _didCommitLayerTree:]):
2235         (-[WKWebView _uiTextCaretRect]):
2236
2237         Introduced a new SPI method for fetching the current rect of the text assistant's caret view, at keyPath
2238         "selectionView.selection.caretRect".
2239
2240         (-[WKWebView _uiTextSelectionRects]):
2241
2242         Renamed (and refactored) from _uiTextSelectionRectViews, which was previously fetching an array of UIViews. I
2243         found this to cause character-granularity-rect.html to fail due to the array of UIViews here being empty, so I
2244         refactored this to simply return an array of rects from the keyPath "selectionView.selection.selectionRects" for
2245         the text selection assistant and @"selectionView.selectionRects" for the web selection assistant.
2246
2247         (-[WKWebView _doAfterNextStablePresentationUpdate:]):
2248
2249         Runs the given block after both the UI process and web processes agree that the visible content rect state is 
2250         stable. To do this, we fire presentation updates until the UI process (via RemoteLayerTreeTransactions)
2251         discovers that the web page is in stable state. This is used solely for testing purposes.
2252
2253         (-[WKWebView _firePresentationUpdateForPendingStableStatePresentationCallbacks]):
2254         (-[WKWebView _uiTextSelectionRectViews]): Deleted.
2255         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2256         * UIProcess/WebPageProxy.h:
2257         (WebKit::WebPageProxy::inStableState):
2258         * UIProcess/ios/WKContentView.mm:
2259         (-[WKContentView _didExitStableState]):
2260
2261         Deactivate the text selection if the assisted node is inside a fixed container.
2262
2263         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
2264         * UIProcess/ios/WKContentViewInteraction.h:
2265         * UIProcess/ios/WKContentViewInteraction.mm:
2266         (-[WKContentView setupInteraction]):
2267         (-[WKContentView cleanupInteraction]):
2268         (-[WKContentView shouldHideSelectionWhenScrolling]):
2269         (-[WKContentView _uiTextSelectionRects]):
2270         (-[WKContentView _didEndScrollingOrZooming]):
2271         (-[WKContentView _updateChangedSelection:]):
2272
2273         If the EditorState was created after a stable state update, reactivate the text selection assistant if it exists.
2274         Additionally, if we are deferring the end scrolling selection update until after the first stable editor state
2275         update arrives from the web process, we need to also call [_textSelectionAssistant didEndScrollingOverflow]
2276         and [_webSelectionAssistant didEndScrollingOrZoomingPage] here instead of doing so immediately after scrolling
2277         finishes. This ensures that selection UI (the callout and selection highlights) do not flicker from their old
2278         position to the new position when scrolling finishes.
2279
2280         * WebProcess/WebPage/WebPage.cpp:
2281         (WebKit::WebPage::willCommitLayerTree):
2282         * WebProcess/WebPage/ios/WebPageIOS.mm:
2283         (WebKit::WebPage::platformEditorState):
2284         (WebKit::WebPage::updateVisibleContentRects):
2285
2286         When updating the layout viewport override rect, also recompute the caret if needed and send an updated
2287         EditorState over to the UI process.
2288
2289 2016-12-16  Claudio Saavedra  <csaavedra@igalia.com>
2290
2291         [WK2] SharedMemory: include cleanups
2292         https://bugs.webkit.org/show_bug.cgi?id=165950
2293
2294         Reviewed by Žan Doberšek.
2295
2296         The WTFString include is not needed in the header, so move to the
2297         Unix file. Use the existing UNIX_DOMAIN_SOCKETS define. Also
2298         include the WTFOptional header where needed.
2299
2300         * Platform/SharedMemory.h:
2301         * Platform/unix/SharedMemoryUnix.cpp:
2302
2303 2016-12-16  Joonghun Park  <jh718.park@samsung.com>
2304
2305         [EFL] Fix build break since r209907. Unreviewed.
2306         https://bugs.webkit.org/show_bug.cgi?id=165954
2307
2308         * UIProcess/efl/TextCheckerEfl.cpp: Change the remaining TextBreakIterator to UBreakIterator
2309         (WebKit::nextWordOffset):
2310         (WebKit::TextChecker::checkTextOfParagraph):
2311
2312 2016-12-15  Darin Adler  <darin@apple.com>
2313
2314         Use asString instead of toWTFString, toString, or getString when we already checked isString
2315         https://bugs.webkit.org/show_bug.cgi?id=165895
2316
2317         Reviewed by Yusuke Suzuki.
2318
2319         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
2320         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant): Use asString/value instead of toWTFString.
2321
2322 2016-12-15  Chris Dumez  <cdumez@apple.com>
2323
2324         Make sure HTML validation bubble's state is updated after layout
2325         https://bugs.webkit.org/show_bug.cgi?id=165922
2326         <rdar://problem/29694730>
2327
2328         Reviewed by Simon Fraser.
2329
2330         Make sure HTML validation bubble's state is updated after layout.
2331         In particular, if the validation bubble's associated element has
2332         moved or is no longer visible, we now hide the bubble.
2333
2334         * WebProcess/WebCoreSupport/WebValidationMessageClient.cpp:
2335         (WebKit::WebValidationMessageClient::showValidationMessage):
2336         (WebKit::WebValidationMessageClient::hideValidationMessage):
2337         (WebKit::WebValidationMessageClient::updateValidationBubbleStateIfNeeded):
2338         * WebProcess/WebCoreSupport/WebValidationMessageClient.h:
2339
2340 2016-12-15  Alex Christensen  <achristensen@webkit.org>
2341
2342         Improve NetworkSession logging
2343         https://bugs.webkit.org/show_bug.cgi?id=165941
2344
2345         Reviewed by Tim Horton.
2346
2347         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2348         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
2349         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
2350         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
2351         One of the "didReceiveResponse completionHandler (cancel)" messages was wrong,
2352         and other messages could have more useful information without being overwhelming.
2353
2354 2016-12-15  Myles C. Maxfield  <mmaxfield@apple.com>
2355
2356         Sort Xcode project files
2357         https://bugs.webkit.org/show_bug.cgi?id=165937
2358
2359         Reviewed by Simon Fraser.
2360
2361         * WebKit2.xcodeproj/project.pbxproj:
2362
2363 2016-12-15  Anders Carlsson  <andersca@apple.com>
2364
2365         Add more mach_msg logging instrumentation
2366         https://bugs.webkit.org/show_bug.cgi?id=165914
2367
2368         Reviewed by Darin Adler.
2369
2370         * Platform/IPC/mac/ConnectionMac.mm:
2371         (IPC::Connection::sendMessage):
2372         (IPC::Connection::sendOutgoingMessage):
2373         * Platform/IPC/mac/MachMessage.h:
2374         (IPC::MachMessage::messageName):
2375         (IPC::MachMessage::setMessageName):
2376
2377 2016-12-15  Konstantin Tokarev  <annulen@yandex.ru>
2378
2379         Added missing override and final specifiers
2380         https://bugs.webkit.org/show_bug.cgi?id=165903
2381
2382         Reviewed by Darin Adler.
2383
2384         * UIProcess/API/gtk/WebKitGeolocationProvider.h:
2385         * UIProcess/WebFormSubmissionListenerProxy.h:
2386         * UIProcess/WebFramePolicyListenerProxy.h:
2387         * WebProcess/Automation/WebAutomationSessionProxy.h:
2388         * WebProcess/InjectedBundle/API/gtk/DOM/GObjectXPathNSResolver.h:
2389         * WebProcess/MediaCache/WebMediaKeyStorageManager.h:
2390         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h:
2391         * WebProcess/WebCoreSupport/WebPlugInClient.h:
2392         * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h:
2393         * WebProcess/WebPage/FindController.h:
2394
2395 2016-12-15  Simon Fraser  <simon.fraser@apple.com>
2396
2397         [iOS WK2] Don't disable position:fixed when a form element has focus
2398         https://bugs.webkit.org/show_bug.cgi?id=165891
2399         rdar://problem/29271694
2400
2401         Reviewed by Wenson Hsieh.
2402
2403         Before visual viewports, we had to lay out position:fixed relative to the document rect (effectively
2404         disabling position:fixed) when a form element was focused, to ensure that we could scroll to inputs
2405         inside position:Fixed.
2406
2407         When visual viewports are enabled, we can do a better job of this, and keep position:fixed active.
2408         
2409         Test: fast/visual-viewport/ios/zoomed-focus-in-fixed.html
2410
2411         * UIProcess/API/Cocoa/WKWebView.mm: 
2412         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Soon this will use
2413         insideFixed to have better scroll-into-view behavior.
2414         (-[WKWebView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted.
2415         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2416         * UIProcess/ios/WKContentView.h:
2417         * UIProcess/ios/WKContentView.mm:
2418         (-[WKContentView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
2419         (-[WKContentView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]): Deleted.
2420         * UIProcess/ios/WKContentViewInteraction.mm:
2421         (-[WKContentView _displayFormNodeInputView]):
2422         * UIProcess/ios/WebPageProxyIOS.mm:
2423         (WebKit::WebPageProxy::computeCustomFixedPositionRect): Don't fall back to using the documentRect as the fixed
2424         position rect if visual viewports are enabled.
2425         * WebProcess/WebPage/ios/WebPageIOS.mm:
2426         (WebKit::WebPage::getAssistedNodeInformation): Don't reset the customtFixedPositionRect around computing element
2427         coordinates if visual viewports are enabled.
2428
2429 2016-12-15  Andreas Kling  <akling@apple.com>
2430
2431         Always clear RenderLayer backing stores when going into page cache.
2432         <https://webkit.org/b/165901>
2433
2434         Reviewed by Simon Fraser.
2435
2436         * WebProcess/WebProcess.cpp:
2437         (WebKit::WebProcess::WebProcess):
2438
2439 2016-12-15  Darin Adler  <darin@apple.com>
2440
2441         Remove custom binding for MediaDevices
2442         https://bugs.webkit.org/show_bug.cgi?id=165894
2443
2444         Reviewed by Eric Carlson.
2445
2446         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2447         Added include of MediaConstraintsImpl.h, now needed because we
2448         removed some unneeded includes from the WebCore headers.
2449
2450 2016-12-15  Dave Hyatt  <hyatt@apple.com>
2451
2452         [CSS Parser] Enable CSS Deferred Parsing
2453         https://bugs.webkit.org/show_bug.cgi?id=165869
2454
2455         Reviewed by Sam Weinig.
2456
2457         * Shared/WebPreferencesDefinitions.h:
2458
2459 2016-12-14  Andreas Kling  <akling@apple.com>
2460
2461         Only send Messages::WebPageProxy::DidSaveToPageCache once when entering page cache.
2462         <https://webkit.org/b/165887>
2463
2464         Reviewed by Brady Eidson.
2465
2466         We were sending one of these IPC messages per frame when a page enters the page cache,
2467         and we really only need one, so only do it for the main frame.
2468
2469         (This message is used to adopt the page cache on the UI process side, in case another
2470         web process currently owns the cache. That happens in WebProcessPool::processDidCachePage().)
2471
2472         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2473         (WebKit::WebFrameLoaderClient::didSaveToPageCache):
2474
2475 2016-12-14  Simon Fraser  <simon.fraser@apple.com>
2476
2477         Fix cause of viewport-related flakiness in iOS tests
2478         https://bugs.webkit.org/show_bug.cgi?id=165878
2479
2480         Reviewed by Tim Horton.
2481
2482         When TestController::platformConfigureViewForTest() changes the view size for a flexible
2483         viewport test, the page would not have updated with the new scale by the time the load event
2484         fired, causing flakiness depending on test order.
2485
2486         This was caused by code added in r170325 that delayed visible content rect updates until
2487         after the UI process has received the transaction after didCommitLoad. So fix by overriding
2488         this mechanism if the view has been resized.
2489
2490         * Shared/VisibleContentRectUpdateInfo.cpp:
2491         (WebKit::VisibleContentRectUpdateInfo::encode):
2492         (WebKit::VisibleContentRectUpdateInfo::decode):
2493         (WebKit::operator<<):
2494         * Shared/VisibleContentRectUpdateInfo.h:
2495         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
2496         (WebKit::VisibleContentRectUpdateInfo::isFirstUpdateForNewViewSize):
2497         (WebKit::operator==):
2498         * UIProcess/API/Cocoa/WKWebView.mm:
2499         (-[WKWebView _frameOrBoundsChanged]):
2500         (-[WKWebView _updateContentRectsWithState:]):
2501         * UIProcess/DrawingAreaProxy.cpp:
2502         (WebKit::DrawingAreaProxy::setSize):
2503         * UIProcess/DrawingAreaProxy.h:
2504         * UIProcess/WebPageProxy.cpp:
2505         (WebKit::WebPageProxy::WebPageProxy):
2506         * UIProcess/WebPageProxy.h:
2507         * UIProcess/ios/WKContentView.h:
2508         * UIProcess/ios/WKContentView.mm:
2509         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
2510         * WebProcess/WebPage/ios/WebPageIOS.mm:
2511         (WebKit::WebPage::updateVisibleContentRects):
2512
2513 2016-12-04  Sam Weinig  <sam@webkit.org>
2514
2515         [WebIDL] Add support for converting dictionaries to JS
2516         https://bugs.webkit.org/show_bug.cgi?id=165367
2517
2518         Reviewed by Chris Dumez.
2519
2520         * CMakeLists.txt:
2521         Add missing directories to look in for headers.
2522
2523 2016-12-14  Anders Carlsson  <andersca@apple.com>
2524
2525         Add WKContextRefreshPlugIns
2526         https://bugs.webkit.org/show_bug.cgi?id=165879
2527         rdar://problem/29602414
2528
2529         Reviewed by Tim Horton.
2530
2531         * UIProcess/API/C/WKContext.cpp:
2532         (WKContextRefreshPlugIns):
2533         * UIProcess/API/C/WKContext.h:
2534         * UIProcess/WebProcessPool.cpp:
2535         (WebKit::WebProcessPool::refreshPlugins):
2536         * UIProcess/WebProcessPool.h:
2537         * WebProcess/Plugins/WebPluginInfoProvider.h:
2538         * WebProcess/WebProcess.cpp:
2539         (WebKit::WebProcess::refreshPlugins):
2540         * WebProcess/WebProcess.h:
2541         * WebProcess/WebProcess.messages.in:
2542
2543 2016-12-14  Tim Horton  <timothy_horton@apple.com>
2544
2545         API Test Fullscreen.TopContentInset is asserting on Yosemite
2546         https://bugs.webkit.org/show_bug.cgi?id=165877
2547
2548         Reviewed by Brady Eidson.
2549
2550         * UIProcess/WebPageProxy.cpp:
2551         (WebKit::WebPageProxy::setTopContentInset):
2552         * WebProcess/WebPage/WebPage.cpp:
2553         * WebProcess/WebPage/WebPage.h:
2554         * WebProcess/WebPage/WebPage.messages.in:
2555         We don't use fences on Yosemite, but this codepath still tried to.
2556         Instead of guarding with PLATFORM(COCOA), make use of the more accurate
2557         HAVE(COREANIMATION_FENCES) guard.
2558
2559 2016-12-14  Anders Carlsson  <andersca@apple.com>
2560
2561         Add some instrumentation to try to detect a crash on the bots
2562         https://bugs.webkit.org/show_bug.cgi?id=165866
2563
2564         Reviewed by Sam Weinig.
2565
2566         * Platform/IPC/mac/ConnectionMac.mm:
2567         (IPC::Connection::sendMessage):
2568
2569 2016-12-14  Dave Hyatt  <hyatt@apple.com>
2570
2571         [CSS Parser] Implement deferred parsing of properties, @media, @supports and @keyframes
2572         https://bugs.webkit.org/show_bug.cgi?id=165743
2573
2574         Reviewed by Dean Jackson.
2575
2576         Repurpose the newCSSParserEnabled preference for deferred parsing. Just change the name
2577         from "new" to "deferred."
2578
2579         * Shared/WebPreferencesDefinitions.h:
2580         * UIProcess/API/C/WKPreferences.cpp:
2581         (WKPreferencesSetDeferredCSSParserEnabled):
2582         (WKPreferencesGetDeferredCSSParserEnabled):
2583         (WKPreferencesSetNewCSSParserEnabled): Deleted.
2584         (WKPreferencesGetNewCSSParserEnabled): Deleted.
2585         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2586         * WebProcess/WebPage/WebPage.cpp:
2587         (WebKit::WebPage::updatePreferences):
2588
2589 2016-12-14  Brent Fulgham  <bfulgham@apple.com>
2590
2591         Unreviewed test fix after r209806.
2592
2593         Plugin-common doesn't define 'home-subpath'. Instead it has 'home-library-subpath'. Switch to the correct
2594         function. Also, 'home-library-subpath' adds '/Library' to the path, so revise the arguments so that we
2595         do not generate paths like '/home/username/Library/Library/Keychains'.
2596
2597         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2598
2599 2016-12-14  Brent Fulgham  <bfulgham@apple.com>
2600
2601         Unreviewed test fix after r209779.
2602
2603         The 'Keygen' element requires the ability to create new keys in '$HOME/Library/Keychains'. Remove the
2604         WebProcess and Plugin sandbox restrictions on per-user Keychain creation to support this use.
2605
2606         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2607         * WebProcess/com.apple.WebProcess.sb.in:
2608
2609 2016-12-13  Yusuke Suzuki  <utatane.tea@gmail.com>
2610
2611         Use JSValue::toWTFString instead of calling toString(exec) and value(exec)
2612         https://bugs.webkit.org/show_bug.cgi?id=165795
2613
2614         Reviewed by Saam Barati.
2615
2616         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
2617         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
2618
2619 2016-12-14  Enrique Ocaña González  <eocanha@igalia.com>
2620
2621         REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early
2622         https://bugs.webkit.org/show_bug.cgi?id=164022
2623
2624         Reviewed by Xabier Rodriguez-Calvar.
2625
2626         * Shared/WebPreferencesDefinitions.h:
2627         New GStreamerEnabled preference, defaults to true.
2628         * WebProcess/WebPage/WebPage.cpp: Ditto.
2629         (WebKit::WebPage::updatePreferences):
2630
2631 2016-12-13  Commit Queue  <commit-queue@webkit.org>
2632
2633         Unreviewed, rolling out r209792.
2634         https://bugs.webkit.org/show_bug.cgi?id=165841
2635
2636         Cause build failures (Requested by yusukesuzuki on #webkit).
2637
2638         Reverted changeset:
2639
2640         "Use JSValue::toWTFString instead of calling toString(exec)
2641         and value(exec)"
2642         https://bugs.webkit.org/show_bug.cgi?id=165795
2643         http://trac.webkit.org/changeset/209792
2644
2645 2016-12-13  Yusuke Suzuki  <utatane.tea@gmail.com>
2646
2647         Use JSValue::toWTFString instead of calling toString(exec) and value(exec)
2648         https://bugs.webkit.org/show_bug.cgi?id=165795
2649
2650         Reviewed by Saam Barati.
2651
2652         * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
2653         (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
2654
2655 2016-12-13  Alex Christensen  <achristensen@webkit.org>
2656
2657         Fix CMake build.
2658
2659         * PlatformMac.cmake:
2660
2661 2016-12-13  Jer Noble  <jer.noble@apple.com>
2662
2663         Fullscreen in WebKit2 does not restore topContentInset upon exiting; leaves top of page not visible
2664         https://bugs.webkit.org/show_bug.cgi?id=165697
2665
2666         Delegate the values of topContentInset() from WebViewImpl (used by WKWebView and WKView) to the
2667         WebPageProxy, so that setting the topContentInset() on WebPageProxy is reflected in the getters
2668         for the two view classes.
2669
2670         Reviewed by Tim Horton.
2671
2672         * UIProcess/Cocoa/WebViewImpl.h:
2673         (WebKit::WebViewImpl::topContentInset): Deleted.
2674         * UIProcess/Cocoa/WebViewImpl.mm:
2675         (WebKit::WebViewImpl::updateContentInsetsIfAutomatic):
2676         (WebKit::WebViewImpl::topContentInset):
2677         (WebKit::WebViewImpl::setTopContentInset):
2678         (WebKit::WebViewImpl::dispatchSetTopContentInset):
2679         * UIProcess/mac/WKFullScreenWindowController.mm:
2680         (-[WKFullScreenWindowController enterFullScreen:]):
2681         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
2682         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
2683         (-[WKFullScreenWindowController _saveTopContentInset]): Deleted.
2684         (-[WKFullScreenWindowController _restoreTopContentInset]): Deleted.
2685
2686 2016-12-13  Brent Fulgham  <bfulgham@apple.com>
2687
2688         [Mac][WK2] Tighten Keychain directory access
2689         https://bugs.webkit.org/show_bug.cgi?id=165818
2690         <rdar://problem/16863857>
2691
2692         Reviewed by Anders Carlsson.
2693
2694         Lock down Keychain directory access to just the file-read-data, file-read-metadata, and
2695         file-write-data operations we actually need.
2696
2697         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2698         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2699         * WebProcess/com.apple.WebProcess.sb.in:
2700
2701 2016-12-13  Andy Estes  <aestes@apple.com>
2702
2703         [Cocoa] Implement -shouldInsertText: on WKWebProcessPlugInEditingDelegate
2704         https://bugs.webkit.org/show_bug.cgi?id=165785
2705         <rdar://problem/26929398>
2706
2707         Reviewed by Darin Adler.
2708
2709         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: Defined
2710         WKEditorInsertAction and declared
2711         -_webProcessPlugInBrowserContextController:shouldInsertText:replacingRange:givenAction:.
2712         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2713         (toWK): Added. Mapped a WebCore::EditorInsertAction to a WKEditorInsertAction.
2714         (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): Implemented
2715         EditorClient::shouldInsertText() by calling
2716         -_webProcessPlugInBrowserContextController:shouldInsertText:replacingRange:givenAction: with
2717         the text, wrapped range handle, and action. Added shouldInsertText to DelegateMethods and
2718         initialized it according to whether the delegate responds to shouldInsertText:.
2719
2720 2016-12-13  Joseph Pecoraro  <pecoraro@apple.com>
2721
2722         NSArray leaks seen in Safari, allocated under WKIconDatabaseTryCopyCGImageArrayForURL
2723         https://bugs.webkit.org/show_bug.cgi?id=165809
2724
2725         Reviewed by Dan Bernstein.
2726
2727         * UIProcess/API/C/cg/WKIconDatabaseCG.cpp:
2728         (WKIconDatabaseTryCopyCGImageArrayForURL):
2729         Avoid an extra retain on already newly created array.
2730
2731 2016-12-13  Eric Carlson  <eric.carlson@apple.com>
2732
2733         Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
2734         https://bugs.webkit.org/show_bug.cgi?id=165251
2735
2736         Reviewed by Youenn Fablet.
2737
2738         * WebProcess/WebPage/WebPage.cpp:
2739         (WebKit::WebPage::updatePreferences): Update the media stream and peer connection runtime
2740         feature instead of the setting.
2741
2742 2016-12-13  Sergio Villar Senin  <svillar@igalia.com>
2743
2744         Fix GTK build after r209733
2745         https://bugs.webkit.org/show_bug.cgi?id=165794
2746
2747         Document::visibilityState() now returns an IDL string enumeration.
2748
2749         Reviewed by Žan Doberšek.
2750
2751         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp:
2752         (webkit_dom_document_get_visibility_state):
2753
2754 2016-12-12  Dean Jackson  <dino@apple.com>
2755
2756         [iOS] MediaDocument "Done" button should navigate the page back
2757         https://bugs.webkit.org/show_bug.cgi?id=165779
2758
2759         Reviewed by Sam Weinig.
2760
2761         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
2762         * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
2763         (WebKit::WebVideoFullscreenModelContext::requestFullscreenMode):
2764         (WebKit::WebVideoFullscreenManagerProxy::requestFullscreenMode):
2765         * WebProcess/cocoa/WebVideoFullscreenManager.h:
2766         * WebProcess/cocoa/WebVideoFullscreenManager.messages.in:
2767         * WebProcess/cocoa/WebVideoFullscreenManager.mm:
2768         (WebKit::WebVideoFullscreenManager::requestFullscreenMode):
2769
2770 2016-12-12  Tim Horton  <timothy_horton@apple.com>
2771
2772         Provide SPI to avoid blocking on painting when coming into view
2773         https://bugs.webkit.org/show_bug.cgi?id=165780
2774         <rdar://problem/29009559>
2775
2776         Reviewed by Simon Fraser.
2777
2778         By default, when parenting a WKWebView which was previously in-window,
2779         we block on painting to ensure that we don't flash stale content.
2780         We added SPI to disable this behavior to WKWebViewConfiguration, but
2781         some clients might want the behavior most of the time, but sometimes
2782         instead want to not block the UI process main thread, but instead do
2783         their own work (e.g. removing a snapshot) when painting eventually occurs.
2784
2785         * UIProcess/API/Cocoa/WKWebView.mm:
2786         (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]):
2787         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2788         Tell WebPageProxy not to block on painting next time we are parented,
2789         and use doAfterNextPresentationUpdate to call the block when the painting
2790         does eventually happen. This SPI must be called before - but in the same
2791         runloop cycle - the WKWebView is brought back in-window to work correctly.
2792         
2793         * UIProcess/WebPageProxy.cpp:
2794         (WebKit::WebPageProxy::dispatchActivityStateChange):
2795         * UIProcess/WebPageProxy.h:
2796         (WebKit::WebPageProxy::skipWaitingForPaintAfterNextViewDidMoveToWindow):
2797         If we would block because we're coming in-window, but the bit to skip
2798         blocking the next time we get brought in-window is set, reset the bit, 
2799         and avoid blocking.
2800
2801 2016-12-12  Chris Dumez  <cdumez@apple.com>
2802
2803         Document.visibilityState should use an IDL string enumeration
2804         https://bugs.webkit.org/show_bug.cgi?id=165774
2805
2806         Reviewed by Daniel Bates.
2807
2808         * Shared/API/c/WKSharedAPICast.h:
2809         (WebKit::toPageVisibilityState):
2810
2811 2016-12-11  Konstantin Tokarev  <annulen@yandex.ru>
2812
2813         Unreviewed attempt to fix EFL and Mac/cmake builds after r209665.
2814         https://bugs.webkit.org/show_bug.cgi?id=165686
2815
2816         * PlatformEfl.cmake: WebKit2 should precede other target so that right
2817         config.h comes first in include path.
2818
2819 2016-12-11  Tim Horton  <timothy_horton@apple.com>
2820
2821         Quarter-second stalls scrolling images that are links because of sync getPositionInformation
2822         https://bugs.webkit.org/show_bug.cgi?id=165707
2823
2824         Reviewed by Simon Fraser.
2825
2826         * UIProcess/ios/WKContentViewInteraction.mm:
2827         (-[WKContentView positionInformationForActionSheetAssistant:]):
2828         (-[WKContentView updatePositionInformationForActionSheetAssistant:]):
2829         For now, synchronously block when presenting the action sheet if we
2830         don't have a snapshot ready.
2831
2832         * WebProcess/WebPage/ios/WebPageIOS.mm:
2833         (WebKit::WebPage::getPositionInformation):
2834         Respect includeSnapshot in another place in getPositionInformation,
2835         so that many getPositionInformations don't have to do extra snapshotting work.
2836
2837 2016-12-10  Filip Pizlo  <fpizlo@apple.com>
2838
2839         The DOM should have an advancing wavefront opaque root barrier
2840         https://bugs.webkit.org/show_bug.cgi?id=165712
2841
2842         Reviewed by Yusuke Suzuki.
2843         
2844         Propagate the JSDOMWindowBase::commonVM() -> commonVM() change.
2845
2846         * Shared/linux/WebMemorySamplerLinux.cpp:
2847         (WebKit::WebMemorySampler::sampleWebKit):
2848         * Shared/mac/WebMemorySampler.mac.mm:
2849         (WebKit::WebMemorySampler::sampleWebKit):
2850         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2851         (WebKit::InjectedBundle::javaScriptObjectsCount):
2852         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
2853         (WebKit::JSNPObject::callMethod):
2854         (WebKit::JSNPObject::callObject):
2855         (WebKit::JSNPObject::callConstructor):
2856         (WebKit::JSNPObject::put):
2857         (WebKit::JSNPObject::deleteProperty):
2858         (WebKit::JSNPObject::getOwnPropertyNames):
2859         (WebKit::JSNPObject::propertyGetter):
2860         * WebProcess/WebPage/WebPage.cpp:
2861         (WebKit::WebPage::runJavaScriptInMainFrame):
2862         (WebKit::WebPage::getBytecodeProfile):
2863         (WebKit::WebPage::getSamplingProfilerOutput):
2864         * WebProcess/WebProcess.cpp:
2865         (WebKit::WebProcess::getWebCoreStatistics):
2866
2867 2016-12-11  Konstantin Tokarev  <annulen@yandex.ru>
2868
2869         Unreviewed build fix for EFL after r209665
2870
2871         * UIProcess/efl/TextCheckerClientEfl.h:
2872
2873 2016-12-10  Konstantin Tokarev  <annulen@yandex.ru>
2874
2875         [cmake] Include WTF, JSC, and WebCore headers automatically to targers using them
2876         https://bugs.webkit.org/show_bug.cgi?id=165686
2877
2878         Reviewed by Michael Catanzaro.
2879
2880         This change reduces duplication of include path lists between modules,
2881         and reduces future need for fixes like r209605 (broken build because of
2882         WebCore header suddenly becoming used in WebKit2).
2883
2884         * CMakeLists.txt:
2885         * PlatformEfl.cmake:
2886         * PlatformGTK.cmake:
2887         * PlatformMac.cmake:
2888
2889 2016-12-10  Antti Koivisto  <antti@apple.com>
2890
2891         CrashTracer: com.apple.WebKit.Networking at WTF::ThreadSafeRefCounted<WebKit::NetworkCache::IOChannel>::deref
2892         https://bugs.webkit.org/show_bug.cgi?id=165659
2893         <rdar://problem/27077977>
2894
2895         Reviewed by Darin Adler.
2896
2897         * NetworkProcess/cache/NetworkCacheIOChannel.h:
2898         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
2899         (WebKit::NetworkCache::IOChannel::~IOChannel):
2900
2901             Add non-inlined destructor and release assert against double deletion to narrow down this crash.
2902
2903 2016-12-09  Brent Fulgham  <bfulgham@apple.com>
2904
2905         WebCore::Timer is not compatible with UIProcess
2906         https://bugs.webkit.org/show_bug.cgi?id=165706
2907         <rdar://problem/29360564>
2908
2909         Reviewed by Andy Estes.
2910
2911         Anders has explained to me (at least twice) that WebCore::Timer must not
2912         be used in UIProcess code. A recent bug fix introduced a WebCore::Timer,
2913         which led to another crash.
2914         
2915         This patch switches from WebCore::Timer to WTF::RunLoop::Timer to avoid
2916         the problem.
2917
2918         * UIProcess/Cocoa/NavigationState.h:
2919         * UIProcess/Cocoa/NavigationState.mm:
2920         (WebKit::NavigationState::NavigationState):
2921
2922 2016-12-09  Eric Carlson  <eric.carlson@apple.com>
2923
2924         Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
2925         https://bugs.webkit.org/show_bug.cgi?id=165251
2926
2927         Reviewed by Dean Jackson.
2928
2929         Based on a patch by Dr Alex Gouaillard <agouaillard@gmail.com>
2930
2931         * Shared/WebPreferencesDefinitions.h: Add peerConnectionEnabled.
2932
2933         * UIProcess/API/C/WKPreferences.cpp:
2934         (WKPreferencesSetPeerConnectionEnabled): Added.
2935         (WKPreferencesGetPeerConnectionEnabled): Added.
2936         * UIProcess/API/C/WKPreferencesRef.h:
2937
2938         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2939         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Add WebKitMediaStreamEnabled
2940           and WebKitPeerConnectionEnabled.
2941
2942         * WebProcess/WebPage/WebPage.cpp:
2943         (WebKit::WebPage::updatePreferences): Initialize the peerConnection preference.
2944
2945 2016-12-09  Brady Eidson  <beidson@apple.com>
2946
2947         Re-landing:
2948         Add _WKIconLoadingDelegate SPI.
2949         https://bugs.webkit.org/show_bug.cgi?id=164894
2950
2951         Reviewed by Alex Christensen.
2952
2953         With this client, WebCore will ask the FrameLoaderClient about each icon found in the <head>.
2954
2955         WebKit2 will then ask the embedding app - for each icon - if it wants that icon to load.
2956
2957         For icons the app decides to load, WebKit will pass the data to the app without storing locally.
2958
2959         * UIProcess/API/APIIconLoadingClient.h: Copied from Source/WebCore/html/LinkIconCollector.h.
2960         (API::IconLoadingClient::~IconLoadingClient):
2961         (API::IconLoadingClient::getLoadDecisionForIcon):
2962
2963         * UIProcess/API/Cocoa/WKWebView.mm:
2964         (-[WKWebView _initializeWithConfiguration:]):
2965         (-[WKWebView _iconLoadingDelegate]):
2966         (-[WKWebView _setIconLoadingDelegate:]):
2967         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2968
2969         * UIProcess/API/Cocoa/_WKIconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
2970
2971         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Copied from Source/WebCore/html/LinkIconCollector.h.
2972         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm: Copied from Source/WebCore/html/LinkIconCollector.h.
2973         (-[_WKLinkIconParameters _initWithLinkIcon:]):
2974         (-[_WKLinkIconParameters url]):
2975         (-[_WKLinkIconParameters mimeType]):
2976         (-[_WKLinkIconParameters size]):
2977         (-[_WKLinkIconParameters iconType]):
2978         * UIProcess/API/Cocoa/_WKLinkIconParametersInternal.h: Copied from Source/WebCore/html/LinkIconCollector.h.
2979
2980         * UIProcess/Cocoa/IconLoadingDelegate.h: Copied from Source/WebCore/html/LinkIconCollector.h.
2981         * UIProcess/Cocoa/IconLoadingDelegate.mm: Added.
2982         (WebKit::IconLoadingDelegate::IconLoadingDelegate):
2983         (WebKit::IconLoadingDelegate::~IconLoadingDelegate):
2984         (WebKit::IconLoadingDelegate::createIconLoadingClient):
2985         (WebKit::IconLoadingDelegate::delegate):
2986         (WebKit::IconLoadingDelegate::setDelegate):
2987         (WebKit::IconLoadingDelegate::IconLoadingClient::IconLoadingClient):
2988         (WebKit::IconLoadingDelegate::IconLoadingClient::~IconLoadingClient):
2989         (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon):
2990
2991         * UIProcess/WebPageProxy.cpp:
2992         (WebKit::WebPageProxy::setIconLoadingClient):
2993         (WebKit::WebPageProxy::getLoadDecisionForIcon):
2994         (WebKit::WebPageProxy::finishedLoadingIcon):
2995         * UIProcess/WebPageProxy.h:
2996         (WebKit::WebPageProxy::iconLoadingClient):
2997         * UIProcess/WebPageProxy.messages.in:
2998
2999         * WebKit2.xcodeproj/project.pbxproj:
3000
3001         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3002         (WebKit::WebFrameLoaderClient::useIconLoadingClient):
3003         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon):
3004         (WebKit::WebFrameLoaderClient::finishedLoadingIcon):
3005         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3006         (WebKit::WebFrameLoaderClient::setUseIconLoadingClient):
3007
3008         * WebProcess/WebPage/WebPage.cpp:
3009         (WebKit::WebPage::didGetLoadDecisionForIcon):
3010         (WebKit::WebPage::setUseIconLoadingClient):
3011         * WebProcess/WebPage/WebPage.h:
3012         * WebProcess/WebPage/WebPage.messages.in:
3013
3014 2016-12-09  Simon Fraser  <simon.fraser@apple.com>
3015
3016         Fix initialization of contentUpdateFrequency
3017         https://bugs.webkit.org/show_bug.cgi?id=165705
3018         rdar://problem/29602039
3019
3020         Reviewed by Tim Horton.
3021
3022         The value that controls web content update frequency was not being initialized.
3023
3024         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3025         (-[WKWebViewConfiguration init]):
3026
3027 2016-12-09  Anders Carlsson  <andersca@apple.com>
3028
3029         Once we can send Mach messages again, make sure to send any pending outgoing messages
3030         https://bugs.webkit.org/show_bug.cgi?id=165693
3031
3032         Reviewed by Brady Eidson.
3033
3034         * Platform/IPC/mac/ConnectionMac.mm:
3035         (IPC::Connection::initializeSendSource):
3036
3037 2016-12-09  Beth Dakin  <bdakin@apple.com>
3038
3039         Password fields should not show the emoji button in TouchBar
3040         https://bugs.webkit.org/show_bug.cgi?id=165673
3041         -and corresponding-
3042         rdar://problem/29235739
3043
3044         Reviewed by Wenson Hsieh.
3045
3046         This patch adds a new member variable for the password touch bar and password 
3047         candidateListTouchBarItem. Since this TouchBar will actually have a different set 
3048         of identifiers than the plain text TouchBar, it should just have its own variable.
3049         * UIProcess/Cocoa/WebViewImpl.h:
3050         * UIProcess/Cocoa/WebViewImpl.mm:
3051
3052         Return m_passwordTextCandidateListTouchBarItem when appropriate.
3053         (WebKit::WebViewImpl::candidateListTouchBarItem):
3054
3055         The candidate list should be the only item for passwords.
3056         (WebKit::passwordTextTouchBarDefaultItemIdentifiers):
3057
3058         Account for m_passwordTextTouchBar.
3059         (WebKit::WebViewImpl::updateTouchBarAndRefreshTextBarIdentifiers):
3060         (WebKit::WebViewImpl::setUpTextTouchBar):
3061         (WebKit::WebViewImpl::textTouchBar):
3062
3063         The empty candidates array is not needed. We can just set @[ ] as the candidates 
3064         for the m_passwordTextCandidateListTouchBarItem. Safe guards already exist in the 
3065         other parts of the code to prevent us from requesting or setting other candidates 
3066         when in a password field. 
3067         (WebKit::WebViewImpl::updateTextTouchBar):
3068
3069 2016-12-09  Keith Rollin  <krollin@apple.com>
3070
3071         Fix string specification in print format
3072         https://bugs.webkit.org/show_bug.cgi?id=165650
3073
3074         Reviewed by Alex Christensen.
3075
3076         Change "%{public}s" string specifier to something that can be changed
3077         to "%s" at compile time when the build environment doesn't support the
3078         former.
3079
3080         * NetworkProcess/capture/NetworkCaptureLogging.h:
3081         * NetworkProcess/capture/NetworkCaptureManager.cpp:
3082         (WebKit::NetworkCapture::Manager::initialize):
3083         (WebKit::NetworkCapture::Manager::findMatch):
3084         (WebKit::NetworkCapture::Manager::findExactMatch):
3085         (WebKit::NetworkCapture::Manager::findBestFuzzyMatch):
3086         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
3087         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
3088         (WebKit::NetworkCapture::Manager::openCacheFile):
3089         (WebKit::NetworkCapture::Manager::getLine):
3090         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
3091         (WebKit::NetworkCapture::Recorder::recordRequestSent):
3092         (WebKit::NetworkCapture::Recorder::recordResponseReceived):
3093         (WebKit::NetworkCapture::Recorder::recordRedirectReceived):
3094         (WebKit::NetworkCapture::Recorder::recordRedirectSent):
3095         (WebKit::NetworkCapture::Recorder::writeEvents):
3096         * NetworkProcess/capture/NetworkCaptureResource.cpp:
3097         (WebKit::NetworkCapture::Resource::url):
3098         (WebKit::NetworkCapture::Resource::EventStream::nextEvent):
3099         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
3100         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay):
3101         (WebKit::NetworkCapture::NetworkDataTaskReplay::~NetworkDataTaskReplay):
3102         (WebKit::NetworkCapture::NetworkDataTaskReplay::resume):
3103         (WebKit::NetworkCapture::NetworkDataTaskReplay::suspend):
3104         (WebKit::NetworkCapture::NetworkDataTaskReplay::complete):
3105         (WebKit::NetworkCapture::NetworkDataTaskReplay::invalidateAndCancel):
3106         (WebKit::NetworkCapture::NetworkDataTaskReplay::enqueueEventHandler):
3107         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRequestSent):
3108         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayResponseReceived):
3109         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectReceived):
3110         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayRedirectSent):
3111         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayDataReceived):
3112         (WebKit::NetworkCapture::NetworkDataTaskReplay::replayFinished):
3113         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
3114
3115 2016-12-09  Jeremy Jones  <jeremyj@apple.com>
3116
3117         WebView doesn't become first responder in element fullscreen.
3118         https://bugs.webkit.org/show_bug.cgi?id=165664
3119         rdar://problem/28927252
3120
3121         Reviewed by Tim Horton.
3122
3123         WebView was being set as the first responder while the contentView was still hidden.
3124         A view can not become first responder while it or its ancestor is hidden.
3125
3126         This change waits until after the contentView is visible to make the web view the first responder.
3127
3128         * UIProcess/mac/WKFullScreenWindowController.mm:
3129         (-[WKFullScreenWindowController enterFullScreen:]):
3130         (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
3131
3132 2016-12-09  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
3133
3134         Unreviewed build fix. Thanks to Konstantin Tokarev and Csaba Osztrogonác
3135         for pointing out the fix.
3136
3137         * CMakeLists.txt: add WebCore/html/canvas to include paths.
3138
3139 2016-12-09  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
3140
3141         [GTK] Fix build after r209558
3142         https://bugs.webkit.org/show_bug.cgi?id=165653
3143
3144         Unreviewed build fix.
3145
3146         * UIProcess/API/APIPolicyClient.h: include WebsitePolicies.h.
3147         * UIProcess/API/gtk/WebKitPolicyClient.cpp: ditto.
3148         * UIProcess/API/gtk/WebKitPolicyDecision.cpp:
3149         (webkit_policy_decision_use):  pass empty structure to new required argument.
3150
3151 2016-12-09  Gavin Barraclough  <barraclough@apple.com>
3152
3153         Revert - Add _WKIconLoadingDelegate SPI
3154         https://bugs.webkit.org/show_bug.cgi?id=164894
3155
3156         Unreviewed rollout due to performance regression.
3157
3158         * PlatformMac.cmake:
3159         * UIProcess/API/APIIconLoadingClient.h: Removed.
3160         * UIProcess/API/Cocoa/WKWebView.mm:
3161         (-[WKWebView _initializeWithConfiguration:]):
3162         (-[WKWebView _iconLoadingDelegate]): Deleted.
3163         (-[WKWebView _setIconLoadingDelegate:]): Deleted.
3164         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3165         * UIProcess/API/Cocoa/_WKIconLoadingDelegate.h: Removed.
3166         * UIProcess/API/Cocoa/_WKLinkIconParameters.h: Removed.
3167         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm: Removed.
3168         * UIProcess/API/Cocoa/_WKLinkIconParametersInternal.h: Removed.
3169         * UIProcess/Cocoa/IconLoadingDelegate.h: Removed.
3170         * UIProcess/Cocoa/IconLoadingDelegate.mm: Removed.
3171         * UIProcess/WebPageProxy.cpp:
3172         (WebKit::WebPageProxy::setIconLoadingClient): Deleted.
3173         (WebKit::WebPageProxy::getLoadDecisionForIcon): Deleted.
3174         (WebKit::WebPageProxy::finishedLoadingIcon): Deleted.
3175         * UIProcess/WebPageProxy.h:
3176         (WebKit::WebPageProxy::iconLoadingClient): Deleted.
3177         * UIProcess/WebPageProxy.messages.in:
3178         * WebKit2.xcodeproj/project.pbxproj:
3179         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3180         (WebKit::WebFrameLoaderClient::useIconLoadingClient): Deleted.
3181         (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon): Deleted.
3182         (WebKit::WebFrameLoaderClient::finishedLoadingIcon): Deleted.
3183         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3184         (WebKit::WebFrameLoaderClient::setUseIconLoadingClient): Deleted.
3185         (): Deleted.
3186         * WebProcess/WebPage/WebPage.cpp:
3187         (WebKit::WebPage::didGetLoadDecisionForIcon): Deleted.
3188         (WebKit::WebPage::setUseIconLoadingClient): Deleted.
3189         * WebProcess/WebPage/WebPage.h:
3190         * WebProcess/WebPage/WebPage.messages.in:
3191
3192 2016-12-08  Keith Rollin  <krollin@apple.com>
3193
3194         Move FileHandle to WebCore FileHandle.h
3195         https://bugs.webkit.org/show_bug.cgi?id=165562
3196
3197         Reviewed by Alex Christensen.
3198
3199         Move FileHandle from NetworkCaptureTypes.h (which can now be deleted)
3200         to WebCore. Update client code to use the new version.
3201
3202         * NetworkProcess/capture/NetworkCaptureEvent.cpp:
3203         * NetworkProcess/capture/NetworkCaptureEvent.h:
3204         * NetworkProcess/capture/NetworkCaptureManager.cpp:
3205         (WebKit::NetworkCapture::Manager::initialize):
3206         (WebKit::NetworkCapture::Manager::terminate):
3207         (WebKit::NetworkCapture::Manager::logRecordedResource):
3208         (WebKit::NetworkCapture::Manager::logLoadedResource):
3209         (WebKit::NetworkCapture::Manager::logPlayedBackResource):
3210         (WebKit::NetworkCapture::Manager::openCacheFile):
3211         (WebKit::NetworkCapture::Manager::ensureFileHandle): Deleted.
3212         (WebKit::NetworkCapture::Manager::printToFile): Deleted.
3213         * NetworkProcess/capture/NetworkCaptureManager.h:
3214         * NetworkProcess/capture/NetworkCaptureRecorder.cpp:
3215         (WebKit::NetworkCapture::Recorder::writeEvents):
3216         * NetworkProcess/capture/NetworkCaptureTypes.h: Removed.
3217         * WebKit2.xcodeproj/project.pbxproj:
3218
3219 2016-12-08  Anders Carlsson  <andersca@apple.com>
3220
3221         Attempt to fix the iOS build.
3222
3223         * Platform/IPC/mac/MachMessage.cpp:
3224
3225 2016-12-08  Anders Carlsson  <andersca@apple.com>
3226
3227         Defer sending Mach messages if the queue is full
3228         https://bugs.webkit.org/show_bug.cgi?id=165622
3229         rdar://problem/29518036
3230
3231         Reviewed by Brady Eidson.
3232
3233         * Platform/IPC/Connection.cpp:
3234         Include MachMessage.h so the Connection destructor can do its thing.
3235
3236         * Platform/IPC/Connection.h:
3237         Add new members.
3238
3239         * Platform/IPC/mac/ConnectionMac.mm:
3240         (IPC::Connection::platformInvalidate):
3241         Null out the pending outgoing mach message.
3242
3243         (IPC::Connection::sendMessage):
3244         New helper that will send a Mach message. If we time out, store the message in m_pendingOutgoingMachMessage.
3245         When our send source will be triggered we'll try to send the message again.
3246
3247         (IPC::Connection::platformCanSendOutgoingMessages):
3248         We can only send messages if we don't have a pending outgoing message.
3249
3250         (IPC::Connection::sendOutgoingMessage):
3251         Call the newly added sendMessage function.
3252
3253         (IPC::Connection::initializeSendSource):
3254         Add the DISPATCH_MACH_SEND_POSSIBLE mask (and DISPATCH_MACH_SEND_DEAD which was previously implicit).
3255         In our event handler, check for DISPATCH_MACH_SEND_POSSIBLE and try to send the pending outgoing message again.
3256
3257         * Platform/IPC/mac/MachMessage.cpp:
3258         (IPC::MachMessage::create):
3259         Rename length to size.
3260
3261         (IPC::MachMessage::MachMessage):
3262         Initialize m_shouldFreeDescriptors.
3263
3264         (IPC::MachMessage::~MachMessage):
3265         Call mach_msg_destroy, which will free the descriptors.
3266
3267         (IPC::MachMessage::leakDescriptors):
3268         Set m_shouldFreeDescriptors to false.
3269
3270         * Platform/IPC/mac/MachMessage.h:
3271         (IPC::MachMessage::size):
3272         (IPC::MachMessage::length): Deleted.
3273
3274 2016-12-08  Chelsea Pugh  <cpugh@apple.com>
3275
3276         [iOS] WKWebView should not allow app links to be opened on back or forward navigation
3277         https://bugs.webkit.org/show_bug.cgi?id=165502
3278
3279         Reviewed by Dan Bernstein.
3280
3281         * UIProcess/WebPageProxy.cpp:
3282         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Add a condition to shouldOpenAppLinks
3283         (which we use when creating a NavigationAction) that the navigationActionData is not a navigation
3284         of type BackForward. This way, we don't open app links when a navigation is done via back or
3285         forward.
3286
3287 2016-12-08  Filip Pizlo  <fpizlo@apple.com>
3288
3289         Enable SharedArrayBuffer, remove the flag
3290         https://bugs.webkit.org/show_bug.cgi?id=165614
3291
3292         Rubber stamped by Geoffrey Garen.
3293
3294         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3295         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3296
3297 2016-12-08  Alex Christensen  <achristensen@webkit.org>
3298
3299         Add SPI for sending WebsiteSettings to WebProcess during navigation
3300         https://bugs.webkit.org/show_bug.cgi?id=165517
3301         <rdar://29341068>
3302
3303         We add the ability for the navigation client to send settings to the WebProcess 
3304         based on the URL of the document being navigated to. This approach adds no new IPC 
3305         messages and allows the application to decide what settings to use during navigation 
3306         instead of declaratively before navigation. Right now there is only one setting, 
3307         whether to disable content blockers, but this infrastructure can be used for more settings.
3308
3309         Reviewed by Anders Carlsson.
3310
3311         * CMakeLists.txt:
3312         * PlatformMac.cmake:
3313         * Shared/API/APIObject.h:
3314         * Shared/API/c/WKBase.h:
3315         * Shared/WebsitePolicies.h: Added.
3316         (WebKit::WebsitePolicies::encode):
3317         (WebKit::WebsitePolicies::decode):
3318         * UIProcess/API/APINavigationClient.h:
3319         (API::NavigationClient::decidePolicyForNavigationAction):
3320         (API::NavigationClient::decidePolicyForNavigationResponse):
3321         * UIProcess/API/APIPolicyClient.h:
3322         (API::PolicyClient::decidePolicyForNavigationAction):
3323         (API::PolicyClient::decidePolicyForNewWindowAction):
3324         (API::PolicyClient::decidePolicyForResponse):
3325         * UIProcess/API/APIWebsitePolicies.cpp: Added.
3326         (API::WebsitePolicies::create):
3327         * UIProcess/API/APIWebsitePolicies.h: Added.
3328         * UIProcess/API/C/WKAPICast.h:
3329         * UIProcess/API/C/WKFramePolicyListener.cpp:
3330         (WKFramePolicyListenerUse):
3331         (WKFramePolicyListenerUseWithPolicies):
3332         * UIProcess/API/C/WKFramePolicyListener.h:
3333         * UIProcess/API/C/WKPage.cpp:
3334         (WKPageSetPagePolicyClient):
3335         * UIProcess/API/C/WKWebsitePolicies.cpp: Added.
3336         (WKWebsitePoliciesGetTypeID):
3337         (WKWebsitePoliciesCreate):
3338         (WKWebsitePoliciesSetContentBlockersEnabled):
3339         (WKWebsitePoliciesGetContentBlockersEnabled):
3340         * UIProcess/API/C/WKWebsitePolicies.h: Added.
3341         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
3342         * UIProcess/API/Cocoa/_WKWebsitePolicies.h: Added.
3343         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm: Added.
3344         (-[_WKWebsitePolicies dealloc]):
3345         (-[_WKWebsitePolicies init]):
3346         (-[_WKWebsitePolicies setContentBlockersEnabled:]):
3347         (-[_WKWebsitePolicies contentBlockersEnabled]):
3348         (-[_WKWebsitePolicies description]):
3349         (-[_WKWebsitePolicies _apiObject]):
3350         * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h: Added.
3351         (WebKit::wrapper):
3352         * UIProcess/Automation/WebAutomationSession.cpp:
3353         (WebKit::WebAutomationSession::reloadBrowsingContext):
3354         * UIProcess/Cocoa/NavigationState.h:
3355         * UIProcess/Cocoa/NavigationState.mm:
3356         (WebKit::NavigationState::setNavigationDelegate):
3357         (WebKit::tryAppLink):
3358         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3359         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
3360         * UIProcess/WebFormSubmissionListenerProxy.cpp:
3361         (WebKit::WebFormSubmissionListenerProxy::continueSubmission):
3362         * UIProcess/WebFrameListenerProxy.cpp:
3363         (WebKit::WebFrameListenerProxy::receivedPolicyDecision):
3364         * UIProcess/WebFrameListenerProxy.h:
3365         * UIProcess/WebFramePolicyListenerProxy.cpp:
3366         (WebKit::WebFramePolicyListenerProxy::use):
3367         (WebKit::WebFramePolicyListenerProxy::download):
3368         (WebKit::WebFramePolicyListenerProxy::ignore):
3369         * UIProcess/WebFramePolicyListenerProxy.h:
3370         (WebKit::WebFramePolicyListenerProxy::create):
3371         * UIProcess/WebFrameProxy.cpp:
3372         (WebKit::WebFrameProxy::receivedPolicyDecision):
3373         * UIProcess/WebFrameProxy.h:
3374         * UIProcess/WebInspectorProxy.cpp:
3375         (WebKit::decidePolicyForNavigationAction):
3376         * UIProcess/WebPageProxy.cpp:
3377         (WebKit::WebPageProxy::receivedPolicyDecision):
3378         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3379         * UIProcess/WebPageProxy.h:
3380         * UIProcess/WebPageProxy.messages.in:
3381         * WebKit2.xcodeproj/project.pbxproj:
3382         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3383         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3384
3385 2016-12-08  Antti Koivisto  <antti@apple.com>
3386
3387         Salt network cache hashes
3388         https://bugs.webkit.org/show_bug.cgi?id=164924
3389
3390         Reviewed by Alex Christensen.
3391
3392         To enhance privacy make cache content unidentifiable from file names alone.
3393         This is done by generating a unique persistent salt for each cache instance.
3394         It is used when computing hashes used in file names.
3395
3396         The patch also replaces plain text partition directory names with salted hashes.
3397
3398         * NetworkProcess/cache/NetworkCache.cpp:
3399         (WebKit::NetworkCache::Cache::makeCacheKey):
3400         (WebKit::NetworkCache::makeCacheKey): Deleted.
3401         * NetworkProcess/cache/NetworkCache.h:
3402
3403             Increment cache version.
3404
3405         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
3406         (WebKit::NetworkCache::BlobStorage::BlobStorage):
3407         (WebKit::NetworkCache::BlobStorage::add):
3408         (WebKit::NetworkCache::BlobStorage::get):
3409
3410             Use salt for blob content hash.
3411
3412         * NetworkProcess/cache/NetworkCacheBlobStorage.h:
3413         * NetworkProcess/cache/NetworkCacheData.cpp:
3414         (WebKit::NetworkCache::computeSHA1):
3415
3416             For simplicity all SHA1s are now salted.
3417
3418         (WebKit::NetworkCache::makeSalt):
3419         (WebKit::NetworkCache::readOrMakeSalt):
3420
3421             Read salt if it exists, generate and persist it otherwise.
3422
3423         * NetworkProcess/cache/NetworkCacheData.h:
3424         * NetworkProcess/cache/NetworkCacheKey.cpp:
3425         (WebKit::NetworkCache::Key::Key):
3426
3427             Remove the "No partition" string and just empty.
3428             That was only needed to have a directory name of some sort.
3429
3430         (WebKit::NetworkCache::Key::computeHash):
3431
3432             Use salt for key hash.
3433
3434         (WebKit::NetworkCache::Key::computePartitionHash):
3435
3436             Separate hash for partition.
3437
3438         * NetworkProcess/cache/NetworkCacheKey.h:
3439         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
3440         (WebKit::NetworkCache::makeSubresourcesKey):
3441         (WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
3442         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
3443         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3444         (WebKit::NetworkCache::makeSaltFilePath):
3445         (WebKit::NetworkCache::Storage::open):
3446
3447             Cache can't be opened if we can't read or persist a salt.
3448
3449         (WebKit::NetworkCache::traverseRecordsFiles):
3450         (WebKit::NetworkCache::Storage::Storage):
3451         (WebKit::NetworkCache::Storage::synchronize):
3452         (WebKit::NetworkCache::Storage::recordDirectoryPathForKey):
3453
3454             Use the partition hash in the directory name instead of a plain text name.
3455
3456         (WebKit::NetworkCache::decodeRecordHeader):
3457         (WebKit::NetworkCache::Storage::readRecord):
3458         (WebKit::NetworkCache::Storage::encodeRecord):
3459         (WebKit::NetworkCache::Storage::traverse):
3460         (WebKit::NetworkCache::Storage::clear):