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