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